From 8d8b73a56ff273ff03f140de2160030b116df42f Mon Sep 17 00:00:00 2001 From: Ihor Dutchak Date: Sun, 14 Jun 2026 11:13:00 +0300 Subject: [PATCH 1/3] 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 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 drop all the hard-coded vcvars64.bat calls. That environment is job-wide, so the MinGW build (which must use gcc, not cl) is split out into its own windows-mingw job that runs without the MSVC environment. The MSVC, NMake, clang-cl and Meson builds stay in windows-cmake with the action. Assisted-by: claude-code:claude-opus-4-8 --- .github/workflows/builds.yml | 37 ++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 8f61dc3f0..86e6c0e9f 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -193,6 +193,10 @@ jobs: choco install ninja pip3 install meson refreshenv + - name: Set up MSVC developer environment + uses: TheMrMilchmann/setup-msvc-dev@v4 + with: + arch: x64 - name: Configure CMake MSVC shell: cmd run: | @@ -235,13 +239,11 @@ jobs: - name: Configure CMake NMake MSVC shell: cmd run: | - call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" 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%" - name: Build CMake NMake MSVC working-directory: build\nmake shell: cmd run: | - call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" nmake install - name: Check artifacts CMake NMake MSVC uses: andstor/file-existence-action@v2 @@ -254,7 +256,6 @@ jobs: - name: Check CMake NMake MSVC Export Package shell: cmd run: | - call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" cmake ^ -G"NMake Makefiles" ^ -B build\nmake_test ^ @@ -271,13 +272,11 @@ jobs: - name: Configure CMake NMake ClangCL shell: cmd run: | - call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" 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%" - name: Build CMake NMake ClangCL working-directory: build\clang_cl shell: cmd run: | - call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" nmake install - name: Check artifacts CMake NMake ClangCL uses: andstor/file-existence-action@v2 @@ -290,7 +289,6 @@ jobs: - name: Check CMake NMake ClangCL Export Package shell: cmd run: | - call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" cmake ^ -G"NMake Makefiles" ^ -B build\clang_cl_test ^ @@ -306,6 +304,25 @@ jobs: working-directory: build/clang_cl run: ctest -C RelWithDebInfo --no-compress-output --output-on-failure + - name: Check Meson build + shell: cmd + run: | + meson setup build_meson hidapisrc + cd build_meson + ninja + + + windows-mingw: + + runs-on: windows-latest + + steps: + - uses: actions/checkout@v3 + with: + path: hidapisrc + # MinGW builds with gcc and runs in its own job, deliberately without the + # MSVC developer environment (which would otherwise make CMake's "MinGW + # Makefiles" generator pick up cl). - name: Configure CMake MinGW shell: cmd run: | @@ -337,14 +354,6 @@ jobs: working-directory: build\mingw run: ctest --no-compress-output --output-on-failure - - name: Check Meson build - shell: cmd - run: | - call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" - meson setup build_meson hidapisrc - cd build_meson - ninja - windows-msbuild: From 213963beb06dc230955794792c256fb38a8b1cb2 Mon Sep 17 00:00:00 2001 From: Ihor Dutchak Date: Sun, 14 Jun 2026 13:26:51 +0300 Subject: [PATCH 2/3] Update .github/workflows/builds.yml --- .github/workflows/builds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 86e6c0e9f..255131116 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -312,7 +312,7 @@ jobs: ninja - windows-mingw: + windows-cmake-mingw: runs-on: windows-latest From 0bbe2cc1f7f2337287333afc232791cc1754d0d3 Mon Sep 17 00:00:00 2001 From: Ihor Dutchak Date: Sun, 14 Jun 2026 13:28:13 +0300 Subject: [PATCH 3/3] Apply suggestions from code review Co-authored-by: Ihor Dutchak --- .github/workflows/builds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 255131116..b2cfbadc1 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -179,7 +179,7 @@ jobs: ninja - windows-cmake: + windows-cmake-msvc: runs-on: windows-latest