diff options
author | Ben Murdoch <benm@google.com> | 2013-07-10 11:42:08 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2013-07-10 11:42:08 +0100 |
commit | c37ff0dcfc880618fb30e0e439667657a73c9db6 (patch) | |
tree | d3ec71bb26e45516861041b62f59e106f4a42c54 | |
parent | a82d0807bd4cb6ebcf10ea3b1e0dbc87c58b544f (diff) | |
parent | 19740f926e7bf4bb6e4331fc4317f4627e323f3f (diff) | |
download | gyp-c37ff0dcfc880618fb30e0e439667657a73c9db6.tar.gz |
Merge from Chromium at DEPS revision r210036
This commit was generated by merge_to_master.py.
Change-Id: I161776643fc0240f1e6b061c2f28f683ed6c0531
-rw-r--r-- | pylib/gyp/generator/android.py | 85 | ||||
-rw-r--r-- | pylib/gyp/generator/msvs.py | 18 | ||||
-rw-r--r-- | pylib/gyp/generator/ninja.py | 2 |
3 files changed, 53 insertions, 52 deletions
diff --git a/pylib/gyp/generator/android.py b/pylib/gyp/generator/android.py index 321556e4..9476a1df 100644 --- a/pylib/gyp/generator/android.py +++ b/pylib/gyp/generator/android.py @@ -39,7 +39,7 @@ generator_default_variables = { 'RULE_INPUT_PATH': '$(RULE_SOURCES)', 'RULE_INPUT_EXT': '$(suffix $<)', 'RULE_INPUT_NAME': '$(notdir $<)', - 'CONFIGURATION_NAME': '$(GYP_DEFAULT_CONFIGURATION)', + 'CONFIGURATION_NAME': '$(GYP_CONFIGURATION)', } # Make supports multiple toolsets @@ -468,42 +468,39 @@ class AndroidMkWriter(object): Args: spec, configs: input from gyp. """ - config = configs[spec['default_configuration']] - extracted_includes = [] - - self.WriteLn('\n# Flags passed to both C and C++ files.') - cflags, includes_from_cflags = self.ExtractIncludesFromCFlags( - config.get('cflags')) - extracted_includes.extend(includes_from_cflags) - self.WriteList(cflags, 'MY_CFLAGS') - - cflags_c, includes_from_cflags_c = self.ExtractIncludesFromCFlags( - config.get('cflags_c')) - extracted_includes.extend(includes_from_cflags_c) - self.WriteList(cflags_c, 'MY_CFLAGS_C') - - self.WriteList(config.get('defines'), 'MY_DEFS', prefix='-D', - quoter=make.EscapeCppDefine) - self.WriteLn('LOCAL_CFLAGS := $(MY_CFLAGS_C) $(MY_CFLAGS) $(MY_DEFS)') - + for configname, config in sorted(configs.iteritems()): + extracted_includes = [] + + self.WriteLn('\n# Flags passed to both C and C++ files.') + cflags, includes_from_cflags = self.ExtractIncludesFromCFlags( + config.get('cflags', []) + config.get('cflags_c', [])) + extracted_includes.extend(includes_from_cflags) + self.WriteList(cflags, 'MY_CFLAGS_%s' % configname) + + self.WriteList(config.get('defines'), 'MY_DEFS_%s' % configname, + prefix='-D', quoter=make.EscapeCppDefine) + + self.WriteLn('\n# Include paths placed before CFLAGS/CPPFLAGS') + includes = list(config.get('include_dirs', [])) + includes.extend(extracted_includes) + includes = map(Sourceify, map(self.LocalPathify, includes)) + includes = self.NormalizeIncludePaths(includes) + self.WriteList(includes, 'LOCAL_C_INCLUDES_%s' % configname) + + self.WriteLn('\n# Flags passed to only C++ (and not C) files.') + self.WriteList(config.get('cflags_cc'), 'LOCAL_CPPFLAGS_%s' % configname) + + self.WriteLn('\nLOCAL_CFLAGS := $(MY_CFLAGS_$(GYP_CONFIGURATION)) ' + '$(MY_DEFS_$(GYP_CONFIGURATION))') # Undefine ANDROID for host modules - # TODO: the source code should not use macro ANDROID to tell if it's host or - # target module. + # TODO: the source code should not use macro ANDROID to tell if it's host + # or target module. if self.toolset == 'host': self.WriteLn('# Undefine ANDROID for host modules') self.WriteLn('LOCAL_CFLAGS += -UANDROID') - - self.WriteLn('\n# Include paths placed before CFLAGS/CPPFLAGS') - includes = list(config.get('include_dirs', [])) - includes.extend(extracted_includes) - includes = map(Sourceify, map(self.LocalPathify, includes)) - includes = self.NormalizeIncludePaths(includes) - self.WriteList(includes, 'LOCAL_C_INCLUDES') self.WriteLn('LOCAL_C_INCLUDES := $(GYP_COPIED_SOURCE_ORIGIN_DIRS) ' - '$(LOCAL_C_INCLUDES)') - - self.WriteLn('\n# Flags passed to only C++ (and not C) files.') - self.WriteList(config.get('cflags_cc'), 'LOCAL_CPPFLAGS') + '$(LOCAL_C_INCLUDES_$(GYP_CONFIGURATION))') + self.WriteLn('LOCAL_CPPFLAGS := $(LOCAL_CPPFLAGS_$(GYP_CONFIGURATION))') def WriteSources(self, spec, configs, extra_sources): @@ -727,12 +724,11 @@ class AndroidMkWriter(object): """ clean_cflags = [] include_paths = [] - if cflags: - for flag in cflags: - if flag.startswith('-I'): - include_paths.append(flag[2:]) - else: - clean_cflags.append(flag) + for flag in cflags: + if flag.startswith('-I'): + include_paths.append(flag[2:]) + else: + clean_cflags.append(flag) return (clean_cflags, include_paths) @@ -796,13 +792,11 @@ class AndroidMkWriter(object): spec, configs: input from gyp. link_deps: link dependency list; see ComputeDeps() """ - config = configs[spec['default_configuration']] - - # LDFLAGS - ldflags = list(config.get('ldflags', [])) - if ldflags: + for configname, config in sorted(configs.iteritems()): + ldflags = list(config.get('ldflags', [])) self.WriteLn('') - self.WriteList(ldflags, 'LOCAL_LDFLAGS') + self.WriteList(ldflags, 'LOCAL_LDFLAGS_%s' % configname) + self.WriteLn('\nLOCAL_LDFLAGS := $(LOCAL_LDFLAGS_$(GYP_CONFIGURATION))') # Libraries (i.e. -lfoo) libraries = gyp.common.uniquer(spec.get('libraries', [])) @@ -1062,8 +1056,7 @@ def GenerateOutput(target_list, target_dicts, data, params): os.path.dirname(makefile_path)) include_list.add(mkfile_rel_path) - root_makefile.write('GYP_DEFAULT_CONFIGURATION := %s\n' % - default_configuration) + root_makefile.write('GYP_CONFIGURATION ?= %s\n' % default_configuration) # Write out the sorted list of includes. root_makefile.write('\n') diff --git a/pylib/gyp/generator/msvs.py b/pylib/gyp/generator/msvs.py index e9b4266f..4bef6a4a 100644 --- a/pylib/gyp/generator/msvs.py +++ b/pylib/gyp/generator/msvs.py @@ -787,10 +787,10 @@ def _GenerateRulesForMSVS(p, output_dir, options, spec, if rules_external: _GenerateExternalRules(rules_external, output_dir, spec, sources, options, actions_to_add) - _AdjustSourcesForRules(rules, sources, excluded_sources) + _AdjustSourcesForRules(spec, rules, sources, excluded_sources) -def _AdjustSourcesForRules(rules, sources, excluded_sources): +def _AdjustSourcesForRules(spec, rules, sources, excluded_sources): # Add outputs generated by each rule (if applicable). for rule in rules: # Done if not processing outputs as sources. @@ -803,7 +803,8 @@ def _AdjustSourcesForRules(rules, sources, excluded_sources): outputs = set(_FixPaths(outputs)) inputs.remove(_FixPath(trigger_file)) sources.update(inputs) - excluded_sources.update(inputs) + if not spec.get('msvs_external_builder'): + excluded_sources.update(inputs) sources.update(outputs) @@ -1327,7 +1328,8 @@ def _PrepareListOfSources(spec, generator_flags, gyp_file): # Add all inputs to sources and excluded sources. inputs = set(inputs) sources.update(inputs) - excluded_sources.update(inputs) + if not spec.get('msvs_external_builder'): + excluded_sources.update(inputs) if int(a.get('process_outputs_as_sources', False)): _AddNormalizedSources(sources, a.get('outputs', [])) # Add in 'copies' inputs and outputs. @@ -1774,6 +1776,9 @@ def CalculateVariables(default_variables, params): else: default_variables['MSVS_OS_BITS'] = 32 + if gyp.common.GetFlavor(params) == 'ninja': + default_variables['SHARED_INTERMEDIATE_DIR'] = '$(OutDir)gen' + def PerformBuild(data, configurations, params): options = params['options'] @@ -2015,7 +2020,7 @@ def _GenerateRulesForMSBuild(output_dir, options, spec, if rules_external: _GenerateExternalRules(rules_external, output_dir, spec, sources, options, actions_to_add) - _AdjustSourcesForRules(rules, sources, excluded_sources) + _AdjustSourcesForRules(spec, rules, sources, excluded_sources) class MSBuildRule(object): @@ -3020,6 +3025,9 @@ def _GenerateMSBuildProject(project, options, version, generator_flags): sources, excluded_sources, props_files_of_rules, targets_files_of_rules, actions_to_add, extension_to_rule_name) + else: + rules = spec.get('rules', []) + _AdjustSourcesForRules(spec, rules, sources, excluded_sources) sources, excluded_sources, excluded_idl = ( _AdjustSourcesAndConvertToFilterHierarchy(spec, options, diff --git a/pylib/gyp/generator/ninja.py b/pylib/gyp/generator/ninja.py index 423b8c7d..9b30c3bb 100644 --- a/pylib/gyp/generator/ninja.py +++ b/pylib/gyp/generator/ninja.py @@ -1361,7 +1361,7 @@ def GetDefaultConcurrentLinks(): stat.dwLength = ctypes.sizeof(stat) ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(stat)) - return max(1, stat.ullTotalPhys / (4 ** 31)) + return max(1, stat.ullTotalPhys / (4 * (2 ** 30))) # total / 4GB else: # TODO(scottmg): Implement this for other platforms. return 1 |