OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 import filecmp | 3 import filecmp |
4 import gyp.common | 4 import gyp.common |
5 import gyp.xcodeproj_file | 5 import gyp.xcodeproj_file |
6 import errno | 6 import errno |
7 import os | 7 import os |
8 import pprint | 8 import pprint |
9 import re | 9 import re |
10 import shutil | 10 import shutil |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
468 | 468 |
469 # Set up the configurations for the target according to the list of names | 469 # Set up the configurations for the target according to the list of names |
470 # supplied. | 470 # supplied. |
471 xccl = gyp.xcodeproj_file.XCConfigurationList({'buildConfigurations': []}) | 471 xccl = gyp.xcodeproj_file.XCConfigurationList({'buildConfigurations': []}) |
472 for configuration_name in configuration_names: | 472 for configuration_name in configuration_names: |
473 xcbc = gyp.xcodeproj_file.XCBuildConfiguration({ | 473 xcbc = gyp.xcodeproj_file.XCBuildConfiguration({ |
474 'name': configuration_name}) | 474 'name': configuration_name}) |
475 xccl.AppendProperty('buildConfigurations', xcbc) | 475 xccl.AppendProperty('buildConfigurations', xcbc) |
476 xccl.SetProperty('defaultConfigurationName', configuration_names[0]) | 476 xccl.SetProperty('defaultConfigurationName', configuration_names[0]) |
477 | 477 |
478 # Create an XCTarget subclass object for the target. | 478 # Create an XCTarget subclass object for the target. We use the type |
479 # with "+bundle" append if the target has "mac_bundle" set. | |
Mark Mentovai
2009/03/19 18:22:50
appended
| |
479 _types = { | 480 _types = { |
480 'application': 'com.apple.product-type.application', | 481 'executable': 'com.apple.product-type.tool', |
481 'executable': 'com.apple.product-type.tool', | 482 'shared_library': 'com.apple.product-type.library.dynamic', |
482 'shared_library': 'com.apple.product-type.library.dynamic', | 483 'static_library': 'com.apple.product-type.library.static', |
483 'static_library': 'com.apple.product-type.library.static', | 484 'executable+bundle': 'com.apple.product-type.application', |
485 # TODO: add 'shared_library+bundle' -> Framework | |
484 } | 486 } |
485 | 487 |
486 target_properties = { | 488 target_properties = { |
487 'buildConfigurationList': xccl, | 489 'buildConfigurationList': xccl, |
488 'name': target_name, | 490 'name': target_name, |
489 } | 491 } |
490 | 492 |
491 type = spec['type'] | 493 type = spec['type'] |
492 if type != 'none': | 494 if type != 'none': |
495 type_bundle_key = type | |
496 if spec.get('mac_bundle', 0): | |
497 type_bundle_key += '+bundle' | |
493 xctarget_type = gyp.xcodeproj_file.PBXNativeTarget | 498 xctarget_type = gyp.xcodeproj_file.PBXNativeTarget |
494 target_properties['productType'] = _types[type] | 499 target_properties['productType'] = _types[type_bundle_key] |
495 else: | 500 else: |
496 xctarget_type = gyp.xcodeproj_file.PBXAggregateTarget | 501 xctarget_type = gyp.xcodeproj_file.PBXAggregateTarget |
497 | 502 |
498 if 'product_name' in spec: | 503 if 'product_name' in spec: |
499 target_properties['productName'] = spec['product_name'] | 504 target_properties['productName'] = spec['product_name'] |
500 | 505 |
501 xct = xctarget_type(target_properties, parent=pbxp) | 506 xct = xctarget_type(target_properties, parent=pbxp) |
502 pbxp.AppendProperty('targets', xct) | 507 pbxp.AppendProperty('targets', xct) |
503 xcode_targets[qualified_target] = xct | 508 xcode_targets[qualified_target] = xct |
504 xcode_target_to_target_dict[xct] = spec | 509 xcode_target_to_target_dict[xct] = spec |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
808 # Add "sources". | 813 # Add "sources". |
809 for source in spec.get('sources', []): | 814 for source in spec.get('sources', []): |
810 (source_root, source_extension) = os.path.splitext(source) | 815 (source_root, source_extension) = os.path.splitext(source) |
811 if source_extension not in rules_by_ext: | 816 if source_extension not in rules_by_ext: |
812 # AddSourceToTarget will add the file to a root group if it's not | 817 # AddSourceToTarget will add the file to a root group if it's not |
813 # already there. | 818 # already there. |
814 AddSourceToTarget(source, pbxp, xct) | 819 AddSourceToTarget(source, pbxp, xct) |
815 else: | 820 else: |
816 pbxp.AddOrGetFileInRootGroup(source) | 821 pbxp.AddOrGetFileInRootGroup(source) |
817 | 822 |
818 # TODO(mark): Hard-coded to "application" now, but this should match any | 823 # Add "mac_bundle_resources" if it's a bundle of any type. |
819 # bundled type. | 824 if spec.get('mac_bundle', 0): |
820 if spec['type'] == 'application': | |
821 # Add "mac_bundle_resources". | |
822 for resource in spec.get('mac_bundle_resources', []): | 825 for resource in spec.get('mac_bundle_resources', []): |
823 AddResourceToTarget(resource, pbxp, xct) | 826 AddResourceToTarget(resource, pbxp, xct) |
824 | 827 |
825 # Add "copies". | 828 # Add "copies". |
826 for copy_group in spec.get('copies', []): | 829 for copy_group in spec.get('copies', []): |
827 pbxcp = gyp.xcodeproj_file.PBXCopyFilesBuildPhase({ | 830 pbxcp = gyp.xcodeproj_file.PBXCopyFilesBuildPhase({ |
828 'name': 'Copy to ' + copy_group['destination'] | 831 'name': 'Copy to ' + copy_group['destination'] |
829 }, | 832 }, |
830 parent=xct) | 833 parent=xct) |
831 pbxcp.SetDestination(copy_group['destination']) | 834 pbxcp.SetDestination(copy_group['destination']) |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
917 | 920 |
918 for build_file in build_files: | 921 for build_file in build_files: |
919 xcode_projects[build_file].Finalize1(xcode_targets) | 922 xcode_projects[build_file].Finalize1(xcode_targets) |
920 | 923 |
921 for build_file in build_files: | 924 for build_file in build_files: |
922 xcode_projects[build_file].Finalize2(xcode_targets, | 925 xcode_projects[build_file].Finalize2(xcode_targets, |
923 xcode_target_to_target_dict) | 926 xcode_target_to_target_dict) |
924 | 927 |
925 for build_file in build_files: | 928 for build_file in build_files: |
926 xcode_projects[build_file].Write() | 929 xcode_projects[build_file].Write() |
OLD | NEW |