Skip to content

Commit

Permalink
Ensure correct VC++ toolset selection for AOT
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 authored Jul 12, 2024
1 parent edf1672 commit 33ce9b3
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions src/coreclr/nativeaot/BuildIntegration/findvcvarsall.bat
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,20 @@ SET vswherePath=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.ex
IF NOT EXIST "%vswherePath%" GOTO :ERROR

SET toolsSuffix=x86.x64
IF /I "%~1"=="arm64" SET toolsSuffix=ARM64
IF /I "%PROCESSOR_ARCHITECTURE%" == "arm64" (
SET vcEnvironment=arm64
IF /I "%~1" == "x64" ( SET vcEnvironment=arm64_amd64 )
IF /I "%~1" == "x86" ( SET vcEnvironment=arm64_x86 )
IF /I "%~1" == "arm64" ( SET toolsSuffix=arm64 )
) ELSE IF /I "%PROCESSOR_ARCHITECTURE%" == "amd64" (
SET vcEnvironment=amd64
IF /I "%~1" == "x86" ( SET vcEnvironment=amd64_x86 )
IF /I "%~1" == "arm64" ( SET vcEnvironment=amd64_arm64 )
) ELSE (
SET vcEnvironment=x86
IF /I "%~1" == "x64" ( SET vcEnvironment=amd64_x86 )
IF /I "%~1" == "arm64" ( SET vcEnvironment=x86_arm64 )
)

FOR /F "tokens=*" %%i IN (
'"%vswherePath%" -latest -prerelease -products * ^
Expand All @@ -21,22 +34,6 @@ FOR /F "tokens=*" %%i IN (

IF "%vsBase%"=="" GOTO :ERROR

SET procArch=%PROCESSOR_ARCHITEW6432%
IF "%procArch%"=="" SET procArch=%PROCESSOR_ARCHITECTURE%

SET vcEnvironment=%~1
IF /I "%~1"=="x64" (
SET vcEnvironment=x86_amd64
IF /I "%procArch%"=="AMD64" SET vcEnvironment=amd64
)
IF /I "%~1"=="arm64" (
SET vcEnvironment=x86_arm64
IF /I "%procArch%"=="AMD64" SET vcEnvironment=amd64_arm64
)
IF /I "%~1"=="x86" (
IF /I "%procArch%"=="AMD64" SET vcEnvironment=amd64_x86
)

CALL "%vsBase%\vc\Auxiliary\Build\vcvarsall.bat" %vcEnvironment% > NUL

FOR /F "delims=" %%W IN ('where link') DO (
Expand Down

0 comments on commit 33ce9b3

Please sign in to comment.