Skip to content

Commit 2689989

Browse files
Updated windows-cmake.yml
1 parent 716d6f7 commit 2689989

File tree

1 file changed

+72
-32
lines changed

1 file changed

+72
-32
lines changed
Lines changed: 72 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,114 @@
11
name: windows-builds
22

3-
# Trigger this workflow on any push or manual dispatch
3+
# Trigger on push to any branch and manual runs
44
on:
55
push:
6-
branches:
7-
- ci-dev
86
workflow_dispatch:
97

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

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

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

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

3937
- name: 🛠️ Configure CMake (Ninja + MSVC)
40-
# Use windows-msvc shell that auto-sets MSVC environment variables
41-
shell: windows-msvc
38+
shell: pwsh
4239
run: |
43-
cmake -S . -B build ^
44-
-G Ninja ^
45-
-A x64 ^
46-
-DCMAKE_PREFIX_PATH="${{ env.QT_DIR }}\Qt\${{ env.QT_VERSION }}\msvc2019_64" ^
47-
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}\install" ^
40+
# Initialize MSVC environment variables for 64-bit architecture
41+
& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" amd64
42+
43+
# Run cmake with Ninja generator and MSVC toolchain
44+
cmake -S . -B build -G Ninja -A x64 `
45+
-DCMAKE_PREFIX_PATH="${{ env.QT_DIR }}\Qt\${{ env.QT_VERSION }}\msvc2019_64" `
46+
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}\install" `
4847
-DCMAKE_BUILD_TYPE=Release
4948
5049
- name: 🔨 Build with Ninja + MSVC
51-
shell: windows-msvc
52-
run: cmake --build build # Build the project
50+
shell: pwsh
51+
run: |
52+
# Initialize MSVC environment again for build step
53+
& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" amd64
54+
55+
cmake --build build
5356
5457
- name: 📦 Install built files
55-
shell: windows-msvc
56-
run: cmake --install build # Install the build output
58+
shell: pwsh
59+
run: |
60+
# Initialize MSVC environment again for install step
61+
& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" amd64
62+
63+
cmake --install build
5764
5865
build_windows_mingw:
59-
name: Build with MinGW + Ninja
66+
name: Build with MinGW and CMake
6067
runs-on: windows-2022
6168

6269
env:
6370
QT_VERSION: 6.4.2
64-
QT_DIR: ${{ github.workspace }}\Qt # Directory where Qt will be installed
71+
QT_DIR: ${{ github.workspace }}\Qt
6572

6673
steps:
6774
- name: 📦 Checkout source code
6875
uses: actions/checkout@v4
6976
with:
70-
fetch-depth: 0 # Full history for tags/versions if needed
77+
fetch-depth: 0
7178

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

0 commit comments

Comments
 (0)