Source release v3.2.0
This commit is contained in:
17
third_party/gyp/generator/make.py
vendored
17
third_party/gyp/generator/make.py
vendored
@@ -31,6 +31,8 @@ import gyp.xcode_emulation
|
||||
from gyp.common import GetEnvironFallback
|
||||
from gyp.common import GypError
|
||||
|
||||
import hashlib
|
||||
|
||||
generator_default_variables = {
|
||||
'EXECUTABLE_PREFIX': '',
|
||||
'EXECUTABLE_SUFFIX': '',
|
||||
@@ -90,7 +92,10 @@ def CalculateVariables(default_variables, params):
|
||||
if flavor == 'android':
|
||||
operating_system = 'linux' # Keep this legacy behavior for now.
|
||||
default_variables.setdefault('OS', operating_system)
|
||||
default_variables.setdefault('SHARED_LIB_SUFFIX', '.so')
|
||||
if flavor == 'aix':
|
||||
default_variables.setdefault('SHARED_LIB_SUFFIX', '.a')
|
||||
else:
|
||||
default_variables.setdefault('SHARED_LIB_SUFFIX', '.so')
|
||||
default_variables.setdefault('SHARED_LIB_DIR','$(builddir)/lib.$(TOOLSET)')
|
||||
default_variables.setdefault('LIB_DIR', '$(obj).$(TOOLSET)')
|
||||
|
||||
@@ -1347,7 +1352,10 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD
|
||||
if target[:3] == 'lib':
|
||||
target = target[3:]
|
||||
target_prefix = 'lib'
|
||||
target_ext = '.so'
|
||||
if self.flavor == 'aix':
|
||||
target_ext = '.a'
|
||||
else:
|
||||
target_ext = '.so'
|
||||
elif self.type == 'none':
|
||||
target = '%s.stamp' % target
|
||||
elif self.type != 'executable':
|
||||
@@ -1743,7 +1751,10 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD
|
||||
# actual command.
|
||||
# - The intermediate recipe will 'touch' the intermediate file.
|
||||
# - The multi-output rule will have an do-nothing recipe.
|
||||
intermediate = "%s.intermediate" % (command if command else self.target)
|
||||
|
||||
# Hash the target name to avoid generating overlong filenames.
|
||||
cmddigest = hashlib.sha1(command if command else self.target).hexdigest()
|
||||
intermediate = "%s.intermediate" % (cmddigest)
|
||||
self.WriteLn('%s: %s' % (' '.join(outputs), intermediate))
|
||||
self.WriteLn('\t%s' % '@:');
|
||||
self.WriteLn('%s: %s' % ('.INTERMEDIATE', intermediate))
|
||||
|
||||
47
third_party/gyp/generator/msvs.py
vendored
47
third_party/gyp/generator/msvs.py
vendored
@@ -46,6 +46,8 @@ VALID_MSVS_GUID_CHARS = re.compile(r'^[A-F0-9\-]+$')
|
||||
|
||||
|
||||
generator_default_variables = {
|
||||
'DRIVER_PREFIX': '',
|
||||
'DRIVER_SUFFIX': '.sys',
|
||||
'EXECUTABLE_PREFIX': '',
|
||||
'EXECUTABLE_SUFFIX': '.exe',
|
||||
'STATIC_LIB_PREFIX': '',
|
||||
@@ -272,6 +274,10 @@ def _ToolSetOrAppend(tools, tool_name, setting, value, only_if_unset=False):
|
||||
tool[setting] = value
|
||||
|
||||
|
||||
def _ConfigTargetVersion(config_data):
|
||||
return config_data.get('msvs_target_version', 'Windows7')
|
||||
|
||||
|
||||
def _ConfigPlatform(config_data):
|
||||
return config_data.get('msvs_configuration_platform', 'Win32')
|
||||
|
||||
@@ -919,6 +925,8 @@ def _GetMsbuildToolsetOfProject(proj_path, spec, version):
|
||||
toolset = default_config.get('msbuild_toolset')
|
||||
if not toolset and version.DefaultToolset():
|
||||
toolset = version.DefaultToolset()
|
||||
if spec['type'] == 'windows_driver':
|
||||
toolset = 'WindowsKernelModeDriver10.0'
|
||||
return toolset
|
||||
|
||||
|
||||
@@ -1102,6 +1110,7 @@ def _GetMSVSConfigurationType(spec, build_file):
|
||||
'shared_library': '2', # .dll
|
||||
'loadable_module': '2', # .dll
|
||||
'static_library': '4', # .lib
|
||||
'windows_driver': '5', # .sys
|
||||
'none': '10', # Utility type
|
||||
}[spec['type']]
|
||||
except KeyError:
|
||||
@@ -1286,6 +1295,7 @@ def _GetOutputFilePathAndTool(spec, msbuild):
|
||||
'executable': ('VCLinkerTool', 'Link', '$(OutDir)', '.exe'),
|
||||
'shared_library': ('VCLinkerTool', 'Link', '$(OutDir)', '.dll'),
|
||||
'loadable_module': ('VCLinkerTool', 'Link', '$(OutDir)', '.dll'),
|
||||
'windows_driver': ('VCLinkerTool', 'Link', '$(OutDir)', '.sys'),
|
||||
'static_library': ('VCLibrarianTool', 'Lib', '$(OutDir)lib\\', '.lib'),
|
||||
}
|
||||
output_file_props = output_file_map.get(spec['type'])
|
||||
@@ -1348,7 +1358,8 @@ def _GetDisabledWarnings(config):
|
||||
|
||||
def _GetModuleDefinition(spec):
|
||||
def_file = ''
|
||||
if spec['type'] in ['shared_library', 'loadable_module', 'executable']:
|
||||
if spec['type'] in ['shared_library', 'loadable_module', 'executable',
|
||||
'windows_driver']:
|
||||
def_files = [s for s in spec.get('sources', []) if s.endswith('.def')]
|
||||
if len(def_files) == 1:
|
||||
def_file = _FixPath(def_files[0])
|
||||
@@ -2668,6 +2679,18 @@ def _GetMSBuildGlobalProperties(spec, guid, gyp_file_name):
|
||||
os.environ.get('PROCESSOR_ARCHITEW6432') == 'AMD64':
|
||||
properties[0].append(['PreferredToolArchitecture', 'x64'])
|
||||
|
||||
if spec.get('msvs_target_platform_version'):
|
||||
target_platform_version = spec.get('msvs_target_platform_version')
|
||||
properties[0].append(['WindowsTargetPlatformVersion',
|
||||
target_platform_version])
|
||||
if spec.get('msvs_target_platform_minversion'):
|
||||
target_platform_minversion = spec.get('msvs_target_platform_minversion')
|
||||
properties[0].append(['WindowsTargetPlatformMinVersion',
|
||||
target_platform_minversion])
|
||||
else:
|
||||
properties[0].append(['WindowsTargetPlatformMinVersion',
|
||||
target_platform_version])
|
||||
|
||||
if spec.get('msvs_enable_winrt'):
|
||||
properties[0].append(['DefaultLanguage', 'en-US'])
|
||||
properties[0].append(['AppContainerApplication', 'true'])
|
||||
@@ -2676,18 +2699,6 @@ def _GetMSBuildGlobalProperties(spec, guid, gyp_file_name):
|
||||
properties[0].append(['ApplicationTypeRevision', app_type_revision])
|
||||
else:
|
||||
properties[0].append(['ApplicationTypeRevision', '8.1'])
|
||||
|
||||
if spec.get('msvs_target_platform_version'):
|
||||
target_platform_version = spec.get('msvs_target_platform_version')
|
||||
properties[0].append(['WindowsTargetPlatformVersion',
|
||||
target_platform_version])
|
||||
if spec.get('msvs_target_platform_minversion'):
|
||||
target_platform_minversion = spec.get('msvs_target_platform_minversion')
|
||||
properties[0].append(['WindowsTargetPlatformMinVersion',
|
||||
target_platform_minversion])
|
||||
else:
|
||||
properties[0].append(['WindowsTargetPlatformMinVersion',
|
||||
target_platform_version])
|
||||
if spec.get('msvs_enable_winphone'):
|
||||
properties[0].append(['ApplicationType', 'Windows Phone'])
|
||||
else:
|
||||
@@ -2710,14 +2721,20 @@ def _GetMSBuildGlobalProperties(spec, guid, gyp_file_name):
|
||||
|
||||
return properties
|
||||
|
||||
|
||||
def _GetMSBuildConfigurationDetails(spec, build_file):
|
||||
properties = {}
|
||||
for name, settings in spec['configurations'].iteritems():
|
||||
msbuild_attributes = _GetMSBuildAttributes(spec, settings, build_file)
|
||||
condition = _GetConfigurationCondition(name, settings)
|
||||
character_set = msbuild_attributes.get('CharacterSet')
|
||||
config_type = msbuild_attributes.get('ConfigurationType')
|
||||
_AddConditionalProperty(properties, condition, 'ConfigurationType',
|
||||
msbuild_attributes['ConfigurationType'])
|
||||
config_type)
|
||||
if config_type == 'Driver':
|
||||
_AddConditionalProperty(properties, condition, 'DriverType', 'WDM')
|
||||
_AddConditionalProperty(properties, condition, 'TargetVersion',
|
||||
_ConfigTargetVersion(settings))
|
||||
if character_set:
|
||||
if 'msvs_enable_winrt' not in spec :
|
||||
_AddConditionalProperty(properties, condition, 'CharacterSet',
|
||||
@@ -2816,6 +2833,7 @@ def _ConvertMSVSConfigurationType(config_type):
|
||||
'1': 'Application',
|
||||
'2': 'DynamicLibrary',
|
||||
'4': 'StaticLibrary',
|
||||
'5': 'Driver',
|
||||
'10': 'Utility'
|
||||
}[config_type]
|
||||
return config_type
|
||||
@@ -2855,6 +2873,7 @@ def _GetMSBuildAttributes(spec, config, build_file):
|
||||
'executable': 'Link',
|
||||
'shared_library': 'Link',
|
||||
'loadable_module': 'Link',
|
||||
'windows_driver': 'Link',
|
||||
'static_library': 'Lib',
|
||||
}
|
||||
msbuild_tool = msbuild_tool_map.get(spec['type'])
|
||||
|
||||
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