Skip to content

Commit

Permalink
Update install_script to support VS2022.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sibras committed Sep 25, 2021
1 parent 1ff70a3 commit fd995c1
Showing 1 changed file with 31 additions and 5 deletions.
36 changes: 31 additions & 5 deletions install_script.bat
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ if "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
REM Check if already running in an environment with VS setup
if defined VCINSTALLDIR (
if defined VisualStudioVersion (
if "%VisualStudioVersion%"=="16.0" (
if "%VisualStudioVersion%"=="17.0" (
echo Existing Visual Studio 2022 environment detected...
set MSVC_VER=16
goto MSVCVarsDone
) else if "%VisualStudioVersion%"=="16.0" (
echo Existing Visual Studio 2019 environment detected...
set MSVC_VER=16
goto MSVCVarsDone
Expand Down Expand Up @@ -81,6 +85,16 @@ if not exist "%SCRIPTDIR%\vswhere.exe" (
:VSwhereDetection
REM Use vswhere to list detected installs
for /f "usebackq tokens=* delims=" %%i in (`"%SCRIPTDIR%\vswhere.exe" -prerelease -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do (
for /f "delims=" %%a in ('echo %%i ^| find "2022"') do (
if not "%%a"=="" (
echo Visual Studio 2022 environment detected...
call "%~0" "17" "%%i"
if not ERRORLEVEL 1 (
set MSVC17=1
set MSVCFOUND=1
)
)
)
for /f "delims=" %%a in ('echo %%i ^| find "2019"') do (
if not "%%a"=="" (
echo Visual Studio 2019 environment detected...
Expand Down Expand Up @@ -220,7 +234,9 @@ if "%SYSARCH%"=="32" (
goto Terminate
)
REM Call the required vcvars file in order to setup up build locations
if "%MSVC_VER%"=="16" (
if "%MSVC_VER%"=="17" (
set VCVARS=%2\VC\Auxiliary\Build\vcvars%SYSARCH%.bat
) else if "%MSVC_VER%"=="16" (
set VCVARS=%2\VC\Auxiliary\Build\vcvars%SYSARCH%.bat
) else if "%MSVC_VER%"=="15" (
set VCVARS=%2\VC\Auxiliary\Build\vcvars%SYSARCH%.bat
Expand Down Expand Up @@ -250,7 +266,9 @@ if not ERRORLEVEL 1 (
)
set /p MSBUILDDIR=<"%SCRIPTDIR%\msbuild.txt"
del /F /Q "%SCRIPTDIR%\msbuild.txt" >nul 2>&1
if "%MSVC_VER%"=="16" (
if "%MSVC_VER%"=="17" (
set VCTargetsPath="..\..\..\Microsoft\VC\v170\BuildCustomizations"
) else if "%MSVC_VER%"=="16" (
set VCTargetsPath="..\..\Microsoft\VC\v160\BuildCustomizations"
) else if "%MSVC_VER%"=="15" (
set VCTargetsPath="..\..\..\Common7\IDE\VC\VCTargets\BuildCustomizations"
Expand All @@ -264,8 +282,16 @@ if "%MSVC_VER%"=="16" (

REM Convert the relative targets path to an absolute one
set CURRDIR=%CD%
pushd %MSBUILDDIR%
pushd %VCTargetsPath%
pushd %MSBUILDDIR% 2>nul
if %ERRORLEVEL% neq 0 (
echo Error: Failed to get correct msbuild path!
goto Terminate
)
pushd %VCTargetsPath% 2>nul
if %ERRORLEVEL% neq 0 (
echo Error: Unknown VCTargetsPath path!
goto Terminate
)
set VCTargetsPath=%CD%
popd
popd
Expand Down

0 comments on commit fd995c1

Please sign in to comment.