Index: build/toolchain/win/setup_toolchain.py |
diff --git a/build/toolchain/win/setup_toolchain.py b/build/toolchain/win/setup_toolchain.py |
index 42c3af1b6cd7e65d3e0641d680ecc9162952cbe1..7645ba79cf485a93773ec1c08248b31e86b732fd 100644 |
--- a/build/toolchain/win/setup_toolchain.py |
+++ b/build/toolchain/win/setup_toolchain.py |
@@ -53,7 +53,7 @@ def _ExtractImportantEnvironment(output_of_set): |
return env |
-def _SetupScript(target_arch, sdk_dir): |
+def _SetupScript(target_arch, sdk_dir, vc_bin_subdir): |
"""Returns a command (with arguments) to be used to set up the |
environment.""" |
# Check if we are running in the SDK command line environment and use |
@@ -68,7 +68,7 @@ def _SetupScript(target_arch, sdk_dir): |
# TODO(scottmg|dpranke): Non-depot_tools toolchain: need to get Visual |
# Studio install location from registry. |
return [os.path.normpath(os.path.join(FIND_VS_IN_REG, 'VC/vcvarsall.bat')), |
- 'amd64_x86' if target_arch == 'x86' else 'amd64'] |
+ vc_bin_subdir] |
def _FormatAsEnvironmentBlock(envvar_dict): |
@@ -98,23 +98,28 @@ def _CopyTool(source_path): |
def main(): |
- if len(sys.argv) != 5: |
+ if len(sys.argv) != 6: |
print('Usage setup_toolchain.py ' |
- '<visual studio path> <win tool path> <win sdk path> <runtime dirs>') |
+ '<visual studio path> <win tool path> <win sdk path> ' |
+ '<runtime dirs> <cpu_arch>') |
sys.exit(2) |
vs_path = sys.argv[1] |
tool_source = sys.argv[2] |
win_sdk_path = sys.argv[3] |
runtime_dirs = sys.argv[4] |
+ cpu_arch = sys.argv[5] |
_CopyTool(tool_source) |
archs = ('x86', 'x64') |
+ assert cpu_arch in archs |
+ vc_bin_subdir = 'amd64_x86' if cpu_arch == 'x86' else 'amd64' |
scottmg
2014/11/21 22:26:59
i guess that's ok :) at least it's all in this scr
|
+ |
# TODO(scottmg|goma): Do we need an equivalent of |
# ninja_use_custom_environment_files? |
for arch in archs: |
# Extract environment variables for subprocesses. |
- args = _SetupScript(arch, win_sdk_path) |
+ args = _SetupScript(arch, win_sdk_path, vc_bin_subdir) |
args.extend(('&&', 'set')) |
popen = subprocess.Popen( |
args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
@@ -129,6 +134,8 @@ def main(): |
with open('environment.' + arch, 'wb') as f: |
f.write(env_block) |
+ print 'vc_bin_dir = "%s"' % os.path.join(vs_path, 'VC', 'bin', vc_bin_subdir) |
+ |
if __name__ == '__main__': |
main() |