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