]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/set_vsprefix_envs.bat
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / BaseTools / set_vsprefix_envs.bat
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"=="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
26
27 if defined VS71COMNTOOLS (
28 if not defined VS2003_PREFIX (
29 set "VS2003_PREFIX=%VS71COMNTOOLS:~0,-14%"
30 )
31 )
32
33 if defined VS80COMNTOOLS (
34 if not defined VS2005_PREFIX (
35 set "VS2005_PREFIX=%VS80COMNTOOLS:~0,-14%"
36 )
37 )
38
39 if defined VS90COMNTOOLS (
40 if not defined VS2008_PREFIX (
41 set "VS2008_PREFIX=%VS90COMNTOOLS:~0,-14%"
42 )
43 if not defined WINSDK_PREFIX (
44 set "WINSDK_PREFIX=c:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\"
45 )
46 if not defined WINSDKx86_PREFIX (
47 set "WINSDKx86_PREFIX=c:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\bin\"
48 )
49 )
50
51 if defined VS100COMNTOOLS (
52 if not defined VS2010_PREFIX (
53 set "VS2010_PREFIX=%VS100COMNTOOLS:~0,-14%"
54 )
55 if not defined WINSDK7_PREFIX (
56 set "WINSDK7_PREFIX=c:\Program Files\Microsoft SDKs\Windows\v7.0A\Bin\"
57 )
58 if not defined WINSDK7x86_PREFIX (
59 set "WINSDK7x86_PREFIX=c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\"
60 )
61 )
62
63 :SetVS2012
64 if defined VS110COMNTOOLS (
65 if not defined VS2012_PREFIX (
66 set "VS2012_PREFIX=%VS110COMNTOOLS:~0,-14%"
67 )
68 if not defined WINSDK71_PREFIX (
69 set "WINSDK71_PREFIX=c:\Program Files\Microsoft SDKs\Windows\v7.1A\Bin\"
70 )
71 if not defined WINSDK71x86_PREFIX (
72 set "WINSDK71x86_PREFIX=c:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\"
73 )
74 ) else (
75 if /I "%1"=="VS2012" goto ToolNotInstall
76 )
77 if /I "%1"=="VS2012" goto SetWinDDK
78
79 :SetVS2013
80 if defined VS120COMNTOOLS (
81 if not defined VS2013_PREFIX (
82 set "VS2013_PREFIX=%VS120COMNTOOLS:~0,-14%"
83 )
84 if not defined WINSDK8_PREFIX (
85 set "WINSDK8_PREFIX=c:\Program Files\Windows Kits\8.0\bin\"
86 )
87 if not defined WINSDK8x86_PREFIX (
88 set "WINSDK8x86_PREFIX=c:\Program Files (x86)\Windows Kits\8.0\bin\"
89 )
90 ) else (
91 if /I "%1"=="VS2013" goto ToolNotInstall
92 )
93 if /I "%1"=="VS2013" goto SetWinDDK
94
95 :SetVS2015
96 if defined VS140COMNTOOLS (
97 if not defined VS2015_PREFIX (
98 set "VS2015_PREFIX=%VS140COMNTOOLS:~0,-14%"
99 )
100 if not defined WINSDK81_PREFIX (
101 set "WINSDK81_PREFIX=c:\Program Files\Windows Kits\8.1\bin\"
102 )
103 if not defined WINSDK81x86_PREFIX (
104 set "WINSDK81x86_PREFIX=c:\Program Files (x86)\Windows Kits\8.1\bin\"
105 )
106 ) else (
107 if /I "%1"=="VS2015" goto ToolNotInstall
108 )
109 if /I "%1"=="VS2015" goto SetWinDDK
110
111 :SetVS2017
112 if not defined VS150COMNTOOLS (
113 @REM clear two envs so that vcvars32.bat can run successfully.
114 set VSINSTALLDIR=
115 set VCToolsVersion=
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"
121 )
122 del vswhereInfo
123 ) else (
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"
127 )
128 del vswhereInfo
129 )
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"
135 )
136 del vswhereInfo
137 ) else (
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"
141 )
142 del vswhereInfo
143 )
144 ) else (
145 if /I "%1"=="VS2017" goto ToolNotInstall
146 goto SetWinDDK
147 )
148 )
149
150 if defined VCToolsInstallDir (
151 if not defined VS2017_PREFIX (
152 set "VS2017_PREFIX=%VCToolsInstallDir%"
153 )
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\"
161 )
162 )
163 )
164 if not defined WINSDK_PATH_FOR_RC_EXE (
165 if defined WINSDK10_PREFIX (
166 set "WINSDK_PATH_FOR_RC_EXE=%WINSDK10_PREFIX%x86"
167 )
168 )
169
170 if /I "%1"=="VS2017" goto SetWinDDK
171
172 :SetVS2019
173 if not defined VS160COMNTOOLS (
174 @REM clear two envs so that vcvars32.bat can run successfully.
175 set VSINSTALLDIR=
176 set VCToolsVersion=
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"
182 )
183 del vswhereInfo
184 ) else (
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"
188 )
189 del vswhereInfo
190 )
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"
196 )
197 del vswhereInfo
198 ) else (
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"
202 )
203 del vswhereInfo
204 )
205 ) else (
206 if /I "%1"=="VS2019" goto ToolNotInstall
207 goto SetWinDDK
208 )
209 )
210
211 if defined VCToolsInstallDir (
212 if not defined VS2019_PREFIX (
213 set "VS2019_PREFIX=%VCToolsInstallDir%"
214 )
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\"
222 )
223 )
224 )
225 if not defined WINSDK_PATH_FOR_RC_EXE (
226 if defined WINSDK10_PREFIX (
227 set "WINSDK_PATH_FOR_RC_EXE=%WINSDK10_PREFIX%x86"
228 )
229 )
230
231 if /I "%1"=="VS2019" goto SetWinDDK
232
233 :SetWinDDK
234 if not defined WINDDK3790_PREFIX (
235 set WINDDK3790_PREFIX=C:\WINDDK\3790.1830\bin\
236 )
237
238 if not defined IASL_PREFIX (
239 set IASL_PREFIX=C:\ASL\
240 )
241
242 popd