Index: tools/clang/scripts/update.py |
diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py |
index af3df5aac680307b3721420e6e7a0e49d9a2958d..8ae4dea5c354bf1e2bb3f292a72185b6f2e11dc1 100755 |
--- a/tools/clang/scripts/update.py |
+++ b/tools/clang/scripts/update.py |
@@ -136,13 +136,20 @@ def AddCMakeToPath(): |
vs_version = None |
def GetVSVersion(): |
global vs_version |
- if not vs_version: |
- # TODO(hans): Find a less hacky way to find the MSVS installation. |
- sys.path.append(os.path.join(CHROMIUM_DIR, 'tools', 'gyp', 'pylib')) |
- import gyp.MSVSVersion |
- # We request VS 2013 because Clang won't build with 2010, and 2013 will be |
- # the default for Chromium soon anyway. |
- vs_version = gyp.MSVSVersion.SelectVisualStudioVersion('2013') |
+ if vs_version: |
+ return vs_version |
+ |
+ # Try using the toolchain in depot_tools. |
+ # This sets environment variables used by SelectVisualStudioVersion below. |
+ sys.path.append(os.path.join(CHROMIUM_DIR, 'build')) |
+ import vs_toolchain |
+ vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs() |
+ |
+ # Use gyp to find the MSVS installation, either in depot_tools as per above, |
+ # or a system-wide installation otherwise. |
+ sys.path.append(os.path.join(CHROMIUM_DIR, 'tools', 'gyp', 'pylib')) |
+ import gyp.MSVSVersion |
+ vs_version = gyp.MSVSVersion.SelectVisualStudioVersion('2013') |
return vs_version |