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

@@ -11,6 +11,7 @@
@echo off
pushd .
set SCRIPT_ERROR=0
@REM ##############################################################
@REM # You should not have to modify anything below this line
@@ -41,6 +42,30 @@ if /I "%1"=="/?" goto Usage
set FORCE_REBUILD=TRUE
goto loop
)
if /I "%1"=="VS2017" (
shift
set VS2017=TRUE
set VSTool=VS2017
goto loop
)
if /I "%1"=="VS2015" (
shift
set VS2015=TRUE
set VSTool=VS2015
goto loop
)
if /I "%1"=="VS2013" (
shift
set VS2013=TRUE
set VSTool=VS2013
goto loop
)
if /I "%1"=="VS2012" (
shift
set VS2012=TRUE
set VSTool=VS2012
goto loop
)
if "%1"=="" goto setup_workspace
if exist %1 (
if not defined BASE_TOOLS_PATH (
@@ -151,7 +176,27 @@ IF NOT exist "%EDK_TOOLS_PATH%\set_vsprefix_envs.bat" (
@echo.
goto end
)
call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat
if defined VS2017 (
call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat VS2017
) else if defined VS2015 (
call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat VS2015
call %EDK_TOOLS_PATH%\get_vsvars.bat VS2015
) else if defined VS2013 (
call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat VS2013
call %EDK_TOOLS_PATH%\get_vsvars.bat VS2013
) else if defined VS2012 (
call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat VS2012
call %EDK_TOOLS_PATH%\get_vsvars.bat VS2012
) else (
call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat
call %EDK_TOOLS_PATH%\get_vsvars.bat
)
if %SCRIPT_ERROR% NEQ 0 (
@echo.
@echo !!! ERROR !!! %VSTool% is not installed !!!
@echo.
goto end
)
if not defined CONF_PATH (
set CONF_PATH=%WORKSPACE%\Conf
@@ -365,7 +410,7 @@ goto end
goto end
)
)
call "%EDK_TOOLS_PATH%\get_vsvars.bat"
if not defined VCINSTALLDIR (
@echo.
@echo !!! ERROR !!!! Cannot find Visual Studio, required to build C tools !!!
@@ -399,7 +444,7 @@ goto end
:Usage
@echo.
echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [ Rebuild | ForceRebuild ] [Reconfig] [base_tools_path [edk_tools_path]]"
echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [ Rebuild | ForceRebuild ] [Reconfig] [base_tools_path [edk_tools_path]] [VS2017] [VS2015] [VS2013] [VS2012]"
@echo.
@echo base_tools_path BaseTools project path, BASE_TOOLS_PATH will be set to this path.
@echo edk_tools_path EDK_TOOLS_PATH will be set to this path.
@@ -408,11 +453,20 @@ goto end
@echo ForceRebuild If sources are available, rebuild all tools regardless of
@echo whether they have been updated or not.
@echo Reconfig Reinstall target.txt, tools_def.txt and build_rule.txt.
@echo VS2012 Set the env for VS2012 build.
@echo VS2013 Set the env for VS2013 build.
@echo VS2015 Set the env for VS2015 build.
@echo VS2017 Set the env for VS2017 build.
@echo.
:end
set REBUILD=
set FORCE_REBUILD=
set RECONFIG=
set VS2017=
set VS2015=
set VS2013=
set VS2012=
set VSTool=
popd