1 | @REM @file
|
---|
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.
|
---|
5 | @REM
|
---|
6 | @REM Copyright (c) 2016-2020, Intel Corporation. All rights reserved.<BR>
|
---|
7 | @REM
|
---|
8 | @REM SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
9 | @REM
|
---|
10 |
|
---|
11 | @echo off
|
---|
12 | pushd .
|
---|
13 | set SCRIPT_ERROR=0
|
---|
14 | goto main
|
---|
15 |
|
---|
16 | :ToolNotInstall
|
---|
17 | set SCRIPT_ERROR=1
|
---|
18 | goto :EOF
|
---|
19 |
|
---|
20 | :main
|
---|
21 | if /I "%1"=="VS2022" goto SetVS2022
|
---|
22 | if /I "%1"=="VS2019" goto SetVS2019
|
---|
23 | if /I "%1"=="VS2017" goto SetVS2017
|
---|
24 | if /I "%1"=="VS2015" goto SetVS2015
|
---|
25 |
|
---|
26 | if defined VS71COMNTOOLS (
|
---|
27 | if not defined VS2003_PREFIX (
|
---|
28 | set "VS2003_PREFIX=%VS71COMNTOOLS:~0,-14%"
|
---|
29 | )
|
---|
30 | )
|
---|
31 |
|
---|
32 | :SetVS2015
|
---|
33 | if defined VS140COMNTOOLS (
|
---|
34 | if not defined VS2015_PREFIX (
|
---|
35 | set "VS2015_PREFIX=%VS140COMNTOOLS:~0,-14%"
|
---|
36 | )
|
---|
37 | if not defined WINSDK81_PREFIX (
|
---|
38 | if exist "%ProgramFiles%\Windows Kits\8.1\bin" (
|
---|
39 | set "WINSDK81_PREFIX=%ProgramFiles%\Windows Kits\8.1\bin\"
|
---|
40 | ) else if exist "%ProgramFiles(x86)%\Windows Kits\8.1\bin" (
|
---|
41 | set "WINSDK81_PREFIX=%ProgramFiles(x86)%\Windows Kits\8.1\bin\"
|
---|
42 | )
|
---|
43 | )
|
---|
44 | if not defined WINSDK81x86_PREFIX (
|
---|
45 | if exist "%ProgramFiles(x86)%\Windows Kits\8.1\bin" (
|
---|
46 | set "WINSDK81x86_PREFIX=%ProgramFiles(x86)%\Windows Kits\8.1\bin\"
|
---|
47 | ) else if exist "%ProgramFiles%\Windows Kits\8.1\bin" (
|
---|
48 | set "WINSDK81x86_PREFIX=%ProgramFiles%\Windows Kits\8.1\bin\"
|
---|
49 | )
|
---|
50 | )
|
---|
51 | ) else (
|
---|
52 | if /I "%1"=="VS2015" goto ToolNotInstall
|
---|
53 | )
|
---|
54 | if /I "%1"=="VS2015" goto SetWinDDK
|
---|
55 |
|
---|
56 | :SetVS2017
|
---|
57 | if not defined VS150COMNTOOLS (
|
---|
58 | @REM clear two envs so that vcvars32.bat can run successfully.
|
---|
59 | set VSINSTALLDIR=
|
---|
60 | set VCToolsVersion=
|
---|
61 | if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
|
---|
62 | if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools" (
|
---|
63 | call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 15,16 > vswhereInfo
|
---|
64 | for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
---|
65 | if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
---|
66 | )
|
---|
67 | del vswhereInfo
|
---|
68 | ) else (
|
---|
69 | call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version 15,16 > vswhereInfo
|
---|
70 | for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
---|
71 | if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
---|
72 | )
|
---|
73 | del vswhereInfo
|
---|
74 | )
|
---|
75 | ) else if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" (
|
---|
76 | if exist "%ProgramFiles%\Microsoft Visual Studio\2017\BuildTools" (
|
---|
77 | call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 15,16 > vswhereInfo
|
---|
78 | for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
---|
79 | if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
---|
80 | )
|
---|
81 | del vswhereInfo
|
---|
82 | ) else (
|
---|
83 | call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -version 15,16 > vswhereInfo
|
---|
84 | for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
---|
85 | if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
---|
86 | )
|
---|
87 | del vswhereInfo
|
---|
88 | )
|
---|
89 | ) else (
|
---|
90 | if /I "%1"=="VS2017" goto ToolNotInstall
|
---|
91 | goto SetWinDDK
|
---|
92 | )
|
---|
93 | )
|
---|
94 |
|
---|
95 | if defined VCToolsInstallDir (
|
---|
96 | if not defined VS2017_PREFIX (
|
---|
97 | set "VS2017_PREFIX=%VCToolsInstallDir%"
|
---|
98 | )
|
---|
99 | if not defined WINSDK10_PREFIX (
|
---|
100 | if defined WindowsSdkVerBinPath (
|
---|
101 | set "WINSDK10_PREFIX=%WindowsSdkVerBinPath%"
|
---|
102 | ) else if exist "%ProgramFiles(x86)%\Windows Kits\10\bin" (
|
---|
103 | set "WINSDK10_PREFIX=%ProgramFiles(x86)%\Windows Kits\10\bin\"
|
---|
104 | ) else if exist "%ProgramFiles%\Windows Kits\10\bin" (
|
---|
105 | set "WINSDK10_PREFIX=%ProgramFiles%\Windows Kits\10\bin\"
|
---|
106 | )
|
---|
107 | )
|
---|
108 | )
|
---|
109 | if not defined WINSDK_PATH_FOR_RC_EXE (
|
---|
110 | if defined WINSDK10_PREFIX (
|
---|
111 | set "WINSDK_PATH_FOR_RC_EXE=%WINSDK10_PREFIX%x86"
|
---|
112 | )
|
---|
113 | )
|
---|
114 |
|
---|
115 | if /I "%1"=="VS2017" goto SetWinDDK
|
---|
116 |
|
---|
117 | :SetVS2019
|
---|
118 | if not defined VS160COMNTOOLS (
|
---|
119 | @REM clear two envs so that vcvars32.bat can run successfully.
|
---|
120 | set VSINSTALLDIR=
|
---|
121 | set VCToolsVersion=
|
---|
122 | if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
|
---|
123 | if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools" (
|
---|
124 | call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 16,17 > vswhereInfo
|
---|
125 | for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
---|
126 | if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
---|
127 | )
|
---|
128 | del vswhereInfo
|
---|
129 | ) else (
|
---|
130 | call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version 16,17 > vswhereInfo
|
---|
131 | for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
---|
132 | if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
---|
133 | )
|
---|
134 | del vswhereInfo
|
---|
135 | )
|
---|
136 | ) else if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" (
|
---|
137 | if exist "%ProgramFiles%\Microsoft Visual Studio\2019\BuildTools" (
|
---|
138 | call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 16,17 > vswhereInfo
|
---|
139 | for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
---|
140 | if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
---|
141 | )
|
---|
142 | del vswhereInfo
|
---|
143 | ) else (
|
---|
144 | call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -version 16,17 > vswhereInfo
|
---|
145 | for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
---|
146 | if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
---|
147 | )
|
---|
148 | del vswhereInfo
|
---|
149 | )
|
---|
150 | ) else (
|
---|
151 | if /I "%1"=="VS2019" goto ToolNotInstall
|
---|
152 | goto SetWinDDK
|
---|
153 | )
|
---|
154 | )
|
---|
155 |
|
---|
156 | if defined VCToolsInstallDir (
|
---|
157 | if not defined VS2019_PREFIX (
|
---|
158 | set "VS2019_PREFIX=%VCToolsInstallDir%"
|
---|
159 | )
|
---|
160 | if not defined WINSDK10_PREFIX (
|
---|
161 | if defined WindowsSdkVerBinPath (
|
---|
162 | set "WINSDK10_PREFIX=%WindowsSdkVerBinPath%"
|
---|
163 | ) else if exist "%ProgramFiles(x86)%\Windows Kits\10\bin" (
|
---|
164 | set "WINSDK10_PREFIX=%ProgramFiles(x86)%\Windows Kits\10\bin\"
|
---|
165 | ) else if exist "%ProgramFiles%\Windows Kits\10\bin" (
|
---|
166 | set "WINSDK10_PREFIX=%ProgramFiles%\Windows Kits\10\bin\"
|
---|
167 | )
|
---|
168 | )
|
---|
169 | )
|
---|
170 | if not defined WINSDK_PATH_FOR_RC_EXE (
|
---|
171 | if defined WINSDK10_PREFIX (
|
---|
172 | set "WINSDK_PATH_FOR_RC_EXE=%WINSDK10_PREFIX%x86"
|
---|
173 | )
|
---|
174 | )
|
---|
175 |
|
---|
176 | if /I "%1"=="VS2019" goto SetWinDDK
|
---|
177 |
|
---|
178 | :SetVS2022
|
---|
179 | if not defined VS170COMNTOOLS (
|
---|
180 | @REM clear two envs so that vcvars32.bat can run successfully.
|
---|
181 | set VSINSTALLDIR=
|
---|
182 | set VCToolsVersion=
|
---|
183 | if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
|
---|
184 | if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools" (
|
---|
185 | call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 17,18 > vswhereInfo
|
---|
186 | for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
---|
187 | if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
---|
188 | )
|
---|
189 | del vswhereInfo
|
---|
190 | ) else (
|
---|
191 | call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version 17,18 > vswhereInfo
|
---|
192 | for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
---|
193 | if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
---|
194 | )
|
---|
195 | del vswhereInfo
|
---|
196 | )
|
---|
197 | ) else if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" (
|
---|
198 | if exist "%ProgramFiles%\Microsoft Visual Studio\2022\BuildTools" (
|
---|
199 | call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 17,18 > vswhereInfo
|
---|
200 | for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
---|
201 | if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
---|
202 | )
|
---|
203 | del vswhereInfo
|
---|
204 | ) else (
|
---|
205 | call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -version 17,18 > vswhereInfo
|
---|
206 | for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
---|
207 | if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
---|
208 | )
|
---|
209 | del vswhereInfo
|
---|
210 | )
|
---|
211 | ) else (
|
---|
212 | if /I "%1"=="VS2022" goto ToolNotInstall
|
---|
213 | goto SetWinDDK
|
---|
214 | )
|
---|
215 | )
|
---|
216 |
|
---|
217 | if defined VCToolsInstallDir (
|
---|
218 | if not defined VS2022_PREFIX (
|
---|
219 | set "VS2022_PREFIX=%VCToolsInstallDir%"
|
---|
220 | )
|
---|
221 | if not defined WINSDK10_PREFIX (
|
---|
222 | if defined WindowsSdkVerBinPath (
|
---|
223 | set "WINSDK10_PREFIX=%WindowsSdkVerBinPath%"
|
---|
224 | ) else if exist "%ProgramFiles(x86)%\Windows Kits\10\bin" (
|
---|
225 | set "WINSDK10_PREFIX=%ProgramFiles(x86)%\Windows Kits\10\bin\"
|
---|
226 | ) else if exist "%ProgramFiles%\Windows Kits\10\bin" (
|
---|
227 | set "WINSDK10_PREFIX=%ProgramFiles%\Windows Kits\10\bin\"
|
---|
228 | )
|
---|
229 | )
|
---|
230 | )
|
---|
231 | if not defined WINSDK_PATH_FOR_RC_EXE (
|
---|
232 | if defined WINSDK10_PREFIX (
|
---|
233 | set "WINSDK_PATH_FOR_RC_EXE=%WINSDK10_PREFIX%x86"
|
---|
234 | )
|
---|
235 | )
|
---|
236 |
|
---|
237 | if /I "%1"=="VS2022" goto SetWinDDK
|
---|
238 |
|
---|
239 | :SetWinDDK
|
---|
240 | if not defined WINDDK3790_PREFIX (
|
---|
241 | set WINDDK3790_PREFIX=C:\WINDDK\3790.1830\bin\
|
---|
242 | )
|
---|
243 |
|
---|
244 | if not defined IASL_PREFIX (
|
---|
245 | set IASL_PREFIX=C:\ASL\
|
---|
246 | )
|
---|
247 |
|
---|
248 | popd
|
---|