2 @REM This stand
-alone program is typically called by the toolsetup.bat file
,
3 @REM however it may be executed directly from the BaseTools project folder
4 @REM
if the file is
not executed within a WORKSPACE\BaseTools folder.
6 @REM Copyright
(c
) 2016-2020, Intel Corporation. All rights reserved.
<BR
>
8 @REM SPDX
-License
-Identifier
: BSD
-2-Clause
-Patent
21 if /I
"%1"=="VS2019" goto SetVS2019
22 if /I
"%1"=="VS2017" goto SetVS2017
23 if /I
"%1"=="VS2015" goto SetVS2015
24 if /I
"%1"=="VS2013" goto SetVS2013
25 if /I
"%1"=="VS2012" goto SetVS2012
27 if defined VS71COMNTOOLS
(
28 if not defined VS2003_PREFIX
(
29 set "VS2003_PREFIX=%VS71COMNTOOLS:~0,-14%"
33 if defined VS80COMNTOOLS
(
34 if not defined VS2005_PREFIX
(
35 set "VS2005_PREFIX=%VS80COMNTOOLS:~0,-14%"
39 if defined VS90COMNTOOLS
(
40 if not defined VS2008_PREFIX
(
41 set "VS2008_PREFIX=%VS90COMNTOOLS:~0,-14%"
43 if not defined WINSDK_PREFIX
(
44 set "WINSDK_PREFIX=c:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\"
46 if not defined WINSDKx86_PREFIX (
47 set "WINSDKx86_PREFIX
=c
:\Program
Files (x86
)\Microsoft SDKs\Windows
\v6.0A
\bin
\"
51 if defined VS100COMNTOOLS
(
52 if not defined VS2010_PREFIX
(
53 set "VS2010_PREFIX=%VS100COMNTOOLS:~0,-14%"
55 if not defined WINSDK7_PREFIX
(
56 set "WINSDK7_PREFIX=c:\Program Files\Microsoft SDKs\Windows\v7.0A\Bin\"
58 if not defined WINSDK7x86_PREFIX (
59 set "WINSDK7x86_PREFIX
=c
:\Program
Files (x86
)\Microsoft SDKs\Windows
\v7.0A\Bin
\"
64 if defined VS110COMNTOOLS
(
65 if not defined VS2012_PREFIX
(
66 set "VS2012_PREFIX=%VS110COMNTOOLS:~0,-14%"
68 if not defined WINSDK71_PREFIX
(
69 set "WINSDK71_PREFIX=c:\Program Files\Microsoft SDKs\Windows\v7.1A\Bin\"
71 if not defined WINSDK71x86_PREFIX (
72 set "WINSDK71x86_PREFIX
=c
:\Program
Files (x86
)\Microsoft SDKs\Windows
\v7.1A\Bin
\"
75 if /I
"%1"=="VS2012" goto ToolNotInstall
77 if /I
"%1"=="VS2012" goto SetWinDDK
80 if defined VS120COMNTOOLS
(
81 if not defined VS2013_PREFIX
(
82 set "VS2013_PREFIX=%VS120COMNTOOLS:~0,-14%"
84 if not defined WINSDK8_PREFIX
(
85 set "WINSDK8_PREFIX=c:\Program Files\Windows Kits\8.0\bin\"
87 if not defined WINSDK8x86_PREFIX (
88 set "WINSDK8x86_PREFIX
=c
:\Program
Files (x86
)\Windows Kits\
8.0\bin
\"
91 if /I
"%1"=="VS2013" goto ToolNotInstall
93 if /I
"%1"=="VS2013" goto SetWinDDK
96 if defined VS140COMNTOOLS
(
97 if not defined VS2015_PREFIX
(
98 set "VS2015_PREFIX=%VS140COMNTOOLS:~0,-14%"
100 if not defined WINSDK81_PREFIX
(
101 set "WINSDK81_PREFIX=c:\Program Files\Windows Kits\8.1\bin\"
103 if not defined WINSDK81x86_PREFIX (
104 set "WINSDK81x86_PREFIX
=c
:\Program
Files (x86
)\Windows Kits\
8.1\bin
\"
107 if /I
"%1"=="VS2015" goto ToolNotInstall
109 if /I
"%1"=="VS2015" goto SetWinDDK
112 if not defined VS150COMNTOOLS
(
113 @REM clear two envs so that vcvars32.bat can
run successfully.
116 if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
117 if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools" (
118 call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools
-version
15,16 > vswhereInfo
119 for /f
"usebackq tokens=1* delims=: " %%i in
(vswhereInfo
) do (
120 if /i
"%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
124 call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version
15,16 > vswhereInfo
125 for /f
"usebackq tokens=1* delims=: " %%i in
(vswhereInfo
) do (
126 if /i
"%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
130 ) else if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" (
131 if exist "%ProgramFiles%\Microsoft Visual Studio\2017\BuildTools" (
132 call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools
-version
15,16 > vswhereInfo
133 for /f
"usebackq tokens=1* delims=: " %%i in
(vswhereInfo
) do (
134 if /i
"%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
138 call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -version
15,16 > vswhereInfo
139 for /f
"usebackq tokens=1* delims=: " %%i in
(vswhereInfo
) do (
140 if /i
"%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
145 if /I
"%1"=="VS2017" goto ToolNotInstall
150 if defined VCToolsInstallDir
(
151 if not defined VS2017_PREFIX
(
152 set "VS2017_PREFIX=%VCToolsInstallDir%"
154 if not defined WINSDK10_PREFIX
(
155 if defined WindowsSdkVerBinPath
(
156 set "WINSDK10_PREFIX=%WindowsSdkVerBinPath%"
157 ) else if exist "%ProgramFiles(x86)%\Windows Kits\10\bin" (
158 set "WINSDK10_PREFIX=%ProgramFiles(x86)%\Windows Kits\10\bin\"
159 ) else if exist "%ProgramFiles%\Windows Kits\
10\bin
" (
160 set "WINSDK10_PREFIX
=%ProgramFiles%\Windows Kits\
10\bin
\"
164 if not defined WINSDK_PATH_FOR_RC_EXE
(
165 if defined WINSDK10_PREFIX
(
166 set "WINSDK_PATH_FOR_RC_EXE=%WINSDK10_PREFIX%x86"
170 if /I
"%1"=="VS2017" goto SetWinDDK
173 if not defined VS160COMNTOOLS
(
174 @REM clear two envs so that vcvars32.bat can
run successfully.
177 if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
178 if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools" (
179 call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools
-version
16,17 > vswhereInfo
180 for /f
"usebackq tokens=1* delims=: " %%i in
(vswhereInfo
) do (
181 if /i
"%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
185 call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version
16,17 > vswhereInfo
186 for /f
"usebackq tokens=1* delims=: " %%i in
(vswhereInfo
) do (
187 if /i
"%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
191 ) else if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" (
192 if exist "%ProgramFiles%\Microsoft Visual Studio\2019\BuildTools" (
193 call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools
-version
16,17 > vswhereInfo
194 for /f
"usebackq tokens=1* delims=: " %%i in
(vswhereInfo
) do (
195 if /i
"%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
199 call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -version
16,17 > vswhereInfo
200 for /f
"usebackq tokens=1* delims=: " %%i in
(vswhereInfo
) do (
201 if /i
"%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
206 if /I
"%1"=="VS2019" goto ToolNotInstall
211 if defined VCToolsInstallDir
(
212 if not defined VS2019_PREFIX
(
213 set "VS2019_PREFIX=%VCToolsInstallDir%"
215 if not defined WINSDK10_PREFIX
(
216 if defined WindowsSdkVerBinPath
(
217 set "WINSDK10_PREFIX=%WindowsSdkVerBinPath%"
218 ) else if exist "%ProgramFiles(x86)%\Windows Kits\10\bin" (
219 set "WINSDK10_PREFIX=%ProgramFiles(x86)%\Windows Kits\10\bin\"
220 ) else if exist "%ProgramFiles%\Windows Kits\
10\bin
" (
221 set "WINSDK10_PREFIX
=%ProgramFiles%\Windows Kits\
10\bin
\"
225 if not defined WINSDK_PATH_FOR_RC_EXE
(
226 if defined WINSDK10_PREFIX
(
227 set "WINSDK_PATH_FOR_RC_EXE=%WINSDK10_PREFIX%x86"
231 if /I
"%1"=="VS2019" goto SetWinDDK
234 if not defined WINDDK3790_PREFIX
(
235 set WINDDK3790_PREFIX
=C
:\WINDDK
\3790.1830
\bin\
238 if not defined IASL_PREFIX
(
239 set IASL_PREFIX
=C
:\ASL\