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

Unified Diff: pylib/gyp/generator/msvs.py

Issue 1845943002: Enabling /ZW (CompileAsWinRT) option for msvs (Closed) Base URL: https://chromium.googlesource.com/external/gyp.git@master
Patch Set: Created 4 years, 9 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
Index: pylib/gyp/generator/msvs.py
diff --git a/pylib/gyp/generator/msvs.py b/pylib/gyp/generator/msvs.py
index bc4dfc31247b735f853eed881c858913169a328e..976fd069ed356aa0372ec6006c06b6c40e039e64 100644
--- a/pylib/gyp/generator/msvs.py
+++ b/pylib/gyp/generator/msvs.py
@@ -257,6 +257,7 @@ def _ToolSetOrAppend(tools, tool_name, setting, value, only_if_unset=False):
if not tools.get(tool_name):
tools[tool_name] = dict()
tool = tools[tool_name]
+ if 'CompileAsWinRT' == setting: return
scottmg 2016/04/04 22:05:17 return on separate line
munyirik 2016/04/11 20:07:10 Acknowledged.
if tool.get(setting):
if only_if_unset: return
if type(tool[setting]) == list and type(value) == list:
@@ -286,6 +287,22 @@ def _ConfigFullName(config_name, config_data):
return '%s|%s' % (_ConfigBaseName(config_name, platform_name), platform_name)
+def _ConfigWindowsTargetPlatformVersion(config_data):
+ ver = config_data.get('msvs_windows_sdk_version')
+ if not ver or re.match(r'^\d+', ver):
scottmg 2016/04/04 22:05:17 What's the re for? This will be something like 'v1
munyirik 2016/04/11 20:07:10 That was a typo in the gyp file. The string will b
+ return ver
+ for key in [r'HKLM\Software\Microsoft\Microsoft SDKs\Windows\%s',
+ r'HKLM\Software\Wow6432Node\Microsoft\Microsoft SDKs\Windows\%s']:
+ sdkdir = MSVSVersion._RegistryGetValue(key % ver, 'InstallationFolder')
scottmg 2016/04/04 22:05:17 nit; sdk_dir looks nicer.
munyirik 2016/04/11 20:07:10 Acknowledged.
+ if not sdkdir:
+ continue
+ version = MSVSVersion._RegistryGetValue(key % ver, 'ProductVersion') or ''
+ # find a matching entry in sdkdir\include
scottmg 2016/04/04 22:05:17 nit; Capital F, end sentence with '.'.
munyirik 2016/04/11 20:07:10 Acknowledged.
+ names = sorted([x for x in os.listdir(r'%s\include' % sdkdir) \
scottmg 2016/04/04 22:05:17 Why do we need to use the prefix and then reverse
munyirik 2016/04/11 20:07:09 The reason is to get the latest SDK version. If so
+ if x.startswith(version)], reverse = True)
scottmg 2016/04/04 22:05:17 nit; no spaces in "reverse=True".
munyirik 2016/04/11 20:07:10 Acknowledged.
+ return names[0]
+
+
def _BuildCommandLineForRuleRaw(spec, cmd, cygwin_shell, has_input_path,
quote_cmd, do_setup_env):
@@ -339,6 +356,8 @@ def _BuildCommandLineForRuleRaw(spec, cmd, cygwin_shell, has_input_path,
command = ['type']
else:
command = [cmd[0].replace('/', '\\')]
+ if quote_cmd:
+ command = ['"%s"' % i for i in command]
# Add call before command to ensure that commands can be tied together one
# after the other without aborting in Incredibuild, since IB makes a bat
# file out of the raw command string, and some commands (like python) are
@@ -2676,6 +2695,22 @@ def _GetMSBuildGlobalProperties(spec, guid, gyp_file_name):
else:
properties[0].append(['ApplicationType', 'Windows Store'])
+ platform_name = None
+ msvs_windows_sdk_version = None
+ for configuration in spec['configurations'].itervalues():
+ platform_name = platform_name or _ConfigPlatform(configuration)
+ msvs_windows_sdk_version = \
scottmg 2016/04/04 22:05:17 Instead of using \, put () around the whole expres
munyirik 2016/04/11 20:07:10 Acknowledged.
+ msvs_windows_sdk_version or \
+ _ConfigWindowsTargetPlatformVersion(configuration)
+ if platform_name and msvs_windows_sdk_version:
+ break
+
+ if platform_name == 'ARM':
+ properties[0].append(['WindowsSDKDesktopARMSupport', 'true'])
+ if msvs_windows_sdk_version:
+ properties[0].append(['WindowsTargetPlatformVersion', \
scottmg 2016/04/04 22:05:17 This \ line continuation is unnecessary.
munyirik 2016/04/11 20:07:10 Acknowledged.
+ str(msvs_windows_sdk_version)])
+
return properties
def _GetMSBuildConfigurationDetails(spec, build_file):
@@ -3217,6 +3252,9 @@ def _GetMSBuildProjectReferences(project):
['ReferenceOutputAssembly', 'false']
]
for config in dependency.spec.get('configurations', {}).itervalues():
+ if config.get('msvs_use_library_dependency_inputs', 0):
scottmg 2016/04/04 22:05:17 What's this? We have ULDI settings already in vari
munyirik 2016/04/11 20:07:10 Sorry, I missed putting this in the description. I
+ project_ref.append(['UseLibraryDependencyInputs', 'true'])
+ break
# If it's disabled in any config, turn it off in the reference.
if config.get('msvs_2010_disable_uldi_when_referenced', 0):
project_ref.append(['UseLibraryDependencyInputs', 'false'])

Powered by Google App Engine
This is Rietveld 408576698