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 |
|
---|
25 | if defined VS71COMNTOOLS (
|
---|
26 | if not defined VS2003_PREFIX (
|
---|
27 | set "VS2003_PREFIX=%VS71COMNTOOLS:~0,-14%"
|
---|
28 | )
|
---|
29 | )
|
---|
30 |
|
---|
31 | :SetVS2015
|
---|
32 | if defined VS140COMNTOOLS (
|
---|
33 | if not defined VS2015_PREFIX (
|
---|
34 | set "VS2015_PREFIX=%VS140COMNTOOLS:~0,-14%"
|
---|
35 | )
|
---|
36 | if not defined WINSDK81_PREFIX (
|
---|
37 | set "WINSDK81_PREFIX=c:\Program Files\Windows Kits\8.1\bin\"
|
---|
38 | )
|
---|
39 | if not defined WINSDK81x86_PREFIX (
|
---|
40 | set "WINSDK81x86_PREFIX=c:\Program Files (x86)\Windows Kits\8.1\bin\"
|
---|
41 | )
|
---|
42 | ) else (
|
---|
43 | if /I "%1"=="VS2015" goto ToolNotInstall
|
---|
44 | )
|
---|
45 | if /I "%1"=="VS2015" goto SetWinDDK
|
---|
46 |
|
---|
47 | :SetVS2017
|
---|
48 | if not defined VS150COMNTOOLS (
|
---|
49 | @REM clear two envs so that vcvars32.bat can run successfully.
|
---|
50 | set VSINSTALLDIR=
|
---|
51 | set VCToolsVersion=
|
---|
52 | if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
|
---|
53 | if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools" (
|
---|
54 | call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 15,16 > vswhereInfo
|
---|
55 | for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
---|
56 | if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
---|
57 | )
|
---|
58 | del vswhereInfo
|
---|
59 | ) else (
|
---|
60 | call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version 15,16 > vswhereInfo
|
---|
61 | for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
---|
62 | if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
---|
63 | )
|
---|
64 | del vswhereInfo
|
---|
65 | )
|
---|
66 | ) else if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" (
|
---|
67 | if exist "%ProgramFiles%\Microsoft Visual Studio\2017\BuildTools" (
|
---|
68 | call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 15,16 > vswhereInfo
|
---|
69 | for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
---|
70 | if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
---|
71 | )
|
---|
72 | del vswhereInfo
|
---|
73 | ) else (
|
---|
74 | call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -version 15,16 > vswhereInfo
|
---|
75 | for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
---|
76 | if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
---|
77 | )
|
---|
78 | del vswhereInfo
|
---|
79 | )
|
---|
80 | ) else (
|
---|
81 | if /I "%1"=="VS2017" goto ToolNotInstall
|
---|
82 | goto SetWinDDK
|
---|
83 | )
|
---|
84 | )
|
---|
85 |
|
---|
86 | if defined VCToolsInstallDir (
|
---|
87 | if not defined VS2017_PREFIX (
|
---|
88 | set "VS2017_PREFIX=%VCToolsInstallDir%"
|
---|
89 | )
|
---|
90 | if not defined WINSDK10_PREFIX (
|
---|
91 | if defined WindowsSdkVerBinPath (
|
---|
92 | set "WINSDK10_PREFIX=%WindowsSdkVerBinPath%"
|
---|
93 | ) else if exist "%ProgramFiles(x86)%\Windows Kits\10\bin" (
|
---|
94 | set "WINSDK10_PREFIX=%ProgramFiles(x86)%\Windows Kits\10\bin\"
|
---|
95 | ) else if exist "%ProgramFiles%\Windows Kits\10\bin" (
|
---|
96 | set "WINSDK10_PREFIX=%ProgramFiles%\Windows Kits\10\bin\"
|
---|
97 | )
|
---|
98 | )
|
---|
99 | )
|
---|
100 | if not defined WINSDK_PATH_FOR_RC_EXE (
|
---|
101 | if defined WINSDK10_PREFIX (
|
---|
102 | set "WINSDK_PATH_FOR_RC_EXE=%WINSDK10_PREFIX%x86"
|
---|
103 | )
|
---|
104 | )
|
---|
105 |
|
---|
106 | if /I "%1"=="VS2017" goto SetWinDDK
|
---|
107 |
|
---|
108 | :SetVS2019
|
---|
109 | if not defined VS160COMNTOOLS (
|
---|
110 | @REM clear two envs so that vcvars32.bat can run successfully.
|
---|
111 | set VSINSTALLDIR=
|
---|
112 | set VCToolsVersion=
|
---|
113 | if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
|
---|
114 | if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools" (
|
---|
115 | call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 16,17 > vswhereInfo
|
---|
116 | for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
---|
117 | if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
---|
118 | )
|
---|
119 | del vswhereInfo
|
---|
120 | ) else (
|
---|
121 | call "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version 16,17 > vswhereInfo
|
---|
122 | for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
---|
123 | if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
---|
124 | )
|
---|
125 | del vswhereInfo
|
---|
126 | )
|
---|
127 | ) else if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" (
|
---|
128 | if exist "%ProgramFiles%\Microsoft Visual Studio\2019\BuildTools" (
|
---|
129 | call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version 16,17 > vswhereInfo
|
---|
130 | for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
---|
131 | if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
---|
132 | )
|
---|
133 | del vswhereInfo
|
---|
134 | ) else (
|
---|
135 | call "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -version 16,17 > vswhereInfo
|
---|
136 | for /f "usebackq tokens=1* delims=: " %%i in (vswhereInfo) do (
|
---|
137 | if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
|
---|
138 | )
|
---|
139 | del vswhereInfo
|
---|
140 | )
|
---|
141 | ) else (
|
---|
142 | if /I "%1"=="VS2019" goto ToolNotInstall
|
---|
143 | goto SetWinDDK
|
---|
144 | )
|
---|
145 | )
|
---|
146 |
|
---|
147 | if defined VCToolsInstallDir (
|
---|
148 | if not defined VS2019_PREFIX (
|
---|
149 | set "VS2019_PREFIX=%VCToolsInstallDir%"
|
---|
150 | )
|
---|
151 | if not defined WINSDK10_PREFIX (
|
---|
152 | if defined WindowsSdkVerBinPath (
|
---|
153 | set "WINSDK10_PREFIX=%WindowsSdkVerBinPath%"
|
---|
154 | ) else if exist "%ProgramFiles(x86)%\Windows Kits\10\bin" (
|
---|
155 | set "WINSDK10_PREFIX=%ProgramFiles(x86)%\Windows Kits\10\bin\"
|
---|
156 | ) else if exist "%ProgramFiles%\Windows Kits\10\bin" (
|
---|
157 | set "WINSDK10_PREFIX=%ProgramFiles%\Windows Kits\10\bin\"
|
---|
158 | )
|
---|
159 | )
|
---|
160 | )
|
---|
161 | if not defined WINSDK_PATH_FOR_RC_EXE (
|
---|
162 | if defined WINSDK10_PREFIX (
|
---|
163 | set "WINSDK_PATH_FOR_RC_EXE=%WINSDK10_PREFIX%x86"
|
---|
164 | )
|
---|
165 | )
|
---|
166 |
|
---|
167 | if /I "%1"=="VS2019" goto SetWinDDK
|
---|
168 |
|
---|
169 | :SetWinDDK
|
---|
170 | if not defined WINDDK3790_PREFIX (
|
---|
171 | set WINDDK3790_PREFIX=C:\WINDDK\3790.1830\bin\
|
---|
172 | )
|
---|
173 |
|
---|
174 | if not defined IASL_PREFIX (
|
---|
175 | set IASL_PREFIX=C:\ASL\
|
---|
176 | )
|
---|
177 |
|
---|
178 | popd
|
---|