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