OLD | NEW |
---|---|
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 import json | 5 import json |
6 import os | 6 import os |
7 import pipes | 7 import pipes |
8 import shutil | 8 import shutil |
9 import subprocess | 9 import subprocess |
10 import sys | 10 import sys |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 os.path.join(depot_tools_path, | 174 os.path.join(depot_tools_path, |
175 'win_toolchain', | 175 'win_toolchain', |
176 'get_toolchain_if_necessary.py'), | 176 'get_toolchain_if_necessary.py'), |
177 '--output-json', json_data_file, | 177 '--output-json', json_data_file, |
178 ] + _GetDesiredVsToolchainHashes() | 178 ] + _GetDesiredVsToolchainHashes() |
179 subprocess.check_call(get_toolchain_args) | 179 subprocess.check_call(get_toolchain_args) |
180 | 180 |
181 return 0 | 181 return 0 |
182 | 182 |
183 | 183 |
184 def GetToolchainDir(): | 184 def GetToolchainDir(cpu_arch): |
185 """Gets location information about the current toolchain (must have been | 185 """Gets location information about the current toolchain (must have been |
186 previously updated by 'update'). This is used for the GN build.""" | 186 previously updated by 'update'). This is used for the GN build.""" |
187 runtime_dll_dirs = SetEnvironmentAndGetRuntimeDllDirs() | 187 runtime_dll_dirs = SetEnvironmentAndGetRuntimeDllDirs() |
188 | 188 |
189 # If WINDOWSSDKDIR is not set, search the default SDK path and set it. | 189 # If WINDOWSSDKDIR is not set, search the default SDK path and set it. |
190 if not 'WINDOWSSDKDIR' in os.environ: | 190 if not 'WINDOWSSDKDIR' in os.environ: |
191 default_sdk_path = 'C:\\Program Files (x86)\\Windows Kits\\8.1' | 191 default_sdk_path = 'C:\\Program Files (x86)\\Windows Kits\\8.1' |
192 if os.path.isdir(default_sdk_path): | 192 if os.path.isdir(default_sdk_path): |
193 os.environ['WINDOWSSDKDIR'] = default_sdk_path | 193 os.environ['WINDOWSSDKDIR'] = default_sdk_path |
194 | 194 |
195 # We only support the 64-bit toolchains, but we need to point | |
196 # GN to either the 32-bit-generating one or the 64-bit-generating one. | |
197 assert(cpu_arch in ("x86", "x64")) | |
198 if cpu_arch == 'x86': | |
199 vc_bin_subdir = 'amd64_x86' | |
scottmg
2014/11/21 02:35:41
this was what i didn't really want; the toolchain
Dirk Pranke
2014/11/21 02:46:00
Okay, I think I understand the concerns now. I wil
| |
200 else: | |
201 vc_bin_subdir = 'amd64' | |
202 | |
203 vs_path = os.environ['GYP_MSVS_OVERRIDE_PATH'] | |
scottmg
2014/11/21 02:35:41
gyp_msvs_override_path won't be set on the non-dep
Dirk Pranke
2014/11/21 02:46:00
Ack.
| |
204 vc_bin_dir = os.path.join(vs_path, 'VC', 'bin', vc_bin_subdir) | |
205 | |
195 print '''vs_path = "%s" | 206 print '''vs_path = "%s" |
196 sdk_path = "%s" | 207 sdk_path = "%s" |
197 vs_version = "%s" | 208 vs_version = "%s" |
198 wdk_dir = "%s" | 209 wdk_dir = "%s" |
199 runtime_dirs = "%s" | 210 runtime_dirs = "%s" |
211 vc_bin_dir = "%s" | |
200 ''' % ( | 212 ''' % ( |
201 os.environ['GYP_MSVS_OVERRIDE_PATH'], | 213 vs_path, |
202 os.environ['WINDOWSSDKDIR'], | 214 os.environ['WINDOWSSDKDIR'], |
203 os.environ['GYP_MSVS_VERSION'], | 215 os.environ['GYP_MSVS_VERSION'], |
204 os.environ.get('WDK_DIR', ''), | 216 os.environ.get('WDK_DIR', ''), |
205 ';'.join(runtime_dll_dirs)) | 217 ';'.join(runtime_dll_dirs), |
218 vc_bin_dir) | |
206 | 219 |
207 | 220 |
208 def main(): | 221 def main(): |
209 if not sys.platform.startswith(('win32', 'cygwin')): | 222 if not sys.platform.startswith(('win32', 'cygwin')): |
210 return 0 | 223 return 0 |
211 commands = { | 224 commands = { |
212 'update': Update, | 225 'update': Update, |
213 'get_toolchain_dir': GetToolchainDir, | 226 'get_toolchain_dir': GetToolchainDir, |
214 'copy_dlls': CopyDlls, | 227 'copy_dlls': CopyDlls, |
215 } | 228 } |
216 if len(sys.argv) < 2 or sys.argv[1] not in commands: | 229 if len(sys.argv) < 2 or sys.argv[1] not in commands: |
217 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) | 230 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) |
218 return 1 | 231 return 1 |
219 return commands[sys.argv[1]](*sys.argv[2:]) | 232 return commands[sys.argv[1]](*sys.argv[2:]) |
220 | 233 |
221 | 234 |
222 if __name__ == '__main__': | 235 if __name__ == '__main__': |
223 sys.exit(main()) | 236 sys.exit(main()) |
OLD | NEW |