]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/set_vsprefix_envs.bat
81686f5b63ad0dd836757e7e455a58a2cd98b46d
[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-2017, 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"=="VS2017" goto SetVS2017
22 if /I "%1"=="VS2015" goto SetVS2015
23 if /I "%1"=="VS2013" goto SetVS2013
24 if /I "%1"=="VS2012" goto SetVS2012
25
26 if defined VS71COMNTOOLS (
27 if not defined VS2003_PREFIX (
28 set "VS2003_PREFIX=%VS71COMNTOOLS:~0,-14%"
29 )
30 )
31
32 if defined VS80COMNTOOLS (
33 if not defined VS2005_PREFIX (
34 set "VS2005_PREFIX=%VS80COMNTOOLS:~0,-14%"
35 )
36 )
37
38 if defined VS90COMNTOOLS (
39 if not defined VS2008_PREFIX (
40 set "VS2008_PREFIX=%VS90COMNTOOLS:~0,-14%"
41 )
42 if not defined WINSDK_PREFIX (
43 set "WINSDK_PREFIX=c:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\"
44 )
45 if not defined WINSDKx86_PREFIX (
46 set "WINSDKx86_PREFIX=c:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\bin\"
47 )
48 )
49
50 if defined VS100COMNTOOLS (
51 if not defined VS2010_PREFIX (
52 set "VS2010_PREFIX=%VS100COMNTOOLS:~0,-14%"
53 )
54 if not defined WINSDK7_PREFIX (
55 set "WINSDK7_PREFIX=c:\Program Files\Microsoft SDKs\Windows\v7.0A\Bin\"
56 )
57 if not defined WINSDK7x86_PREFIX (
58 set "WINSDK7x86_PREFIX=c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\"
59 )
60 )
61
62 :SetVS2012
63 if defined VS110COMNTOOLS (
64 if not defined VS2012_PREFIX (
65 set "VS2012_PREFIX=%VS110COMNTOOLS:~0,-14%"
66 )
67 if not defined WINSDK71_PREFIX (
68 set "WINSDK71_PREFIX=c:\Program Files\Microsoft SDKs\Windows\v7.1A\Bin\"
69 )
70 if not defined WINSDK71x86_PREFIX (
71 set "WINSDK71x86_PREFIX=c:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\"
72 )
73 ) else (
74 if /I "%1"=="VS2012" goto ToolNotInstall
75 )
76 if /I "%1"=="VS2012" goto SetWinDDK
77
78 :SetVS2013
79 if defined VS120COMNTOOLS (
80 if not defined VS2013_PREFIX (
81 set "VS2013_PREFIX=%VS120COMNTOOLS:~0,-14%"
82 )
83 if not defined WINSDK8_PREFIX (
84 set "WINSDK8_PREFIX=c:\Program Files\Windows Kits\8.0\bin\"
85 )
86 if not defined WINSDK8x86_PREFIX (
87 set "WINSDK8x86_PREFIX=c:\Program Files (x86)\Windows Kits\8.0\bin\"
88 )
89 ) else (
90 if /I "%1"=="VS2013" goto ToolNotInstall
91 )
92 if /I "%1"=="VS2013" goto SetWinDDK
93
94 :SetVS2015
95 if defined VS140COMNTOOLS (
96 if not defined VS2015_PREFIX (
97 set "VS2015_PREFIX=%VS140COMNTOOLS:~0,-14%"
98 )
99 if not defined WINSDK81_PREFIX (
100 set "WINSDK81_PREFIX=c:\Program Files\Windows Kits\8.1\bin\"
101 )
102 if not defined WINSDK81x86_PREFIX (
103 set "WINSDK81x86_PREFIX=c:\Program Files (x86)\Windows Kits\8.1\bin\"
104 )
105 ) else (
106 if /I "%1"=="VS2015" goto ToolNotInstall
107 )
108 if /I "%1"=="VS2015" goto SetWinDDK
109
110 :SetVS2017
111 if not defined VS150COMNTOOLS (
112 if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
113 if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools" (
114 for /f "usebackq tokens=1* delims=: " %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools`) do (
115 if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
116 )
117 ) else (
118 for /f "usebackq tokens=1* delims=: " %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"`) do (
119 if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
120 )
121 )
122 ) else if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" (
123 if exist "%ProgramFiles%\Microsoft Visual Studio\2017\BuildTools" (
124 for /f "usebackq tokens=1* delims=: " %%i in (`"%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools`) do (
125 if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
126 )
127 ) else (
128 for /f "usebackq tokens=1* delims=: " %%i in (`"%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"`) do (
129 if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
130 )
131 )
132 ) else (
133 if /I "%1"=="VS2017" goto ToolNotInstall
134 goto SetWinDDK
135 )
136 )
137
138 if defined VCToolsInstallDir (
139 if not defined VS2017_PREFIX (
140 set "VS2017_PREFIX=%VCToolsInstallDir%"
141 )
142 )
143 if not defined WINSDK10_PREFIX (
144 if defined WindowsSdkVerBinPath (
145 set "WINSDK10_PREFIX=%WindowsSdkVerBinPath%"
146 ) else if exist "%ProgramFiles(x86)%\Windows Kits\10\bin" (
147 set "WINSDK10_PREFIX=%ProgramFiles(x86)%\Windows Kits\10\bin\"
148 ) else if exist "%ProgramFiles%\Windows Kits\10\bin" (
149 set "WINSDK10_PREFIX=%ProgramFiles%\Windows Kits\10\bin\"
150 )
151 )
152
153 :SetWinDDK
154 if not defined WINDDK3790_PREFIX (
155 set WINDDK3790_PREFIX=C:\WINDDK\3790.1830\bin\
156 )
157
158 if not defined IASL_PREFIX (
159 set IASL_PREFIX=C:\ASL\
160 )
161
162 popd