Chromium Code Reviews| Index: build/vs_toolchain.py |
| diff --git a/build/vs_toolchain.py b/build/vs_toolchain.py |
| index 3edf1fff67cb449014b592c04ca5a3d371ce9c38..ff3c2490e06a1c01d7b4abad402918ab4918b355 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 |
|
scottmg
2017/01/22 23:43:35
Muppets. I guess we can do a .ps that prints out t
brucedawson
2017/01/23 06:46:03
I assume we can do COM from Python, but I don't re
|
| + # 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' |
| else: |
| raise ValueError('Unexpected GYP_MSVS_VERSION') |
| @@ -223,9 +236,10 @@ 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': |
| + if GetVisualStudioVersion() == '2015' or GetVisualStudioVersion() == '2017': |
| + # VS 2017 RC uses the same CRT DLLs as VS 2015. |
| _CopyRuntime2015(target_dir, source_dir, '%s140' + suffix, suffix) |
|
scottmg
2017/01/22 23:43:35
Please rename this function.
brucedawson
2017/01/23 06:46:03
Done.
|
| else: |
| _CopyRuntime2013(target_dir, source_dir, 'msvc%s120' + suffix) |