[edk2-devel] [PATCH] Update edksetup.bat etc. to support building BaseTools with VS2008 and VS2010

rebecca@bsdio.com posted 1 patch 4 years, 8 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/edk2 tags/patchew/20190822001713.65061-1-rebecca@bsdio.com
BaseTools/get_vsvars.bat        | 10 ++++++++--
BaseTools/set_vsprefix_envs.bat |  2 ++
BaseTools/toolsetup.bat         | 24 +++++++++++++++++++++++-
edksetup.bat                    |  6 +++++-
4 files changed, 38 insertions(+), 4 deletions(-)
[edk2-devel] [PATCH] Update edksetup.bat etc. to support building BaseTools with VS2008 and VS2010
Posted by rebecca@bsdio.com 4 years, 8 months ago
The parameter to select which version of Visual Studio to use when
building BaseTools only goes back to VS2012. Add support for VS2008 and
VS2010 and fix the code to avoid selecting a newer version if the user
has requested a specific version.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
---
 BaseTools/get_vsvars.bat        | 10 ++++++++--
 BaseTools/set_vsprefix_envs.bat |  2 ++
 BaseTools/toolsetup.bat         | 24 +++++++++++++++++++++++-
 edksetup.bat                    |  6 +++++-
 4 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/BaseTools/get_vsvars.bat b/BaseTools/get_vsvars.bat
index 9f3759b2a9..de8ba79c8b 100644
--- a/BaseTools/get_vsvars.bat
+++ b/BaseTools/get_vsvars.bat
@@ -14,6 +14,8 @@ if /I "%1"=="VS2017" goto VS2017Vars
 if /I "%1"=="VS2015" goto VS2015Vars
 if /I "%1"=="VS2013" goto VS2013Vars
 if /I "%1"=="VS2012" goto VS2012Vars
+if /I "%1"=="VS2010" goto VS2010Vars
+if /I "%1"=="VS2008" goto VS2008Vars
 
 :set_vsvars
 for /f "usebackq tokens=1* delims=: " %%i in (`%*`) do (
@@ -68,8 +70,12 @@ if defined VCINSTALLDIR goto :done
   :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%"
+  :VS2010Vars
+  if defined VS100COMNTOOLS (call :read_vsvars  "%VS100COMNTOOLS%") else (if /I "%1"=="VS2010" goto ToolNotInstall)
+
+  :VS2008Vars
+  if defined VS90COMNTOOLS  (call :read_vsvars  "%VS90COMNTOOLS%") else (if /I "%1"=="VS2008" goto ToolNotInstall)
+
   if defined VS80COMNTOOLS   call :read_vsvars  "%VS80COMNTOOLS%"
   if defined VS71COMNTOOLS   call :read_vsvars  "%VS71COMNTOOLS%"
 
diff --git a/BaseTools/set_vsprefix_envs.bat b/BaseTools/set_vsprefix_envs.bat
index 81686f5b63..9165883d95 100644
--- a/BaseTools/set_vsprefix_envs.bat
+++ b/BaseTools/set_vsprefix_envs.bat
@@ -46,6 +46,7 @@ if defined VS90COMNTOOLS (
     set "WINSDKx86_PREFIX=c:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\bin\"
   )
 )
