Skip to content

Commit 282f756

Browse files
committed
ci: use setup-msvc-dev action instead of a hard-coded vcvars path
The windows-cmake job set up the MSVC environment by calling a hard-coded "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" in its NMake, clang-cl and Meson steps. The hosted windows-latest image no longer has Visual Studio installed under that "Enterprise" path, so those steps started failing with "The system cannot find the path specified." Set up the developer environment once per job with the TheMrMilchmann/setup-msvc-dev action -- it locates the installed toolchain (no hard-coded path or edition) and exports the environment for the following steps -- and drop all the hard-coded vcvars64.bat calls. Assisted-by: claude-code:claude-opus-4-8
1 parent 4957824 commit 282f756

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

.github/workflows/builds.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@ jobs:
193193
choco install ninja
194194
pip3 install meson
195195
refreshenv
196+
- name: Set up MSVC developer environment
197+
uses: TheMrMilchmann/setup-msvc-dev@v4
198+
with:
199+
arch: x64
196200
- name: Configure CMake MSVC
197201
shell: cmd
198202
run: |
@@ -235,13 +239,11 @@ jobs:
235239
- name: Configure CMake NMake MSVC
236240
shell: cmd
237241
run: |
238-
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
239242
cmake -G"NMake Makefiles" -B build\nmake -S hidapisrc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHIDAPI_WITH_TESTS=ON -DHIDAPI_BUILD_PP_DATA_DUMP=ON -DHIDAPI_ENABLE_ASAN=ON -DCMAKE_INSTALL_PREFIX=install\nmake -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=%MSVC_COMPILE_FLAGS%"
240243
- name: Build CMake NMake MSVC
241244
working-directory: build\nmake
242245
shell: cmd
243246
run: |
244-
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
245247
nmake install
246248
- name: Check artifacts CMake NMake MSVC
247249
uses: andstor/file-existence-action@v2
@@ -254,7 +256,6 @@ jobs:
254256
- name: Check CMake NMake MSVC Export Package
255257
shell: cmd
256258
run: |
257-
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
258259
cmake ^
259260
-G"NMake Makefiles" ^
260261
-B build\nmake_test ^
@@ -271,13 +272,11 @@ jobs:
271272
- name: Configure CMake NMake ClangCL
272273
shell: cmd
273274
run: |
274-
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
275275
cmake -G"NMake Makefiles" -B build\clang_cl -S hidapisrc -D CMAKE_C_COMPILER=clang-cl -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHIDAPI_WITH_TESTS=ON -DHIDAPI_BUILD_PP_DATA_DUMP=ON -DHIDAPI_ENABLE_ASAN=OFF -DCMAKE_INSTALL_PREFIX=install\clang_cl -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=%MSVC_COMPILE_FLAGS%"
276276
- name: Build CMake NMake ClangCL
277277
working-directory: build\clang_cl
278278
shell: cmd
279279
run: |
280-
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
281280
nmake install
282281
- name: Check artifacts CMake NMake ClangCL
283282
uses: andstor/file-existence-action@v2
@@ -290,7 +289,6 @@ jobs:
290289
- name: Check CMake NMake ClangCL Export Package
291290
shell: cmd
292291
run: |
293-
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
294292
cmake ^
295293
-G"NMake Makefiles" ^
296294
-B build\clang_cl_test ^
@@ -340,7 +338,6 @@ jobs:
340338
- name: Check Meson build
341339
shell: cmd
342340
run: |
343-
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
344341
meson setup build_meson hidapisrc
345342
cd build_meson
346343
ninja

0 commit comments

Comments
 (0)