Index: build/toolchain/win/setup_toolchain.py |
diff --git a/build/toolchain/win/setup_toolchain.py b/build/toolchain/win/setup_toolchain.py |
index bceafd121be44b6c0c2271ea8c40462937493fd7..19f73b4d19e06660bcf6877c94b2d7579a36c820 100644 |
--- a/build/toolchain/win/setup_toolchain.py |
+++ b/build/toolchain/win/setup_toolchain.py |
@@ -23,17 +23,18 @@ def ExtractImportantEnvironment(): |
"""Extracts environment variables required for the toolchain from the |
current environment.""" |
envvars_to_save = ( |
- 'goma_.*', # TODO(scottmg): This is ugly, but needed for goma. |
- 'Path', |
- 'PATHEXT', |
- 'SystemRoot', |
- 'TEMP', |
- 'TMP', |
+ 'goma_.*', # TODO(scottmg): This is ugly, but needed for goma. |
+ 'path', |
+ 'pathext', |
+ 'systemroot', |
+ 'temp', |
+ 'tmp', |
) |
result = {} |
for envvar in envvars_to_save: |
if envvar in os.environ: |
- if envvar == 'Path': |
+ envvar = envvar.lower() |
+ if envvar == 'path': |
# Our own rules (for running gyp-win-tool) and other actions in |
# Chromium rely on python being in the path. Add the path to this |
# python here so that if it's not in the path when ninja is run |
@@ -74,11 +75,13 @@ def CopyTool(source_path): |
'# Generated by setup_toolchain.py do not edit.\n'] |
+ tool_source[1:])) |
-if len(sys.argv) != 3: |
- print 'Usage setup_toolchain.py <visual studio path> <win tool path>' |
+if len(sys.argv) != 4: |
+ print('Usage setup_toolchain.py ' |
+ '<visual studio path> <win tool path> <win sdk path>') |
sys.exit(2) |
vs_path = sys.argv[1] |
tool_source = sys.argv[2] |
+win_sdk_path = sys.argv[3] |
CopyTool(tool_source) |
@@ -86,14 +89,18 @@ important_env_vars = ExtractImportantEnvironment() |
path = important_env_vars["PATH"].split(";") |
# Add 32-bit compiler path to the beginning and write the block. |
-path32 = [os.path.join(vs_path, "VC\\BIN")] + path |
+path32 = [os.path.join(vs_path, "VC\\BIN")] + \ |
+ [os.path.join(win_sdk_path, "bin\\x86")] + \ |
+ path |
important_env_vars["PATH"] = ";".join(path32) |
environ = FormatAsEnvironmentBlock(important_env_vars) |
with open('environment.x86', 'wb') as env_file: |
env_file.write(environ) |
# Add 64-bit compiler path to the beginning and write the block. |
-path64 = [os.path.join(vs_path, "VC\\BIN\\amd64")] + path |
+path64 = [os.path.join(vs_path, "VC\\BIN\\amd64")] + \ |
+ [os.path.join(win_sdk_path, "bin\\x64")] + \ |
+ path |
important_env_vars["PATH"] = ";".join(path64) |
environ = FormatAsEnvironmentBlock(important_env_vars) |
with open('environment.x64', 'wb') as env_file: |