diff options
author | Dandan Bi <dandan.bi@intel.com> | 2019-06-12 11:28:46 +0800 |
---|---|---|
committer | Liming Gao <liming.gao@intel.com> | 2019-06-28 15:04:42 +0800 |
commit | 6759212fa69d5d266c2854ea6de44bfd3f7e370b (patch) | |
tree | 780f1255422bc89603fc4f2dbdc293b9def0bf7b /BaseTools/set_vsprefix_envs.bat | |
parent | 541d6017e2d1f3a3a9e016c0ce03704e57f7ceb1 (diff) | |
download | edk2-6759212fa69d5d266c2854ea6de44bfd3f7e370b.zip edk2-6759212fa69d5d266c2854ea6de44bfd3f7e370b.tar.gz edk2-6759212fa69d5d266c2854ea6de44bfd3f7e370b.tar.bz2 |
Edk2Setup: Support different VS tool chain setup
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1693
This patch is to update edksetup with additional option:
VS2017 VS2015 VS2013 VS2012 to setup different VS environment.
And will report error if the specified VS tool is not installed.
For VS2017, also consider the case that only VS2017 build tool
is installed.
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/set_vsprefix_envs.bat')
-rw-r--r-- | BaseTools/set_vsprefix_envs.bat | 47 |
1 files changed, 42 insertions, 5 deletions
diff --git a/BaseTools/set_vsprefix_envs.bat b/BaseTools/set_vsprefix_envs.bat index 95f30f7..81686f5 100644 --- a/BaseTools/set_vsprefix_envs.bat +++ b/BaseTools/set_vsprefix_envs.bat @@ -10,6 +10,18 @@ @echo off
pushd .
+set SCRIPT_ERROR=0
+goto main
+
+:ToolNotInstall
+set SCRIPT_ERROR=1
+goto :EOF
+
+:main
+if /I "%1"=="VS2017" goto SetVS2017
+if /I "%1"=="VS2015" goto SetVS2015
+if /I "%1"=="VS2013" goto SetVS2013
+if /I "%1"=="VS2012" goto SetVS2012
if defined VS71COMNTOOLS (
if not defined VS2003_PREFIX (
@@ -47,6 +59,7 @@ if defined VS100COMNTOOLS ( )
)
+:SetVS2012
if defined VS110COMNTOOLS (
if not defined VS2012_PREFIX (
set "VS2012_PREFIX=%VS110COMNTOOLS:~0,-14%"
@@ -57,8 +70,12 @@ if defined VS110COMNTOOLS ( if not defined WINSDK71x86_PREFIX (
set "WINSDK71x86_PREFIX=c:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\"
)
+) else (
+ if /I "%1"=="VS2012" goto ToolNotInstall
)
+if /I "%1"=="VS2012" goto SetWinDDK
+:SetVS2013
if defined VS120COMNTOOLS (
if not defined VS2013_PREFIX (
set "VS2013_PREFIX=%VS120COMNTOOLS:~0,-14%"
@@ -69,8 +86,12 @@ if defined VS120COMNTOOLS ( if not defined WINSDK8x86_PREFIX (
set "WINSDK8x86_PREFIX=c:\Program Files (x86)\Windows Kits\8.0\bin\"
)
+) else (
+ if /I "%1"=="VS2013" goto ToolNotInstall
)
+if /I "%1"=="VS2013" goto SetWinDDK
+:SetVS2015
if defined VS140COMNTOOLS (
if not defined VS2015_PREFIX (
set "VS2015_PREFIX=%VS140COMNTOOLS:~0,-14%"
@@ -81,19 +102,35 @@ if defined VS140COMNTOOLS ( if not defined WINSDK81x86_PREFIX (
set "WINSDK81x86_PREFIX=c:\Program Files (x86)\Windows Kits\8.1\bin\"
)
+) else (
+ if /I "%1"=="VS2015" goto ToolNotInstall
)
+if /I "%1"=="VS2015" goto SetWinDDK
-@REM set VS2017
+:SetVS2017
if not defined VS150COMNTOOLS (
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
- for /f "usebackq tokens=1* delims=: " %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"`) do (
- if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
+ if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools" (
+ for /f "usebackq tokens=1* delims=: " %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools`) do (
+ if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
+ )
+ ) else (
+ for /f "usebackq tokens=1* delims=: " %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"`) do (
+ if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
+ )
)
) else if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" (
- for /f "usebackq tokens=1* delims=: " %%i in (`"%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"`) do (
- if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
+ if exist "%ProgramFiles%\Microsoft Visual Studio\2017\BuildTools" (
+ for /f "usebackq tokens=1* delims=: " %%i in (`"%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools`) do (
+ if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
+ )
+ ) else (
+ for /f "usebackq tokens=1* delims=: " %%i in (`"%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"`) do (
+ if /i "%%i"=="installationPath" call "%%j\VC\Auxiliary\Build\vcvars32.bat"
+ )
)
) else (
+ if /I "%1"=="VS2017" goto ToolNotInstall
goto SetWinDDK
)
)
|