Index: pylib/gyp/generator/msvs.py |
diff --git a/pylib/gyp/generator/msvs.py b/pylib/gyp/generator/msvs.py |
index bc3b4c2fb4481a389ae38fe2148c46ab7d9daa72..30f15e6f809d8a238464496ae49e97d0c28e038a 100644 |
--- a/pylib/gyp/generator/msvs.py |
+++ b/pylib/gyp/generator/msvs.py |
@@ -1203,6 +1203,23 @@ def _GetOutputFilePathAndTool(spec, msbuild): |
return out_file, vc_tool, msbuild_tool |
+def _GetOutputTargetExt(spec): |
+ """Returns the extension for this target. |
+ |
+ If target_extension is specified, will prepend "." and return it, |
+ otherwise None. |
+ |
+ Arguments: |
+ spec: The target dictionary containing the properties of the target. |
+ Returns: |
+ A string with the extension, or None |
+ """ |
+ target_extension = spec.get('target_extension') |
+ if target_extension: |
+ return '.' + target_extension |
+ return None |
+ |
+ |
def _GetDefines(config): |
"""Returns the list of preprocessor definitions for this configuation. |
@@ -2652,6 +2669,9 @@ def _GetMSBuildAttributes(spec, config, build_file): |
out_file = msbuild_settings[msbuild_tool].get('OutputFile') |
if out_file: |
msbuild_attributes['TargetPath'] = _FixPath(out_file) |
+ target_ext = msbuild_settings[msbuild_tool].get('TargetExt') |
+ if target_ext: |
+ msbuild_attributes['TargetExt'] = target_ext |
return msbuild_attributes |
@@ -2687,6 +2707,9 @@ def _GetMSBuildConfigurationGlobalProperties(spec, configurations, build_file): |
if attributes.get('TargetPath'): |
_AddConditionalProperty(properties, condition, 'TargetPath', |
attributes['TargetPath']) |
+ if attributes.get('TargetExt'): |
+ _AddConditionalProperty(properties, condition, 'TargetExt', |
+ attributes['TargetExt']) |
if new_paths: |
_AddConditionalProperty(properties, condition, 'ExecutablePath', |
@@ -2807,6 +2830,7 @@ def _FinalizeMSBuildSettings(spec, configuration): |
libraries = _GetLibraries(spec) |
library_dirs = _GetLibraryDirs(configuration) |
out_file, _, msbuild_tool = _GetOutputFilePathAndTool(spec, msbuild=True) |
+ target_ext = _GetOutputTargetExt(spec) |
defines = _GetDefines(configuration) |
if converted: |
# Visual Studio 2010 has TR1 |
@@ -2844,6 +2868,9 @@ def _FinalizeMSBuildSettings(spec, configuration): |
if out_file: |
_ToolAppend(msbuild_settings, msbuild_tool, 'OutputFile', out_file, |
only_if_unset=True) |
+ if target_ext: |
+ _ToolAppend(msbuild_settings, msbuild_tool, 'TargetExt', target_ext, |
+ only_if_unset=True) |
# Add defines. |
_ToolAppend(msbuild_settings, 'ClCompile', |
'PreprocessorDefinitions', defines) |