Source release v3.3.0
This commit is contained in:
66
third_party/gyp/generator/msvs.py
vendored
66
third_party/gyp/generator/msvs.py
vendored
@@ -294,19 +294,21 @@ 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')
|
||||
|
||||
for key in [r'HKLM\Software\Microsoft\Microsoft SDKs\Windows\%s',
|
||||
r'HKLM\Software\Wow6432Node\Microsoft\Microsoft SDKs\Windows\%s']:
|
||||
sdk_dir = MSVSVersion._RegistryGetValue(key % ver, 'InstallationFolder')
|
||||
if not sdk_dir:
|
||||
continue
|
||||
version = MSVSVersion._RegistryGetValue(key % ver, 'ProductVersion') or ''
|
||||
# Find a matching entry in sdk_dir\include.
|
||||
names = sorted([x for x in os.listdir(r'%s\include' % sdk_dir)
|
||||
if x.startswith(version)], reverse=True)
|
||||
return names[0]
|
||||
def _ConfigWindowsTargetPlatformVersion(config_data, version):
|
||||
config_ver = config_data.get('msvs_windows_sdk_version')
|
||||
vers = [config_ver] if config_ver else version.compatible_sdks
|
||||
for ver in vers:
|
||||
for key in [
|
||||
r'HKLM\Software\Microsoft\Microsoft SDKs\Windows\%s',
|
||||
r'HKLM\Software\Wow6432Node\Microsoft\Microsoft SDKs\Windows\%s']:
|
||||
sdk_dir = MSVSVersion._RegistryGetValue(key % ver, 'InstallationFolder')
|
||||
if not sdk_dir:
|
||||
continue
|
||||
version = MSVSVersion._RegistryGetValue(key % ver, 'ProductVersion') or ''
|
||||
# Find a matching entry in sdk_dir\include.
|
||||
names = sorted([x for x in os.listdir(r'%s\include' % sdk_dir)
|
||||
if x.startswith(version)], reverse=True)
|
||||
return names[0]
|
||||
|
||||
|
||||
def _BuildCommandLineForRuleRaw(spec, cmd, cygwin_shell, has_input_path,
|
||||
@@ -1715,14 +1717,17 @@ def _GetCopies(spec):
|
||||
src_bare = src[:-1]
|
||||
base_dir = posixpath.split(src_bare)[0]
|
||||
outer_dir = posixpath.split(src_bare)[1]
|
||||
cmd = 'cd "%s" && xcopy /e /f /y "%s" "%s\\%s\\"' % (
|
||||
_FixPath(base_dir), outer_dir, _FixPath(dst), outer_dir)
|
||||
fixed_dst = _FixPath(dst)
|
||||
full_dst = '"%s\\%s\\"' % (fixed_dst, outer_dir)
|
||||
cmd = 'mkdir %s 2>nul & cd "%s" && xcopy /e /f /y "%s" %s' % (
|
||||
full_dst, _FixPath(base_dir), outer_dir, full_dst)
|
||||
copies.append(([src], ['dummy_copies', dst], cmd,
|
||||
'Copying %s to %s' % (src, dst)))
|
||||
'Copying %s to %s' % (src, fixed_dst)))
|
||||
else:
|
||||
fix_dst = _FixPath(cpy['destination'])
|
||||
cmd = 'mkdir "%s" 2>nul & set ERRORLEVEL=0 & copy /Y "%s" "%s"' % (
|
||||
_FixPath(cpy['destination']), _FixPath(src), _FixPath(dst))
|
||||
copies.append(([src], [dst], cmd, 'Copying %s to %s' % (src, dst)))
|
||||
fix_dst, _FixPath(src), _FixPath(dst))
|
||||
copies.append(([src], [dst], cmd, 'Copying %s to %s' % (src, fix_dst)))
|
||||
return copies
|
||||
|
||||
|
||||
@@ -2664,7 +2669,7 @@ def _GetMSBuildProjectConfigurations(configurations):
|
||||
return [group]
|
||||
|
||||
|
||||
def _GetMSBuildGlobalProperties(spec, guid, gyp_file_name):
|
||||
def _GetMSBuildGlobalProperties(spec, version, guid, gyp_file_name):
|
||||
namespace = os.path.splitext(gyp_file_name)[0]
|
||||
properties = [
|
||||
['PropertyGroup', {'Label': 'Globals'},
|
||||
@@ -2709,15 +2714,18 @@ def _GetMSBuildGlobalProperties(spec, guid, gyp_file_name):
|
||||
for configuration in spec['configurations'].itervalues():
|
||||
platform_name = platform_name or _ConfigPlatform(configuration)
|
||||
msvs_windows_sdk_version = (msvs_windows_sdk_version or
|
||||
_ConfigWindowsTargetPlatformVersion(configuration))
|
||||
_ConfigWindowsTargetPlatformVersion(configuration, version))
|
||||
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',
|
||||
str(msvs_windows_sdk_version)])
|
||||
elif version.compatible_sdks:
|
||||
raise GypError('%s requires any SDK of %o version, but non were found' %
|
||||
(version.description, version.compatible_sdks))
|
||||
|
||||
if platform_name == 'ARM':
|
||||
properties[0].append(['WindowsSDKDesktopARMSupport', 'true'])
|
||||
|
||||
return properties
|
||||
|
||||
@@ -2862,6 +2870,9 @@ def _GetMSBuildAttributes(spec, config, build_file):
|
||||
product_name = spec.get('product_name', '$(ProjectName)')
|
||||
target_name = prefix + product_name
|
||||
msbuild_attributes['TargetName'] = target_name
|
||||
if 'TargetExt' not in msbuild_attributes and 'product_extension' in spec:
|
||||
ext = spec.get('product_extension')
|
||||
msbuild_attributes['TargetExt'] = '.' + ext
|
||||
|
||||
if spec.get('msvs_external_builder'):
|
||||
external_out_dir = spec.get('msvs_external_builder_out_dir', '.')
|
||||
@@ -2916,6 +2927,9 @@ def _GetMSBuildConfigurationGlobalProperties(spec, configurations, build_file):
|
||||
attributes['OutputDirectory'])
|
||||
_AddConditionalProperty(properties, condition, 'TargetName',
|
||||
attributes['TargetName'])
|
||||
if 'TargetExt' in attributes:
|
||||
_AddConditionalProperty(properties, condition, 'TargetExt',
|
||||
attributes['TargetExt'])
|
||||
|
||||
if attributes.get('TargetPath'):
|
||||
_AddConditionalProperty(properties, condition, 'TargetPath',
|
||||
@@ -3268,6 +3282,9 @@ def _GetMSBuildProjectReferences(project):
|
||||
['ReferenceOutputAssembly', 'false']
|
||||
]
|
||||
for config in dependency.spec.get('configurations', {}).itervalues():
|
||||
if config.get('msvs_use_library_dependency_inputs', 0):
|
||||
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'])
|
||||
@@ -3360,7 +3377,8 @@ def _GenerateMSBuildProject(project, options, version, generator_flags):
|
||||
}]
|
||||
|
||||
content += _GetMSBuildProjectConfigurations(configurations)
|
||||
content += _GetMSBuildGlobalProperties(spec, project.guid, project_file_name)
|
||||
content += _GetMSBuildGlobalProperties(spec, version, project.guid,
|
||||
project_file_name)
|
||||
content += import_default_section
|
||||
content += _GetMSBuildConfigurationDetails(spec, project.build_file)
|
||||
if spec.get('msvs_enable_winphone'):
|
||||
|
||||
Reference in New Issue
Block a user