summaryrefslogtreecommitdiffstats
path: root/BaseTools/get_vsvars.bat
diff options
context:
space:
mode:
authorDandan Bi <dandan.bi@intel.com>2019-06-12 11:28:46 +0800
committerLiming Gao <liming.gao@intel.com>2019-06-28 15:04:42 +0800
commit6759212fa69d5d266c2854ea6de44bfd3f7e370b (patch)
tree780f1255422bc89603fc4f2dbdc293b9def0bf7b /BaseTools/get_vsvars.bat
parent541d6017e2d1f3a3a9e016c0ce03704e57f7ceb1 (diff)
downloadedk2-6759212fa69d5d266c2854ea6de44bfd3f7e370b.tar.gz
edk2-6759212fa69d5d266c2854ea6de44bfd3f7e370b.tar.bz2
edk2-6759212fa69d5d266c2854ea6de44bfd3f7e370b.zip
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/get_vsvars.bat')
-rw-r--r--BaseTools/get_vsvars.bat42
1 files changed, 36 insertions, 6 deletions
diff --git a/BaseTools/get_vsvars.bat b/BaseTools/get_vsvars.bat
index 9b5e9d24fc..9f3759b2a9 100644
--- a/BaseTools/get_vsvars.bat
+++ b/BaseTools/get_vsvars.bat
@@ -8,7 +8,12 @@
@echo off
-goto :main
+set SCRIPT_ERROR=0
+if "%1"=="" goto main
+if /I "%1"=="VS2017" goto VS2017Vars
+if /I "%1"=="VS2015" goto VS2015Vars
+if /I "%1"=="VS2013" goto VS2013Vars
+if /I "%1"=="VS2012" goto VS2012Vars
:set_vsvars
for /f "usebackq tokens=1* delims=: " %%i in (`%*`) do (
@@ -26,6 +31,10 @@ if defined VCINSTALLDIR goto :EOF
goto :EOF
+:ToolNotInstall
+set SCRIPT_ERROR=1
+goto :EOF
+
REM NOTE: This file will find the most recent Visual Studio installation
REM apparent from the environment.
REM To use an older version, modify your environment set up.
@@ -33,11 +42,32 @@ REM (Or invoke the relevant vsvars32 file beforehand).
:main
if defined VCINSTALLDIR goto :done
- if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" call :set_vsvars "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
- if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" call :set_vsvars "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"
- if defined VS140COMNTOOLS call :read_vsvars "%VS140COMNTOOLS%"
- if defined VS120COMNTOOLS call :read_vsvars "%VS120COMNTOOLS%"
- if defined VS110COMNTOOLS call :read_vsvars "%VS110COMNTOOLS%"
+ :VS2017Vars
+ if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
+ if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools" (
+ call :set_vsvars "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools
+ ) else (
+ call :set_vsvars "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
+ )
+ )
+ if exist "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" (
+ if exist "%ProgramFiles%\Microsoft Visual Studio\2017\BuildTools" (
+ call :set_vsvars "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools
+ ) else (
+ call :set_vsvars "%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe"
+ )
+ )
+ if /I "%1"=="VS2017" goto ToolNotInstall
+
+ :VS2015Vars
+ if defined VS140COMNTOOLS (call :read_vsvars "%VS140COMNTOOLS%") else (if /I "%1"=="VS2015" goto ToolNotInstall)
+
+ :VS2013Vars
+ if defined VS120COMNTOOLS ( call :read_vsvars "%VS120COMNTOOLS%") else (if /I "%1"=="VS2013" goto ToolNotInstall)
+
+ :VS2012Vars
+ if defined VS110COMNTOOLS (call :read_vsvars "%VS110COMNTOOLS%") else (if /I "%1"=="VS2012" goto ToolNotInstall)
+
if defined VS100COMNTOOLS call :read_vsvars "%VS100COMNTOOLS%"
if defined VS90COMNTOOLS call :read_vsvars "%VS90COMNTOOLS%"
if defined VS80COMNTOOLS call :read_vsvars "%VS80COMNTOOLS%"