diff --git a/.github/workflows/analyzers.yml b/.github/workflows/analyzers.yml index b75298cf1..e3394b200 100644 --- a/.github/workflows/analyzers.yml +++ b/.github/workflows/analyzers.yml @@ -7,6 +7,8 @@ on: types: - completed +env: + CACHE_INDEX: '2' jobs: pvs: @@ -25,10 +27,9 @@ jobs: repository: ${{ github.event.workflow_run.head_repository.full_name }} ref: ${{ github.event.workflow_run.head_branch }} - - name: Install Qt - uses: jurplel/install-qt-action@v4 + - uses: actions/setup-python@v5 with: - cache: true + python-version: '3.6.x - 3.11.x' - name: get conan uses: turtlebrowser/get-conan@main @@ -39,8 +40,7 @@ jobs: path: | ~/.conan2 /Users/runner/.conan2/ - key: deps-ci-ubuntu-clang-Release-${{ hashFiles('**/conanfile.py') }}-${{ hashFiles('**/CMakePresets.json') }} - restore-keys: deps-ci-ubuntu-clang-Release + key: deps-ci-ubuntu-clang-Release-${{ hashFiles('**/conanfile.py') }}-${{ hashFiles('**/CMakePresets.json') }}-${{env.CACHE_INDEX}} - name: conan detect profile run: | @@ -98,10 +98,9 @@ jobs: - name: Install llvm run: sudo apt-get update -q && sudo apt-get install llvm -q -y - - name: Install Qt - uses: jurplel/install-qt-action@v4 + - uses: actions/setup-python@v5 with: - cache: true + python-version: '3.6.x - 3.11.x' - name: get conan uses: turtlebrowser/get-conan@main @@ -112,8 +111,7 @@ jobs: path: | ~/.conan2 /Users/runner/.conan2/ - key: deps-ci-ubuntu-clang-Release-${{ hashFiles('**/conanfile.py') }}-${{ hashFiles('**/CMakePresets.json') }} - restore-keys: deps-ci-ubuntu-clang-Release + key: deps-ci-ubuntu-clang-Release-${{ hashFiles('**/conanfile.py') }}-${{ hashFiles('**/CMakePresets.json') }}-${{env.CACHE_INDEX}} - name: conan detect profile run: | diff --git a/.github/workflows/ci v2.yml b/.github/workflows/ci v2.yml index d952d1518..7c28b34a6 100644 --- a/.github/workflows/ci v2.yml +++ b/.github/workflows/ci v2.yml @@ -16,6 +16,8 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true +env: + CACHE_INDEX: '2' jobs: cache_deps: @@ -24,8 +26,8 @@ jobs: config: [{name: ci-ubuntu-gcc, os: ubuntu-latest}, {name: ci-ubuntu-clang, os: ubuntu-latest}, {name: ci-windows, os: windows-latest}, - {name: ci-macos, os: macos-12}] - build_type: [{config: Release}, {config: Debug}] + {name: ci-macos, os: macos-latest}] + build_type: [{config: Release}] timeout-minutes: 120 runs-on: ${{ matrix.config.os }} @@ -50,16 +52,9 @@ jobs: path: | ~/.conan2 /Users/runner/.conan2/ - key: deps-${{ matrix.config.name }}-${{ matrix.build_type.config }}-${{ hashFiles('**/conanfile.py') }}-${{ hashFiles('**/CMakePresets.json') }} - restore-keys: deps-${{ matrix.config.name }}-${{ matrix.build_type.config }} + key: deps-${{ matrix.config.name }}-${{ matrix.build_type.config }}-${{ hashFiles('**/conanfile.py') }}-${{ hashFiles('**/CMakePresets.json') }}-${{env.CACHE_INDEX}} lookup-only: true - - name: Install Qt - if: steps.check_cache.outputs.cache-hit != 'true' || github.event_name == 'schedule' - uses: jurplel/install-qt-action@v4 - with: - cache: true - - name: conan detect profile if: steps.check_cache.outputs.cache-hit != 'true' || github.event_name == 'schedule' run: | @@ -88,18 +83,9 @@ jobs: with: fetch-depth: 0 - # Work around https://github.com/actions/runner-images/issues/8659 - # - name: "Remove GCC 13 from runner image (workaround)" - # shell: bash - # run: | - # sudo apt-get update - # sudo apt-get purge -y g++-13 gcc-13 libstdc++-13-dev - # sudo apt-get install -y --allow-downgrades libstdc++-12-dev libstdc++6=12.* libgcc-s1=12.* - - - name: Install Qt - uses: jurplel/install-qt-action@v4 + - uses: actions/setup-python@v5 with: - cache: true + python-version: '3.6.x - 3.11.x' - name: get conan uses: turtlebrowser/get-conan@main @@ -110,8 +96,7 @@ jobs: path: | ~/.conan2 /Users/runner/.conan2/ - key: deps-ci-ubuntu-clang-Release-${{ hashFiles('**/conanfile.py') }}-${{ hashFiles('**/CMakePresets.json') }} - restore-keys: deps-ci-ubuntu-clang-Release + key: deps-ci-ubuntu-clang-Release-${{ hashFiles('**/conanfile.py') }}-${{ hashFiles('**/CMakePresets.json') }}-${{env.CACHE_INDEX}} - name: conan detect profile run: | @@ -137,9 +122,9 @@ jobs: config: [{name: ci-ubuntu-gcc, os: ubuntu-latest}, {name: ci-ubuntu-clang, os: ubuntu-latest}, {name: ci-windows, os: windows-latest}, - {name: ci-macos, os: macos-12}] + {name: ci-macos, os: macos-latest}] type: [tests, benchmarks] - build_type: [{config: Release, test_preset: ci-tests}, {config: Debug, test_preset: ci-tests-debug}] + build_type: [{config: Release, test_preset: ci-tests}] optimization_disabled: [{mode: 0, postfix: ""}, {mode: 1, postfix: " (Optimizations disabled)"}] timeout-minutes: 20 @@ -174,10 +159,9 @@ jobs: - name: Cmake version run: cmake --version - - name: Install Qt - uses: jurplel/install-qt-action@v4 + - uses: actions/setup-python@v5 with: - cache: true + python-version: '3.6.x - 3.11.x' - name: get conan uses: turtlebrowser/get-conan@main @@ -188,8 +172,7 @@ jobs: path: | ~/.conan2 /Users/runner/.conan2/ - key: deps-${{ matrix.config.name }}-${{ matrix.build_type.config }}-${{ hashFiles('**/conanfile.py') }}-${{ hashFiles('**/CMakePresets.json') }} - restore-keys: deps-${{ matrix.config.name }}-${{ matrix.build_type.config }} + key: deps-${{ matrix.config.name }}-${{ matrix.build_type.config }}-${{ hashFiles('**/conanfile.py') }}-${{ hashFiles('**/CMakePresets.json') }}-${{env.CACHE_INDEX}} - name: conan detect profile run: | @@ -254,11 +237,6 @@ jobs: with: fetch-depth: 0 - - name: Install Qt - uses: jurplel/install-qt-action@v4 - with: - cache: true - - name: Install project and build env: CC: gcc-10 diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake index 469278cf2..fc148d510 100644 --- a/cmake/dependencies.cmake +++ b/cmake/dependencies.cmake @@ -48,12 +48,12 @@ endif() # ==================== QT ========================== if (RPP_BUILD_QT_CODE AND (RPP_BUILD_TESTS OR RPP_BUILD_EXAMPLES)) - find_package(Qt6 COMPONENTS Widgets QUIET) + find_package(Qt6 COMPONENTS Widgets Core Gui QUIET) if (Qt6_FOUND) SET(RPP_QT_TARGET Qt6) else() message("-- RPP: Can't find Qt6, searching for Qt5...") - find_package(Qt5 REQUIRED COMPONENTS Widgets) + find_package(Qt5 REQUIRED COMPONENTS Widgets Core Gui) SET(RPP_QT_TARGET Qt5) endif() @@ -61,11 +61,11 @@ if (RPP_BUILD_QT_CODE AND (RPP_BUILD_TESTS OR RPP_BUILD_EXAMPLES)) macro(rpp_add_qt_support_to_executable TARGET) target_link_libraries(${TARGET} PRIVATE ${RPP_QT_TARGET}::Widgets) set_target_properties(${TARGET} PROPERTIES AUTOMOC TRUE) - if (WIN32) - add_custom_command (TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $ $) - add_custom_command (TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $ $) - add_custom_command (TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $ $) - endif() + # if (WIN32) + # add_custom_command (TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $ $) + # add_custom_command (TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $ $) + # add_custom_command (TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $ $) + # endif() endmacro() endif() diff --git a/cmake/variables.cmake b/cmake/variables.cmake index 297a9933d..b6fd4708a 100644 --- a/cmake/variables.cmake +++ b/cmake/variables.cmake @@ -108,6 +108,9 @@ if (RPP_DEVELOPER_MODE) if (RPP_BUILD_ASIO_CODE) set(CONAN_ARGS "${CONAN_ARGS};-o rpp/*:with_asio=True") endif() + if (RPP_BUILD_QT_CODE) + set(CONAN_ARGS "${CONAN_ARGS};-o rpp/*:with_qt=True") + endif() endif() if(RPP_ENABLE_COVERAGE) diff --git a/conanfile.py b/conanfile.py index f8fbc9a53..fa76c24fa 100644 --- a/conanfile.py +++ b/conanfile.py @@ -12,7 +12,8 @@ class RppConan(ConanFile): "with_tests" : [False, True], "with_cmake" : [False, True], "with_benchmarks" : [False, True], - "with_asio" : [False, True] + "with_asio" : [False, True], + "with_qt" : [False, True], } default_options = { "with_grpc" : False, @@ -20,7 +21,9 @@ class RppConan(ConanFile): "with_tests": False, "with_cmake": False, "with_benchmarks" : False, - "with_asio" : False + "with_asio" : False, + "with_qt" : False, + "qt/*:shared": True, } def requirements(self): @@ -44,3 +47,6 @@ def requirements(self): if self.options.with_cmake: self.tool_requires("cmake/3.29.3") + + if self.options.with_qt: + self.requires("qt/5.15.14", transitive_libs=True)