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: |
::- 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

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

@ -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% %*