summaryrefslogtreecommitdiffstats
path: root/BaseTools/set_vsprefix_envs.bat
diff options
context:
space:
mode:
Diffstat (limited to 'BaseTools/set_vsprefix_envs.bat')
-rw-r--r--BaseTools/set_vsprefix_envs.bat62
1 files changed, 62 insertions, 0 deletions
diff --git a/BaseTools/set_vsprefix_envs.bat b/BaseTools/set_vsprefix_envs.bat
index 0b9a0c75b9..39e4e004b5 100644
--- a/BaseTools/set_vsprefix_envs.bat
+++ b/BaseTools/set_vsprefix_envs.bat
@@ -18,6 +18,7 @@ set SCRIPT_ERROR=1
goto :EOF
:main
+if /I "%1"=="VS2022" goto SetVS2022
if /I "%1"=="VS2019" goto SetVS2019
if /I "%1"=="VS2017" goto SetVS2017
if /I "%1"=="VS2015" goto SetVS2015
@@ -166,6 +167,67 @@ if not defined WINSDK_PATH_FOR_RC_EXE (
if /I "%1"=="VS2019" goto SetWinDDK
+:SetVS2022
+if not defined VS170COMNTOOLS (
+ @REM clear two envs so that vcvars32.bat can run successfully.
+ set VSINSTALLDIR=
+ set VCToolsVersion=
+ if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
+ if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools" (
+ call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 17,18 > vswhereInfo
+ for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
+ if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
+ )
+ del vswhereInfo
+ ) else (
+ call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version 17,18 > vswhereInfo
+ for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
+ if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
+ )
+ del vswhereInfo
+ )
+ ) else if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" (
+ if exist "%ProgramFiles%\Microsoft Visual Studio\2022\BuildTools" (
+ call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 17,18 > vswhereInfo
+ for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
+ if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
+ )
+ del vswhereInfo
+ ) else (
+ call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -version 17,18 > vswhereInfo
+ for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
+ if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
+ )
+ del vswhereInfo
+ )
+ ) else (
+ if /I "%1"=="VS2022" goto ToolNotInstall
+ goto SetWinDDK
+ )
+)
+
+if defined VCToolsInstallDir (
+ if not defined VS2022_PREFIX (
+ set "VS2022_PREFIX=%VCToolsInstallDir%"
+ )
+ if not defined WINSDK10_PREFIX (
+ if defined WindowsSdkVerBinPath (
+ set "WINSDK10_PREFIX=%WindowsSdkVerBinPath%"
+ ) else if exist "%ProgramFiles(x86)%\Windows Kits\10\bin" (
+ set "WINSDK10_PREFIX=%ProgramFiles(x86)%\Windows Kits\10\bin\"
+ ) else if exist "%ProgramFiles%\Windows Kits\10\bin" (
+ set "WINSDK10_PREFIX=%ProgramFiles%\Windows Kits\10\bin\"
+ )
+ )
+)
+if not defined WINSDK_PATH_FOR_RC_EXE (
+ if defined WINSDK10_PREFIX (
+ set "WINSDK_PATH_FOR_RC_EXE=%WINSDK10_PREFIX%x86"
+ )
+)
+
+if /I "%1"=="VS2022" goto SetWinDDK
+
:SetWinDDK
if not defined WINDDK3790_PREFIX (
set WINDDK3790_PREFIX=C:\WINDDK\3790.1830\bin\