]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools/WindowsVsToolChain: Setup VS2017/VS2019 env
authorSean Brogan <sean.brogan@microsoft.com>
Thu, 6 Feb 2020 23:07:14 +0000 (07:07 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 7 Feb 2020 07:04:16 +0000 (07:04 +0000)
https://bugzilla.tianocore.org/show_bug.cgi?id=2495

Update the WindowsVsToolChain plugin to setup the VS2017
or VS2019 development environment.  This is required to
build BaseTools and Structured PCD host applications.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
BaseTools/Plugin/WindowsVsToolChain/WindowsVsToolChain.py

index bcb0648c855c2e497885f10c019f5be50a032d78..c9279e1c75b5f55a7cd960d6c6bf4a7b98ba6a39 100644 (file)
@@ -22,6 +22,9 @@ class WindowsVsToolChain(IUefiBuildPlugin):
 \r
     def do_pre_build(self, thebuilder):\r
         self.Logger = logging.getLogger("WindowsVsToolChain")\r
+        interesting_keys = ["ExtensionSdkDir", "INCLUDE", "LIB", "LIBPATH", "UniversalCRTSdkDir",\r
+                            "UCRTVersion", "WindowsLibPath", "WindowsSdkBinPath", "WindowsSdkDir", "WindowsSdkVerBinPath",\r
+                            "WindowsSDKVersion", "VCToolsInstallDir", "Path"]\r
 \r
 #\r
         # VS2017 - Follow VS2017 where there is potential for many versions of the tools.\r
@@ -56,6 +59,16 @@ class WindowsVsToolChain(IUefiBuildPlugin):
                 prefix = prefix + os.path.sep\r
                 shell_environment.GetEnvironment().set_shell_var("VS2017_PREFIX", prefix)\r
 \r
+                shell_env = shell_environment.GetEnvironment()\r
+                # Use the tools lib to determine the correct values for the vars that interest us.\r
+                vs_vars = locate_tools.QueryVcVariables(\r
+                    interesting_keys, "amd64", vs_version="vs2017")\r
+                for (k, v) in vs_vars.items():\r
+                    if k.upper() == "PATH":\r
+                        shell_env.insert_path(v)\r
+                    else:\r
+                        shell_env.set_shell_var(k, v)\r
+\r
             # now confirm it exists\r
             if not os.path.exists(shell_environment.GetEnvironment().get_shell_var("VS2017_PREFIX")):\r
                 self.Logger.error("Path for VS2017 toolchain is invalid")\r
@@ -94,6 +107,16 @@ class WindowsVsToolChain(IUefiBuildPlugin):
                 prefix = prefix + os.path.sep\r
                 shell_environment.GetEnvironment().set_shell_var("VS2019_PREFIX", prefix)\r
 \r
+                shell_env = shell_environment.GetEnvironment()\r
+                # Use the tools lib to determine the correct values for the vars that interest us.\r
+                vs_vars = locate_tools.QueryVcVariables(\r
+                    interesting_keys, "amd64", vs_version="vs2019")\r
+                for (k, v) in vs_vars.items():\r
+                    if k.upper() == "PATH":\r
+                        shell_env.insert_path(v)\r
+                    else:\r
+                        shell_env.set_shell_var(k, v)\r
+\r
             # now confirm it exists\r
             if not os.path.exists(shell_environment.GetEnvironment().get_shell_var("VS2019_PREFIX")):\r
                 self.Logger.error("Path for VS2019 toolchain is invalid")\r