| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2010 Google Inc. All rights reserved. | 3 # Copyright (c) 2010 Google Inc. 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 import filecmp | 7 import filecmp |
| 8 import gyp.common | 8 import gyp.common |
| 9 import gyp.xcodeproj_file | 9 import gyp.xcodeproj_file |
| 10 import errno | 10 import errno |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 for configuration_name in sorted(spec['configurations'].keys()): | 590 for configuration_name in sorted(spec['configurations'].keys()): |
| 591 if configuration_name not in configuration_names: | 591 if configuration_name not in configuration_names: |
| 592 configuration_names.append(configuration_name) | 592 configuration_names.append(configuration_name) |
| 593 xcp = xcode_projects[build_file] | 593 xcp = xcode_projects[build_file] |
| 594 pbxp = xcp.project | 594 pbxp = xcp.project |
| 595 | 595 |
| 596 # Set up the configurations for the target according to the list of names | 596 # Set up the configurations for the target according to the list of names |
| 597 # supplied. | 597 # supplied. |
| 598 xccl = CreateXCConfigurationList(configuration_names) | 598 xccl = CreateXCConfigurationList(configuration_names) |
| 599 | 599 |
| 600 # Create an XCTarget subclass object for the target. We use the type | 600 # Create an XCTarget subclass object for the target. The type with |
| 601 # with "+bundle" appended if the target has "mac_bundle" set. | 601 # "+bundle" appended will be used if the target has "mac_bundle" set. |
| 602 # loadable_modules not in a mac_bundle are mapped to |
| 603 # com.googlecode.gyp.xcode.bundle, a pseudo-type that xcode.py interprets |
| 604 # to create a single-file mh_bundle. |
| 602 _types = { | 605 _types = { |
| 603 'executable': 'com.apple.product-type.tool', | 606 'executable': 'com.apple.product-type.tool', |
| 604 'loadable_module': 'com.apple.product-type.library.dynamic', | 607 'loadable_module': 'com.googlecode.gyp.xcode.bundle', |
| 605 'shared_library': 'com.apple.product-type.library.dynamic', | 608 'shared_library': 'com.apple.product-type.library.dynamic', |
| 606 'static_library': 'com.apple.product-type.library.static', | 609 'static_library': 'com.apple.product-type.library.static', |
| 607 'executable+bundle': 'com.apple.product-type.application', | 610 'executable+bundle': 'com.apple.product-type.application', |
| 608 'loadable_module+bundle': 'com.apple.product-type.bundle', | 611 'loadable_module+bundle': 'com.apple.product-type.bundle', |
| 609 'shared_library+bundle': 'com.apple.product-type.framework', | 612 'shared_library+bundle': 'com.apple.product-type.framework', |
| 610 } | 613 } |
| 611 | 614 |
| 612 target_properties = { | 615 target_properties = { |
| 613 'buildConfigurationList': xccl, | 616 'buildConfigurationList': xccl, |
| 614 'name': target_name, | 617 'name': target_name, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 635 target_properties['productName'] = target_product_name | 638 target_properties['productName'] = target_product_name |
| 636 | 639 |
| 637 xct = xctarget_type(target_properties, parent=pbxp, | 640 xct = xctarget_type(target_properties, parent=pbxp, |
| 638 force_outdir=spec.get('product_dir'), | 641 force_outdir=spec.get('product_dir'), |
| 639 force_prefix=spec.get('product_prefix'), | 642 force_prefix=spec.get('product_prefix'), |
| 640 force_extension=spec.get('product_extension')) | 643 force_extension=spec.get('product_extension')) |
| 641 pbxp.AppendProperty('targets', xct) | 644 pbxp.AppendProperty('targets', xct) |
| 642 xcode_targets[qualified_target] = xct | 645 xcode_targets[qualified_target] = xct |
| 643 xcode_target_to_target_dict[xct] = spec | 646 xcode_target_to_target_dict[xct] = spec |
| 644 | 647 |
| 645 # Xcode does not have a distinct type for loadable_modules that are pure | |
| 646 # BSD targets (ie-unbundled). It uses the same setup as a shared_library | |
| 647 # but the mach-o type is explictly set in the settings. So before we do | |
| 648 # anything else, for this one case, we stuff in that one setting. This | |
| 649 # would allow the other data in the spec to change it if need be. | |
| 650 if type == 'loadable_module' and not is_bundle: | |
| 651 xccl.SetBuildSetting('MACH_O_TYPE', 'mh_bundle') | |
| 652 | |
| 653 spec_actions = spec.get('actions', []) | 648 spec_actions = spec.get('actions', []) |
| 654 spec_rules = spec.get('rules', []) | 649 spec_rules = spec.get('rules', []) |
| 655 | 650 |
| 656 # Xcode has some "issues" with checking dependencies for the "Compile | 651 # Xcode has some "issues" with checking dependencies for the "Compile |
| 657 # sources" step with any source files/headers generated by actions/rules. | 652 # sources" step with any source files/headers generated by actions/rules. |
| 658 # To work around this, if a target is building anything directly (not | 653 # To work around this, if a target is building anything directly (not |
| 659 # type "none"), then a second target as used to run the GYP actions/rules | 654 # type "none"), then a second target as used to run the GYP actions/rules |
| 660 # and is made a dependency of this target. This way the work is done | 655 # and is made a dependency of this target. This way the work is done |
| 661 # before the dependency checks for what should be recompiled. | 656 # before the dependency checks for what should be recompiled. |
| 662 support_xct = None | 657 support_xct = None |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1134 | 1129 |
| 1135 for build_file in build_files: | 1130 for build_file in build_files: |
| 1136 xcode_projects[build_file].Finalize1(xcode_targets, serialize_all_tests) | 1131 xcode_projects[build_file].Finalize1(xcode_targets, serialize_all_tests) |
| 1137 | 1132 |
| 1138 for build_file in build_files: | 1133 for build_file in build_files: |
| 1139 xcode_projects[build_file].Finalize2(xcode_targets, | 1134 xcode_projects[build_file].Finalize2(xcode_targets, |
| 1140 xcode_target_to_target_dict) | 1135 xcode_target_to_target_dict) |
| 1141 | 1136 |
| 1142 for build_file in build_files: | 1137 for build_file in build_files: |
| 1143 xcode_projects[build_file].Write() | 1138 xcode_projects[build_file].Write() |
| OLD | NEW |