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

Unified Diff: build/vs_toolchain.py

Issue 1163723003: Prepare for VS2015 toolchain (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: delete dead code Created 5 years, 7 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 | « build/toolchain_vs2013.hash ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/vs_toolchain.py
diff --git a/build/vs_toolchain.py b/build/vs_toolchain.py
index 5b175eb13169af7dc7f9a51619052ce92fabf88c..f9908004ddc9adae5766f947ab7042cc5c152b2b 100644
--- a/build/vs_toolchain.py
+++ b/build/vs_toolchain.py
@@ -37,7 +37,9 @@ def SetEnvironmentAndGetRuntimeDllDirs():
toolchain = toolchain_data['path']
version = toolchain_data['version']
- win8sdk = toolchain_data['win8sdk']
+ win_sdk = toolchain_data.get('win_sdk')
+ if not win_sdk:
+ win_sdk = toolchain_data['win8sdk']
wdk = toolchain_data['wdk']
# TODO(scottmg): The order unfortunately matters in these. They should be
# split into separate keys for x86 and x64. (See CopyVsRuntimeDlls call
@@ -51,10 +53,10 @@ def SetEnvironmentAndGetRuntimeDllDirs():
# otheroptions.express
# values there.
gyp_defines_dict = gyp.NameValueListToDict(gyp.ShlexEnv('GYP_DEFINES'))
- gyp_defines_dict['windows_sdk_path'] = win8sdk
+ gyp_defines_dict['windows_sdk_path'] = win_sdk
os.environ['GYP_DEFINES'] = ' '.join('%s=%s' % (k, pipes.quote(str(v)))
for k, v in gyp_defines_dict.iteritems())
- os.environ['WINDOWSSDKDIR'] = win8sdk
+ os.environ['WINDOWSSDKDIR'] = win_sdk
os.environ['WDK_DIR'] = wdk
# Include the VS runtime in the PATH in case it's not machine-installed.
runtime_path = ';'.join(vs2013_runtime_dll_dirs)
@@ -62,6 +64,17 @@ def SetEnvironmentAndGetRuntimeDllDirs():
return vs2013_runtime_dll_dirs
+def _VersionNumber():
+ """Gets the standard version number ('120', '140', etc.) based on
+ GYP_MSVS_VERSION."""
+ if os.environ['GYP_MSVS_VERSION'] == '2013':
+ return '120'
+ elif os.environ['GYP_MSVS_VERSION'] == '2015':
+ return '140'
+ else:
+ raise ValueError('Unexpected GYP_MSVS_VERSION')
+
+
def _CopyRuntimeImpl(target, source):
"""Copy |source| to |target| if it doesn't already exist or if it
needs to be updated.
@@ -75,14 +88,24 @@ def _CopyRuntimeImpl(target, source):
shutil.copy2(source, target)
-def _CopyRuntime(target_dir, source_dir, dll_pattern):
- """Copy both the msvcr and msvcp runtime DLLs, only if the target doesn't
- exist, but the target directory does exist."""
- for which in ('p', 'r'):
- dll = dll_pattern % which
- target = os.path.join(target_dir, dll)
- source = os.path.join(source_dir, dll)
- _CopyRuntimeImpl(target, source)
+def _CopyRuntime2013(target_dir, source_dir, dll_pattern):
+ """Copy both the msvcr and msvcp runtime DLLs, only if the target doesn't
+ exist, but the target directory does exist."""
+ for file_part in ('p', 'r'):
+ dll = dll_pattern % file_part
+ target = os.path.join(target_dir, dll)
+ source = os.path.join(source_dir, dll)
+ _CopyRuntimeImpl(target, source)
+
+
+def _CopyRuntime2015(target_dir, source_dir, dll_pattern):
+ """Copy both the msvcp and vccorlib runtime DLLs, only if the target doesn't
+ exist, but the target directory does exist."""
+ for file_part in ('msvcp', 'vccorlib'):
+ dll = dll_pattern % file_part
+ target = os.path.join(target_dir, dll)
+ source = os.path.join(source_dir, dll)
+ _CopyRuntimeImpl(target, source)
def CopyVsRuntimeDlls(output_dir, runtime_dirs):
@@ -107,19 +130,28 @@ def CopyVsRuntimeDlls(output_dir, runtime_dirs):
os.makedirs(out_debug_nacl64)
if os.path.exists(out_release) and not os.path.exists(out_release_nacl64):
os.makedirs(out_release_nacl64)
- _CopyRuntime(out_debug, x86, 'msvc%s120d.dll')
- _CopyRuntime(out_release, x86, 'msvc%s120.dll')
- _CopyRuntime(out_debug_x64, x64, 'msvc%s120d.dll')
- _CopyRuntime(out_release_x64, x64, 'msvc%s120.dll')
- _CopyRuntime(out_debug_nacl64, x64, 'msvc%s120d.dll')
- _CopyRuntime(out_release_nacl64, x64, 'msvc%s120.dll')
+ if os.environ.get('GYP_MSVS_VERSION') == '2015':
+ _CopyRuntime2015(out_debug, x86, '%s140d.dll')
+ _CopyRuntime2015(out_release, x86, '%s140.dll')
+ _CopyRuntime2015(out_debug_x64, x64, '%s140d.dll')
+ _CopyRuntime2015(out_release_x64, x64, '%s140.dll')
+ _CopyRuntime2015(out_debug_nacl64, x64, '%s140d.dll')
+ _CopyRuntime2015(out_release_nacl64, x64, '%s140.dll')
+ else:
+ # VS2013 is the default.
+ _CopyRuntime2013(out_debug, x86, 'msvc%s120d.dll')
+ _CopyRuntime2013(out_release, x86, 'msvc%s120.dll')
+ _CopyRuntime2013(out_debug_x64, x64, 'msvc%s120d.dll')
+ _CopyRuntime2013(out_release_x64, x64, 'msvc%s120.dll')
+ _CopyRuntime2013(out_debug_nacl64, x64, 'msvc%s120d.dll')
+ _CopyRuntime2013(out_release_nacl64, x64, 'msvc%s120.dll')
# Copy the PGO runtime library to the release directories.
if os.environ.get('GYP_MSVS_OVERRIDE_PATH'):
pgo_x86_runtime_dir = os.path.join(os.environ.get('GYP_MSVS_OVERRIDE_PATH'),
'VC', 'bin')
pgo_x64_runtime_dir = os.path.join(pgo_x86_runtime_dir, 'amd64')
- pgo_runtime_dll = 'pgort120.dll'
+ pgo_runtime_dll = 'pgort' + _VersionNumber() + '.dll'
source_x86 = os.path.join(pgo_x86_runtime_dir, pgo_runtime_dll)
if os.path.exists(source_x86):
_CopyRuntimeImpl(os.path.join(out_release, pgo_runtime_dll), source_x86)
@@ -144,17 +176,23 @@ def CopyDlls(target_dir, configuration, target_cpu):
x64_runtime, x86_runtime = vs2013_runtime_dll_dirs
runtime_dir = x64_runtime if target_cpu == 'x64' else x86_runtime
- _CopyRuntime(target_dir, runtime_dir, 'msvc%s120.dll')
+ _CopyRuntime2013(
+ target_dir, runtime_dir, 'msvc%s' + _VersionNumber() + '.dll')
if configuration == 'Debug':
- _CopyRuntime(target_dir, runtime_dir, 'msvc%s120d.dll')
+ _CopyRuntime2013(
+ target_dir, runtime_dir, 'msvc%s' + _VersionNumber() + 'd.dll')
def _GetDesiredVsToolchainHashes():
"""Load a list of SHA1s corresponding to the toolchains that we want installed
to build with."""
- sha1path = os.path.join(script_dir, 'toolchain_vs2013.hash')
- with open(sha1path, 'rb') as f:
- return f.read().strip().splitlines()
+ # TODO(scottmg): If explicitly set to VS2015 override hashes to the VS2015 RC
+ # toolchain. http://crbug.com/492774.
+ if os.environ.get('GYP_MSVS_VERSION') == '2015':
+ return ['89341a333306b216e0121fcf2495d04ccbb8c4fc']
+ else:
+ # Default to VS2013.
+ return ['ee7d718ec60c2dc5d255bbe325909c2021a7efef']
def Update():
« no previous file with comments | « build/toolchain_vs2013.hash ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698