public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Michael D Kinney" <michael.d.kinney@intel.com>
To: devel@edk2.groups.io
Cc: Sean Brogan <sean.brogan@microsoft.com>,
	Bob Feng <bob.c.feng@intel.com>,
	Liming Gao <liming.gao@intel.com>
Subject: [Patch 3/4] BaseTools/WindowsVsToolChain: Setup VS2017/VS2019 env
Date: Thu,  6 Feb 2020 15:07:14 -0800	[thread overview]
Message-ID: <20200206230715.15564-4-michael.d.kinney@intel.com> (raw)
In-Reply-To: <20200206230715.15564-1-michael.d.kinney@intel.com>

From: Sean Brogan <sean.brogan@microsoft.com>

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>
---
 .../WindowsVsToolChain/WindowsVsToolChain.py  | 23 +++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/BaseTools/Plugin/WindowsVsToolChain/WindowsVsToolChain.py b/BaseTools/Plugin/WindowsVsToolChain/WindowsVsToolChain.py
index a8202e5992..e3c4cc94a3 100644
--- a/BaseTools/Plugin/WindowsVsToolChain/WindowsVsToolChain.py
+++ b/BaseTools/Plugin/WindowsVsToolChain/WindowsVsToolChain.py
@@ -21,6 +21,9 @@ class WindowsVsToolChain(IUefiBuildPlugin):
 
     def do_pre_build(self, thebuilder):
         self.Logger = logging.getLogger("WindowsVsToolChain")
+        interesting_keys = ["ExtensionSdkDir", "INCLUDE", "LIB", "LIBPATH", "UniversalCRTSdkDir",
+                            "UCRTVersion", "WindowsLibPath", "WindowsSdkBinPath", "WindowsSdkDir", "WindowsSdkVerBinPath",
+                            "WindowsSDKVersion", "VCToolsInstallDir", "Path"]
 
 #
         # VS2017 - Follow VS2017 where there is potential for many versions of the tools.
@@ -52,6 +55,16 @@ class WindowsVsToolChain(IUefiBuildPlugin):
                 prefix = prefix + os.path.sep
                 shell_environment.GetEnvironment().set_shell_var("VS2017_PREFIX", prefix)
 
+                shell_env = shell_environment.GetEnvironment()
+                # Use the tools lib to determine the correct values for the vars that interest us.
+                vs_vars = locate_tools.QueryVcVariables(
+                    interesting_keys, "amd64", vs_version="vs2017")
+                for (k, v) in vs_vars.items():
+                    if k.upper() == "PATH":
+                        shell_env.insert_path(v)
+                    else:
+                        shell_env.set_shell_var(k, v)
+
             # now confirm it exists
             if not os.path.exists(shell_environment.GetEnvironment().get_shell_var("VS2017_PREFIX")):
                 self.Logger.error("Path for VS2017 toolchain is invalid")
@@ -87,6 +100,16 @@ class WindowsVsToolChain(IUefiBuildPlugin):
                 prefix = prefix + os.path.sep
                 shell_environment.GetEnvironment().set_shell_var("VS2019_PREFIX", prefix)
 
+                shell_env = shell_environment.GetEnvironment()
+                # Use the tools lib to determine the correct values for the vars that interest us.
+                vs_vars = locate_tools.QueryVcVariables(
+                    interesting_keys, "amd64", vs_version="vs2019")
+                for (k, v) in vs_vars.items():
+                    if k.upper() == "PATH":
+                        shell_env.insert_path(v)
+                    else:
+                        shell_env.set_shell_var(k, v)
+
             # now confirm it exists
             if not os.path.exists(shell_environment.GetEnvironment().get_shell_var("VS2019_PREFIX")):
                 self.Logger.error("Path for VS2019 toolchain is invalid")
-- 
2.21.0.windows.1


  parent reply	other threads:[~2020-02-06 23:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-06 23:07 [Patch 0/4] Fix Structured PCD Application CI build issues Michael D Kinney
2020-02-06 23:07 ` [Patch 1/4] BaseTools/Build: Do not use Common.lib in Structured PCD app Michael D Kinney
2020-02-07  3:43   ` Bob Feng
2020-02-06 23:07 ` [Patch 2/4] BaseTools/PcdValueCommon: Fix 64-bit host compiler error Michael D Kinney
2020-02-07  2:47   ` Bob Feng
2020-02-06 23:07 ` Michael D Kinney [this message]
2020-02-07  3:32   ` [Patch 3/4] BaseTools/WindowsVsToolChain: Setup VS2017/VS2019 env Bob Feng
2020-02-06 23:07 ` [Patch 4/4] BaseTools/WindowsVsToolChain: Clean up Python source formatting Michael D Kinney
2020-02-07  3:28   ` Bob Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200206230715.15564-4-michael.d.kinney@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox