Updated workflow file to fix wrong CMake detection of MSVC

This commit is contained in:
Uwe Kindler
2025-06-01 11:06:38 +02:00
parent 0a78dcf460
commit ceb7c91844

View File

@@ -1,20 +1,65 @@
name: windows-builds
# Trigger on:
# - Manual runs via GitHub UI (workflow_dispatch)
# - Pushes that touch build-relevant files
# Trigger this workflow on any push or manual dispatch
on:
push:
workflow_dispatch:
jobs:
build_windows_msvc:
name: Build with MSVC and CMake
build_windows_msvc_ninja:
name: Build with MSVC + Ninja
runs-on: windows-2022
env:
QT_VERSION: 6.4.2
QT_DIR: ${{ github.workspace }}\Qt
QT_DIR: ${{ github.workspace }}\Qt # Directory where Qt will be installed
steps:
- name: 📦 Checkout source code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch full git history and tags
- name: 📥 Install Qt for MSVC
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT_VERSION }} # Qt version to install
target: desktop # Desktop Qt build
host: windows # Host OS
arch: win64_msvc2019_64 # MSVC 2019 64-bit architecture
dir: ${{ env.QT_DIR }} # Install path for Qt
setup-python: false # Skip Python setup (optional)
- name: ⚙️ Install Ninja build system
run: choco install ninja --no-progress # Install Ninja via Chocolatey
shell: powershell
- name: 🛠️ Configure CMake (Ninja + MSVC)
# Use windows-msvc shell that auto-sets MSVC environment variables
shell: windows-msvc
run: |
cmake -S . -B build `
-G Ninja ` # Use Ninja generator
-A x64 ` # Target 64-bit architecture
-DCMAKE_PREFIX_PATH="${{ env.QT_DIR }}\Qt\${{ env.QT_VERSION }}\msvc2019_64" ` # Qt install path for CMake
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}\install" ` # Install path
-DCMAKE_BUILD_TYPE=Release # Release build type
- name: 🔨 Build with Ninja + MSVC
shell: windows-msvc
run: cmake --build build # Build the project
- name: 📦 Install built files
shell: windows-msvc
run: cmake --install build # Install the build output
build_windows_mingw:
name: Build with MinGW + Ninja
runs-on: windows-2022
env:
QT_VERSION: 6.4.2
QT_DIR: ${{ github.workspace }}\Qt # Directory where Qt will be installed
steps:
- name: 📦 Checkout source code
@@ -22,84 +67,6 @@ jobs:
with:
fetch-depth: 0 # Full history for tags/versions if needed
- name: ⚙️ Install Ninja build system
run: choco install ninja --no-progress
shell: powershell
- name: 📥 Install Qt for MSVC
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT_VERSION }}
target: desktop
host: windows
arch: win64_msvc2019_64
dir: ${{ env.QT_DIR }}
setup-python: false
- name: 🛠️ Configure CMake (MSVC)
run: |
cmake -S . -B build `
-DCMAKE_PREFIX_PATH="${{ env.QT_DIR }}\Qt\${{ env.QT_VERSION }}\msvc2019_64" `
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}\install `
-DCMAKE_BUILD_TYPE=Release `
-G Ninja
shell: powershell
- name: 🔨 Build with CMake (MSVC)
run: cmake --build build
shell: powershell
- name: 📦 Install built files (MSVC)
run: cmake --install build
shell: powershell
build_windows_mingw:
name: Build with MinGW and CMake
runs-on: windows-2022
env:
QT_VERSION: 6.4.2
QT_DIR: ${{ github.workspace }}\Qt
steps:
- name: 📦 Checkout source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: ⚙️ Install Ninja and MinGW toolchain
run: |
choco install ninja --no-progress
choco install mingw --no-progress
shell: powershell
- name: Add MinGW to system PATH
run: echo "C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin" >> $env:GITHUB_PATH
shell: powershell
- name: 📥 Install Qt for MinGW
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT_VERSION }}
target: desktop
host: windows
arch: mingw_64
dir: ${{ env.QT_DIR }}
setup-python: false
- name: 🛠️ Configure CMake (MinGW)
run: |
cmake -S . -B build-mingw `
-DCMAKE_PREFIX_PATH="${{ env.QT_DIR }}\Qt\${{ env.QT_VERSION }}\mingw_64" `
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}\install `
-DCMAKE_BUILD_TYPE=Release `
-G Ninja
shell: powershell
- name: 🔨 Build with CMake (MinGW)
run: cmake --build build-mingw
shell: powershell
- name: 📦 Install built files (MinGW)
run: cmake --install build-mingw
shell: powershell
choco inst