blob: a39c51a5cffcd052f2851d96065920bdf24289b5 [file] [log] [blame]
diff --git build/toolchain/win/setup_toolchain.py build/toolchain/win/setup_toolchain.py
index 2ab240da4548..81e69abe1ecd 100644
--- build/toolchain/win/setup_toolchain.py
+++ build/toolchain/win/setup_toolchain.py
@@ -142,21 +142,29 @@ def _LoadToolchainEnv(cpu, sdk_dir, target_store):
# variable.
if 'VSINSTALLDIR' in os.environ:
del os.environ['VSINSTALLDIR']
- other_path = os.path.normpath(os.path.join(
+ script_path = os.path.normpath(os.path.join(
os.environ['GYP_MSVS_OVERRIDE_PATH'],
'VC/Auxiliary/Build/vcvarsall.bat'))
- if not os.path.exists(other_path):
- raise Exception('%s is missing - make sure VC++ tools are installed.' %
- script_path)
- script_path = other_path
+ if not os.path.exists(script_path):
+ # Compiler environment variables must already be specified.
+ variables = []
+ for k in sorted(os.environ.keys()):
+ variables.append('%s=%s' % (str(k), str(os.environ[k])))
+ variables = '\n'.join(variables)
+ return _ExtractImportantEnvironment(variables)
+
cpu_arg = "amd64"
if (cpu != 'x64'):
# x64 is default target CPU thus any other CPU requires a target set
cpu_arg += '_' + cpu
- args = [script_path, cpu_arg]
+ args = [script_path, cpu_arg, ]
# Store target must come before any SDK version declaration
if (target_store):
- args.append(['store'])
+ args.append('store')
+ # Explicitly specifying the SDK version to build with to avoid accidentally
+ # building with a new and untested SDK. This should stay in sync with the
+ # packaged toolchain in build/vs_toolchain.py.
+ args.append('10.0.18362.0')
variables = _LoadEnvFromBat(args)
return _ExtractImportantEnvironment(variables)
diff --git build/vs_toolchain.py build/vs_toolchain.py
index 97600e73ba10..36773b159453 100755
--- build/vs_toolchain.py
+++ build/vs_toolchain.py
@@ -89,9 +89,16 @@ def SetEnvironmentAndGetRuntimeDllDirs():
runtime_path = os.path.pathsep.join(vs_runtime_dll_dirs)
os.environ['PATH'] = runtime_path + os.path.pathsep + os.environ['PATH']
elif sys.platform == 'win32' and not depot_tools_win_toolchain:
+ has_override_path = True
if not 'GYP_MSVS_OVERRIDE_PATH' in os.environ:
+ has_override_path = False
os.environ['GYP_MSVS_OVERRIDE_PATH'] = DetectVisualStudioPath()
+ if has_override_path:
+ # Don't attempt to copy DLLs when using a custom toolchain.
+ # The DLLs should already be discoverable via the PATH env variable.
+ return None
+
# When using an installed toolchain these files aren't needed in the output
# directory in order to run binaries locally, but they are needed in order
# to create isolates or the mini_installer. Copying them to the output
@@ -140,6 +147,10 @@ def _RegistryGetValue(key, value):
def GetVisualStudioVersion():
"""Return best available version of Visual Studio.
"""
+ # Return the explicitly requested version, if any.
+ if 'GYP_MSVS_VERSION' in os.environ:
+ return os.environ['GYP_MSVS_VERSION']
+
supported_versions = list(MSVS_VERSIONS.keys())
# VS installed in depot_tools for Googlers