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 old mode 100644 new mode 100755 index 01487f9098..be77c87b29 --- 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% %*