Source release v3.2.0
This commit is contained in:
21
third_party/gyp/generator/ninja.py
vendored
21
third_party/gyp/generator/ninja.py
vendored
@@ -148,6 +148,9 @@ class Target(object):
|
||||
# because dependents only link against the lib (not both the lib and the
|
||||
# dll) we keep track of the import library here.
|
||||
self.import_lib = None
|
||||
# Track if this target contains any C++ files, to decide if gcc or g++
|
||||
# should be used for linking.
|
||||
self.uses_cpp = False
|
||||
|
||||
def Linkable(self):
|
||||
"""Return true if this is a target that can be linked against."""
|
||||
@@ -375,9 +378,6 @@ class NinjaWriter(object):
|
||||
self.target = Target(spec['type'])
|
||||
self.is_standalone_static_library = bool(
|
||||
spec.get('standalone_static_library', 0))
|
||||
# Track if this target contains any C++ files, to decide if gcc or g++
|
||||
# should be used for linking.
|
||||
self.uses_cpp = False
|
||||
|
||||
self.target_rpath = generator_flags.get('target_rpath', r'\$$ORIGIN/lib/')
|
||||
|
||||
@@ -425,6 +425,8 @@ class NinjaWriter(object):
|
||||
target = self.target_outputs[dep]
|
||||
actions_depends.append(target.PreActionInput(self.flavor))
|
||||
compile_depends.append(target.PreCompileInput())
|
||||
if target.uses_cpp:
|
||||
self.target.uses_cpp = True
|
||||
actions_depends = filter(None, actions_depends)
|
||||
compile_depends = filter(None, compile_depends)
|
||||
actions_depends = self.WriteCollapsedDependencies('actions_depends',
|
||||
@@ -450,7 +452,12 @@ class NinjaWriter(object):
|
||||
|
||||
# Write out the compilation steps, if any.
|
||||
link_deps = []
|
||||
sources = extra_sources + spec.get('sources', [])
|
||||
try:
|
||||
sources = extra_sources + spec.get('sources', [])
|
||||
except TypeError:
|
||||
print 'extra_sources: ', str(extra_sources)
|
||||
print 'spec.get("sources"): ', str(spec.get('sources'))
|
||||
raise
|
||||
if sources:
|
||||
if self.flavor == 'mac' and len(self.archs) > 1:
|
||||
# Write subninja file containing compile and link commands scoped to
|
||||
@@ -1027,7 +1034,7 @@ class NinjaWriter(object):
|
||||
obj_ext = self.obj_ext
|
||||
if ext in ('cc', 'cpp', 'cxx'):
|
||||
command = 'cxx'
|
||||
self.uses_cpp = True
|
||||
self.target.uses_cpp = True
|
||||
elif ext == 'c' or (ext == 'S' and self.flavor != 'win'):
|
||||
command = 'cc'
|
||||
elif ext == 's' and self.flavor != 'win': # Doesn't generate .o.d files.
|
||||
@@ -1042,7 +1049,7 @@ class NinjaWriter(object):
|
||||
command = 'objc'
|
||||
elif self.flavor == 'mac' and ext == 'mm':
|
||||
command = 'objcxx'
|
||||
self.uses_cpp = True
|
||||
self.target.uses_cpp = True
|
||||
elif self.flavor == 'win' and ext == 'rc':
|
||||
command = 'rc'
|
||||
obj_ext = '.res'
|
||||
@@ -1178,7 +1185,7 @@ class NinjaWriter(object):
|
||||
implicit_deps.add(final_output)
|
||||
|
||||
extra_bindings = []
|
||||
if self.uses_cpp and self.flavor != 'win':
|
||||
if self.target.uses_cpp and self.flavor != 'win':
|
||||
extra_bindings.append(('ld', '$ldxx'))
|
||||
|
||||
output = self.ComputeOutput(spec, arch)
|
||||
|
||||
Reference in New Issue
Block a user