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>
This commit is contained in:
Dandan Bi
2019-06-12 11:28:46 +08:00
committed by Liming Gao
parent 541d6017e2
commit 6759212fa6
4 changed files with 144 additions and 15 deletions

View File

@@ -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
)
)