2020-03-04 21:00:17 +01:00
|
|
|
diff --git build/toolchain/win/setup_toolchain.py build/toolchain/win/setup_toolchain.py
|
2022-09-26 21:30:45 +02:00
|
|
|
index 112690a7f7ad3..6c65b68b171ab 100644
|
2020-03-04 21:00:17 +01:00
|
|
|
--- build/toolchain/win/setup_toolchain.py
|
|
|
|
+++ build/toolchain/win/setup_toolchain.py
|
2022-05-19 12:28:44 +02:00
|
|
|
@@ -166,13 +166,17 @@ def _LoadToolchainEnv(cpu, toolchain_root, sdk_dir, target_store):
|
2021-12-16 23:35:54 +01:00
|
|
|
del os.environ['LIB']
|
|
|
|
if 'LIBPATH' in os.environ:
|
|
|
|
del os.environ['LIBPATH']
|
2020-03-04 21:00:17 +01:00
|
|
|
- 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
|
2020-07-08 19:23:29 +02:00
|
|
|
+ if not os.path.exists(script_path):
|
|
|
|
+ # Compiler environment variables must already be specified.
|
2020-03-04 21:00:17 +01:00
|
|
|
+ variables = []
|
|
|
|
+ for k in sorted(os.environ.keys()):
|
|
|
|
+ variables.append('%s=%s' % (str(k), str(os.environ[k])))
|
|
|
|
+ variables = '\n'.join(variables)
|
2020-07-08 19:23:29 +02:00
|
|
|
+ return _ExtractImportantEnvironment(variables)
|
2020-03-04 21:00:17 +01:00
|
|
|
+
|
2020-07-08 19:23:29 +02:00
|
|
|
cpu_arg = "amd64"
|
|
|
|
if (cpu != 'x64'):
|
|
|
|
# x64 is default target CPU thus any other CPU requires a target set
|
2020-03-04 21:00:17 +01:00
|
|
|
diff --git build/vs_toolchain.py build/vs_toolchain.py
|
2022-09-26 21:30:45 +02:00
|
|
|
index 76ef5490c88f9..dd36de8edbf3c 100755
|
2020-03-04 21:00:17 +01:00
|
|
|
--- build/vs_toolchain.py
|
|
|
|
+++ build/vs_toolchain.py
|
2022-01-25 21:26:51 +01:00
|
|
|
@@ -107,9 +107,16 @@ def SetEnvironmentAndGetRuntimeDllDirs():
|
2020-03-04 21:00:17 +01:00
|
|
|
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
|
2022-01-25 21:26:51 +01:00
|
|
|
@@ -158,6 +165,10 @@ def _RegistryGetValue(key, value):
|
2020-03-04 21:00:17 +01:00
|
|
|
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
|
2022-07-13 12:46:15 +02:00
|
|
|
@@ -431,7 +442,7 @@ def _CopyDebugger(target_dir, target_cpu):
|
|
|
|
|
|
|
|
# List of debug files that should be copied, the first element of the tuple is
|
|
|
|
# the name of the file and the second indicates if it's optional.
|
|
|
|
- debug_files = [('dbghelp.dll', False), ('dbgcore.dll', True)]
|
|
|
|
+ debug_files = []
|
|
|
|
# The UCRT is not a redistributable component on arm64.
|
|
|
|
if target_cpu != 'arm64':
|
|
|
|
debug_files.extend([('api-ms-win-downlevel-kernel32-l2-1-0.dll', False),
|