summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-02-06 11:13:24 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2022-11-09 11:48:34 +0100
commitce837f21f22d3a0851781dbf6627beb18bfae3f3 (patch)
tree37a12568a2cdcf8fe442da96a2077282e63d13c9
parent2e2ec7e672b2514078091dc1964e34561105ad5f (diff)
downloadqtwebengine-chromium-ce837f21f22d3a0851781dbf6627beb18bfae3f3.tar.gz
Reintroduce ninja_use_custom_environment_files
For Qt we want to read the environment variable from the environment not from Google's downloaded packages. Change-Id: I52def6474daec97cc63cda415d279cbe29881d08 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
-rw-r--r--chromium/build/config/win/visual_studio_version.gni12
-rw-r--r--chromium/build/toolchain/win/BUILD.gn2
-rw-r--r--chromium/build/toolchain/win/setup_toolchain.py46
-rw-r--r--chromium/build/toolchain/win/toolchain.gni30
4 files changed, 58 insertions, 32 deletions
diff --git a/chromium/build/config/win/visual_studio_version.gni b/chromium/build/config/win/visual_studio_version.gni
index 982fbe8d3f0..3bc58fe4d7a 100644
--- a/chromium/build/config/win/visual_studio_version.gni
+++ b/chromium/build/config/win/visual_studio_version.gni
@@ -20,9 +20,11 @@ declare_args() {
# This value is the default location, override if you have a different
# installation location.
windows_sdk_path = "C:\Program Files (x86)\Windows Kits\10"
+
+ ninja_use_custom_environment_files = true
}
-if (visual_studio_path == "") {
+if (visual_studio_path == "" && ninja_use_custom_environment_files) {
toolchain_data =
exec_script("../../vs_toolchain.py", [ "get_toolchain_dir" ], "scope")
visual_studio_path = toolchain_data.vs_path
@@ -33,7 +35,9 @@ if (visual_studio_path == "") {
} else {
assert(visual_studio_version != "",
"You must set the visual_studio_version if you set the path")
- assert(wdk_path != "",
- "You must set the wdk_path if you set the visual studio path")
- visual_studio_runtime_dirs = []
+ if (ninja_use_custom_environment_files) {
+ assert(wdk_path != "",
+ "You must set the wdk_path if you set the visual studio path")
+ }
+ visual_studio_runtime_dirs = "\"\""
}
diff --git a/chromium/build/toolchain/win/BUILD.gn b/chromium/build/toolchain/win/BUILD.gn
index 52624a7d54e..0f33833133c 100644
--- a/chromium/build/toolchain/win/BUILD.gn
+++ b/chromium/build/toolchain/win/BUILD.gn
@@ -15,7 +15,7 @@ assert(is_win, "Should only be running on Windows")
# Copy the VS runtime DLL for the default toolchain to the root build directory
# so things will run.
-if (current_toolchain == default_toolchain) {
+if (current_toolchain == default_toolchain && ninja_use_custom_environment_files) {
if (is_debug) {
configuration_name = "Debug"
} else {
diff --git a/chromium/build/toolchain/win/setup_toolchain.py b/chromium/build/toolchain/win/setup_toolchain.py
index e680ba07e3c..83f9f8f08fd 100644
--- a/chromium/build/toolchain/win/setup_toolchain.py
+++ b/chromium/build/toolchain/win/setup_toolchain.py
@@ -224,23 +224,33 @@ def FindFileInEnvList(env, env_name, separator, file_name, optional=False):
def main():
- if len(sys.argv) != 7:
+ if len(sys.argv) != 7 and len(sys.argv) != 4:
print('Usage setup_toolchain.py '
'<visual studio path> <win sdk path> '
'<runtime dirs> <target_os> <target_cpu> '
'<environment block name|none>')
+ print('or setup_toolchain.py <target_os> <target_cpu>'
+ '<environment block name|none>')
sys.exit(2)
- # toolchain_root and win_sdk_path are only read if the hermetic Windows
- # toolchain is set, that is if DEPOT_TOOLS_WIN_TOOLCHAIN is not set to 0.
- # With the hermetic Windows toolchain, the visual studio path in argv[1]
- # is the root of the Windows toolchain directory.
- toolchain_root = sys.argv[1]
- win_sdk_path = sys.argv[2]
-
- runtime_dirs = sys.argv[3]
- target_os = sys.argv[4]
- target_cpu = sys.argv[5]
- environment_block_name = sys.argv[6]
+ if len(sys.argv) == 7:
+ # toolchain_root and win_sdk_path are only read if the hermetic Windows
+ # toolchain is set, that is if DEPOT_TOOLS_WIN_TOOLCHAIN is not set to 0.
+ # With the hermetic Windows toolchain, the visual studio path in argv[1]
+ # is the root of the Windows toolchain directory.
+ toolchain_root = sys.argv[1]
+ win_sdk_path = sys.argv[2]
+
+ runtime_dirs = sys.argv[3]
+ target_os = sys.argv[4]
+ target_cpu = sys.argv[5]
+ environment_block_name = sys.argv[6]
+
+ else:
+ win_sdk_path = ''
+ target_os = sys.argv[1]
+ target_cpu = sys.argv[2]
+ environment_block_name = sys.argv[3]
+
if (environment_block_name == 'none'):
environment_block_name = ''
@@ -255,8 +265,7 @@ def main():
include = ''
lib = ''
- # TODO(scottmg|goma): Do we need an equivalent of
- # ninja_use_custom_environment_files?
+ ninja_use_custom_environment_files = (len(sys.argv) == 7)
def relflag(s): # Make s relative to builddir when cwd and sdk on same drive.
try:
@@ -269,9 +278,12 @@ def main():
for cpu in cpus:
if cpu == target_cpu:
- # Extract environment variables for subprocesses.
- env = _LoadToolchainEnv(cpu, toolchain_root, win_sdk_path, target_store)
- env['PATH'] = runtime_dirs + os.pathsep + env['PATH']
+ if not ninja_use_custom_environment_files:
+ env = os.environ
+ else:
+ # Extract environment variables for subprocesses.
+ env = _LoadToolchainEnv(cpu, toolchain_root, win_sdk_path, target_store)
+ env['PATH'] = runtime_dirs + os.pathsep + env['PATH']
vc_bin_dir = FindFileInEnvList(env, 'PATH', os.pathsep, 'cl.exe')
diff --git a/chromium/build/toolchain/win/toolchain.gni b/chromium/build/toolchain/win/toolchain.gni
index 17414505bc4..34433d96e25 100644
--- a/chromium/build/toolchain/win/toolchain.gni
+++ b/chromium/build/toolchain/win/toolchain.gni
@@ -497,16 +497,26 @@ template("win_toolchains") {
assert(defined(invoker.toolchain_arch))
toolchain_arch = invoker.toolchain_arch
- win_toolchain_data = exec_script("//build/toolchain/win/setup_toolchain.py",
- [
- visual_studio_path,
- windows_sdk_path,
- visual_studio_runtime_dirs,
- "win",
- toolchain_arch,
- "environment." + toolchain_arch,
- ],
- "scope")
+ if (ninja_use_custom_environment_files) {
+ win_toolchain_data = exec_script("//build/toolchain/win/setup_toolchain.py",
+ [
+ visual_studio_path,
+ windows_sdk_path,
+ visual_studio_runtime_dirs,
+ "win",
+ toolchain_arch,
+ "environment." + toolchain_arch,
+ ],
+ "scope")
+ } else {
+ win_toolchain_data = exec_script("//build/toolchain/win/setup_toolchain.py",
+ [
+ "win",
+ toolchain_arch,
+ "environment." + toolchain_arch,
+ ],
+ "scope")
+ }
# The toolchain using MSVC only makes sense when not doing cross builds.
# Chromium exclusively uses the win_clang_ toolchain below, but V8 and