Win: Use VsDevCmd.bat instead of old vcvarsall.bat

This commit is contained in:
Nobuyoshi Nakada 2025-05-31 19:02:32 +09:00
parent a64616fb4c
commit 1395abd025
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465
Notes: git 2025-06-01 05:14:04 +00:00
2 changed files with 12 additions and 9 deletions

View File

@ -96,7 +96,7 @@ jobs:
run: | run: |
::- Set up VC ${{ matrix.vc }} ::- Set up VC ${{ matrix.vc }}
set | uutils sort > old.env 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 nmake -f nul
set TMP=%USERPROFILE%\AppData\Local\Temp set TMP=%USERPROFILE%\AppData\Local\Temp
set TEMP=%USERPROFILE%\AppData\Local\Temp set TEMP=%USERPROFILE%\AppData\Local\Temp

19
win32/vssetup.cmd Normal file → Executable file
View File

@ -1,5 +1,5 @@
@echo off @echo off
setlocal setlocal ENABLEEXTENSIONS
::- check for vswhere ::- check for vswhere
set vswhere=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe 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. ::- 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 ( 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 echo 1>&2 Visual Studio not found
exit /b 1 exit /b 1
) )
::- If no target is given, setup for the current processor. ::- default to the current processor.
set target= set arch=%PROCESSOR_ARCHITECTURE%
if "%1" == "" set target=%PROCESSOR_ARCHITECTURE% ::- `vsdevcmd.bat` requires arch names to be lowercase
echo on && endlocal && "%VCVARS%" %target% %* 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% %*