diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2020-11-23 09:34:02 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-12-17 09:17:54 -0800 |
commit | 0851224b6c53d1023ea7b2d8642de77608475e44 (patch) | |
tree | d314f6cf5e07d9bfcdfaafea238eede07587c83b | |
parent | daebd0ad0e49f7577a45c182d738f03b157d05df (diff) | |
download | subsurface-0851224b6c53d1023ea7b2d8642de77608475e44.tar.gz |
mobile/kirigami: first steps to switching to Kirigami 5.76
Our half-assed manual build of Kirigami was becoming completely unmaintainable.
So let's try to use the build method that the Kirigami team recommends. Which
unfortunately requires us to have access to the KDE extra cmake modules (ECM).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | CMakeLists.txt | 33 | ||||
-rw-r--r-- | mobile-widgets/3rdparty/CMakeLists.txt | 4 | ||||
-rw-r--r-- | mobile-widgets/CMakeLists.txt | 16 | ||||
-rw-r--r-- | mobile-widgets/qml/mobile-resources.qrc | 26 | ||||
-rwxr-xr-x | scripts/get-dep-lib.sh | 2 | ||||
-rwxr-xr-x | scripts/mobilecomponents.sh | 13 |
6 files changed, 36 insertions, 58 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 79fd6eddd..0f23e1323 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -328,25 +328,29 @@ endif() # create the executables if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable") + # set up Kirigami using KDE ECM + # that's available as kde-extra-cmake-modules on Homebrew, on all Linux flavors + # Android and iOS are built via qmake, Windows build of Subsurface-mobile isn't supported + find_package(ECM REQUIRED CONFIG) + set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/ ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH}) + set(BREEZEICONS_DIR mobile-widgets/3rdparty/breeze-icons/) + + SET(QML_IMPORT_PATH ${QML_IMPORT_PATH} ${CMAKE_SOURCE_DIR}/mobile-widgets/3rdparty/kirigami/src ${CMAKE_SOURCE_DIR}/mobile-widgets/qml) + add_subdirectory(mobile-widgets/3rdparty) + include_directories(${CMAKE_SOURCE_DIR}/mobile-widgets/3rdparty/kirigami/src) + include(${CMAKE_SOURCE_DIR}/mobile-widgets/3rdparty/kirigami/KF5Kirigami2Macros.cmake) + set(MOBILE_SRC subsurface-mobile-main.cpp subsurface-helper.cpp ) - include_directories(${CMAKE_SOURCE_DIR}/mobile-widgets/qml/kirigami/src/libkirigami) - add_definitions(-DKIRIGAMI_BUILD_TYPE_STATIC) qt5_add_resources(MOBILE_RESOURCES mobile-widgets/qml/mobile-resources.qrc) - qt5_add_resources(MOBILE_RESOURCES mobile-widgets/qml/kirigami/kirigami.qrc) - # When building the mobile application in Android, link it and Qt will do the rest, when doing the mobile application on Desktop, create an executable. - if(ANDROID) - qt5_add_resources(MOBILE_RESOURCES android-mobile/font.qrc) - add_library(${SUBSURFACE_TARGET} SHARED ${SUBSURFACE_PKG} ${MOBILE_SRC} ${SUBSURFACE_RESOURCES} ${MOBILE_RESOURCES}) - else() - # the following is split across two commands since in cmake 3.12 this would result - # in a non-sensical "no sources given to target" error if done all as one set of - # arguments to the add_executable() call - add_executable(${SUBSURFACE_TARGET} ${SUBSURFACE_PKG} ${SUBSURFACE_RESOURCES}) - target_sources(${SUBSURFACE_TARGET} PUBLIC ${MOBILE_SRC} ${MOBILE_RESOURCES}) - endif() + + # the following is split across two commands since in cmake 3.12 this would result + # in a non-sensical "no sources given to target" error if done all as one set of + # arguments to the add_executable() call + add_executable(${SUBSURFACE_TARGET} ${SUBSURFACE_PKG} ${SUBSURFACE_RESOURCES}) + target_sources(${SUBSURFACE_TARGET} PUBLIC ${MOBILE_SRC} ${MOBILE_RESOURCES}) target_link_libraries( ${SUBSURFACE_TARGET} subsurface_mobile @@ -356,6 +360,7 @@ if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable") subsurface_models_mobile subsurface_commands subsurface_corelib + kirigamiplugin ${SUBSURFACE_LINK_LIBRARIES} ) elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable") diff --git a/mobile-widgets/3rdparty/CMakeLists.txt b/mobile-widgets/3rdparty/CMakeLists.txt new file mode 100644 index 000000000..e0afef627 --- /dev/null +++ b/mobile-widgets/3rdparty/CMakeLists.txt @@ -0,0 +1,4 @@ +# simply pull in Kirigami, making sure it's statically built +option(BUILD_SHARED_LIBS "Build a shared module" OFF) + +add_subdirectory(kirigami) diff --git a/mobile-widgets/CMakeLists.txt b/mobile-widgets/CMakeLists.txt index 9f5ddaf47..4e4135a5a 100644 --- a/mobile-widgets/CMakeLists.txt +++ b/mobile-widgets/CMakeLists.txt @@ -4,25 +4,9 @@ set(SUBSURFACE_MOBILE_SRCS qmlinterface.cpp qmlmanager.cpp themeinterface.cpp - qml/kirigami/src/columnview.cpp - qml/kirigami/src/delegaterecycler.cpp - qml/kirigami/src/enums.cpp - qml/kirigami/src/formlayoutattached.cpp - qml/kirigami/src/icon.cpp - qml/kirigami/src/kirigamiplugin.cpp - qml/kirigami/src/mnemonicattached.cpp - qml/kirigami/src/scenepositionattached.cpp - qml/kirigami/src/settings.cpp - qml/kirigami/src/wheelhandler.cpp - qml/kirigami/src/libkirigami/basictheme.cpp - qml/kirigami/src/libkirigami/kirigamipluginfactory.cpp - qml/kirigami/src/libkirigami/platformtheme.cpp - qml/kirigami/src/libkirigami/tabletmodewatcher.cpp ) if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable") - include_directories(${CMAKE_SOURCE_DIR}/mobile-widgets/qml/kirigami/src/libkirigami) - add_definitions(-DKIRIGAMI_BUILD_TYPE_STATIC) add_library(subsurface_mobile STATIC ${SUBSURFACE_MOBILE_SRCS}) target_link_libraries(subsurface_mobile ${QT_LIBRARIES}) endif() diff --git a/mobile-widgets/qml/mobile-resources.qrc b/mobile-widgets/qml/mobile-resources.qrc index 7e6f9bc06..78b5f2ed3 100644 --- a/mobile-widgets/qml/mobile-resources.qrc +++ b/mobile-widgets/qml/mobile-resources.qrc @@ -96,34 +96,8 @@ <file alias="icons/ic_sort.svg">icons/ic_sort_24px.svg</file> <file alias="icons/trip_details.svg">icons/local_offer.svg</file> - <!-- ********** kirigami icons ********** --> - <file alias="icons/application-menu.svg">kirigami/icons/application-menu.svg</file> - <file alias="icons/dialog-cancel.svg">kirigami/icons/dialog-cancel.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/go-up.svg">kirigami/icons/go-up.svg</file> - <file alias="icons/gps.svg">kirigami/icons/gps.svg</file> - <file alias="icons/handle-left.svg">kirigami/icons/handle-left.svg</file> - <file alias="icons/handle-right.svg">kirigami/icons/handle-right.svg</file> - <file alias="icons/map-globe.svg">kirigami/icons/map-globe.svg</file> - <file alias="icons/list-add.svg">kirigami/icons/list-add.svg</file> - <file alias="icons/overflow-menu.svg">kirigami/icons/overflow-menu.svg</file> - <file alias="icons/trash-empty.svg">kirigami/icons/trash-empty.svg</file> - <file alias="icons/edit-copy.svg">kirigami/icons/edit-copy.svg</file> - <file alias="icons/edit-paste.svg">kirigami/icons/edit-paste.svg</file> - <file alias="icons/view-readermode.svg">kirigami/icons/view-readermode.svg</file> </qresource> - <qresource prefix="/"> - <!-- ********** kirigami icons ********** --> - <file alias="/org/kde/kirigami/templates/private/go-next-symbolic">kirigami/icons/go-next.svg</file> - <file alias="/org/kde/kirigami/templates/private/go-previous-symbolic">kirigami/icons/go-previous.svg</file> - <file alias="go-next-symbolic">kirigami/icons/go-next.svg</file> - <file alias="go-previous-symbolic">kirigami/icons/go-previous.svg</file> - </qresource> - - <qresource prefix="/xslt"> <!-- ********** xslt ********** --> <file alias="commonTemplates.xsl">../../xslt/commonTemplates.xsl</file> diff --git a/scripts/get-dep-lib.sh b/scripts/get-dep-lib.sh index 3a0bb5901..c81b1711a 100755 --- a/scripts/get-dep-lib.sh +++ b/scripts/get-dep-lib.sh @@ -13,7 +13,7 @@ CURRENT_XSLT="v1.1.34" CURRENT_SQLITE="3190200" CURRENT_LIBXML2="v2.9.4" CURRENT_LIBFTDI="1.3" -CURRENT_KIRIGAMI="v5.62.0" +CURRENT_KIRIGAMI="v5.76.0" CURRENT_BREEZE_ICONS="4daac191fb33c8c03bba8356db9767816cb8ee02" CURRENT_MDBTOOLS="master" CURRENT_QT_ANDROID_CMAKE="master" diff --git a/scripts/mobilecomponents.sh b/scripts/mobilecomponents.sh index 64538c44b..e295c49d8 100755 --- a/scripts/mobilecomponents.sh +++ b/scripts/mobilecomponents.sh @@ -14,6 +14,17 @@ if [ ! -d "$SRC/subsurface" ] || [ ! -d "mobile-widgets" ] || [ ! -d "core" ] ; exit 1 fi +# completely changing the Kirigami build, going down the path that the +# Kirigami developers favor, which is to install Kirigami and Breeze in +# a 3rdparty folder within our sources +./scripts/get-dep-lib.sh single "$SRC"/subsurface/mobile-widgets/3rdparty kirigami +./scripts/get-dep-lib.sh single "$SRC"/subsurface/mobile-widgets/3rdparty breeze-icons + + +exit 0 + + + # now bring in the latest Kirigami mobile components plus a couple of icons that we need # first, get the latest from upstream # yes, this is a bit overkill as we clone a lot of stuff for just a few files, but this way @@ -64,7 +75,7 @@ sed -i -e "s/width: backgroundRect/enabled: root.enabled; width: backgroundRe # double defined symbols in our setting. I would like a nicer fix for this # issue, but failed to find one. For example, not adding the resource in # our build causes the qrc file not to be generated. Manual generation -# of the resource file (using rcc) introduces the double symbols again. +# of the resource file (using rcc) introduces the double symbols again. # so it seems some Kirigami weirdness (but their staticcmake example compiles # correctly). |