build(cmake): use mutli-config generators for debug/release presets

This prevents us from hardcoding variants for each release type. Yay!

Signed-off-by: Seth Flynn <getchoo@tuta.io>
This commit is contained in:
Seth Flynn
2025-11-04 02:23:53 -05:00
parent c5c12ae8ce
commit ffdf00876e
8 changed files with 149 additions and 880 deletions

View File

@@ -13,10 +13,6 @@ inputs:
description: Name of the uploaded artifact
required: true
default: Linux
cmake-preset:
description: Base CMake preset previously used for the build
required: true
default: linux
qt-version:
description: Version of Qt to use
required: true
@@ -62,7 +58,7 @@ runs:
GPG_PRIVATE_KEY: ${{ inputs.gpg-private-key }}
run: |
cmake --install ${{ env.BUILD_DIR }} --prefix ${{ env.INSTALL_APPIMAGE_DIR }}/usr
cmake --install ${{ env.BUILD_DIR }} --config ${{ inputs.build-type }} --prefix ${{ env.INSTALL_APPIMAGE_DIR }}/usr
mv ${{ env.INSTALL_APPIMAGE_DIR }}/usr/share/metainfo/org.prismlauncher.PrismLauncher.metainfo.xml ${{ env.INSTALL_APPIMAGE_DIR }}/usr/share/metainfo/org.prismlauncher.PrismLauncher.appdata.xml
export "NO_APPSTREAM=1" # we have to skip appstream checking because appstream on ubuntu 20.04 is outdated
@@ -107,12 +103,10 @@ runs:
env:
BUILD_DIR: build
CMAKE_PRESET: ${{ inputs.cmake-preset }}
INSTALL_PORTABLE_DIR: install-portable
run: |
cmake --install ${{ env.BUILD_DIR }} --prefix ${{ env.INSTALL_PORTABLE_DIR }}
cmake --install ${{ env.BUILD_DIR }} --prefix ${{ env.INSTALL_PORTABLE_DIR }} --component portable
cmake --install ${{ env.BUILD_DIR }} --config ${{ inputs.build-type }} --prefix ${{ env.INSTALL_PORTABLE_DIR }}
cmake --install ${{ env.BUILD_DIR }} --config ${{ inputs.build-type }} --prefix ${{ env.INSTALL_PORTABLE_DIR }} --component portable
for l in $(find ${{ env.INSTALL_PORTABLE_DIR }} -type f); do l=${l#$(pwd)/}; l=${l#${{ env.INSTALL_PORTABLE_DIR }}/}; l=${l#./}; echo $l; done > ${{ env.INSTALL_PORTABLE_DIR }}/manifest.txt
cd ${{ env.INSTALL_PORTABLE_DIR }}

View File

@@ -79,7 +79,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!!!
#
@@ -87,34 +87,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 }}
@@ -124,6 +124,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:
@@ -140,7 +145,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 }}
@@ -150,22 +155,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
@@ -184,7 +184,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