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

Unified Diff: build/toolchain/win/setup_toolchain.py

Issue 1556993002: [gn] Detect location of Visual Studio in the registry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review fixes. Created 4 years, 11 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 | « no previous file | build/vs_toolchain.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/toolchain/win/setup_toolchain.py
diff --git a/build/toolchain/win/setup_toolchain.py b/build/toolchain/win/setup_toolchain.py
index 4e79cd904eea00303f17b15380ba7b807ebda02b..d2dc4609644fe9862901e8938b8c590bc54eace0 100644
--- a/build/toolchain/win/setup_toolchain.py
+++ b/build/toolchain/win/setup_toolchain.py
@@ -16,6 +16,7 @@ import re
import subprocess
import sys
+SCRIPT_DIR = os.path.dirname(__file__)
def _ExtractImportantEnvironment(output_of_set):
"""Extracts environment variables required for the toolchain to run from
@@ -55,6 +56,17 @@ def _ExtractImportantEnvironment(output_of_set):
return env
+def _DetectVisualStudioPath():
+ """Return path to the GYP_MSVS_VERSION of Visual Studio.
+ """
+
+ # Use the code in build/vs_toolchain.py to avoid duplicating code.
+ chromium_dir = os.path.abspath(os.path.join(SCRIPT_DIR, '..', '..', '..'))
+ sys.path.append(os.path.join(chromium_dir, 'build'))
+ import vs_toolchain
+ return vs_toolchain.DetectVisualStudioPath()
+
+
def _SetupScript(target_cpu, sdk_dir):
"""Returns a command (with arguments) to be used to set up the
environment."""
@@ -66,9 +78,9 @@ def _SetupScript(target_cpu, sdk_dir):
return [os.path.normpath(os.path.join(sdk_dir, 'Bin/SetEnv.Cmd')),
'/' + target_cpu]
else:
+ if 'GYP_MSVS_OVERRIDE_PATH' not in os.environ:
+ os.environ['GYP_MSVS_OVERRIDE_PATH'] = _DetectVisualStudioPath()
# We only support x64-hosted tools.
- # TODO(scottmg|dpranke): Non-depot_tools toolchain: need to get Visual
- # Studio install location from registry.
return [os.path.normpath(os.path.join(os.environ['GYP_MSVS_OVERRIDE_PATH'],
'VC/vcvarsall.bat')),
'amd64_x86' if target_cpu == 'x86' else 'amd64']
« no previous file with comments | « no previous file | build/vs_toolchain.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698