Use multi-config generator for CMake presets (#4301)

This commit is contained in:
Alexandru Ionut Tripon
2025-11-13 20:21:40 +02:00
committed by GitHub
10 changed files with 232 additions and 1023 deletions

View File

@@ -81,7 +81,7 @@ jobs:
include:
- os: ubuntu-22.04
artifact-name: Linux
base-cmake-preset: linux
cmake-preset: linux
# NOTE(@getchoo): Yes, we're intentionally using 24.04 here!!!
#
@@ -89,34 +89,34 @@ jobs:
# *for the same version* are compiled against 24.04 on ARM, and *not* 22.04 like x64
- os: ubuntu-24.04-arm
artifact-name: Linux-aarch64
base-cmake-preset: linux
cmake-preset: linux
- os: windows-2022
artifact-name: Windows-MinGW-w64
base-cmake-preset: windows_mingw
cmake-preset: windows_mingw
msystem: CLANG64
vcvars-arch: amd64_x86
- os: windows-11-arm
artifact-name: Windows-MinGW-arm64
base-cmake-preset: windows_mingw
cmake-preset: windows_mingw
msystem: CLANGARM64
vcvars-arch: arm64
- os: windows-2022
artifact-name: Windows-MSVC
base-cmake-preset: windows_msvc
cmake-preset: windows_msvc
# TODO(@getchoo): This is the default in setup-dependencies/windows. Why isn't it working?!?!
vcvars-arch: amd64
- os: windows-11-arm
artifact-name: Windows-MSVC-arm64
base-cmake-preset: windows_msvc
cmake-preset: windows_msvc
vcvars-arch: arm64
- os: macos-14
artifact-name: macOS
base-cmake-preset: ${{ (inputs.build-type || 'Debug') == 'Debug' && 'macos_universal' || 'macos' }}
cmake-preset: macos_universal
macosx-deployment-target: 12.0
runs-on: ${{ matrix.os }}
@@ -126,6 +126,11 @@ jobs:
shell: ${{ matrix.msystem != '' && 'msys2 {0}' || 'bash' }}
env:
ARTIFACT_NAME: ${{ matrix.artifact-name }}-Qt6
BUILD_PLATFORM: official
BUILD_TYPE: ${{ inputs.build-type || 'Debug' }}
CMAKE_PRESET: ${{ matrix.cmake-preset }}
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macosx-deployment-target }}
steps:
@@ -142,7 +147,7 @@ jobs:
id: setup-dependencies
uses: ./.github/actions/setup-dependencies
with:
build-type: ${{ inputs.build-type || 'Debug' }}
build-type: ${{ env.BUILD_TYPE }}
artifact-name: ${{ matrix.artifact-name }}
msystem: ${{ matrix.msystem }}
vcvars-arch: ${{ matrix.vcvars-arch }}
@@ -152,22 +157,17 @@ jobs:
# BUILD
##
- name: Get CMake preset
id: cmake-preset
env:
BASE_CMAKE_PRESET: ${{ matrix.base-cmake-preset }}
PRESET_TYPE: ${{ (inputs.build-type || 'Debug') == 'Debug' && 'debug' || 'ci' }}
- name: Configure project
run: |
echo preset="$BASE_CMAKE_PRESET"_"$PRESET_TYPE" >> "$GITHUB_OUTPUT"
cmake --preset "$CMAKE_PRESET"
- name: Run CMake workflow
env:
CMAKE_PRESET: ${{ steps.cmake-preset.outputs.preset }}
ARTIFACT_NAME: ${{ matrix.artifact-name }}-Qt6
BUILD_PLATFORM: official
- name: Run build
run: |
cmake --workflow --preset "$CMAKE_PRESET"
cmake --build --preset "$CMAKE_PRESET" --config "$BUILD_TYPE"
- name: Run tests
run: |
ctest --preset "$CMAKE_PRESET" --build-config "$BUILD_TYPE"
##
# PACKAGE
@@ -186,7 +186,6 @@ jobs:
version: ${{ steps.short-version.outputs.version }}
build-type: ${{ steps.setup-dependencies.outputs.build-type }}
artifact-name: ${{ matrix.artifact-name }}
cmake-preset: ${{ steps.cmake-preset.outputs.preset }}
qt-version: ${{ steps.setup-dependencies.outputs.qt-version }}
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}

View File

@@ -78,8 +78,8 @@ jobs:
- name: Configure and Build
run: |
cmake --preset linux_debug
cmake --build --preset linux_debug
cmake --preset linux
cmake --build --preset linux --config Debug
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4