diff options
author | scottmg <scottmg@chromium.org> | 2015-06-01 18:15:44 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-02 01:16:21 +0000 |
commit | 54e450611852fcf8cb120f73b381a50768212415 (patch) | |
tree | a9fd8b87e9d4ce6fc90e9cc0b282dc75960d5fda /build/vs_toolchain.py | |
parent | b82ca244914869e9e6f667be9303f3ef42fbb22d (diff) | |
download | chromium_src-54e450611852fcf8cb120f73b381a50768212415.zip chromium_src-54e450611852fcf8cb120f73b381a50768212415.tar.gz chromium_src-54e450611852fcf8cb120f73b381a50768212415.tar.bz2 |
Prepare for VS2015 toolchain
This is not intended to change anything for current VS2013 users.
The 2015 code here will not work until a change in depot_tools side
lands. (It might not work after that either, but this is
the first step in getting a 2015 fyi bot up.)
R=dpranke@chromium.org
BUG=492774
Review URL: https://codereview.chromium.org/1163723003
Cr-Commit-Position: refs/heads/master@{#332296}
Diffstat (limited to 'build/vs_toolchain.py')
-rw-r--r-- | build/vs_toolchain.py | 84 |
1 files changed, 61 insertions, 23 deletions
diff --git a/build/vs_toolchain.py b/build/vs_toolchain.py index 5b175eb..f9908004 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(): |