OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import glob | 6 import glob |
7 import json | 7 import json |
8 import os | 8 import os |
9 import pipes | 9 import pipes |
10 import platform | 10 import platform |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 vs_runtime_dll_dirs = SetEnvironmentAndGetRuntimeDllDirs() | 307 vs_runtime_dll_dirs = SetEnvironmentAndGetRuntimeDllDirs() |
308 if not vs_runtime_dll_dirs: | 308 if not vs_runtime_dll_dirs: |
309 return | 309 return |
310 | 310 |
311 x64_runtime, x86_runtime = vs_runtime_dll_dirs | 311 x64_runtime, x86_runtime = vs_runtime_dll_dirs |
312 runtime_dir = x64_runtime if target_cpu == 'x64' else x86_runtime | 312 runtime_dir = x64_runtime if target_cpu == 'x64' else x86_runtime |
313 _CopyRuntime(target_dir, runtime_dir, target_cpu, debug=False) | 313 _CopyRuntime(target_dir, runtime_dir, target_cpu, debug=False) |
314 if configuration == 'Debug': | 314 if configuration == 'Debug': |
315 _CopyRuntime(target_dir, runtime_dir, target_cpu, debug=True) | 315 _CopyRuntime(target_dir, runtime_dir, target_cpu, debug=True) |
316 | 316 |
| 317 _CopyDebugger(target_dir, target_cpu) |
| 318 |
| 319 |
| 320 def _CopyDebugger(target_dir, target_cpu): |
| 321 """Copy cdb.exe into the requested directory as needed. |
| 322 |
| 323 target_cpu is one of 'x86' or 'x64'. |
| 324 |
| 325 This is used for the GN build. |
| 326 """ |
| 327 win_sdk_dir = SetEnvironmentAndGetSDKDir() |
| 328 if not win_sdk_dir: |
| 329 return |
| 330 |
| 331 debugger_files = ( |
| 332 'cdb.exe', 'dbgeng.dll', 'dbghelp.dll', 'dbgmodel.dll', 'dbgcore.dll') |
| 333 |
| 334 for debug_file in debugger_files: |
| 335 full_path = os.path.join(win_sdk_dir, 'Debuggers', target_cpu, debug_file) |
| 336 target_path = os.path.join(target_dir, debug_file) |
| 337 _CopyRuntimeImpl(target_path, full_path) |
| 338 |
317 | 339 |
318 def _GetDesiredVsToolchainHashes(): | 340 def _GetDesiredVsToolchainHashes(): |
319 """Load a list of SHA1s corresponding to the toolchains that we want installed | 341 """Load a list of SHA1s corresponding to the toolchains that we want installed |
320 to build with.""" | 342 to build with.""" |
321 if GetVisualStudioVersion() == '2015': | 343 if GetVisualStudioVersion() == '2015': |
322 # Update 3 final with patches with 10.0.14393.0 SDK. | 344 # Update 3 final with patches with 10.0.14393.0 SDK. |
323 return ['d3cb0e37bdd120ad0ac4650b674b09e81be45616'] | 345 return ['d3cb0e37bdd120ad0ac4650b674b09e81be45616'] |
324 else: | 346 else: |
325 return ['03a4e939cd325d6bc5216af41b92d02dda1366a6'] | 347 return ['03a4e939cd325d6bc5216af41b92d02dda1366a6'] |
326 | 348 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 | 393 |
372 return 0 | 394 return 0 |
373 | 395 |
374 | 396 |
375 def NormalizePath(path): | 397 def NormalizePath(path): |
376 while path.endswith("\\"): | 398 while path.endswith("\\"): |
377 path = path[:-1] | 399 path = path[:-1] |
378 return path | 400 return path |
379 | 401 |
380 | 402 |
381 def GetToolchainDir(): | 403 def SetEnvironmentAndGetSDKDir(): |
382 """Gets location information about the current toolchain (must have been | 404 """Gets location information about the current sdk (must have been |
383 previously updated by 'update'). This is used for the GN build.""" | 405 previously updated by 'update'). This is used for the GN build.""" |
384 runtime_dll_dirs = SetEnvironmentAndGetRuntimeDllDirs() | 406 runtime_dll_dirs = SetEnvironmentAndGetRuntimeDllDirs() |
385 | 407 |
386 # If WINDOWSSDKDIR is not set, search the default SDK path and set it. | 408 # If WINDOWSSDKDIR is not set, search the default SDK path and set it. |
387 if not 'WINDOWSSDKDIR' in os.environ: | 409 if not 'WINDOWSSDKDIR' in os.environ: |
388 default_sdk_path = 'C:\\Program Files (x86)\\Windows Kits\\10' | 410 default_sdk_path = 'C:\\Program Files (x86)\\Windows Kits\\10' |
389 if os.path.isdir(default_sdk_path): | 411 if os.path.isdir(default_sdk_path): |
390 os.environ['WINDOWSSDKDIR'] = default_sdk_path | 412 os.environ['WINDOWSSDKDIR'] = default_sdk_path |
391 | 413 |
| 414 return NormalizePath(os.environ['WINDOWSSDKDIR']) |
| 415 |
| 416 |
| 417 def GetToolchainDir(): |
| 418 """Gets location information about the current toolchain (must have been |
| 419 previously updated by 'update'). This is used for the GN build.""" |
| 420 runtime_dll_dirs = SetEnvironmentAndGetRuntimeDllDirs() |
| 421 win_sdk_dir = SetEnvironmentAndGetSDKDir() |
| 422 |
392 print '''vs_path = "%s" | 423 print '''vs_path = "%s" |
393 sdk_path = "%s" | 424 sdk_path = "%s" |
394 vs_version = "%s" | 425 vs_version = "%s" |
395 wdk_dir = "%s" | 426 wdk_dir = "%s" |
396 runtime_dirs = "%s" | 427 runtime_dirs = "%s" |
397 ''' % ( | 428 ''' % ( |
398 NormalizePath(os.environ['GYP_MSVS_OVERRIDE_PATH']), | 429 NormalizePath(os.environ['GYP_MSVS_OVERRIDE_PATH']), |
399 NormalizePath(os.environ['WINDOWSSDKDIR']), | 430 win_sdk_dir, |
400 GetVisualStudioVersion(), | 431 GetVisualStudioVersion(), |
401 NormalizePath(os.environ.get('WDK_DIR', '')), | 432 NormalizePath(os.environ.get('WDK_DIR', '')), |
402 os.path.pathsep.join(runtime_dll_dirs or ['None'])) | 433 os.path.pathsep.join(runtime_dll_dirs or ['None'])) |
403 | 434 |
404 | 435 |
405 def main(): | 436 def main(): |
406 commands = { | 437 commands = { |
407 'update': Update, | 438 'update': Update, |
408 'get_toolchain_dir': GetToolchainDir, | 439 'get_toolchain_dir': GetToolchainDir, |
409 'copy_dlls': CopyDlls, | 440 'copy_dlls': CopyDlls, |
410 } | 441 } |
411 if len(sys.argv) < 2 or sys.argv[1] not in commands: | 442 if len(sys.argv) < 2 or sys.argv[1] not in commands: |
412 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) | 443 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) |
413 return 1 | 444 return 1 |
414 return commands[sys.argv[1]](*sys.argv[2:]) | 445 return commands[sys.argv[1]](*sys.argv[2:]) |
415 | 446 |
416 | 447 |
417 if __name__ == '__main__': | 448 if __name__ == '__main__': |
418 sys.exit(main()) | 449 sys.exit(main()) |
OLD | NEW |