+if /I "%1"=="VS2008" goto SetWinDDK
 
 if defined VS100COMNTOOLS (
   if not defined VS2010_PREFIX (
@@ -58,6 +59,7 @@ if defined VS100COMNTOOLS (
     set "WINSDK7x86_PREFIX=c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\"
   )
 )
+if /I "%1"=="VS2010" goto SetWinDDK
 
 :SetVS2012
 if defined VS110COMNTOOLS (
diff --git a/BaseTools/toolsetup.bat b/BaseTools/toolsetup.bat
index 395694fa09..26060c947d 100755
--- a/BaseTools/toolsetup.bat
+++ b/BaseTools/toolsetup.bat
@@ -66,6 +66,18 @@ if /I "%1"=="/?" goto Usage
     set VSTool=VS2012
     goto loop
   )
+  if /I "%1"=="VS2010" (
+    shift
+    set VS2010=TRUE
+    set VSTool=VS2010
+    goto loop
+  )
+  if /I "%1"=="VS2008" (
+    shift
+    set VS2008=TRUE
+    set VSTool=VS2008
+    goto loop
+  )
   if "%1"=="" goto setup_workspace
   if exist %1 (
     if not defined BASE_TOOLS_PATH (
@@ -187,6 +199,12 @@ if defined VS2017 (
 ) else if defined VS2012 (
   call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat VS2012
   call %EDK_TOOLS_PATH%\get_vsvars.bat VS2012
+) else if defined VS2010 (
+  call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat VS2010
+  call %EDK_TOOLS_PATH%\get_vsvars.bat VS2010
+) else if defined VS2008 (
+  call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat VS2008
+  call %EDK_TOOLS_PATH%\get_vsvars.bat VS2008
 ) else (
   call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat
   call %EDK_TOOLS_PATH%\get_vsvars.bat
@@ -444,7 +462,7 @@ goto end
 
 :Usage
   @echo.
-  echo  Usage: "%0 [-h | -help | --help | /h | /help | /?] [ Rebuild | ForceRebuild ] [Reconfig] [base_tools_path [edk_tools_path]] [VS2017] [VS2015] [VS2013] [VS2012]"
+  echo  Usage: "%0 [-h | -help | --help | /h | /help | /?] [ Rebuild | ForceRebuild ] [Reconfig] [base_tools_path [edk_tools_path]] [VS2017] [VS2015] [VS2013] [VS2012] [VS2010] [VS2008]"
   @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.
@@ -453,6 +471,8 @@ 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         VS2008            Set the env for VS2008 build.
+  @echo         VS2010            Set the env for VS2010 build.
   @echo         VS2012            Set the env for VS2012 build.
   @echo         VS2013            Set the env for VS2013 build.
   @echo         VS2015            Set the env for VS2015 build.
@@ -467,6 +487,8 @@ set VS2017=
 set VS2015=
 set VS2013=
 set VS2012=
+set VS2010=
+set VS2008=
 set VSTool=
 popd
 
diff --git a/edksetup.bat b/edksetup.bat
index 5f6028deff..fba19485bf 100755
--- a/edksetup.bat
+++ b/edksetup.bat
@@ -137,15 +137,19 @@ if /I "%1"=="VS2017" shift
 if /I "%1"=="VS2015" shift
 if /I "%1"=="VS2013" shift
 if /I "%1"=="VS2012" shift
+if /I "%1"=="VS2010" shift
+if /I "%1"=="VS2008" shift
 if "%1"=="" goto end
 
 :Usage
   @echo.
-  @echo  Usage: "%0 [-h | -help | --help | /h | /help | /?] [Reconfig] [Rebuild] [ForceRebuild] [VS2017] [VS2015] [VS2013] [VS2012]"
+  @echo  Usage: "%0 [-h | -help | --help | /h | /help | /?] [Reconfig] [Rebuild] [ForceRebuild] [VS2017] [VS2015] [VS2013] [VS2012] [VS2010] [VS2008]"
   @echo.
   @echo         Reconfig       Reinstall target.txt, tools_def.txt and build_rule.txt.
   @echo         Rebuild        Perform incremental rebuild of BaseTools binaries.
   @echo         ForceRebuild   Force a full rebuild of BaseTools binaries.
+  @echo         VS2008         Set the env for VS2008 build.
+  @echo         VS2010         Set the env for VS2010 build.
   @echo         VS2012         Set the env for VS2012 build.
   @echo         VS2013         Set the env for VS2013 build.
   @echo         VS2015         Set the env for VS2015 build.
-- 
2.22.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#46185): https://edk2.groups.io/g/devel/message/46185
Mute This Topic: https://groups.io/mt/32985108/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH] Update edksetup.bat etc. to support building BaseTools with VS2008 and VS2010
Posted by Liming Gao 4 years, 8 months ago
Rebecca:
  I am glad that you add this support. But, I want to confirm whether someone still uses VS2008 or VS2010. 

Thanks
Liming
>-----Original Message-----
>From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
>rebecca@bsdio.com
>Sent: Thursday, August 22, 2019 8:17 AM
>To: devel@edk2.groups.io; Gao, Liming <liming.gao@intel.com>; Feng, Bob C
><bob.c.feng@intel.com>
>Cc: Rebecca Cran <rebecca@bsdio.com>
>Subject: [edk2-devel] [PATCH] Update edksetup.bat etc. to support building
>BaseTools with VS2008 and VS2010
>
>The parameter to select which version of Visual Studio to use when
>building BaseTools only goes back to VS2012. Add support for VS2008 and
>VS2010 and fix the code to avoid selecting a newer version if the user
>has requested a specific version.
>
>Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
>---
> BaseTools/get_vsvars.bat        | 10 ++++++++--
> BaseTools/set_vsprefix_envs.bat |  2 ++
> BaseTools/toolsetup.bat         | 24 +++++++++++++++++++++++-
> edksetup.bat                    |  6 +++++-
> 4 files changed, 38 insertions(+), 4 deletions(-)
>
>diff --git a/BaseTools/get_vsvars.bat b/BaseTools/get_vsvars.bat
>index 9f3759b2a9..de8ba79c8b 100644
>--- a/BaseTools/get_vsvars.bat
>+++ b/BaseTools/get_vsvars.bat
>@@ -14,6 +14,8 @@ if /I "%1"=="VS2017" goto VS2017Vars
> if /I "%1"=="VS2015" goto VS2015Vars
>
> if /I "%1"=="VS2013" goto VS2013Vars
>
> if /I "%1"=="VS2012" goto VS2012Vars
>
>+if /I "%1"=="VS2010" goto VS2010Vars
>
>+if /I "%1"=="VS2008" goto VS2008Vars
>
>
>
> :set_vsvars
>
> for /f "usebackq tokens=1* delims=: " %%i in (`%*`) do (
>
>@@ -68,8 +70,12 @@ if defined VCINSTALLDIR goto :done
>   :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%"
>
>+  :VS2010Vars
>
>+  if defined VS100COMNTOOLS (call :read_vsvars  "%VS100COMNTOOLS%")
>else (if /I "%1"=="VS2010" goto ToolNotInstall)
>
>+
>
>+  :VS2008Vars
>
>+  if defined VS90COMNTOOLS  (call :read_vsvars  "%VS90COMNTOOLS%")
>else (if /I "%1"=="VS2008" goto ToolNotInstall)
>
>+
>
>   if defined VS80COMNTOOLS   call :read_vsvars  "%VS80COMNTOOLS%"
>
>   if defined VS71COMNTOOLS   call :read_vsvars  "%VS71COMNTOOLS%"
>
>
>
>diff --git a/BaseTools/set_vsprefix_envs.bat
>b/BaseTools/set_vsprefix_envs.bat
>index 81686f5b63..9165883d95 100644
>--- a/BaseTools/set_vsprefix_envs.bat
>+++ b/BaseTools/set_vsprefix_envs.bat
>@@ -46,6 +46,7 @@ if defined VS90COMNTOOLS (
>     set "WINSDKx86_PREFIX=c:\Program Files (x86)\Microsoft
>SDKs\Windows\v6.0A\bin\"
>
>   )
>
> )
>
>+if /I "%1"=="VS2008" goto SetWinDDK
>
>
>
> if defined VS100COMNTOOLS (
>
>   if not defined VS2010_PREFIX (
>
>@@ -58,6 +59,7 @@ if defined VS100COMNTOOLS (
>     set "WINSDK7x86_PREFIX=c:\Program Files (x86)\Microsoft
>SDKs\Windows\v7.0A\Bin\"
>
>   )
>
> )
>
>+if /I "%1"=="VS2010" goto SetWinDDK
>
>
>
> :SetVS2012
>
> if defined VS110COMNTOOLS (
>
>diff --git a/BaseTools/toolsetup.bat b/BaseTools/toolsetup.bat
>index 395694fa09..26060c947d 100755
>--- a/BaseTools/toolsetup.bat
>+++ b/BaseTools/toolsetup.bat
>@@ -66,6 +66,18 @@ if /I "%1"=="/?" goto Usage
>     set VSTool=VS2012
>
>     goto loop
>
>   )
>
>+  if /I "%1"=="VS2010" (
>
>+    shift
>
>+    set VS2010=TRUE
>
>+    set VSTool=VS2010
>
>+    goto loop
>
>+  )
>
>+  if /I "%1"=="VS2008" (
>
>+    shift
>
>+    set VS2008=TRUE
>
>+    set VSTool=VS2008
>
>+    goto loop
>
>+  )
>
>   if "%1"=="" goto setup_workspace
>
>   if exist %1 (
>
>     if not defined BASE_TOOLS_PATH (
>
>@@ -187,6 +199,12 @@ if defined VS2017 (
> ) else if defined VS2012 (
>
>   call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat VS2012
>
>   call %EDK_TOOLS_PATH%\get_vsvars.bat VS2012
>
>+) else if defined VS2010 (
>
>+  call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat VS2010
>
>+  call %EDK_TOOLS_PATH%\get_vsvars.bat VS2010
>
>+) else if defined VS2008 (
>
>+  call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat VS2008
>
>+  call %EDK_TOOLS_PATH%\get_vsvars.bat VS2008
>
> ) else (
>
>   call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat
>
>   call %EDK_TOOLS_PATH%\get_vsvars.bat
>
>@@ -444,7 +462,7 @@ goto end
>
>
> :Usage
>
>   @echo.
>
>-  echo  Usage: "%0 [-h | -help | --help | /h | /help | /?] [ Rebuild |
>ForceRebuild ] [Reconfig] [base_tools_path [edk_tools_path]] [VS2017]
>[VS2015] [VS2013] [VS2012]"
>
>+  echo  Usage: "%0 [-h | -help | --help | /h | /help | /?] [ Rebuild |
>ForceRebuild ] [Reconfig] [base_tools_path [edk_tools_path]] [VS2017]
>[VS2015] [VS2013] [VS2012] [VS2010] [VS2008]"
>
>   @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.
>
>@@ -453,6 +471,8 @@ 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         VS2008            Set the env for VS2008 build.
>
>+  @echo         VS2010            Set the env for VS2010 build.
>
>   @echo         VS2012            Set the env for VS2012 build.
>
>   @echo         VS2013            Set the env for VS2013 build.
>
>   @echo         VS2015            Set the env for VS2015 build.
>
>@@ -467,6 +487,8 @@ set VS2017=
> set VS2015=
>
> set VS2013=
>
> set VS2012=
>
>+set VS2010=
>
>+set VS2008=
>
> set VSTool=
>
> popd
>
>
>
>diff --git a/edksetup.bat b/edksetup.bat
>index 5f6028deff..fba19485bf 100755
>--- a/edksetup.bat
>+++ b/edksetup.bat
>@@ -137,15 +137,19 @@ if /I "%1"=="VS2017" shift
> if /I "%1"=="VS2015" shift
>
> if /I "%1"=="VS2013" shift
>
> if /I "%1"=="VS2012" shift
>
>+if /I "%1"=="VS2010" shift
>
>+if /I "%1"=="VS2008" shift
>
> if "%1"=="" goto end
>
>
>
> :Usage
>
>   @echo.
>
>-  @echo  Usage: "%0 [-h | -help | --help | /h | /help | /?] [Reconfig] [Rebuild]
>[ForceRebuild] [VS2017] [VS2015] [VS2013] [VS2012]"
>
>+  @echo  Usage: "%0 [-h | -help | --help | /h | /help | /?] [Reconfig] [Rebuild]
>[ForceRebuild] [VS2017] [VS2015] [VS2013] [VS2012] [VS2010] [VS2008]"
>
>   @echo.
>
>   @echo         Reconfig       Reinstall target.txt, tools_def.txt and build_rule.txt.
>
>   @echo         Rebuild        Perform incremental rebuild of BaseTools binaries.
>
>   @echo         ForceRebuild   Force a full rebuild of BaseTools binaries.
>
>+  @echo         VS2008         Set the env for VS2008 build.
>
>+  @echo         VS2010         Set the env for VS2010 build.
>
>   @echo         VS2012         Set the env for VS2012 build.
>
>   @echo         VS2013         Set the env for VS2013 build.
>
>   @echo         VS2015         Set the env for VS2015 build.
>
>--
>2.22.1
>
>
>-=-=-=-=-=-=
>Groups.io Links: You receive all messages sent to this group.
>
>View/Reply Online (#46185): https://edk2.groups.io/g/devel/message/46185
>Mute This Topic: https://groups.io/mt/32985108/1759384
>Group Owner: devel+owner@edk2.groups.io
>Unsubscribe: https://edk2.groups.io/g/devel/unsub  [liming.gao@intel.com]
>-=-=-=-=-=-=


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#46190): https://edk2.groups.io/g/devel/message/46190
Mute This Topic: https://groups.io/mt/32985108/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-