OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # This script is wrapper for Chromium that adds some support for how GYP | 7 # This script is wrapper for Chromium that adds some support for how GYP |
8 # is invoked by Chromium beyond what can be done in the gclient hooks. | 8 # is invoked by Chromium beyond what can be done in the gclient hooks. |
9 | 9 |
10 import glob | 10 import glob |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 not 'OS=ios' in os.environ.get('GYP_DEFINES', []): | 390 not 'OS=ios' in os.environ.get('GYP_DEFINES', []): |
391 os.environ['GYP_GENERATORS'] = 'ninja' | 391 os.environ['GYP_GENERATORS'] = 'ninja' |
392 | 392 |
393 # If using ninja on windows, and the automatic toolchain has been installed | 393 # If using ninja on windows, and the automatic toolchain has been installed |
394 # by depot_tools, then use it. | 394 # by depot_tools, then use it. |
395 if (sys.platform in ('win32', 'cygwin') and | 395 if (sys.platform in ('win32', 'cygwin') and |
396 os.environ.get('GYP_GENERATORS') == 'ninja'): | 396 os.environ.get('GYP_GENERATORS') == 'ninja'): |
397 depot_tools_path = find_depot_tools.add_depot_tools_to_path() | 397 depot_tools_path = find_depot_tools.add_depot_tools_to_path() |
398 toolchain = os.path.normpath(os.path.join( | 398 toolchain = os.path.normpath(os.path.join( |
399 depot_tools_path, 'win_toolchain', 'vs2013_files')) | 399 depot_tools_path, 'win_toolchain', 'vs2013_files')) |
400 if os.path.isdir(toolchain): | 400 version_file = os.path.join(toolchain, '.version') |
| 401 if os.path.isdir(toolchain) and os.path.isfile(version_file): |
401 os.environ['GYP_MSVS_OVERRIDE_PATH'] = toolchain | 402 os.environ['GYP_MSVS_OVERRIDE_PATH'] = toolchain |
402 os.environ['GYP_MSVS_VERSION'] = '2013' | 403 with open(version_file, 'r') as f: |
| 404 version_is_pro = f.read().strip() == 'pro' |
| 405 os.environ['GYP_MSVS_VERSION'] = '2013' if version_is_pro else '2013e' |
403 # We need to make sure windows_sdk_path is set to the automated | 406 # We need to make sure windows_sdk_path is set to the automated |
404 # toolchain values in GYP_DEFINES, but don't want to override any other | 407 # toolchain values in GYP_DEFINES, but don't want to override any other |
405 # values there. | 408 # values there. |
406 gyp_defines_dict = gyp.NameValueListToDict(gyp.ShlexEnv('GYP_DEFINES')) | 409 gyp_defines_dict = gyp.NameValueListToDict(gyp.ShlexEnv('GYP_DEFINES')) |
407 win8sdk = os.path.join(toolchain, 'win8sdk') | 410 win8sdk = os.path.join(toolchain, 'win8sdk') |
| 411 wdk = os.path.join(toolchain, 'wdk') |
408 gyp_defines_dict['windows_sdk_path'] = win8sdk | 412 gyp_defines_dict['windows_sdk_path'] = win8sdk |
409 os.environ['WINDOWSSDKDIR'] = win8sdk | 413 os.environ['WINDOWSSDKDIR'] = win8sdk |
| 414 os.environ['WDK_DIR'] = wdk |
410 os.environ['GYP_DEFINES'] = ' '.join('%s=%s' % (k, pipes.quote(str(v))) | 415 os.environ['GYP_DEFINES'] = ' '.join('%s=%s' % (k, pipes.quote(str(v))) |
411 for k, v in gyp_defines_dict.iteritems()) | 416 for k, v in gyp_defines_dict.iteritems()) |
412 # Include the VS runtime in the PATH in case it's not machine-installed. | 417 # Include the VS runtime in the PATH in case it's not machine-installed. |
413 runtime_path = ';'.join(os.path.normpath(os.path.join(toolchain, s)) | 418 runtime_path = ';'.join(os.path.normpath(os.path.join(toolchain, s)) |
414 for s in ('sys64', 'sys32')) | 419 for s in ('sys64', 'sys32')) |
415 os.environ['PATH'] = runtime_path + ';' + os.environ['PATH'] | 420 os.environ['PATH'] = runtime_path + ';' + os.environ['PATH'] |
416 print('Using automatic toolchain in %s.' % toolchain) | 421 print('Using automatic toolchain in %s (%s edition).' % ( |
| 422 toolchain, 'Pro' if version_is_pro else 'Express')) |
417 | 423 |
418 # If CHROMIUM_GYP_SYNTAX_CHECK is set to 1, it will invoke gyp with --check | 424 # If CHROMIUM_GYP_SYNTAX_CHECK is set to 1, it will invoke gyp with --check |
419 # to enfore syntax checking. | 425 # to enfore syntax checking. |
420 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') | 426 syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK') |
421 if syntax_check and int(syntax_check): | 427 if syntax_check and int(syntax_check): |
422 args.append('--check') | 428 args.append('--check') |
423 | 429 |
424 supplemental_includes = GetSupplementalFiles() | 430 supplemental_includes = GetSupplementalFiles() |
425 if not RunGN(supplemental_includes): | 431 if not RunGN(supplemental_includes): |
426 sys.exit(1) | 432 sys.exit(1) |
427 args.extend( | 433 args.extend( |
428 ['-I' + i for i in additional_include_files(supplemental_includes, args)]) | 434 ['-I' + i for i in additional_include_files(supplemental_includes, args)]) |
429 | 435 |
430 args.extend(['-D', 'gyp_output_dir=' + GetOutputDirectory()]) | 436 args.extend(['-D', 'gyp_output_dir=' + GetOutputDirectory()]) |
431 | 437 |
432 print 'Updating projects from gyp files...' | 438 print 'Updating projects from gyp files...' |
433 sys.stdout.flush() | 439 sys.stdout.flush() |
434 | 440 |
435 # Off we go... | 441 # Off we go... |
436 sys.exit(gyp.main(args)) | 442 sys.exit(gyp.main(args)) |
OLD | NEW |