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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 generator_additional_non_configuration_keys = [ | 76 generator_additional_non_configuration_keys = [ |
77 'msvs_cygwin_dirs', | 77 'msvs_cygwin_dirs', |
78 'msvs_cygwin_shell', | 78 'msvs_cygwin_shell', |
79 'msvs_large_pdb', | 79 'msvs_large_pdb', |
80 'msvs_shard', | 80 'msvs_shard', |
81 'msvs_external_builder', | 81 'msvs_external_builder', |
82 'msvs_external_builder_out_dir', | 82 'msvs_external_builder_out_dir', |
83 'msvs_external_builder_build_cmd', | 83 'msvs_external_builder_build_cmd', |
84 'msvs_external_builder_clean_cmd', | 84 'msvs_external_builder_clean_cmd', |
85 'msvs_external_builder_clcompile_cmd', | 85 'msvs_external_builder_clcompile_cmd', |
86 'msvs_enable_winrt', | |
87 'msvs_requires_importlibrary', | |
88 'msvs_enable_winphone', | |
86 ] | 89 ] |
87 | 90 |
88 | 91 |
89 # List of precompiled header related keys. | 92 # List of precompiled header related keys. |
90 precomp_keys = [ | 93 precomp_keys = [ |
91 'msvs_precompiled_header', | 94 'msvs_precompiled_header', |
92 'msvs_precompiled_source', | 95 'msvs_precompiled_source', |
93 ] | 96 ] |
94 | 97 |
95 | 98 |
(...skipping 2492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2588 designation = '%s|%s' % (configuration, platform) | 2591 designation = '%s|%s' % (configuration, platform) |
2589 group.append( | 2592 group.append( |
2590 ['ProjectConfiguration', {'Include': designation}, | 2593 ['ProjectConfiguration', {'Include': designation}, |
2591 ['Configuration', configuration], | 2594 ['Configuration', configuration], |
2592 ['Platform', platform]]) | 2595 ['Platform', platform]]) |
2593 return [group] | 2596 return [group] |
2594 | 2597 |
2595 | 2598 |
2596 def _GetMSBuildGlobalProperties(spec, guid, gyp_file_name): | 2599 def _GetMSBuildGlobalProperties(spec, guid, gyp_file_name): |
2597 namespace = os.path.splitext(gyp_file_name)[0] | 2600 namespace = os.path.splitext(gyp_file_name)[0] |
2598 return [ | 2601 properties = {} |
scottmg
2014/09/23 17:04:25
(missed this, deleted this line on landing.)
| |
2602 properties = [ | |
2599 ['PropertyGroup', {'Label': 'Globals'}, | 2603 ['PropertyGroup', {'Label': 'Globals'}, |
2600 ['ProjectGuid', guid], | 2604 ['ProjectGuid', guid], |
2601 ['Keyword', 'Win32Proj'], | 2605 ['Keyword', 'Win32Proj'], |
2602 ['RootNamespace', namespace], | 2606 ['RootNamespace', namespace], |
2603 ['IgnoreWarnCompileDuplicatedFilename', 'true'], | 2607 ['IgnoreWarnCompileDuplicatedFilename', 'true'], |
2604 ] | 2608 ] |
2605 ] | 2609 ] |
2606 | 2610 |
2611 if spec.get('msvs_enable_winrt'): | |
2612 properties[0].append(['DefaultLanguage', 'en-US']) | |
2613 properties[0].append(['AppContainerApplication', 'true']) | |
2614 properties[0].append(['ApplicationTypeRevision', '8.1']) | |
2615 | |
2616 if spec.get('msvs_enable_winphone'): | |
2617 properties[0].append(['ApplicationType', 'Windows Phone']) | |
2618 else: | |
2619 properties[0].append(['ApplicationType', 'Windows Store']) | |
2620 | |
2621 return properties | |
2607 | 2622 |
2608 def _GetMSBuildConfigurationDetails(spec, build_file): | 2623 def _GetMSBuildConfigurationDetails(spec, build_file): |
2609 properties = {} | 2624 properties = {} |
2610 for name, settings in spec['configurations'].iteritems(): | 2625 for name, settings in spec['configurations'].iteritems(): |
2611 msbuild_attributes = _GetMSBuildAttributes(spec, settings, build_file) | 2626 msbuild_attributes = _GetMSBuildAttributes(spec, settings, build_file) |
2612 condition = _GetConfigurationCondition(name, settings) | 2627 condition = _GetConfigurationCondition(name, settings) |
2613 character_set = msbuild_attributes.get('CharacterSet') | 2628 character_set = msbuild_attributes.get('CharacterSet') |
2614 _AddConditionalProperty(properties, condition, 'ConfigurationType', | 2629 _AddConditionalProperty(properties, condition, 'ConfigurationType', |
2615 msbuild_attributes['ConfigurationType']) | 2630 msbuild_attributes['ConfigurationType']) |
2616 if character_set: | 2631 if character_set: |
2617 _AddConditionalProperty(properties, condition, 'CharacterSet', | 2632 if 'msvs_enable_winrt' not in spec : |
2618 character_set) | 2633 _AddConditionalProperty(properties, condition, 'CharacterSet', |
2634 character_set) | |
2619 return _GetMSBuildPropertyGroup(spec, 'Configuration', properties) | 2635 return _GetMSBuildPropertyGroup(spec, 'Configuration', properties) |
2620 | 2636 |
2621 | 2637 |
2622 def _GetMSBuildLocalProperties(msbuild_toolset): | 2638 def _GetMSBuildLocalProperties(msbuild_toolset): |
2623 # Currently the only local property we support is PlatformToolset | 2639 # Currently the only local property we support is PlatformToolset |
2624 properties = {} | 2640 properties = {} |
2625 if msbuild_toolset: | 2641 if msbuild_toolset: |
2626 properties = [ | 2642 properties = [ |
2627 ['PropertyGroup', {'Label': 'Locals'}, | 2643 ['PropertyGroup', {'Label': 'Locals'}, |
2628 ['PlatformToolset', msbuild_toolset], | 2644 ['PlatformToolset', msbuild_toolset], |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2967 _ToolAppend(msbuild_settings, 'ClCompile', | 2983 _ToolAppend(msbuild_settings, 'ClCompile', |
2968 'DisableSpecificWarnings', disabled_warnings) | 2984 'DisableSpecificWarnings', disabled_warnings) |
2969 # Turn on precompiled headers if appropriate. | 2985 # Turn on precompiled headers if appropriate. |
2970 if precompiled_header: | 2986 if precompiled_header: |
2971 precompiled_header = os.path.split(precompiled_header)[1] | 2987 precompiled_header = os.path.split(precompiled_header)[1] |
2972 _ToolAppend(msbuild_settings, 'ClCompile', 'PrecompiledHeader', 'Use') | 2988 _ToolAppend(msbuild_settings, 'ClCompile', 'PrecompiledHeader', 'Use') |
2973 _ToolAppend(msbuild_settings, 'ClCompile', | 2989 _ToolAppend(msbuild_settings, 'ClCompile', |
2974 'PrecompiledHeaderFile', precompiled_header) | 2990 'PrecompiledHeaderFile', precompiled_header) |
2975 _ToolAppend(msbuild_settings, 'ClCompile', | 2991 _ToolAppend(msbuild_settings, 'ClCompile', |
2976 'ForcedIncludeFiles', [precompiled_header]) | 2992 'ForcedIncludeFiles', [precompiled_header]) |
2993 else: | |
2994 _ToolAppend(msbuild_settings, 'ClCompile', 'PrecompiledHeader', 'NotUsing') | |
2995 # Turn off WinRT compilation | |
2996 _ToolAppend(msbuild_settings, 'ClCompile', 'CompileAsWinRT', 'false') | |
2997 # Turn on import libraries if appropriate | |
2998 if spec.get('msvs_requires_importlibrary'): | |
2999 _ToolAppend(msbuild_settings, '', 'IgnoreImportLibrary', 'false') | |
2977 # Loadable modules don't generate import libraries; | 3000 # Loadable modules don't generate import libraries; |
2978 # tell dependent projects to not expect one. | 3001 # tell dependent projects to not expect one. |
2979 if spec['type'] == 'loadable_module': | 3002 if spec['type'] == 'loadable_module': |
2980 _ToolAppend(msbuild_settings, '', 'IgnoreImportLibrary', 'true') | 3003 _ToolAppend(msbuild_settings, '', 'IgnoreImportLibrary', 'true') |
2981 # Set the module definition file if any. | 3004 # Set the module definition file if any. |
2982 if def_file: | 3005 if def_file: |
2983 _ToolAppend(msbuild_settings, 'Link', 'ModuleDefinitionFile', def_file) | 3006 _ToolAppend(msbuild_settings, 'Link', 'ModuleDefinitionFile', def_file) |
2984 configuration['finalized_msbuild_settings'] = msbuild_settings | 3007 configuration['finalized_msbuild_settings'] = msbuild_settings |
2985 if prebuild: | 3008 if prebuild: |
2986 _ToolAppend(msbuild_settings, 'PreBuildEvent', 'Command', prebuild) | 3009 _ToolAppend(msbuild_settings, 'PreBuildEvent', 'Command', prebuild) |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3207 'Project', | 3230 'Project', |
3208 {'xmlns': 'http://schemas.microsoft.com/developer/msbuild/2003', | 3231 {'xmlns': 'http://schemas.microsoft.com/developer/msbuild/2003', |
3209 'ToolsVersion': version.ProjectVersion(), | 3232 'ToolsVersion': version.ProjectVersion(), |
3210 'DefaultTargets': 'Build' | 3233 'DefaultTargets': 'Build' |
3211 }] | 3234 }] |
3212 | 3235 |
3213 content += _GetMSBuildProjectConfigurations(configurations) | 3236 content += _GetMSBuildProjectConfigurations(configurations) |
3214 content += _GetMSBuildGlobalProperties(spec, project.guid, project_file_name) | 3237 content += _GetMSBuildGlobalProperties(spec, project.guid, project_file_name) |
3215 content += import_default_section | 3238 content += import_default_section |
3216 content += _GetMSBuildConfigurationDetails(spec, project.build_file) | 3239 content += _GetMSBuildConfigurationDetails(spec, project.build_file) |
3217 content += _GetMSBuildLocalProperties(project.msbuild_toolset) | 3240 if spec.get('msvs_enable_winphone'): |
3241 content += _GetMSBuildLocalProperties('v120_wp81') | |
3242 else: | |
3243 content += _GetMSBuildLocalProperties(project.msbuild_toolset) | |
3218 content += import_cpp_props_section | 3244 content += import_cpp_props_section |
3219 content += _GetMSBuildExtensions(props_files_of_rules) | 3245 content += _GetMSBuildExtensions(props_files_of_rules) |
3220 content += _GetMSBuildPropertySheets(configurations) | 3246 content += _GetMSBuildPropertySheets(configurations) |
3221 content += macro_section | 3247 content += macro_section |
3222 content += _GetMSBuildConfigurationGlobalProperties(spec, configurations, | 3248 content += _GetMSBuildConfigurationGlobalProperties(spec, configurations, |
3223 project.build_file) | 3249 project.build_file) |
3224 content += _GetMSBuildToolSettingsSections(spec, configurations) | 3250 content += _GetMSBuildToolSettingsSections(spec, configurations) |
3225 content += _GetMSBuildSources( | 3251 content += _GetMSBuildSources( |
3226 spec, sources, exclusions, extension_to_rule_name, actions_spec, | 3252 spec, sources, exclusions, extension_to_rule_name, actions_spec, |
3227 sources_handled_by_action, list_excluded) | 3253 sources_handled_by_action, list_excluded) |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3355 action_spec.extend( | 3381 action_spec.extend( |
3356 # TODO(jeanluc) 'Document' for all or just if as_sources? | 3382 # TODO(jeanluc) 'Document' for all or just if as_sources? |
3357 [['FileType', 'Document'], | 3383 [['FileType', 'Document'], |
3358 ['Command', command], | 3384 ['Command', command], |
3359 ['Message', description], | 3385 ['Message', description], |
3360 ['Outputs', outputs] | 3386 ['Outputs', outputs] |
3361 ]) | 3387 ]) |
3362 if additional_inputs: | 3388 if additional_inputs: |
3363 action_spec.append(['AdditionalInputs', additional_inputs]) | 3389 action_spec.append(['AdditionalInputs', additional_inputs]) |
3364 actions_spec.append(action_spec) | 3390 actions_spec.append(action_spec) |
OLD | NEW |