Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions scripts/call-vcvars.cmd
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
@echo off

:: NOTE: Intentionally not specifying 'setlocal' as we want the side-effects of calling 'vcvars' to affect the caller
REM NOTE: Intentionally not specifying 'setlocal' as we want the side-effects of calling 'vcvars' to affect the caller

:: NOTE: This is primarily intended to be used by the build pipelines, hence the hard-coded paths, and might not be
:: generally useful. The following check is intended to help diagnose such possible issues
if NOT EXIST "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" (
echo ERROR: Could not locate 'vcvars' batch file. This script is intended to be run from a build machine & exit /B 1
)
set _VCVARSALL=
for /f "delims=" %%i in ('"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -products * -latest -find VC\Auxiliary\Build\vcvarsall.bat') do set _VCVARSALL=%%i
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is -latest desirable in this case? If there is a compat issue with a new version, such as 2026, then CI will be broken until someone forces this back to the previous version.

Would it make sense to add this to the matrix in YAML? Build with 1 or more versions of VS, as available on the build agents.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even before the change to GH Actions, we've been forcing updates to Clang to the newest version. I don't think this would be much different. If a PR fails because of a newer version, it's typically not that difficult to just fix the issue & push to the PR branch


if "%_VCVARSALL%"=="" echo ERROR: Unable to locate vcvarsall.bat & exit /B 1

set ARCH=%1
if /I "%ARCH%"=="x86" (
set _ARCH=%1
if /I "%_ARCH%"=="x86" (
REM Use the x64 toolchain
set ARCH=x64_x86
set _ARCH=x64_x86
)

call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %ARCH%
call "%_VCVARSALL%" %_ARCH%