From 8981085dc36fc18c46c991cb75ca01287fc7fc24 Mon Sep 17 00:00:00 2001 From: Brendan Fletcher Date: Thu, 8 Aug 2024 22:09:41 -0400 Subject: [PATCH] Use Ninja Multi-Config for cmake presets, add release-only option for CI --- .github/workflows/build.windows.workflow.yml | 11 +- gui/qt/CMakeLists.txt | 12 + gui/qt/CMakePresets.json | 271 ++++++++++--------- 3 files changed, 164 insertions(+), 130 deletions(-) diff --git a/.github/workflows/build.windows.workflow.yml b/.github/workflows/build.windows.workflow.yml index 0a8fb4672..73e61fbfe 100644 --- a/.github/workflows/build.windows.workflow.yml +++ b/.github/workflows/build.windows.workflow.yml @@ -52,8 +52,9 @@ jobs: uses: lukka/run-cmake@4b1adc1944be8367be9f4e08303ce49918db8e3c # latest as of 2024-08-08 with: cmakeListsTxtPath: '${{ github.workspace }}/gui/qt/CMakeLists.txt' - configurePreset: '${{ matrix.arch }}-${{ matrix.config }}-${{ matrix.qtver }}' - buildPreset: '${{ matrix.arch }}-${{ matrix.config }}-${{ matrix.qtver }}' + configurePreset: 'Win-${{ matrix.arch }}-${{ matrix.qtver }}' + configureAdditionalArgs: "['-DDEPS_RELEASE_ONLY=ON']" + buildPreset: 'Win-${{ matrix.arch }}-${{ matrix.qtver }}-${{ matrix.config }}' env: VCPKG_DEFAULT_TRIPLET: ${{ matrix.arch }}-windows VCPKG_DEFAULT_HOST_TRIPLET: x64-windows-static-release @@ -63,13 +64,13 @@ jobs: uses: actions/upload-artifact@v3 with: name: CEmu_win${{ matrix.arch_suffix }}_${{ matrix.qtver }}_master - path: ${{ github.workspace }}/gui/qt/CEmu.build/${{ matrix.arch }}-${{ matrix.config }}-${{ matrix.qtver }}/CEmu.exe + path: ${{ github.workspace }}/gui/qt/CEmu.build/${{ matrix.arch }}-${{ matrix.qtver }}/${{ matrix.config }}/CEmu.exe - name: Prepare binary for release upload if: ${{ matrix.config == 'Release' }} run: | $ReleaseName = "CEmu-nightly_win${{ matrix.arch_suffix }}-msvc_${{ matrix.qtver }}.exe".Replace("Qt", "qt") - Rename-Item -Path "${{ github.workspace }}/gui/qt/CEmu.build/${{ matrix.arch }}-${{ matrix.config }}-${{ matrix.qtver }}/CEmu.exe" -NewName $ReleaseName + Rename-Item -Path "${{ github.workspace }}/gui/qt/CEmu.build/${{ matrix.arch }}-${{ matrix.qtver }}/${{ matrix.config }}/CEmu.exe" -NewName $ReleaseName echo "RELEASE_NAME=$ReleaseName" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - name: Update nightly release @@ -80,4 +81,4 @@ jobs: prerelease: true token: ${{secrets.GITHUB_TOKEN}} files: | - ./gui/qt/CEmu.build/${{ matrix.arch }}-${{ matrix.config }}-${{ matrix.qtver }}/${{ env.RELEASE_NAME }} + ./gui/qt/CEmu.build/${{ matrix.arch }}-${{ matrix.qtver }}/${{ matrix.config }}/${{ env.RELEASE_NAME }} diff --git a/gui/qt/CMakeLists.txt b/gui/qt/CMakeLists.txt index 24c4ad783..e34e9b6e4 100644 --- a/gui/qt/CMakeLists.txt +++ b/gui/qt/CMakeLists.txt @@ -8,6 +8,18 @@ else() list(APPEND VCPKG_MANIFEST_FEATURES "qt6") endif() +option(DEPS_RELEASE_ONLY "Build only release versions of vcpkg dependencies" OFF) + +if(DEPS_RELEASE_ONLY) + if(NOT DEFINED VCPKG_TARGET_TRIPLET) + message(FATAL_ERROR "Must provide a VCPKG_TARGET_TRIPLET to set as release only") + endif() + if(NOT VCPKG_TARGET_TRIPLET MATCHES "-release$") + set(VCPKG_TARGET_TRIPLET "${VCPKG_TARGET_TRIPLET}-release") + message("Updated VCPKG_TARGET_TRIPLET to ${VCPKG_TARGET_TRIPLET}") + endif() +endif() + project(CEmu VERSION 2.0 LANGUAGES C CXX) diff --git a/gui/qt/CMakePresets.json b/gui/qt/CMakePresets.json index d0173da1a..f5734fb44 100644 --- a/gui/qt/CMakePresets.json +++ b/gui/qt/CMakePresets.json @@ -9,7 +9,7 @@ { "name": "ninja-vcpkg", "hidden": true, - "generator": "Ninja", + "generator": "Ninja Multi-Config", "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", "binaryDir": "${sourceDir}/CEmu.build/${presetName}", "installDir": "${sourceDir}/CEmu.build/${presetName}", @@ -21,6 +21,10 @@ "VCPKG_MANIFEST_INSTALL": { "type": "BOOL", "value": "True" + }, + "TRY_STATIC_LIBS": { + "type": "BOOL", + "value": "ON" } } }, @@ -31,16 +35,6 @@ "architecture": { "strategy": "external", "value": "x64" - }, - "cacheVariables": { - "TRY_STATIC_LIBS": { - "type": "BOOL", - "value": "ON" - }, - "VCPKG_TARGET_TRIPLET": { - "type": "STRING", - "value": "x64-windows-static" - } } }, { @@ -50,31 +44,20 @@ "architecture": { "strategy": "external", "value": "x86" - }, - "cacheVariables": { - "TRY_STATIC_LIBS": { - "type": "BOOL", - "value": "ON" - }, - "VCPKG_TARGET_TRIPLET": { - "type": "STRING", - "value": "x86-windows-static" - } } }, { - "name": "x64-Debug-Qt6", - "inherits": "ninja-vcpkg-x64", - "cacheVariables": { - "CMAKE_BUILD_TYPE": { - "type": "STRING", - "value": "Debug" - } + "name": "ninja-vcpkg-arm64", + "hidden": true, + "inherits": "ninja-vcpkg", + "architecture": { + "strategy": "external", + "value": "arm64" } }, { - "name": "x64-Debug-Qt5", - "inherits": "x64-Debug-Qt6", + "name": "Qt5", + "hidden": true, "cacheVariables": { "USE_QT5": { "type": "BOOL", @@ -83,162 +66,200 @@ } }, { - "name": "x64-RelWithDebInfo-Qt6", - "inherits": "ninja-vcpkg-x64", - "cacheVariables": { - "CMAKE_BUILD_TYPE": { - "type": "STRING", - "value": "RelWithDebInfo" - } + "name": "win-only", + "hidden": true, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" } }, { - "name": "x64-RelWithDebInfo-Qt5", - "inherits": "x64-RelWithDebInfo-Qt6", - "cacheVariables": { - "USE_QT5": { - "type": "BOOL", - "value": "ON" - } + "name": "mac-only", + "hidden": true, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" } }, { - "name": "x64-Release-Qt6", - "inherits": "ninja-vcpkg-x64", + "name": "Win-x64-Qt6", + "inherits": [ "ninja-vcpkg-x64", "win-only" ], "cacheVariables": { - "CMAKE_BUILD_TYPE": { - "type": "STRING", - "value": "Release" - }, - "VCPKG_HOST_TRIPLET": { - "type": "STRING", - "value": "x64-windows-static-release" - }, "VCPKG_TARGET_TRIPLET": { "type": "STRING", - "value": "x64-windows-static-release" + "value": "x64-windows-static" } } }, { - "name": "x64-Release-Qt5", - "inherits": "x64-Release-Qt6", + "name": "Win-x86-Qt6", + "inherits": [ "ninja-vcpkg-x86", "win-only" ], "cacheVariables": { - "USE_QT5": { - "type": "BOOL", - "value": "ON" + "VCPKG_TARGET_TRIPLET": { + "type": "STRING", + "value": "x86-windows-static" } } }, { - "name": "x86-Debug-Qt6", - "inherits": "ninja-vcpkg-x86", + "name": "Mac-x64-Qt6", + "inherits": [ "ninja-vcpkg-x64", "mac-only" ], "cacheVariables": { - "CMAKE_BUILD_TYPE": { + "VCPKG_TARGET_TRIPLET": { "type": "STRING", - "value": "Debug" + "value": "x64-osx" } } }, { - "name": "x86-Debug-Qt5", - "inherits": "x86-Debug-Qt6", + "name": "Mac-arm64-Qt6", + "inherits": [ "ninja-vcpkg-arm64", "mac-only" ], "cacheVariables": { - "USE_QT5": { - "type": "BOOL", - "value": "ON" + "VCPKG_TARGET_TRIPLET": { + "type": "STRING", + "value": "arm64-osx" } } }, { - "name": "x86-RelWithDebInfo-Qt6", - "inherits": "ninja-vcpkg-x86", - "cacheVariables": { - "CMAKE_BUILD_TYPE": { - "type": "STRING", - "value": "RelWithDebInfo" - } - } + "name": "Win-x64-Qt5", + "inherits": [ "Win-x64-Qt6", "Qt5" ] }, { - "name": "x86-RelWithDebInfo-Qt5", - "inherits": "x86-RelWithDebInfo-Qt6", - "cacheVariables": { - "USE_QT5": { - "type": "BOOL", - "value": "ON" - } - } + "name": "Win-x86-Qt5", + "inherits": [ "Win-x86-Qt6", "Qt5" ] }, { - "name": "x86-Release-Qt6", - "inherits": "ninja-vcpkg-x86", - "cacheVariables": { - "CMAKE_BUILD_TYPE": { - "type": "STRING", - "value": "Release" - } - } + "name": "Mac-x64-Qt5", + "inherits": [ "Mac-x64-Qt6", "Qt5" ] }, { - "name": "x86-Release-Qt5", - "inherits": "x86-Release-Qt6", - "cacheVariables": { - "USE_QT5": { - "type": "BOOL", - "value": "ON" - } - } + "name": "Mac-arm64-Qt5", + "inherits": [ "Mac-arm64-Qt6", "Qt5" ] } ], "buildPresets": [ { - "name": "x64-Debug-Qt6", - "configurePreset": "x64-Debug-Qt6" + "name": "Win-x64-Qt6-Debug", + "configurePreset": "Win-x64-Qt6", + "configuration": "Debug" + }, + { + "name": "Win-x64-Qt6-RelWithDebInfo", + "configurePreset": "Win-x64-Qt6", + "configuration": "RelWithDebInfo" + }, + { + "name": "Win-x64-Qt6-Release", + "configurePreset": "Win-x64-Qt6", + "configuration": "Release" + }, + { + "name": "Win-x64-Qt5-Debug", + "configurePreset": "Win-x64-Qt5", + "configuration": "Debug" + }, + { + "name": "Win-x64-Qt5-RelWithDebInfo", + "configurePreset": "Win-x64-Qt5", + "configuration": "RelWithDebInfo" + }, + { + "name": "Win-x64-Qt5-Release", + "configurePreset": "Win-x64-Qt5", + "configuration": "Release" + }, + { + "name": "Win-x86-Qt6-Debug", + "configurePreset": "Win-x86-Qt6", + "configuration": "Debug" + }, + { + "name": "Win-x86-Qt6-RelWithDebInfo", + "configurePreset": "Win-x86-Qt6", + "configuration": "RelWithDebInfo" + }, + { + "name": "Win-x86-Qt6-Release", + "configurePreset": "Win-x86-Qt6", + "configuration": "Release" + }, + { + "name": "Win-x86-Qt5-Debug", + "configurePreset": "Win-x86-Qt5", + "configuration": "Debug" + }, + { + "name": "Win-x86-Qt5-RelWithDebInfo", + "configurePreset": "Win-x86-Qt5", + "configuration": "RelWithDebInfo" + }, + { + "name": "Win-x86-Qt5-Release", + "configurePreset": "Win-x86-Qt5", + "configuration": "Release" + }, + { + "name": "Mac-x64-Qt6-Debug", + "configurePreset": "Mac-x64-Qt6", + "configuration": "Debug" }, { - "name": "x64-Debug-Qt5", - "configurePreset": "x64-Debug-Qt5" + "name": "Mac-x64-Qt6-RelWithDebInfo", + "configurePreset": "Mac-x64-Qt6", + "configuration": "RelWithDebInfo" }, { - "name": "x64-RelWithDebInfo-Qt6", - "configurePreset": "x64-RelWithDebInfo-Qt6" + "name": "Mac-x64-Qt6-Release", + "configurePreset": "Mac-x64-Qt6", + "configuration": "Release" }, { - "name": "x64-RelWithDebInfo-Qt5", - "configurePreset": "x64-RelWithDebInfo-Qt5" + "name": "Mac-x64-Qt5-Debug", + "configurePreset": "Mac-x64-Qt5", + "configuration": "Debug" }, { - "name": "x64-Release-Qt6", - "configurePreset": "x64-Release-Qt6" + "name": "Mac-x64-Qt5-RelWithDebInfo", + "configurePreset": "Mac-x64-Qt5", + "configuration": "RelWithDebInfo" }, { - "name": "x64-Release-Qt5", - "configurePreset": "x64-Release-Qt5" + "name": "Mac-x64-Qt5-Release", + "configurePreset": "Mac-x64-Qt5", + "configuration": "Release" }, { - "name": "x86-Debug-Qt6", - "configurePreset": "x86-Debug-Qt6" + "name": "Mac-arm64-Qt6-Debug", + "configurePreset": "Mac-arm64-Qt6", + "configuration": "Debug" }, { - "name": "x86-Debug-Qt5", - "configurePreset": "x86-Debug-Qt5" + "name": "Mac-arm64-Qt6-RelWithDebInfo", + "configurePreset": "Mac-arm64-Qt6", + "configuration": "RelWithDebInfo" }, { - "name": "x86-RelWithDebInfo-Qt6", - "configurePreset": "x86-RelWithDebInfo-Qt6" + "name": "Mac-arm64-Qt6-Release", + "configurePreset": "Mac-arm64-Qt6", + "configuration": "Release" }, { - "name": "x86-RelWithDebInfo-Qt5", - "configurePreset": "x86-RelWithDebInfo-Qt5" + "name": "Mac-arm64-Qt5-Debug", + "configurePreset": "Mac-arm64-Qt5", + "configuration": "Debug" }, { - "name": "x86-Release-Qt6", - "configurePreset": "x86-Release-Qt6" + "name": "Mac-arm64-Qt5-RelWithDebInfo", + "configurePreset": "Mac-arm64-Qt5", + "configuration": "RelWithDebInfo" }, { - "name": "x86-Release-Qt5", - "configurePreset": "x86-Release-Qt5" + "name": "Mac-arm64-Qt5-Release", + "configurePreset": "Mac-arm64-Qt5", + "configuration": "Release" } ] } \ No newline at end of file