OLD | NEW |
---|---|
1 # Copyright (c) 2012 Google Inc. All rights reserved. | 1 # Copyright (c) 2012 Google Inc. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import copy | 5 import copy |
6 import ntpath | 6 import ntpath |
7 import os | 7 import os |
8 import posixpath | 8 import posixpath |
9 import re | 9 import re |
10 import subprocess | 10 import subprocess |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
250 def _ToolSetOrAppend(tools, tool_name, setting, value, only_if_unset=False): | 250 def _ToolSetOrAppend(tools, tool_name, setting, value, only_if_unset=False): |
251 # TODO(bradnelson): ugly hack, fix this more generally!!! | 251 # TODO(bradnelson): ugly hack, fix this more generally!!! |
252 if 'Directories' in setting or 'Dependencies' in setting: | 252 if 'Directories' in setting or 'Dependencies' in setting: |
253 if type(value) == str: | 253 if type(value) == str: |
254 value = value.replace('/', '\\') | 254 value = value.replace('/', '\\') |
255 else: | 255 else: |
256 value = [i.replace('/', '\\') for i in value] | 256 value = [i.replace('/', '\\') for i in value] |
257 if not tools.get(tool_name): | 257 if not tools.get(tool_name): |
258 tools[tool_name] = dict() | 258 tools[tool_name] = dict() |
259 tool = tools[tool_name] | 259 tool = tools[tool_name] |
260 if 'CompileAsWinRT' == setting: | |
261 return | |
260 if tool.get(setting): | 262 if tool.get(setting): |
261 if only_if_unset: return | 263 if only_if_unset: return |
262 if type(tool[setting]) == list and type(value) == list: | 264 if type(tool[setting]) == list and type(value) == list: |
263 tool[setting] += value | 265 tool[setting] += value |
264 else: | 266 else: |
265 raise TypeError( | 267 raise TypeError( |
266 'Appending "%s" to a non-list setting "%s" for tool "%s" is ' | 268 'Appending "%s" to a non-list setting "%s" for tool "%s" is ' |
267 'not allowed, previous value: %s' % ( | 269 'not allowed, previous value: %s' % ( |
268 value, setting, tool_name, str(tool[setting]))) | 270 value, setting, tool_name, str(tool[setting]))) |
269 else: | 271 else: |
270 tool[setting] = value | 272 tool[setting] = value |
271 | 273 |
272 | 274 |
273 def _ConfigPlatform(config_data): | 275 def _ConfigPlatform(config_data): |
274 return config_data.get('msvs_configuration_platform', 'Win32') | 276 return config_data.get('msvs_configuration_platform', 'Win32') |
275 | 277 |
276 | 278 |
277 def _ConfigBaseName(config_name, platform_name): | 279 def _ConfigBaseName(config_name, platform_name): |
278 if config_name.endswith('_' + platform_name): | 280 if config_name.endswith('_' + platform_name): |
279 return config_name[0:-len(platform_name) - 1] | 281 return config_name[0:-len(platform_name) - 1] |
280 else: | 282 else: |
281 return config_name | 283 return config_name |
282 | 284 |
283 | 285 |
284 def _ConfigFullName(config_name, config_data): | 286 def _ConfigFullName(config_name, config_data): |
285 platform_name = _ConfigPlatform(config_data) | 287 platform_name = _ConfigPlatform(config_data) |
286 return '%s|%s' % (_ConfigBaseName(config_name, platform_name), platform_name) | 288 return '%s|%s' % (_ConfigBaseName(config_name, platform_name), platform_name) |
287 | 289 |
288 | 290 |
291 def _ConfigWindowsTargetPlatformVersion(config_data): | |
292 ver = config_data.get('msvs_windows_sdk_version') | |
293 | |
294 for key in [r'HKLM\Software\Microsoft\Microsoft SDKs\Windows\%s', | |
295 r'HKLM\Software\Wow6432Node\Microsoft\Microsoft SDKs\Windows\%s']: | |
296 sdk_dir = MSVSVersion._RegistryGetValue(key % ver, 'InstallationFolder') | |
297 if not sdk_dir: | |
298 continue | |
299 version = MSVSVersion._RegistryGetValue(key % ver, 'ProductVersion') or '' | |
300 # Find a matching entry in sdk_dir\include. | |
301 names = sorted([x for x in os.listdir(r'%s\include' % sdk_dir) \ | |
scottmg
2016/04/05 16:52:36
This \ is unnecessary.
munyirik
2016/04/11 20:07:10
Acknowledged.
| |
302 if x.startswith(version)], reverse=True) | |
303 return names[0] | |
304 | |
305 | |
289 def _BuildCommandLineForRuleRaw(spec, cmd, cygwin_shell, has_input_path, | 306 def _BuildCommandLineForRuleRaw(spec, cmd, cygwin_shell, has_input_path, |
290 quote_cmd, do_setup_env): | 307 quote_cmd, do_setup_env): |
291 | 308 |
292 if [x for x in cmd if '$(InputDir)' in x]: | 309 if [x for x in cmd if '$(InputDir)' in x]: |
293 input_dir_preamble = ( | 310 input_dir_preamble = ( |
294 'set INPUTDIR=$(InputDir)\n' | 311 'set INPUTDIR=$(InputDir)\n' |
295 'if NOT DEFINED INPUTDIR set INPUTDIR=.\\\n' | 312 'if NOT DEFINED INPUTDIR set INPUTDIR=.\\\n' |
296 'set INPUTDIR=%INPUTDIR:~0,-1%\n' | 313 'set INPUTDIR=%INPUTDIR:~0,-1%\n' |
297 ) | 314 ) |
298 else: | 315 else: |
(...skipping 2370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2669 properties[0].append(['WindowsTargetPlatformMinVersion', | 2686 properties[0].append(['WindowsTargetPlatformMinVersion', |
2670 target_platform_minversion]) | 2687 target_platform_minversion]) |
2671 else: | 2688 else: |
2672 properties[0].append(['WindowsTargetPlatformMinVersion', | 2689 properties[0].append(['WindowsTargetPlatformMinVersion', |
2673 target_platform_version]) | 2690 target_platform_version]) |
2674 if spec.get('msvs_enable_winphone'): | 2691 if spec.get('msvs_enable_winphone'): |
2675 properties[0].append(['ApplicationType', 'Windows Phone']) | 2692 properties[0].append(['ApplicationType', 'Windows Phone']) |
2676 else: | 2693 else: |
2677 properties[0].append(['ApplicationType', 'Windows Store']) | 2694 properties[0].append(['ApplicationType', 'Windows Store']) |
2678 | 2695 |
2696 platform_name = None | |
2697 msvs_windows_sdk_version = None | |
2698 for configuration in spec['configurations'].itervalues(): | |
2699 platform_name = platform_name or _ConfigPlatform(configuration) | |
2700 msvs_windows_sdk_version = (msvs_windows_sdk_version or | |
2701 _ConfigWindowsTargetPlatformVersion(configuration)) | |
2702 if platform_name and msvs_windows_sdk_version: | |
2703 break | |
2704 | |
2705 if platform_name == 'ARM': | |
2706 properties[0].append(['WindowsSDKDesktopARMSupport', 'true']) | |
2707 if msvs_windows_sdk_version: | |
2708 properties[0].append(['WindowsTargetPlatformVersion', | |
2709 str(msvs_windows_sdk_version)]) | |
2710 | |
2679 return properties | 2711 return properties |
2680 | 2712 |
2681 def _GetMSBuildConfigurationDetails(spec, build_file): | 2713 def _GetMSBuildConfigurationDetails(spec, build_file): |
2682 properties = {} | 2714 properties = {} |
2683 for name, settings in spec['configurations'].iteritems(): | 2715 for name, settings in spec['configurations'].iteritems(): |
2684 msbuild_attributes = _GetMSBuildAttributes(spec, settings, build_file) | 2716 msbuild_attributes = _GetMSBuildAttributes(spec, settings, build_file) |
2685 condition = _GetConfigurationCondition(name, settings) | 2717 condition = _GetConfigurationCondition(name, settings) |
2686 character_set = msbuild_attributes.get('CharacterSet') | 2718 character_set = msbuild_attributes.get('CharacterSet') |
2687 _AddConditionalProperty(properties, condition, 'ConfigurationType', | 2719 _AddConditionalProperty(properties, condition, 'ConfigurationType', |
2688 msbuild_attributes['ConfigurationType']) | 2720 msbuild_attributes['ConfigurationType']) |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3210 for dependency in project.dependencies: | 3242 for dependency in project.dependencies: |
3211 guid = dependency.guid | 3243 guid = dependency.guid |
3212 project_dir = os.path.split(project.path)[0] | 3244 project_dir = os.path.split(project.path)[0] |
3213 relative_path = gyp.common.RelativePath(dependency.path, project_dir) | 3245 relative_path = gyp.common.RelativePath(dependency.path, project_dir) |
3214 project_ref = ['ProjectReference', | 3246 project_ref = ['ProjectReference', |
3215 {'Include': relative_path}, | 3247 {'Include': relative_path}, |
3216 ['Project', guid], | 3248 ['Project', guid], |
3217 ['ReferenceOutputAssembly', 'false'] | 3249 ['ReferenceOutputAssembly', 'false'] |
3218 ] | 3250 ] |
3219 for config in dependency.spec.get('configurations', {}).itervalues(): | 3251 for config in dependency.spec.get('configurations', {}).itervalues(): |
3252 if config.get('msvs_use_library_dependency_inputs', 0): | |
scottmg
2016/04/05 16:52:36
Could you explain why this needs to be added?
munyirik
2016/04/11 20:07:10
Ah yeah, your earlier comment was right. This is n
| |
3253 project_ref.append(['UseLibraryDependencyInputs', 'true']) | |
3254 break | |
3220 # If it's disabled in any config, turn it off in the reference. | 3255 # If it's disabled in any config, turn it off in the reference. |
3221 if config.get('msvs_2010_disable_uldi_when_referenced', 0): | 3256 if config.get('msvs_2010_disable_uldi_when_referenced', 0): |
3222 project_ref.append(['UseLibraryDependencyInputs', 'false']) | 3257 project_ref.append(['UseLibraryDependencyInputs', 'false']) |
3223 break | 3258 break |
3224 group.append(project_ref) | 3259 group.append(project_ref) |
3225 references.append(group) | 3260 references.append(group) |
3226 return references | 3261 return references |
3227 | 3262 |
3228 | 3263 |
3229 def _GenerateMSBuildProject(project, options, version, generator_flags): | 3264 def _GenerateMSBuildProject(project, options, version, generator_flags): |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3458 action_spec.extend( | 3493 action_spec.extend( |
3459 # TODO(jeanluc) 'Document' for all or just if as_sources? | 3494 # TODO(jeanluc) 'Document' for all or just if as_sources? |
3460 [['FileType', 'Document'], | 3495 [['FileType', 'Document'], |
3461 ['Command', command], | 3496 ['Command', command], |
3462 ['Message', description], | 3497 ['Message', description], |
3463 ['Outputs', outputs] | 3498 ['Outputs', outputs] |
3464 ]) | 3499 ]) |
3465 if additional_inputs: | 3500 if additional_inputs: |
3466 action_spec.append(['AdditionalInputs', additional_inputs]) | 3501 action_spec.append(['AdditionalInputs', additional_inputs]) |
3467 actions_spec.append(action_spec) | 3502 actions_spec.append(action_spec) |
OLD | NEW |