| OLD | NEW |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 # | 4 # |
| 5 # Copies the given "win tool" (which the toolchain uses to wrap compiler | 5 # Copies the given "win tool" (which the toolchain uses to wrap compiler |
| 6 # invocations) and the environment blocks for the 32-bit and 64-bit builds on | 6 # invocations) and the environment blocks for the 32-bit and 64-bit builds on |
| 7 # Windows to the build directory. | 7 # Windows to the build directory. |
| 8 # | 8 # |
| 9 # The arguments are the visual studio install location and the location of the | 9 # The arguments are the visual studio install location and the location of the |
| 10 # win tool. The script assumes that the root build directory is the current dir | 10 # win tool. The script assumes that the root build directory is the current dir |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 def _LoadToolchainEnv(cpu, sdk_dir): | 84 def _LoadToolchainEnv(cpu, sdk_dir): |
| 85 """Returns a dictionary with environment variables that must be set while | 85 """Returns a dictionary with environment variables that must be set while |
| 86 running binaries from the toolchain (e.g. INCLUDE and PATH for cl.exe).""" | 86 running binaries from the toolchain (e.g. INCLUDE and PATH for cl.exe).""" |
| 87 # Check if we are running in the SDK command line environment and use | 87 # Check if we are running in the SDK command line environment and use |
| 88 # the setup script from the SDK if so. |cpu| should be either | 88 # the setup script from the SDK if so. |cpu| should be either |
| 89 # 'x86' or 'x64'. | 89 # 'x86' or 'x64'. |
| 90 assert cpu in ('x86', 'x64') | 90 assert cpu in ('x86', 'x64') |
| 91 if bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', 1))) and sdk_dir: | 91 if bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', 1))) and sdk_dir: |
| 92 # Load environment from json file. | 92 # Load environment from json file. |
| 93 env = os.path.normpath(os.path.join(sdk_dir, 'Bin/SetEnv.%s.json' % cpu)) | 93 env = os.path.normpath(os.path.join(sdk_dir, 'bin/SetEnv.%s.json' % cpu)) |
| 94 env = json.load(open(env))['env'] | 94 env = json.load(open(env))['env'] |
| 95 for k in env: | 95 for k in env: |
| 96 entries = [os.path.join(*([os.path.join(sdk_dir, 'bin')] + e)) | 96 entries = [os.path.join(*([os.path.join(sdk_dir, 'bin')] + e)) |
| 97 for e in env[k]] | 97 for e in env[k]] |
| 98 # clang-cl wants INCLUDE to be ;-separated even on non-Windows, | 98 # clang-cl wants INCLUDE to be ;-separated even on non-Windows, |
| 99 # lld-link wants LIB to be ;-separated even on non-Windows. Path gets :. | 99 # lld-link wants LIB to be ;-separated even on non-Windows. Path gets :. |
| 100 # The separator for INCLUDE here must match the one used in main() below. | 100 # The separator for INCLUDE here must match the one used in main() below. |
| 101 sep = os.pathsep if k == 'PATH' else ';' | 101 sep = os.pathsep if k == 'PATH' else ';' |
| 102 env[k] = sep.join(entries) | 102 env[k] = sep.join(entries) |
| 103 # PATH is a bit of a special case, it's in addition to the current PATH. | 103 # PATH is a bit of a special case, it's in addition to the current PATH. |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 222 |
| 223 assert vc_bin_dir | 223 assert vc_bin_dir |
| 224 assert '"' not in vc_bin_dir | 224 assert '"' not in vc_bin_dir |
| 225 print 'vc_bin_dir = "%s"' % vc_bin_dir | 225 print 'vc_bin_dir = "%s"' % vc_bin_dir |
| 226 assert include | 226 assert include |
| 227 assert '"' not in include | 227 assert '"' not in include |
| 228 print 'include_flags = "%s"' % include | 228 print 'include_flags = "%s"' % include |
| 229 | 229 |
| 230 if __name__ == '__main__': | 230 if __name__ == '__main__': |
| 231 main() | 231 main() |
| OLD | NEW |