MCPcopy Create free account
hub / github.com/nodejs/node / AddSourceToTarget

Function AddSourceToTarget

tools/gyp/pylib/gyp/generator/xcode.py:522–545  ·  view source on GitHub ↗
(source, type, pbxp, xct)

Source from the content-addressed store, hash-verified

520
521
522def AddSourceToTarget(source, type, pbxp, xct):
523 # TODO(mark): Perhaps source_extensions and library_extensions can be made a
524 # little bit fancier.
525 source_extensions = ["c", "cc", "cpp", "cxx", "m", "mm", "s", "swift"]
526
527 # .o is conceptually more of a "source" than a "library," but Xcode thinks
528 # of "sources" as things to compile and "libraries" (or "frameworks") as
529 # things to link with. Adding an object file to an Xcode target's frameworks
530 # phase works properly.
531 library_extensions = ["a", "dylib", "framework", "o"]
532
533 basename = posixpath.basename(source)
534 (_root, ext) = posixpath.splitext(basename)
535 if ext:
536 ext = ext[1:].lower()
537
538 if ext in source_extensions and type != "none":
539 xct.SourcesPhase().AddFile(source)
540 elif ext in library_extensions and type != "none":
541 xct.FrameworksPhase().AddFile(source)
542 else:
543 # Files that aren't added to a sources or frameworks build phase can still
544 # go into the project file, just not as part of a build phase.
545 pbxp.AddOrGetFileInRootGroup(source)
546
547
548def AddResourceToTarget(resource, pbxp, xct):

Callers 1

GenerateOutputFunction · 0.85

Calls 4

AddFileMethod · 0.80
SourcesPhaseMethod · 0.80
FrameworksPhaseMethod · 0.80

Tested by

no test coverage detected