Chromium Code Reviews| Index: build/vs_toolchain.py |
| diff --git a/build/vs_toolchain.py b/build/vs_toolchain.py |
| index 3edf1fff67cb449014b592c04ca5a3d371ce9c38..aa56a79b8adc76dced28026663a5bf1610c34b67 100755 |
| --- a/build/vs_toolchain.py |
| +++ b/build/vs_toolchain.py |
| @@ -135,20 +135,31 @@ def DetectVisualStudioPath(): |
| year_to_version = { |
| '2013': '12.0', |
| '2015': '14.0', |
| + '2017': '15.0', |
| } |
| if version_as_year not in year_to_version: |
| raise Exception(('Visual Studio version %s (from GYP_MSVS_VERSION)' |
| ' not supported. Supported versions are: %s') % ( |
| version_as_year, ', '.join(year_to_version.keys()))) |
| version = year_to_version[version_as_year] |
| - keys = [r'HKLM\Software\Microsoft\VisualStudio\%s' % version, |
| - r'HKLM\Software\Wow6432Node\Microsoft\VisualStudio\%s' % version] |
| - for key in keys: |
| - path = _RegistryGetValue(key, 'InstallDir') |
| - if not path: |
| - continue |
| - path = os.path.normpath(os.path.join(path, '..', '..')) |
| - return path |
| + if version_as_year == '2017': |
| + # The VC++ 2017 install location needs to be located using COM instead of |
| + # the registry. For details see: |
| + # https://blogs.msdn.microsoft.com/heaths/2016/09/15/changes-to-visual-studio-15-setup/ |
| + # For now we use a hardcoded default with an environment variable override. |
| + path = r'C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional' |
| + path = os.environ.get('vs2017_install', path) |
| + if os.path.exists(path): |
| + return path |
| + else: |
| + keys = [r'HKLM\Software\Microsoft\VisualStudio\%s' % version, |
| + r'HKLM\Software\Wow6432Node\Microsoft\VisualStudio\%s' % version] |
| + for key in keys: |
| + path = _RegistryGetValue(key, 'InstallDir') |
| + if not path: |
| + continue |
| + path = os.path.normpath(os.path.join(path, '..', '..')) |
| + return path |
| raise Exception(('Visual Studio Version %s (from GYP_MSVS_VERSION)' |
| ' not found.') % (version_as_year)) |
| @@ -162,6 +173,8 @@ def _VersionNumber(): |
| return '120' |
| elif vs_version == '2015': |
| return '140' |
| + elif vs_version == '2017': |
| + return '150' |
|
Sébastien Marchand
2017/05/10 21:23:49
Is it true? The files in 4e8a360587a3c8ff3fa46aa92
brucedawson
2017/05/10 21:32:32
I think VS 2017 uses 140, 141, and 150, depending
|
| else: |
| raise ValueError('Unexpected GYP_MSVS_VERSION') |
| @@ -196,7 +209,7 @@ def _CopyRuntime2013(target_dir, source_dir, dll_pattern): |
| _CopyRuntimeImpl(target, source) |
| -def _CopyRuntime2015(target_dir, source_dir, dll_pattern, suffix): |
| +def _CopyUCRTRuntime(target_dir, source_dir, dll_pattern, suffix): |
| """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', 'vcruntime'): |
| @@ -223,10 +236,11 @@ def _CopyRuntime2015(target_dir, source_dir, dll_pattern, suffix): |
| def _CopyRuntime(target_dir, source_dir, target_cpu, debug): |
| """Copy the VS runtime DLLs, only if the target doesn't exist, but the target |
| - directory does exist. Handles VS 2013 and VS 2015.""" |
| + directory does exist. Handles VS 2013, VS 2015, and VS 2017.""" |
| suffix = "d.dll" if debug else ".dll" |
| - if GetVisualStudioVersion() == '2015': |
| - _CopyRuntime2015(target_dir, source_dir, '%s140' + suffix, suffix) |
| + if GetVisualStudioVersion() == '2015' or GetVisualStudioVersion() == '2017': |
| + # VS 2017 RC uses the same CRT DLLs as VS 2015. |
| + _CopyUCRTRuntime(target_dir, source_dir, '%s140' + suffix, suffix) |
| else: |
| _CopyRuntime2013(target_dir, source_dir, 'msvc%s120' + suffix) |