From 74dbf9507f95e6b768274d2367f976bde5e2577b Mon Sep 17 00:00:00 2001 From: Emeric Date: Fri, 29 Nov 2024 18:54:42 +0100 Subject: [PATCH] Work on CI builds --- CMakeLists.txt | 15 +++++++--- assets/windows/QmlAppTemplate.rc | 32 +++++++++++++++++++++ qml/PageButtons.qml | 1 - qml/PageColors.qml | 1 - qml/PageDateTime.qml | 1 - qml/PageDialogs.qml | 1 - qml/PageIndicators.qml | 1 - qml/PageSelectors.qml | 1 - qml/PageTextFields.qml | 1 - qml/PageTickers.qml | 1 - qml/QmlImports.qml | 5 ---- qml/ScreenDesktopComponents.qml | 1 - qml/ScreenMobileComponents.qml | 1 - thirdparty/AppUtils/CMakeLists.txt | 6 ++-- thirdparty/ComponentLibrary/CMakeLists.txt | 26 +++++++++++------ thirdparty/MobileUI/CMakeLists.txt | 7 ++--- thirdparty/SingleApplication/CMakeLists.txt | 3 -- 17 files changed, 67 insertions(+), 37 deletions(-) create mode 100644 assets/windows/QmlAppTemplate.rc delete mode 100644 qml/QmlImports.qml diff --git a/CMakeLists.txt b/CMakeLists.txt index 42dd0d8..7a4f751 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,7 @@ message(STATUS "[PROJECT] QT_HOST_PATH = ${QT_HOST_PATH}") ################################################################################ -find_package(Qt6 REQUIRED COMPONENTS Core Gui Svg Qml Quick QuickControls2) +find_package(Qt6 REQUIRED COMPONENTS Core Gui Svg Qml Quick QuickControls2 LabsQmlModels) find_package(Qt6 REQUIRED COMPONENTS LinguistTools) qt_standard_project_setup(REQUIRES 6.7) @@ -42,6 +42,8 @@ qt_add_executable(${CMAKE_PROJECT_NAME} src/SettingsManager.cpp src/SettingsManager.h assets/assets.qrc thirdparty/IconLibrary/IconLibrary.qrc + ${app_icon_macos} + ${app_icon_windows} ) qt_add_qml_module(${CMAKE_PROJECT_NAME} @@ -154,6 +156,9 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") #set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64") set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0") + set(app_icon_macos "${CMAKE_SOURCE_DIR}/assets/macos/${CMAKE_PROJECT_NAME}.icns") + set_source_files_properties(${app_icon_macos} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") + set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES MACOSX_BUNDLE ON MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/assets/macos/Info.plist" @@ -168,9 +173,8 @@ endif() ## iOS if(CMAKE_SYSTEM_NAME STREQUAL "iOS") - #set(assets_catalog_path "${CMAKE_SOURCE_DIR}/assets/ios/Assets.xcassets") - #target_sources(${CMAKE_PROJECT_NAME} PRIVATE ${assets_catalog_path}) - #set_source_files_properties(${assets_catalog_path} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) + #set(app_icon_ios "${CMAKE_SOURCE_DIR}/assets/ios/Assets.xcassets") + #set_source_files_properties(${app_icon_ios} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES MACOSX_BUNDLE ON @@ -191,6 +195,9 @@ endif() ## Windows if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + + set(app_icon_windows "${CMAKE_SOURCE_DIR}/assets/windows/${CMAKE_PROJECT_NAME}.rc") + set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES WIN32_EXECUTABLE ON ) diff --git a/assets/windows/QmlAppTemplate.rc b/assets/windows/QmlAppTemplate.rc new file mode 100644 index 0000000..2d66ebd --- /dev/null +++ b/assets/windows/QmlAppTemplate.rc @@ -0,0 +1,32 @@ +#include "winver.h" + +IDI_ICON1 ICON "QmlAppTemplate.ico" + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,0 + PRODUCTVERSION 1,0,0,0 + FILEFLAGS 0x0L + FILEFLAGSMASK 0x3fL + FILEOS 0x00040004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "000004b0" + BEGIN + VALUE "CompanyName", "QmlAppTemplate" + VALUE "FileDescription", "QmlAppTemplate" + VALUE "FileVersion", "1.0.0.0" + VALUE "LegalCopyright", "Copyright (C) 2024 QmlAppTemplate" + VALUE "InternalName", "QmlAppTemplate" + VALUE "OriginalFilename", "QmlAppTemplate.exe" + VALUE "ProductName", "QmlAppTemplate" + VALUE "ProductVersion", "1.0.0.0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0, 1200 + END +END diff --git a/qml/PageButtons.qml b/qml/PageButtons.qml index 621fe40..2fcf6ce 100644 --- a/qml/PageButtons.qml +++ b/qml/PageButtons.qml @@ -2,7 +2,6 @@ import QtQuick import QtQuick.Controls import ComponentLibrary -import QmlAppTemplate Item { diff --git a/qml/PageColors.qml b/qml/PageColors.qml index b752efa..7ed037e 100644 --- a/qml/PageColors.qml +++ b/qml/PageColors.qml @@ -2,7 +2,6 @@ import QtQuick import QtQuick.Controls import ComponentLibrary -import QmlAppTemplate Flickable { contentWidth: -1 diff --git a/qml/PageDateTime.qml b/qml/PageDateTime.qml index 6348bbf..860caeb 100644 --- a/qml/PageDateTime.qml +++ b/qml/PageDateTime.qml @@ -2,7 +2,6 @@ import QtQuick import QtQuick.Controls import ComponentLibrary -import QmlAppTemplate Flickable { contentWidth: -1 diff --git a/qml/PageDialogs.qml b/qml/PageDialogs.qml index 3c9be62..73674a8 100644 --- a/qml/PageDialogs.qml +++ b/qml/PageDialogs.qml @@ -2,7 +2,6 @@ import QtQuick import QtQuick.Controls import ComponentLibrary -import QmlAppTemplate Flickable { contentWidth: -1 diff --git a/qml/PageIndicators.qml b/qml/PageIndicators.qml index ff51c56..9e9c908 100644 --- a/qml/PageIndicators.qml +++ b/qml/PageIndicators.qml @@ -2,7 +2,6 @@ import QtQuick import QtQuick.Controls import ComponentLibrary -import QmlAppTemplate Flickable { contentWidth: -1 diff --git a/qml/PageSelectors.qml b/qml/PageSelectors.qml index 0500050..c522b51 100644 --- a/qml/PageSelectors.qml +++ b/qml/PageSelectors.qml @@ -2,7 +2,6 @@ import QtQuick import QtQuick.Controls import ComponentLibrary -import QmlAppTemplate Flickable { contentWidth: -1 diff --git a/qml/PageTextFields.qml b/qml/PageTextFields.qml index 385ddc3..4dd26e2 100644 --- a/qml/PageTextFields.qml +++ b/qml/PageTextFields.qml @@ -2,7 +2,6 @@ import QtQuick import QtQuick.Controls import ComponentLibrary -import QmlAppTemplate Flickable { contentWidth: -1 diff --git a/qml/PageTickers.qml b/qml/PageTickers.qml index 117a045..46cec2f 100644 --- a/qml/PageTickers.qml +++ b/qml/PageTickers.qml @@ -2,7 +2,6 @@ import QtQuick import QtQuick.Controls import ComponentLibrary -import QmlAppTemplate Flickable { contentWidth: -1 diff --git a/qml/QmlImports.qml b/qml/QmlImports.qml deleted file mode 100644 index ee29371..0000000 --- a/qml/QmlImports.qml +++ /dev/null @@ -1,5 +0,0 @@ -import QtCore - -import Qt.labs.qmlmodels - -QtObject {} diff --git a/qml/ScreenDesktopComponents.qml b/qml/ScreenDesktopComponents.qml index bfaa12e..32e8b58 100644 --- a/qml/ScreenDesktopComponents.qml +++ b/qml/ScreenDesktopComponents.qml @@ -2,7 +2,6 @@ import QtQuick import QtQuick.Controls import ComponentLibrary -import QmlAppTemplate Loader { id: screenDesktopComponents diff --git a/qml/ScreenMobileComponents.qml b/qml/ScreenMobileComponents.qml index 4ba6d1e..5e2d6bf 100644 --- a/qml/ScreenMobileComponents.qml +++ b/qml/ScreenMobileComponents.qml @@ -2,7 +2,6 @@ import QtQuick import QtQuick.Controls import ComponentLibrary -import QmlAppTemplate Loader { id: screenMobileComponents diff --git a/thirdparty/AppUtils/CMakeLists.txt b/thirdparty/AppUtils/CMakeLists.txt index 5564621..349b863 100644 --- a/thirdparty/AppUtils/CMakeLists.txt +++ b/thirdparty/AppUtils/CMakeLists.txt @@ -3,6 +3,9 @@ project(AppUtils LANGUAGES CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_AUTOMOC ON) +# Use that find_package() call in the root project: +find_package(Qt6 6.6 REQUIRED COMPONENTS Core Gui Qml Quick) + ################################################################################ # Optional stuff (for macOS) @@ -15,8 +18,6 @@ set(CMAKE_AUTOMOC ON) ################################################################################ # Generic dependencies -find_package(Qt6 6.6 REQUIRED COMPONENTS Core Gui Qml Quick) - set(CORE_LIBRARIES Qt::Core Qt::Gui @@ -115,7 +116,6 @@ endif() ################################################################################ add_library(AppUtils OBJECT ${CORE_SOURCES} ${PLATFORM_SOURCES}) -add_library(AppUtils::AppUtils ALIAS AppUtils) target_compile_definitions(AppUtils PUBLIC APP_NAME=\"${APP_NAME}\" APP_VERSION=\"${APP_VERSION}\") target_link_libraries(AppUtils PRIVATE ${CORE_LIBRARIES} ${PLATFORM_LIBRARIES}) diff --git a/thirdparty/ComponentLibrary/CMakeLists.txt b/thirdparty/ComponentLibrary/CMakeLists.txt index bd528c4..4354c2f 100644 --- a/thirdparty/ComponentLibrary/CMakeLists.txt +++ b/thirdparty/ComponentLibrary/CMakeLists.txt @@ -1,4 +1,13 @@ -qt_add_library(ComponentLibrary STATIC) +project(ComponentLibrary LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) + +# Use that find_package() call in the root project: +find_package(Qt6 6.5 REQUIRED COMPONENTS Svg Qml Quick QuickControls2 LabsQmlModels) + +################################################################################ list(APPEND MODULE_ASSETS # @@ -133,7 +142,7 @@ list(APPEND MODULE_QML_FILES utils/WindowGeometrySaver.qml ) -if (TARGET Qt::Location) +if(TARGET Qt::Location) list(APPEND MODULE_QML_FILES maps/MapButton.qml maps/MapButtonCompass.qml @@ -143,7 +152,7 @@ if (TARGET Qt::Location) maps/MapScale.qml ) else() - message(STATUS "Skipping the mapping components from ComponentLibrary as Qt6::Location is not used.") + message(STATUS "ComponentLibrary > Skipping the mapping components as Qt6::Location is not used by the root project.") endif() list(APPEND MODULE_QML_FILES @@ -166,6 +175,8 @@ list(APPEND MODULE_SOURCES # ) +################################################################################ + set_source_files_properties(QML_FILES PROPERTIES QT_QML_SKIP_CACHEGEN FALSE ) @@ -175,11 +186,7 @@ set_source_files_properties(ThemeEngine.qml PROPERTIES QT_QML_SOURCE_TYPENAME Theme ) -set_target_properties(ComponentLibrary PROPERTIES AUTOMOC ON) - -find_package(Qt6 REQUIRED COMPONENTS Qml Quick QuickControls2) - -target_link_libraries(ComponentLibrary PRIVATE Qt6::Qml Qt6::Quick Qt6::QuickControls2 Qt6::QmlModels) +qt_add_library(ComponentLibrary STATIC ${MODULE_SOURCES}) qt_add_qml_module(ComponentLibrary URI ComponentLibrary @@ -189,3 +196,6 @@ qt_add_qml_module(ComponentLibrary RESOURCES ${MODULE_ASSETS} SOURCES ${MODULE_SOURCES} ) + +target_link_libraries(ComponentLibrary PRIVATE Qt6::Qml Qt6::Quick Qt6::QuickControls2 Qt6::LabsQmlModels) +target_include_directories(ComponentLibrary PUBLIC ${CMAKE_CURRENT_LIST_DIR}) diff --git a/thirdparty/MobileUI/CMakeLists.txt b/thirdparty/MobileUI/CMakeLists.txt index ee8d0ec..409510b 100644 --- a/thirdparty/MobileUI/CMakeLists.txt +++ b/thirdparty/MobileUI/CMakeLists.txt @@ -3,12 +3,12 @@ project(MobileUI LANGUAGES CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_AUTOMOC ON) +# Use that find_package() call in the root project: +find_package(Qt6 6.7 REQUIRED COMPONENTS Core Gui Qml) + ################################################################################ # Generic dependencies -set(CORE_COMPONENTS Core Gui Qml) -find_package(Qt6 6.7 REQUIRED COMPONENTS ${CORE_COMPONENTS}) - set(CORE_LIBRARIES Qt::Core Qt::Gui Qt::Qml) # Generic sources @@ -29,7 +29,6 @@ endif() ################################################################################ add_library(MobileUI OBJECT ${CORE_SOURCES} ${PLATFORM_SOURCES}) -add_library(MobileUI::MobileUI ALIAS MobileUI) target_link_libraries(MobileUI PRIVATE ${CORE_LIBRARIES} ${PLATFORM_LIBRARIES}) target_include_directories(MobileUI PUBLIC ${CMAKE_CURRENT_LIST_DIR}) diff --git a/thirdparty/SingleApplication/CMakeLists.txt b/thirdparty/SingleApplication/CMakeLists.txt index fd05f38..eb33ba2 100644 --- a/thirdparty/SingleApplication/CMakeLists.txt +++ b/thirdparty/SingleApplication/CMakeLists.txt @@ -43,7 +43,6 @@ endif() ################################################################################ add_library(SingleApplication STATIC SingleApplication.cpp SingleApplication_private.cpp) -add_library(SingleApplication::SingleApplication ALIAS SingleApplication) target_link_libraries(SingleApplication PRIVATE ${CORE_LIBRARIES} ${PLATFORM_LIBRARIES}) target_include_directories(SingleApplication PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) @@ -59,5 +58,3 @@ target_compile_definitions(SingleApplication PRIVATE QT_NO_KEYWORDS QT_NO_FOREACH ) - -################################################################################