Chromium Code Reviews| 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 | 317 |
| 318 def CopyDebugger(target_dir, target_cpu): | |
| 319 """Copy cdb.exe into the requested directory as needed. | |
| 320 | |
| 321 target_cpu is one of 'x86' or 'x64'. | |
| 322 | |
| 323 This is used for the GN build. | |
| 324 """ | |
| 325 win_sdk_dir = SetEnvironmentAndGetSDKDir() | |
| 326 if not win_sdk_dir: | |
| 327 return | |
| 328 | |
| 329 cdb_exe = os.path.join(win_sdk_dir, 'Debuggers', target_cpu, 'cdb.exe') | |
| 330 _CopyRuntimeImpl(os.path.join(target_dir, 'cdb.exe'), cdb_exe) | |
|
scottmg
2017/02/10 15:52:32
I don't think this will run isolated without some
jochen (gone - plz use gerrit)
2017/02/10 15:56:39
Is there some kind of ldd equivalent that lists al
| |
| 331 | |
| 332 | |
| 318 def _GetDesiredVsToolchainHashes(): | 333 def _GetDesiredVsToolchainHashes(): |
| 319 """Load a list of SHA1s corresponding to the toolchains that we want installed | 334 """Load a list of SHA1s corresponding to the toolchains that we want installed |
| 320 to build with.""" | 335 to build with.""" |
| 321 if GetVisualStudioVersion() == '2015': | 336 if GetVisualStudioVersion() == '2015': |
| 322 # Update 3 final with patches with 10.0.14393.0 SDK. | 337 # Update 3 final with patches with 10.0.14393.0 SDK. |
| 323 return ['d3cb0e37bdd120ad0ac4650b674b09e81be45616'] | 338 return ['d3cb0e37bdd120ad0ac4650b674b09e81be45616'] |
| 324 else: | 339 else: |
| 325 return ['03a4e939cd325d6bc5216af41b92d02dda1366a6'] | 340 return ['03a4e939cd325d6bc5216af41b92d02dda1366a6'] |
| 326 | 341 |
| 327 | 342 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 371 | 386 |
| 372 return 0 | 387 return 0 |
| 373 | 388 |
| 374 | 389 |
| 375 def NormalizePath(path): | 390 def NormalizePath(path): |
| 376 while path.endswith("\\"): | 391 while path.endswith("\\"): |
| 377 path = path[:-1] | 392 path = path[:-1] |
| 378 return path | 393 return path |
| 379 | 394 |
| 380 | 395 |
| 381 def GetToolchainDir(): | 396 def SetEnvironmentAndGetSDKDir(): |
| 382 """Gets location information about the current toolchain (must have been | 397 """Gets location information about the current sdk (must have been |
| 383 previously updated by 'update'). This is used for the GN build.""" | 398 previously updated by 'update'). This is used for the GN build.""" |
| 384 runtime_dll_dirs = SetEnvironmentAndGetRuntimeDllDirs() | 399 runtime_dll_dirs = SetEnvironmentAndGetRuntimeDllDirs() |
| 385 | 400 |
| 386 # If WINDOWSSDKDIR is not set, search the default SDK path and set it. | 401 # If WINDOWSSDKDIR is not set, search the default SDK path and set it. |
| 387 if not 'WINDOWSSDKDIR' in os.environ: | 402 if not 'WINDOWSSDKDIR' in os.environ: |
| 388 default_sdk_path = 'C:\\Program Files (x86)\\Windows Kits\\10' | 403 default_sdk_path = 'C:\\Program Files (x86)\\Windows Kits\\10' |
| 389 if os.path.isdir(default_sdk_path): | 404 if os.path.isdir(default_sdk_path): |
| 390 os.environ['WINDOWSSDKDIR'] = default_sdk_path | 405 os.environ['WINDOWSSDKDIR'] = default_sdk_path |
| 391 | 406 |
| 407 return NormalizePath(os.environ['WINDOWSSDKDIR']) | |
| 408 | |
| 409 | |
| 410 def GetToolchainDir(): | |
| 411 """Gets location information about the current toolchain (must have been | |
| 412 previously updated by 'update'). This is used for the GN build.""" | |
| 413 runtime_dll_dirs = SetEnvironmentAndGetRuntimeDllDirs() | |
| 414 win_sdk_dir = SetEnvironmentAndGetSDKDir() | |
| 415 | |
| 392 print '''vs_path = "%s" | 416 print '''vs_path = "%s" |
| 393 sdk_path = "%s" | 417 sdk_path = "%s" |
| 394 vs_version = "%s" | 418 vs_version = "%s" |
| 395 wdk_dir = "%s" | 419 wdk_dir = "%s" |
| 396 runtime_dirs = "%s" | 420 runtime_dirs = "%s" |
| 397 ''' % ( | 421 ''' % ( |
| 398 NormalizePath(os.environ['GYP_MSVS_OVERRIDE_PATH']), | 422 NormalizePath(os.environ['GYP_MSVS_OVERRIDE_PATH']), |
| 399 NormalizePath(os.environ['WINDOWSSDKDIR']), | 423 win_sdk_dir, |
| 400 GetVisualStudioVersion(), | 424 GetVisualStudioVersion(), |
| 401 NormalizePath(os.environ.get('WDK_DIR', '')), | 425 NormalizePath(os.environ.get('WDK_DIR', '')), |
| 402 os.path.pathsep.join(runtime_dll_dirs or ['None'])) | 426 os.path.pathsep.join(runtime_dll_dirs or ['None'])) |
| 403 | 427 |
| 404 | 428 |
| 405 def main(): | 429 def main(): |
| 406 commands = { | 430 commands = { |
| 407 'update': Update, | 431 'update': Update, |
| 408 'get_toolchain_dir': GetToolchainDir, | 432 'get_toolchain_dir': GetToolchainDir, |
| 409 'copy_dlls': CopyDlls, | 433 'copy_dlls': CopyDlls, |
| 434 'copy_debugger': CopyDebugger, | |
| 410 } | 435 } |
| 411 if len(sys.argv) < 2 or sys.argv[1] not in commands: | 436 if len(sys.argv) < 2 or sys.argv[1] not in commands: |
| 412 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) | 437 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) |
| 413 return 1 | 438 return 1 |
| 414 return commands[sys.argv[1]](*sys.argv[2:]) | 439 return commands[sys.argv[1]](*sys.argv[2:]) |
| 415 | 440 |
| 416 | 441 |
| 417 if __name__ == '__main__': | 442 if __name__ == '__main__': |
| 418 sys.exit(main()) | 443 sys.exit(main()) |
| OLD | NEW |