From b850c185576b9ec835532215f1ce7ac31536263d Mon Sep 17 00:00:00 2001 From: Rick Vogel Date: Mon, 4 Dec 2023 18:52:41 +0100 Subject: [PATCH 1/7] don't use QSK_SOURCE_DIR --- CMakeLists.txt | 2 ++ inputcontext/CMakeLists.txt | 8 ++++---- src/CMakeLists.txt | 2 +- support/CMakeLists.txt | 2 +- tools/svg2qvg/CMakeLists.txt | 4 ++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e45367a..5517241d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,6 +75,8 @@ project(QSkinny HOMEPAGE_URL "https://github.com/uwerat/qskinny" VERSION 0.8.0) +set(QSK_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}) + qsk_setup_options() include(GNUInstallDirs) diff --git a/inputcontext/CMakeLists.txt b/inputcontext/CMakeLists.txt index 0201a65e..43a9db6d 100644 --- a/inputcontext/CMakeLists.txt +++ b/inputcontext/CMakeLists.txt @@ -19,8 +19,8 @@ if(ENABLE_PINYIN) qsk_setup_Pinyin() list(APPEND SOURCES - ${CMAKE_SOURCE_DIR}/src/inputpanel/QskPinyinTextPredictor.h - ${CMAKE_SOURCE_DIR}/src/inputpanel/QskPinyinTextPredictor.cpp + ${QSK_SOURCE_DIR}/src/inputpanel/QskPinyinTextPredictor.h + ${QSK_SOURCE_DIR}/src/inputpanel/QskPinyinTextPredictor.cpp ) endif() @@ -28,8 +28,8 @@ if(ENABLE_HUNSPELL) qsk_setup_Hunspell() list(APPEND SOURCES - ${CMAKE_SOURCE_DIR}/src/inputpanel/QskHunspellTextPredictor.h - ${CMAKE_SOURCE_DIR}/src/inputpanel/QskHunspellTextPredictor.cpp + ${QSK_SOURCE_DIR}/src/inputpanel/QskHunspellTextPredictor.h + ${QSK_SOURCE_DIR}/src/inputpanel/QskHunspellTextPredictor.cpp ) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e017237a..d4f0b076 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -499,7 +499,7 @@ if(ENABLE_PINYIN) target_link_libraries(${target} PRIVATE pinyin Fcitx5::Utils) target_include_directories(${target} - PUBLIC $) + PUBLIC $) endif() set_target_properties(${target} PROPERTIES FOLDER libs) diff --git a/support/CMakeLists.txt b/support/CMakeLists.txt index 4d15724f..5dc77dd5 100644 --- a/support/CMakeLists.txt +++ b/support/CMakeLists.txt @@ -31,7 +31,7 @@ target_compile_definitions(${target} target_include_directories(${target} PUBLIC ${CMAKE_CURRENT_LIST_DIR}) if(ENABLE_ENSURE_SKINS) - target_include_directories(${target} PRIVATE ${CMAKE_SOURCE_DIR}/skins) + target_include_directories(${target} PRIVATE ${QSK_SOURCE_DIR}/skins) target_compile_definitions(${target} PRIVATE ENSURE_SKINS) target_link_libraries(${target} PRIVATE squiekskin material3skin fluent2skin) endif() diff --git a/tools/svg2qvg/CMakeLists.txt b/tools/svg2qvg/CMakeLists.txt index c206f820..b468fd44 100644 --- a/tools/svg2qvg/CMakeLists.txt +++ b/tools/svg2qvg/CMakeLists.txt @@ -28,8 +28,8 @@ if(BUILD_SVG2QVG_STANDALONE) target_include_directories(${target} PRIVATE - ${CMAKE_SOURCE_DIR}/src/common - ${CMAKE_SOURCE_DIR}/src/graphic) + ${QSK_SOURCE_DIR}/src/common + ${QSK_SOURCE_DIR}/src/graphic) target_compile_definitions(${target} PRIVATE QSK_STANDALONE) target_link_libraries(${target} PRIVATE Qt::Gui Qt::GuiPrivate) From 32eed71c2131b0bca1c564b4fcdd6597a7ff11e1 Mon Sep 17 00:00:00 2001 From: "Vogel, Rick" Date: Thu, 21 Dec 2023 14:12:38 +0100 Subject: [PATCH 2/7] reintegrate find package --- .github/workflows/cmake.yml | 32 ++++++------- CMakeLists.txt | 45 +++++++++++++++++++ cmake/QSkinnyConfig.cmake | 2 + .../iotdashboard_smoketest/CMakeLists.txt | 24 ++++++++++ 4 files changed, 87 insertions(+), 16 deletions(-) create mode 100644 cmake/QSkinnyConfig.cmake create mode 100644 examples/iotdashboard_smoketest/CMakeLists.txt diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 632d8313..61406637 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -431,22 +431,22 @@ jobs: killall iotdashboard killall Xvfb - #- name: Configure ( CMake Integration Test ) - # shell: bash - # run: | - # mkdir qskinny_build_test - # cmake \ - # -S qskinny_source/examples/iotdashboard_smoketest \ - # -B qskinny_build_test \ - # -G "${{ matrix.config.generators }}" \ - # -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \ - # -DCMAKE_PREFIX_PATH:PATH="${{ matrix.config.cmake.qtprefixpath }}" \ - # -D${{ matrix.config.cmake.qtdirkey }}:PATH="${{ matrix.config.cmake.qtdirvalue }}" \ - # -DQSkinny_DIR:PATH=$GITHUB_WORKSPACE/qskinny_install/lib/cmake/QSkinny -# - #- name: Build ( CMake Integration Test ) - # shell: bash - # run: cmake --build qskinny_build_test --config ${{ matrix.config.build_type }} + - name: Configure ( CMake Integration Test ) + shell: bash + run: | + mkdir qskinny_build_test + cmake \ + -S qskinny_source/examples/iotdashboard_smoketest \ + -B qskinny_build_test \ + -G "${{ matrix.config.generators }}" \ + -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \ + -DCMAKE_PREFIX_PATH:PATH="${{ matrix.config.cmake.qtprefixpath }}" \ + -D${{ matrix.config.cmake.qtdirkey }}:PATH="${{ matrix.config.cmake.qtdirvalue }}" \ + -DQSkinny_DIR:PATH=$GITHUB_WORKSPACE/qskinny_install/lib/cmake/QSkinny + + - name: Build ( CMake Integration Test ) + shell: bash + run: cmake --build qskinny_build_test --config ${{ matrix.config.build_type }} # - name: Pack # shell: bash diff --git a/CMakeLists.txt b/CMakeLists.txt index 5517241d..a6fa1268 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,3 +118,48 @@ endif() if(BUILD_PLAYGROUND) add_subdirectory(playground) endif() + +# packaging +set(PACKAGE_NAME ${PROJECT_NAME}) +set(PACKAGE_VERSION ${CMAKE_PROJECT_VERSION}) +set(PACKAGE_NAMESPACE Qsk) +set(PACKAGE_LOCATION lib/cmake/${PROJECT_NAME}) + +install(TARGETS qskinny EXPORT ${PACKAGE_NAME}Targets + LIBRARY DESTINATION ${QSK_INSTALL_LIBS} + ARCHIVE DESTINATION ${QSK_INSTALL_LIBS} + RUNTIME DESTINATION ${QSK_INSTALL_LIBS} + INCLUDES DESTINATION ${QSK_INSTALL_HEADERS} + PUBLIC_HEADER DESTINATION ${QSK_INSTALL_HEADERS}) + +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}/${PACKAGE_NAME}ConfigVersion.cmake + VERSION ${PACKAGE_VERSION} + COMPATIBILITY AnyNewerVersion) + +export(EXPORT ${PACKAGE_NAME}Targets + FILE ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}/${PACKAGE_NAME}Targets.cmake + NAMESPACE ${PACKAGE_NAMESPACE}::) + +configure_file(cmake/${PACKAGE_NAME}Config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}/${PACKAGE_NAME}Config.cmake + COPYONLY) + +install(EXPORT ${PACKAGE_NAME}Targets + FILE + ${PACKAGE_NAME}Targets.cmake + NAMESPACE + ${PACKAGE_NAMESPACE}:: + DESTINATION + ${PACKAGE_LOCATION}) + +install( + FILES + cmake/${PACKAGE_NAME}Config.cmake + cmake/QskTools.cmake + ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}/${PACKAGE_NAME}ConfigVersion.cmake + DESTINATION + ${PACKAGE_LOCATION} + COMPONENT + Devel) \ No newline at end of file diff --git a/cmake/QSkinnyConfig.cmake b/cmake/QSkinnyConfig.cmake new file mode 100644 index 00000000..e24cd20c --- /dev/null +++ b/cmake/QSkinnyConfig.cmake @@ -0,0 +1,2 @@ +include("${CMAKE_CURRENT_LIST_DIR}/QSkinnyTargets.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/QskTools.cmake") \ No newline at end of file diff --git a/examples/iotdashboard_smoketest/CMakeLists.txt b/examples/iotdashboard_smoketest/CMakeLists.txt new file mode 100644 index 00000000..2ee64519 --- /dev/null +++ b/examples/iotdashboard_smoketest/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.18) + +project(iotdashboard_smoketest) + +find_package(QSkinny REQUIRED) + +find_package(Qt6 COMPONENTS Core QUIET) +if (NOT Qt6_FOUND) + find_package(Qt5 5.15 REQUIRED COMPONENTS Core Gui OpenGL Quick Svg Widgets) + find_package(Qt5 5.15 OPTIONAL_COMPONENTS QuickWidgets WebEngine WebEngineCore) + message(WARNING "using QSkinny's 'qt_add_executable()'") + function(qt_add_executable) + add_executable(${ARGV}) + endfunction(qt_add_executable) + message(WARNING "using QSkinny's 'qt_add_library()'") + function(qt_add_library) + add_library(${ARGV}) + endfunction(qt_add_library) +else() + find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL Quick QuickWidgets Svg Widgets) + find_package(Qt6 OPTIONAL_COMPONENTS QuickWidgets WebEngineCore WebEngineQuick) +endif() + +add_subdirectory(../iotdashboard ${CMAKE_CURRENT_BINARY_DIR}/../iotdashboard) \ No newline at end of file From e0bdf160f9438cc38d252c97cf1d7e01c4daad80 Mon Sep 17 00:00:00 2001 From: "Vogel, Rick" Date: Thu, 21 Dec 2023 15:07:18 +0100 Subject: [PATCH 3/7] add missing install variables --- CMakeLists.txt | 6 ++-- examples/iotdashboard_smoketest/.gitignore | 2 ++ .../iotdashboard_smoketest/CMakeLists.txt | 35 +++++++++++++++---- src/CMakeLists.txt | 4 +++ 4 files changed, 38 insertions(+), 9 deletions(-) create mode 100644 examples/iotdashboard_smoketest/.gitignore diff --git a/CMakeLists.txt b/CMakeLists.txt index a6fa1268..21ee66fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,8 +62,8 @@ macro(qsk_setup_build) endmacro() macro(qsk_setup_install) - # we have to provide and install a QSkinnyConfig.cmake - # TODO ... + set(QSK_INSTALL_HEADERS include) + set(QSK_INSTALL_LIBS lib) endmacro() ############################################################################ @@ -123,7 +123,7 @@ endif() set(PACKAGE_NAME ${PROJECT_NAME}) set(PACKAGE_VERSION ${CMAKE_PROJECT_VERSION}) set(PACKAGE_NAMESPACE Qsk) -set(PACKAGE_LOCATION lib/cmake/${PROJECT_NAME}) +set(PACKAGE_LOCATION ${QSK_INSTALL_LIBS}/cmake/${PROJECT_NAME}) install(TARGETS qskinny EXPORT ${PACKAGE_NAME}Targets LIBRARY DESTINATION ${QSK_INSTALL_LIBS} diff --git a/examples/iotdashboard_smoketest/.gitignore b/examples/iotdashboard_smoketest/.gitignore new file mode 100644 index 00000000..09a75fee --- /dev/null +++ b/examples/iotdashboard_smoketest/.gitignore @@ -0,0 +1,2 @@ +build +iotdashboard \ No newline at end of file diff --git a/examples/iotdashboard_smoketest/CMakeLists.txt b/examples/iotdashboard_smoketest/CMakeLists.txt index 2ee64519..ea34d940 100644 --- a/examples/iotdashboard_smoketest/CMakeLists.txt +++ b/examples/iotdashboard_smoketest/CMakeLists.txt @@ -2,23 +2,46 @@ cmake_minimum_required(VERSION 3.18) project(iotdashboard_smoketest) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC OFF) +set(CMAKE_GLOBAL_AUTOGEN_TARGET OFF) + find_package(QSkinny REQUIRED) +# TODO we don't delivery the qsk macros +function(qsk_add_executable target) + if(QT_VERSION_MAJOR VERSION_GREATER_EQUAL 6) + qt6_add_executable(${ARGV}) + else() + add_executable(${ARGV}) + endif() +endfunction() + +# TODO we don't delivery the qsk macros +function(qsk_add_example target) + cmake_parse_arguments(PARSE_ARGV 1 arg "MANUAL_FINALIZATION" "" "") + add_executable(${target} WIN32 MACOSX_BUNDLE ${arg_UNPARSED_ARGUMENTS} ) + target_link_libraries(${target} PRIVATE Qsk::qskinny ) + target_include_directories(${target} PRIVATE ${CMAKE_CURRENT_LIST_DIR}) +endfunction() + find_package(Qt6 COMPONENTS Core QUIET) if (NOT Qt6_FOUND) find_package(Qt5 5.15 REQUIRED COMPONENTS Core Gui OpenGL Quick Svg Widgets) find_package(Qt5 5.15 OPTIONAL_COMPONENTS QuickWidgets WebEngine WebEngineCore) - message(WARNING "using QSkinny's 'qt_add_executable()'") + function(qt_add_executable) add_executable(${ARGV}) endfunction(qt_add_executable) - message(WARNING "using QSkinny's 'qt_add_library()'") - function(qt_add_library) - add_library(${ARGV}) - endfunction(qt_add_library) else() find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL Quick QuickWidgets Svg Widgets) find_package(Qt6 OPTIONAL_COMPONENTS QuickWidgets WebEngineCore WebEngineQuick) endif() -add_subdirectory(../iotdashboard ${CMAKE_CURRENT_BINARY_DIR}/../iotdashboard) \ No newline at end of file +add_subdirectory(../iotdashboard ${CMAKE_CURRENT_BINARY_DIR}/../iotdashboard) + +# TODO we don't delivery the support library +get_target_property(iotdashboard_COMPILE_DEFINITIONS iotdashboard COMPILE_DEFINITIONS) +list(FILTER iotdashboard_COMPILE_DEFINITIONS EXCLUDE REGEX [[^USE_SHORTCUTS=1$]]) +set_property(TARGET iotdashboard PROPERTY COMPILE_DEFINITIONS ${iotdashboard_COMPILE_DEFINITIONS}) \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d4f0b076..43feec2c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -483,6 +483,10 @@ target_include_directories(${target} PUBLIC $ $) +target_include_directories(${target} + INTERFACE + $) + target_link_libraries(${target} PUBLIC Qt::Core Qt::CorePrivate Qt::Quick Qt::QuickPrivate) From cba94215973ba526a5de054f30f58a8d788754f9 Mon Sep 17 00:00:00 2001 From: Rick Vogel <111582062+rick-vogel@users.noreply.github.com> Date: Thu, 21 Dec 2023 16:07:22 +0100 Subject: [PATCH 4/7] add msvc parallel build flag --- cmake/QskConfigMacros.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/QskConfigMacros.cmake b/cmake/QskConfigMacros.cmake index 0d373c18..5f5a2f2e 100644 --- a/cmake/QskConfigMacros.cmake +++ b/cmake/QskConfigMacros.cmake @@ -118,6 +118,7 @@ macro(qsk_initialize_build_flags) add_compile_options( -Wall -Wextra ) else() # add_compile_options(/W4 /WX) + add_compile_options($<$:/MP>) endif() endmacro() From 426e20883f49b3e4f316f8fc130e0c100caf8c5f Mon Sep 17 00:00:00 2001 From: Rick Vogel <111582062+rick-vogel@users.noreply.github.com> Date: Thu, 21 Dec 2023 16:10:24 +0100 Subject: [PATCH 5/7] simplify statement --- cmake/QskConfigMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/QskConfigMacros.cmake b/cmake/QskConfigMacros.cmake index 5f5a2f2e..8cc8992b 100644 --- a/cmake/QskConfigMacros.cmake +++ b/cmake/QskConfigMacros.cmake @@ -118,7 +118,7 @@ macro(qsk_initialize_build_flags) add_compile_options( -Wall -Wextra ) else() # add_compile_options(/W4 /WX) - add_compile_options($<$:/MP>) + add_compile_options(/MP) endif() endmacro() From 06a78455acf186bfa3bdede249f3136f10345619 Mon Sep 17 00:00:00 2001 From: Rick Vogel Date: Thu, 21 Dec 2023 16:32:49 +0100 Subject: [PATCH 6/7] add ninja multi fix --- tools/svg2qvg/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/svg2qvg/CMakeLists.txt b/tools/svg2qvg/CMakeLists.txt index b468fd44..6c64b50c 100644 --- a/tools/svg2qvg/CMakeLists.txt +++ b/tools/svg2qvg/CMakeLists.txt @@ -22,6 +22,10 @@ if(BUILD_SVG2QVG_STANDALONE) # TODO fix multi configuration generators if(CMAKE_GENERATOR MATCHES "Visual Studio.*") add_definitions("/I${qskinny_AUTOGEN_DIR}/include_\$(Configuration)") + elseif(CMAKE_GENERATOR MATCHES "Ninja Multi.*") + target_include_directories(${target} + PRIVATE + ${qskinny_AUTOGEN_DIR}/include_$) else() target_include_directories(${target} PRIVATE ${qskinny_AUTOGEN_DIR}/include) endif() From 101492fff751159e5136d3a8fe6f3ce580450b68 Mon Sep 17 00:00:00 2001 From: Rick Vogel Date: Thu, 21 Dec 2023 16:34:24 +0100 Subject: [PATCH 7/7] use Ninja Multi-Config --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 61406637..84656396 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -104,7 +104,7 @@ jobs: cc: "gcc", cxx: "g++", archiver: "7z a", - generators: "Ninja", + generators: "Ninja Multi-Config", env: { DISPLAY: ":1" }, cmake: {