Skip to content

Commit ceb7c91

Browse files
Updated workflow file to fix wrong CMake detection of MSVC
1 parent 0a78dcf commit ceb7c91

File tree

1 file changed

+33
-66
lines changed

1 file changed

+33
-66
lines changed

.github/workflows/windows-cmake.yml

Lines changed: 33 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,72 @@
11
name: windows-builds
22

3-
# Trigger on:
4-
# - Manual runs via GitHub UI (workflow_dispatch)
5-
# - Pushes that touch build-relevant files
3+
# Trigger this workflow on any push or manual dispatch
64
on:
75
push:
86
workflow_dispatch:
97

108
jobs:
11-
build_windows_msvc:
12-
name: Build with MSVC and CMake
9+
build_windows_msvc_ninja:
10+
name: Build with MSVC + Ninja
1311
runs-on: windows-2022
1412

1513
env:
1614
QT_VERSION: 6.4.2
17-
QT_DIR: ${{ github.workspace }}\Qt
15+
QT_DIR: ${{ github.workspace }}\Qt # Directory where Qt will be installed
1816

1917
steps:
2018
- name: 📦 Checkout source code
2119
uses: actions/checkout@v4
2220
with:
23-
fetch-depth: 0 # Full history for tags/versions if needed
24-
25-
- name: ⚙️ Install Ninja build system
26-
run: choco install ninja --no-progress
27-
shell: powershell
21+
fetch-depth: 0 # Fetch full git history and tags
2822

2923
- name: 📥 Install Qt for MSVC
3024
uses: jurplel/install-qt-action@v3
3125
with:
32-
version: ${{ env.QT_VERSION }}
33-
target: desktop
34-
host: windows
35-
arch: win64_msvc2019_64
36-
dir: ${{ env.QT_DIR }}
37-
setup-python: false
26+
version: ${{ env.QT_VERSION }} # Qt version to install
27+
target: desktop # Desktop Qt build
28+
host: windows # Host OS
29+
arch: win64_msvc2019_64 # MSVC 2019 64-bit architecture
30+
dir: ${{ env.QT_DIR }} # Install path for Qt
31+
setup-python: false # Skip Python setup (optional)
32+
33+
- name: ⚙️ Install Ninja build system
34+
run: choco install ninja --no-progress # Install Ninja via Chocolatey
35+
shell: powershell
3836

39-
- name: 🛠️ Configure CMake (MSVC)
37+
- name: 🛠️ Configure CMake (Ninja + MSVC)
38+
# Use windows-msvc shell that auto-sets MSVC environment variables
39+
shell: windows-msvc
4040
run: |
4141
cmake -S . -B build `
42-
-DCMAKE_PREFIX_PATH="${{ env.QT_DIR }}\Qt\${{ env.QT_VERSION }}\msvc2019_64" `
43-
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}\install `
44-
-DCMAKE_BUILD_TYPE=Release `
45-
-G Ninja
46-
shell: powershell
42+
-G Ninja ` # Use Ninja generator
43+
-A x64 ` # Target 64-bit architecture
44+
-DCMAKE_PREFIX_PATH="${{ env.QT_DIR }}\Qt\${{ env.QT_VERSION }}\msvc2019_64" ` # Qt install path for CMake
45+
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}\install" ` # Install path
46+
-DCMAKE_BUILD_TYPE=Release # Release build type
4747
48-
- name: 🔨 Build with CMake (MSVC)
49-
run: cmake --build build
50-
shell: powershell
48+
- name: 🔨 Build with Ninja + MSVC
49+
shell: windows-msvc
50+
run: cmake --build build # Build the project
5151

52-
- name: 📦 Install built files (MSVC)
53-
run: cmake --install build
54-
shell: powershell
52+
- name: 📦 Install built files
53+
shell: windows-msvc
54+
run: cmake --install build # Install the build output
5555

5656
build_windows_mingw:
57-
name: Build with MinGW and CMake
57+
name: Build with MinGW + Ninja
5858
runs-on: windows-2022
5959

6060
env:
6161
QT_VERSION: 6.4.2
62-
QT_DIR: ${{ github.workspace }}\Qt
62+
QT_DIR: ${{ github.workspace }}\Qt # Directory where Qt will be installed
6363

6464
steps:
6565
- name: 📦 Checkout source code
6666
uses: actions/checkout@v4
6767
with:
68-
fetch-depth: 0
68+
fetch-depth: 0 # Full history for tags/versions if needed
6969

7070
- name: ⚙️ Install Ninja and MinGW toolchain
7171
run: |
72-
choco install ninja --no-progress
73-
choco install mingw --no-progress
74-
shell: powershell
75-
76-
- name: ➕ Add MinGW to system PATH
77-
run: echo "C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin" >> $env:GITHUB_PATH
78-
shell: powershell
79-
80-
- name: 📥 Install Qt for MinGW
81-
uses: jurplel/install-qt-action@v3
82-
with:
83-
version: ${{ env.QT_VERSION }}
84-
target: desktop
85-
host: windows
86-
arch: mingw_64
87-
dir: ${{ env.QT_DIR }}
88-
setup-python: false
89-
90-
- name: 🛠️ Configure CMake (MinGW)
91-
run: |
92-
cmake -S . -B build-mingw `
93-
-DCMAKE_PREFIX_PATH="${{ env.QT_DIR }}\Qt\${{ env.QT_VERSION }}\mingw_64" `
94-
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}\install `
95-
-DCMAKE_BUILD_TYPE=Release `
96-
-G Ninja
97-
shell: powershell
98-
99-
- name: 🔨 Build with CMake (MinGW)
100-
run: cmake --build build-mingw
101-
shell: powershell
102-
103-
- name: 📦 Install built files (MinGW)
104-
run: cmake --install build-mingw
105-
shell: powershell
72+
choco inst

0 commit comments

Comments
 (0)