summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2025-05-31 19:02:32 +0900
committerNobuyoshi Nakada <[email protected]>2025-06-01 12:16:18 +0900
commit1395abd025f69045fe3dd7552b0ff210ba53fded (patch)
treeb392538a4e4b9c37536c9c88619533484a7f393b
parenta64616fb4c29290478adde391327ab97acf12be8 (diff)
Win: Use `VsDevCmd.bat` instead of old `vcvarsall.bat`
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13490
-rw-r--r--.github/workflows/windows.yml2
-rwxr-xr-x[-rw-r--r--]win32/vssetup.cmd19
2 files changed, 12 insertions, 9 deletions
diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml
index 1dbbbd897e..294f3529f7 100644
--- a/.github/workflows/windows.yml
+++ b/.github/workflows/windows.yml
@@ -96,7 +96,7 @@ jobs:
run: |
::- Set up VC ${{ matrix.vc }}
set | uutils sort > old.env
- call ..\src\win32\vssetup.cmd ${{ matrix.target || 'amd64' }} ${{ matrix.vcvars || '' }}
+ call ..\src\win32\vssetup.cmd -arch=${{ matrix.target || 'amd64' }} ${{ matrix.vcvars || '' }}
nmake -f nul
set TMP=%USERPROFILE%\AppData\Local\Temp
set TEMP=%USERPROFILE%\AppData\Local\Temp
diff --git a/win32/vssetup.cmd b/win32/vssetup.cmd
index 01487f9098..be77c87b29 100644..100755
--- a/win32/vssetup.cmd
+++ b/win32/vssetup.cmd
@@ -1,5 +1,5 @@
@echo off
-setlocal
+setlocal ENABLEEXTENSIONS
::- check for vswhere
set vswhere=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe
@@ -9,16 +9,19 @@ if not exist "%vswhere%" (
)
::- find the latest build tool and its setup batch file.
-set VCVARS=
+set VSDEVCMD=
for /f "delims=" %%I in ('"%vswhere%" -products * -latest -property installationPath') do (
- set VCVARS=%%I\VC\Auxiliary\Build\vcvarsall.bat
+ set VSDEVCMD=%%I\Common7\Tools\VsDevCmd.bat
)
-if not defined VCVARS (
+if not defined VSDEVCMD (
echo 1>&2 Visual Studio not found
exit /b 1
)
-::- If no target is given, setup for the current processor.
-set target=
-if "%1" == "" set target=%PROCESSOR_ARCHITECTURE%
-echo on && endlocal && "%VCVARS%" %target% %*
+::- default to the current processor.
+set arch=%PROCESSOR_ARCHITECTURE%
+::- `vsdevcmd.bat` requires arch names to be lowercase
+for %%i in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do @(
+ call set arch=%%arch:%%i=%%i%%
+)
+echo on && endlocal && "%VSDEVCMD%" -arch=%arch% -host_arch=%arch% %*