Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2405)

Unified Diff: pylib/gyp/msvs_emulation.py

Issue 629543002: Add Ninja support for MSVS $(TargetExt), $(TargetFileName) and $(TargetPath) macros. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk
Patch Set: Reuse dictionary from MSVSUtil. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pylib/gyp/generator/ninja.py ('k') | test/win/gyptest-macro-targetext.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pylib/gyp/msvs_emulation.py
diff --git a/pylib/gyp/msvs_emulation.py b/pylib/gyp/msvs_emulation.py
index f0b814d36ec199062fb3ed53c451117c98242275..35cdb346602dbb0f14de9cf7af228d1195ae3077 100644
--- a/pylib/gyp/msvs_emulation.py
+++ b/pylib/gyp/msvs_emulation.py
@@ -13,10 +13,13 @@ import subprocess
import sys
from gyp.common import OrderedSet
+import gyp.MSVSUtil
import gyp.MSVSVersion
+
windows_quoter_regex = re.compile(r'(\\*)"')
+
def QuoteForRspFile(arg):
"""Quote a command line argument so that it appears as one argument when
processed via cmd.exe and parsed by CommandLineToArgvW (as is typical for
@@ -220,6 +223,17 @@ class MsvsSettings(object):
if unsupported:
raise Exception('\n'.join(unsupported))
+ def GetExtension(self):
+ """Returns the extension for the target, with no leading dot.
+
+ Uses 'product_extension' if specified, otherwise uses MSVS defaults based on
+ the target type.
+ """
+ ext = self.spec.get('product_extension', None)
+ if ext:
+ return ext
+ return gyp.MSVSUtil.TARGET_TYPE_EXT.get(self.spec['type'], '')
+
def GetVSMacroEnv(self, base_to_build=None, config=None):
"""Get a dict of variables mapping internal VS macro names to their gyp
equivalents."""
@@ -227,16 +241,22 @@ class MsvsSettings(object):
target_name = self.spec.get('product_prefix', '') + \
self.spec.get('product_name', self.spec['target_name'])
target_dir = base_to_build + '\\' if base_to_build else ''
+ target_ext = '.' + self.GetExtension()
+ target_file_name = target_name + target_ext
+
replacements = {
- '$(OutDir)\\': target_dir,
- '$(TargetDir)\\': target_dir,
- '$(IntDir)': '$!INTERMEDIATE_DIR',
- '$(InputPath)': '${source}',
'$(InputName)': '${root}',
- '$(ProjectName)': self.spec['target_name'],
- '$(TargetName)': target_name,
+ '$(InputPath)': '${source}',
+ '$(IntDir)': '$!INTERMEDIATE_DIR',
+ '$(OutDir)\\': target_dir,
'$(PlatformName)': target_platform,
'$(ProjectDir)\\': '',
+ '$(ProjectName)': self.spec['target_name'],
+ '$(TargetDir)\\': target_dir,
+ '$(TargetExt)': target_ext,
+ '$(TargetFileName)': target_file_name,
+ '$(TargetName)': target_name,
+ '$(TargetPath)': os.path.join(target_dir, target_file_name),
}
replacements.update(GetGlobalVSMacroEnv(self.vs_version))
return replacements
« no previous file with comments | « pylib/gyp/generator/ninja.py ('k') | test/win/gyptest-macro-targetext.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698