Use kirigami built in static mode

Now kirigami needs to be built with a C++ plugin.
In cases of mobile operating systems such as iOS (and in a lesser measuse,
Android) having a proper plugin loaded at runtime may be difficult, so
statically link it together with all of its qml files compiled as a
qresource inside the static library.

Signed-off-by: Marco Martin <notmart@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Marco Martin 2016-06-22 18:17:25 +02:00 committed by Dirk Hohndel
parent 545c60a517
commit 24718adfc3
6 changed files with 40 additions and 50 deletions

View file

@ -238,12 +238,16 @@ if(${SUBSURFACE_TARGET_EXECUTABLE} MATCHES "MobileExecutable")
else()
add_executable(${SUBSURFACE_TARGET} MACOSX_BUNDLE WIN32 ${SUBSURFACE_PKG} ${MOBILE_SRC} ${SUBSURFACE_RESOURCES} ${MOBILE_RESOURCES})
endif()
ADD_LIBRARY(kirigami_static_library STATIC IMPORTED)
SET_TARGET_PROPERTIES(kirigami_static_library PROPERTIES
IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/mobile-widgets/qml/kirigami/build/src/libkirigamiplugin.a)
target_link_libraries(
${SUBSURFACE_TARGET}
subsurface_profile
subsurface_models
subsurface_corelib
${SUBSURFACE_LINK_LIBRARIES}
kirigami_static_library
)
elseif(${SUBSURFACE_TARGET_EXECUTABLE} MATCHES "DesktopExecutable")
set(SUBSURFACE_APP

View file

@ -23,50 +23,18 @@
<file alias="menu-back.png">icons/menu-back.png</file>
<file alias="nocloud.svg">icons/nocloud.svg</file>
</qresource>
<qresource prefix="/imports">
<file alias="org/kde/kirigami/qmldir">kirigami/qmldir</file>
<file alias="org/kde/kirigami/Action.qml">kirigami/Action.qml</file>
<file alias="org/kde/kirigami/ApplicationWindow.qml">kirigami/ApplicationWindow.qml</file>
<file alias="org/kde/kirigami/BasicListItem.qml">kirigami/BasicListItem.qml</file>
<file alias="org/kde/kirigami/GlobalDrawer.qml">kirigami/GlobalDrawer.qml</file>
<file alias="org/kde/kirigami/ContextDrawer.qml">kirigami/ContextDrawer.qml</file>
<file alias="org/kde/kirigami/Page.qml">kirigami/Page.qml</file>
<file alias="org/kde/kirigami/ScrollablePage.qml">kirigami/ScrollablePage.qml</file>
<file alias="org/kde/kirigami/Icon.qml">kirigami/Icon.qml</file>
<file alias="org/kde/kirigami/Heading.qml">kirigami/Heading.qml</file>
<file alias="org/kde/kirigami/OverlaySheet.qml">kirigami/OverlaySheet.qml</file>
<file alias="org/kde/kirigami/ApplicationHeader.qml">kirigami/ApplicationHeader.qml</file>
<file alias="org/kde/kirigami/AbstractApplicationHeader.qml">kirigami/AbstractApplicationHeader.qml</file>
<file alias="org/kde/kirigami/AbstractApplicationWindow.qml">kirigami/AbstractApplicationWindow.qml</file>
<file alias="org/kde/kirigami/private/PageRow.qml">kirigami/private/PageRow.qml</file>
<file alias="org/kde/kirigami/Label.qml">kirigami/Label.qml</file>
<file alias="org/kde/kirigami/AbstractListItem.qml">kirigami/AbstractListItem.qml</file>
<file alias="org/kde/kirigami/SwipeListItem.qml">kirigami/SwipeListItem.qml</file>
<file alias="org/kde/kirigami/OverlayDrawer.qml">kirigami/OverlayDrawer.qml</file>
<file alias="org/kde/kirigami/Theme.qml">kirigami/Theme.qml</file>
<file alias="org/kde/kirigami/Units.qml">kirigami/Units.qml</file>
<file alias="org/kde/kirigami/private/AbstractDrawer.qml">kirigami/private/AbstractDrawer.qml</file>
<file alias="org/kde/kirigami/private/ActionButton.qml">kirigami/private/ActionButton.qml</file>
<file alias="org/kde/kirigami/private/BackButton.qml">kirigami/private/BackButton.qml</file>
<file alias="org/kde/kirigami/private/ContextIcon.qml">kirigami/private/ContextIcon.qml</file>
<file alias="org/kde/kirigami/private/CornerShadow.qml">kirigami/private/CornerShadow.qml</file>
<file alias="org/kde/kirigami/private/DefaultListItemBackground.qml">kirigami/private/DefaultListItemBackground.qml</file>
<file alias="org/kde/kirigami/private/EdgeShadow.qml">kirigami/private/EdgeShadow.qml</file>
<file alias="org/kde/kirigami/private/MenuIcon.qml">kirigami/private/MenuIcon.qml</file>
<file alias="org/kde/kirigami/private/PageActionPropertyGroup.qml">kirigami/private/PageActionPropertyGroup.qml</file>
<file alias="org/kde/kirigami/private/PassiveNotification.qml">kirigami/private/PassiveNotification.qml</file>
<file alias="org/kde/kirigami/private/RefreshableScrollView.qml">kirigami/private/RefreshableScrollView.qml</file>
<file alias="org/kde/kirigami/icons/go-next.svg">kirigami/icons/go-next.svg</file>
<file alias="org/kde/kirigami/icons/go-previous.svg">kirigami/icons/go-previous.svg</file>
<file alias="org/kde/kirigami/icons/handle-left.svg">kirigami/icons/handle-left.svg</file>
<file alias="org/kde/kirigami/icons/distribute-horizontal-x.svg">kirigami/icons/distribute-horizontal-x.svg</file>
<file alias="org/kde/kirigami/icons/document-edit.svg">kirigami/icons/document-edit.svg</file>
<file alias="org/kde/kirigami/icons/document-save.svg">kirigami/icons/document-save.svg</file>
<file alias="org/kde/kirigami/icons/view-readermode.svg">kirigami/icons/view-readermode.svg</file>
<file alias="org/kde/kirigami/icons/dialog-cancel.svg">kirigami/icons/dialog-cancel.svg</file>
<file alias="org/kde/kirigami/icons/application-menu.svg">kirigami/icons/application-menu.svg</file>
<file alias="org/kde/kirigami/icons/gps.svg">kirigami/icons/gps.svg</file>
<file alias="org/kde/kirigami/icons/trash-empty.svg">kirigami/icons/trash-empty.svg</file>
<file alias="org/kde/kirigami/icons/list-add.svg">kirigami/icons/list-add.svg</file>
<qresource prefix="/">
<file alias="icons/go-next.svg">kirigami/icons/go-next.svg</file>
<file alias="icons/go-previous.svg">kirigami/icons/go-previous.svg</file>
<file alias="icons/handle-left.svg">kirigami/icons/handle-left.svg</file>
<file alias="icons/distribute-horizontal-x.svg">kirigami/icons/distribute-horizontal-x.svg</file>
<file alias="icons/document-edit.svg">kirigami/icons/document-edit.svg</file>
<file alias="icons/document-save.svg">kirigami/icons/document-save.svg</file>
<file alias="icons/view-readermode.svg">kirigami/icons/view-readermode.svg</file>
<file alias="icons/dialog-cancel.svg">kirigami/icons/dialog-cancel.svg</file>
<file alias="icons/application-menu.svg">kirigami/icons/application-menu.svg</file>
<file alias="icons/gps.svg">kirigami/icons/gps.svg</file>
<file alias="icons/trash-empty.svg">kirigami/icons/trash-empty.svg</file>
<file alias="icons/list-add.svg">kirigami/icons/list-add.svg</file>
</qresource>
</RCC>

View file

@ -316,6 +316,13 @@ if [ "$SUBSURFACE_MOBILE" = "ON" ] ; then
pushd $SUBSURFACE_SOURCE
bash ./scripts/mobilecomponents.sh
popd
cd $SUBSURFACE_SOURCE/mobile-widgets/qml/kirigami/
mkdir -p build
cd build
cmake .. -DSTATIC_LIBRARY=ON
make -j4
make install
fi
if [ ! -z "$SUBSURFACE_MOBILE" ] ; then

View file

@ -211,6 +211,9 @@ if [ "$BUILDGRANTLEE" = "1" ] ; then
make install
fi
# finally, build Subsurface
if [ $PLATFORM = Darwin ] ; then
@ -229,6 +232,13 @@ for (( i=0 ; i < ${#BUILDS[@]} ; i++ )) ; do
if [ "$SUBSURFACE_EXECUTABLE" = "MobileExecutable" ] ; then
cd $SRC/subsurface
bash ./scripts/mobilecomponents.sh
cd $SRC/subsurface/mobile-widgets/qml/kirigami/
mkdir -p build
cd build
cmake .. -DSTATIC_LIBRARY=ON
make -j4
make install
fi
mkdir -p $SRC/subsurface/$BUILDDIR

View file

@ -44,16 +44,12 @@ fi
# now copy the components and a couple of icons into plae
MC=$SRC/subsurface/mobile-widgets/qml/kirigami
PMMC=kirigami/src/qml
PMMC=kirigami
BREEZE=breeze-icons
rm -rf $MC
mkdir -p $MC/icons
cp -R $PMMC/* $MC/
cp $PMMC/../fallbacktheme/*qml $MC/
# fix plugin requirement
sed -i -e 's/^plugin kirigamiplugin/# plugin kirigamiplugin/' $MC/qmldir
cp $BREEZE/icons/actions/24/dialog-cancel.svg $MC/icons
cp $BREEZE/icons/actions/24/distribute-horizontal-x.svg $MC/icons

View file

@ -21,6 +21,9 @@
#include "qt-models/gpslistmodel.h"
#include "mobile-widgets/qmlprofile.h"
#define KIRIGAMI_BUILD_TYPE_STATIC
#include "mobile-widgets/qml/kirigami/src/kirigamiplugin.h"
QObject *qqWindowObject = NULL;
void init_ui()
@ -32,7 +35,9 @@ void run_ui()
{
qmlRegisterType<QMLManager>("org.subsurfacedivelog.mobile", 1, 0, "QMLManager");
qmlRegisterType<QMLProfile>("org.subsurfacedivelog.mobile", 1, 0, "QMLProfile");
QQmlApplicationEngine engine;
KirigamiPlugin::getInstance().registerTypes();
#if __APPLE__
// when running the QML UI on a Mac the deployment of the QML Components seems
// to fail and the search path for the components is rather odd - simply the