Skip to content

Commit 0a78dcf

Browse files
Add workflow to build with CMake and MSVC / MinGW on Windows
1 parent da7d23c commit 0a78dcf

File tree

1 file changed

+105
-0
lines changed

1 file changed

+105
-0
lines changed

.github/workflows/windows-cmake.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: windows-builds
2+
3+
# Trigger on:
4+
# - Manual runs via GitHub UI (workflow_dispatch)
5+
# - Pushes that touch build-relevant files
6+
on:
7+
push:
8+
workflow_dispatch:
9+
10+
jobs:
11+
build_windows_msvc:
12+
name: Build with MSVC and CMake
13+
runs-on: windows-2022
14+
15+
env:
16+
QT_VERSION: 6.4.2
17+
QT_DIR: ${{ github.workspace }}\Qt
18+
19+
steps:
20+
- name: 📦 Checkout source code
21+
uses: actions/checkout@v4
22+
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
28+
29+
- name: 📥 Install Qt for MSVC
30+
uses: jurplel/install-qt-action@v3
31+
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
38+
39+
- name: 🛠️ Configure CMake (MSVC)
40+
run: |
41+
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
47+
48+
- name: 🔨 Build with CMake (MSVC)
49+
run: cmake --build build
50+
shell: powershell
51+
52+
- name: 📦 Install built files (MSVC)
53+
run: cmake --install build
54+
shell: powershell
55+
56+
build_windows_mingw:
57+
name: Build with MinGW and CMake
58+
runs-on: windows-2022
59+
60+
env:
61+
QT_VERSION: 6.4.2
62+
QT_DIR: ${{ github.workspace }}\Qt
63+
64+
steps:
65+
- name: 📦 Checkout source code
66+
uses: actions/checkout@v4
67+
with:
68+
fetch-depth: 0
69+
70+
- name: ⚙️ Install Ninja and MinGW toolchain
71+
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

0 commit comments

Comments
 (0)