Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(595)

Side by Side Diff: trunk/pylib/gyp/generator/xcode.py

Issue 2878002: Xcode support for already-assembled .o (object) files as sources (Closed) Base URL: http://gyp.googlecode.com/svn/
Patch Set: Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | trunk/pylib/gyp/xcodeproj_file.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 484
485 # Pull out the Xcode version itself. 485 # Pull out the Xcode version itself.
486 match_line = re.search('^Xcode (.*)$', xcodebuild_version_info, re.MULTILINE) 486 match_line = re.search('^Xcode (.*)$', xcodebuild_version_info, re.MULTILINE)
487 if match_line: 487 if match_line:
488 cached_xcode_version = match_line.group(1) 488 cached_xcode_version = match_line.group(1)
489 # Done! 489 # Done!
490 return cached_xcode_version 490 return cached_xcode_version
491 491
492 492
493 def AddSourceToTarget(source, pbxp, xct): 493 def AddSourceToTarget(source, pbxp, xct):
494 # TODO(mark): Perhaps this can be made a little bit fancier. 494 # TODO(mark): Perhaps source_extensions and library_extensions can be made a
495 # little bit fancier.
495 source_extensions = ['c', 'cc', 'cpp', 'cxx', 'm', 'mm', 's'] 496 source_extensions = ['c', 'cc', 'cpp', 'cxx', 'm', 'mm', 's']
497
498 # .o is conceptually more of a "source" than a "library," but Xcode thinks
499 # of "sources" as things to compile and "libraries" (or "frameworks") as
500 # things to link with. Adding an object file to an Xcode target's frameworks
501 # phase works properly.
502 library_extensions = ['a', 'dylib', 'framework', 'o']
503
496 basename = posixpath.basename(source) 504 basename = posixpath.basename(source)
497 (root, ext) = posixpath.splitext(basename) 505 (root, ext) = posixpath.splitext(basename)
498 if ext != '': 506 if ext != '':
499 ext = ext[1:].lower() 507 ext = ext[1:].lower()
500 508
501 if ext in source_extensions: 509 if ext in source_extensions:
502 xct.SourcesPhase().AddFile(source) 510 xct.SourcesPhase().AddFile(source)
511 elif ext in library_extensions:
512 xct.FrameworksPhase().AddFile(source)
503 else: 513 else:
504 # Files that aren't added to a sources build phase can still go into 514 # Files that aren't added to a sources or frameworks build phase can still
505 # the project file, just not as part of a build phase. 515 # go into the project file, just not as part of a build phase.
506 pbxp.AddOrGetFileInRootGroup(source) 516 pbxp.AddOrGetFileInRootGroup(source)
507 517
508 518
509 def AddResourceToTarget(resource, pbxp, xct): 519 def AddResourceToTarget(resource, pbxp, xct):
510 # TODO(mark): Combine with AddSourceToTarget above? Or just inline this call 520 # TODO(mark): Combine with AddSourceToTarget above? Or just inline this call
511 # where it's used. 521 # where it's used.
512 xct.ResourcesPhase().AddFile(resource) 522 xct.ResourcesPhase().AddFile(resource)
513 523
514 524
515 _xcode_variable_re = re.compile('(\$\((.*?)\))') 525 _xcode_variable_re = re.compile('(\$\((.*?)\))')
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 1139
1130 for build_file in build_files: 1140 for build_file in build_files:
1131 xcode_projects[build_file].Finalize1(xcode_targets, serialize_all_tests) 1141 xcode_projects[build_file].Finalize1(xcode_targets, serialize_all_tests)
1132 1142
1133 for build_file in build_files: 1143 for build_file in build_files:
1134 xcode_projects[build_file].Finalize2(xcode_targets, 1144 xcode_projects[build_file].Finalize2(xcode_targets,
1135 xcode_target_to_target_dict) 1145 xcode_target_to_target_dict)
1136 1146
1137 for build_file in build_files: 1147 for build_file in build_files:
1138 xcode_projects[build_file].Write() 1148 xcode_projects[build_file].Write()
OLDNEW
« no previous file with comments | « no previous file | trunk/pylib/gyp/xcodeproj_file.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698