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