diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 632d8313..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: { @@ -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 3e45367a..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() ############################################################################ @@ -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) @@ -116,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 ${QSK_INSTALL_LIBS}/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/cmake/QskConfigMacros.cmake b/cmake/QskConfigMacros.cmake index 0d373c18..8cc8992b 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() 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 new file mode 100644 index 00000000..ea34d940 --- /dev/null +++ b/examples/iotdashboard_smoketest/CMakeLists.txt @@ -0,0 +1,47 @@ +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) + + function(qt_add_executable) + add_executable(${ARGV}) + endfunction(qt_add_executable) +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) + +# 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/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 313e1b93..3906ad94 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -480,6 +480,10 @@ target_include_directories(${target} PUBLIC $ $) +target_include_directories(${target} + INTERFACE + $) + target_link_libraries(${target} PUBLIC Qt::Core Qt::CorePrivate Qt::Quick Qt::QuickPrivate) @@ -496,7 +500,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..6c64b50c 100644 --- a/tools/svg2qvg/CMakeLists.txt +++ b/tools/svg2qvg/CMakeLists.txt @@ -22,14 +22,18 @@ 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() 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)