Fix Windows CI: use msvc-dev-cmd + Ninja instead of hardcoded VS2022

windows-latest now resolves to the windows-2025-vs2026 image, which no
longer ships Visual Studio 2022: the 'Visual Studio 17 2022' CMake
generator and the hardcoded vcvars64.bat path both fail. Use
ilammy/msvc-dev-cmd (vswhere-based, version agnostic) to set up cl.exe
and the Ninja generator for the CMake jobs.
This commit is contained in:
Syoyo Fujita
2026-07-31 22:09:06 +09:00
parent 6257f5024d
commit 9b56d2f600
2 changed files with 19 additions and 20 deletions
+7 -10
View File
@@ -22,27 +22,24 @@ jobs:
cd tests
x86_64-w64-mingw32-gcc -I../ -std=c11 -DTINYGLTF3_ENABLE_FS -o tester_v3_c.exe tester_v3_c.c ../tiny_gltf_v3.c
# Windows(x64) + Visual Studio 2022 build
# Windows(x64) + MSVC build (VS version agnostic: msvc-dev-cmd locates
# whatever Visual Studio the runner image ships, e.g. VS2022 or VS2026)
build-windows-msvc:
runs-on: windows-latest
name: Build v3 C tests on Windows(x64, MSVC)
# Use system installed cmake
# https://help.github.com/en/actions/reference/software-installed-on-github-hosted-runners
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set up MSVC environment
uses: ilammy/msvc-dev-cmd@v1
- name: Configure
run: |
mkdir build
cd build
cmake -G "Visual Studio 17 2022" -A x64 -DTINYGLTF3_BUILD_TESTS=ON ..
cd ..
run: cmake -B build -G Ninja -DTINYGLTF3_BUILD_TESTS=ON
- name: Build
run: cmake --build build --config Release
run: cmake --build build
- name: Run tests
run: ctest --test-dir build -C Release --output-on-failure
run: ctest --test-dir build --output-on-failure
build-linux:
+12 -10
View File
@@ -104,7 +104,8 @@ jobs:
- name: Run tests
run: ctest --test-dir build --output-on-failure
# Windows x64 - MSVC
# Windows x64 - MSVC (VS version agnostic; msvc-dev-cmd locates the
# Visual Studio shipped with the runner image, e.g. VS2022 or VS2026)
windows-msvc-x64:
runs-on: windows-latest
name: Windows x64 (MSVC)
@@ -112,21 +113,21 @@ jobs:
- name: Checkout
uses: actions/checkout@v5
- name: Set up MSVC environment
uses: ilammy/msvc-dev-cmd@v1
- name: Configure
run: |
mkdir build
cd build
cmake -G "Visual Studio 17 2022" -A x64 -DTINYGLTF3_BUILD_TESTS=ON ..
run: cmake -B build -G Ninja -DTINYGLTF3_BUILD_TESTS=ON
- name: Build
run: cmake --build build --config Release
run: cmake --build build
- name: Run tester_v3_c on a sample model
run: |
.\build\Release\tester_v3_c.exe models\Cube\Cube.gltf
.\build\tester_v3_c.exe models\Cube\Cube.gltf
- name: Run tests
run: ctest --test-dir build -C Release --output-on-failure
run: ctest --test-dir build --output-on-failure
# Windows MinGW - MSYS2
windows-mingw-msys2:
@@ -332,10 +333,12 @@ jobs:
- name: Checkout
uses: actions/checkout@v5
- name: Set up MSVC environment
uses: ilammy/msvc-dev-cmd@v1
- name: Build and run tester_v3_c
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cd tests
cl /nologo /W4 /WX /std:c11 /Zi /Od /D_CRT_SECURE_NO_WARNINGS /DTINYGLTF3_ENABLE_FS /I.. tester_v3_c.c ..\tiny_gltf_v3.c /Fe:tester_v3_c.exe
tester_v3_c.exe
@@ -343,7 +346,6 @@ jobs:
- name: Build and run tester_v3_c_v1port
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cd tests
cl /nologo /W4 /WX /std:c11 /Zi /Od /D_CRT_SECURE_NO_WARNINGS /DTINYGLTF3_ENABLE_FS /I.. tester_v3_c_v1port.c ..\tiny_gltf_v3.c /Fe:tester_v3_c_v1port.exe
tester_v3_c_v1port.exe