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>2018-05-23 13:31:33 +0200
commit876c25d3fe6ff2478a7212e4afff2463fcf638cc (patch)
tree062d7e0ceb80edc1c98dbb56d5bc16d501d92a9b
parent71ff71248d14d7b2c6508fd634361914fbad2139 (diff)
downloadqtwebengine-chromium-876c25d3fe6ff2478a7212e4afff2463fcf638cc.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/BUILD.gn32
-rw-r--r--chromium/build/config/win/visual_studio_version.gni12
-rw-r--r--chromium/build/toolchain/win/BUILD.gn66
-rw-r--r--chromium/build/toolchain/win/setup_toolchain.py91
-rwxr-xr-xchromium/tools/gn/bootstrap/bootstrap.py12
5 files changed, 125 insertions, 88 deletions
diff --git a/chromium/build/config/win/BUILD.gn b/chromium/build/config/win/BUILD.gn
index a7f63743220..f19b5877dcc 100644
--- a/chromium/build/config/win/BUILD.gn
+++ b/chromium/build/config/win/BUILD.gn
@@ -313,17 +313,27 @@ config("sdk_link") {
ldflags = [ "/MACHINE:ARM64" ]
}
- vcvars_toolchain_data = exec_script("../../toolchain/win/setup_toolchain.py",
- [
- visual_studio_path,
- windows_sdk_path,
- visual_studio_runtime_dirs,
- current_os,
- current_cpu,
- "none",
- goma_disabled,
- ],
- "scope")
+ if (ninja_use_custom_environment_files) {
+ vcvars_toolchain_data = exec_script("../../toolchain/win/setup_toolchain.py",
+ [
+ visual_studio_path,
+ windows_sdk_path,
+ visual_studio_runtime_dirs,
+ current_os,
+ current_cpu,
+ "none",
+ goma_disabled,
+ ],
+ "scope")
+ } else {
+ vcvars_toolchain_data = exec_script("../../toolchain/win/setup_toolchain.py",
+ [
+ current_os,
+ current_cpu,
+ "none",
+ ],
+ "scope")
+ }
vc_lib_path = vcvars_toolchain_data.vc_lib_path
if (defined(vcvars_toolchain_data.vc_lib_atlmfc_path)) {
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 dc7b0bbf7a2..b570d08f7ac 100644
--- a/chromium/build/toolchain/win/BUILD.gn
+++ b/chromium/build/toolchain/win/BUILD.gn
@@ -40,7 +40,7 @@ if (disable_goma) {
# 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 {
@@ -351,17 +351,27 @@ if (host_os == "win") {
# stuff from 32-bit/arm/arm64 target builds).
if (target_os == "win" &&
(target_cpu == "x86" || target_cpu == "arm" || target_cpu == "arm64")) {
- target_cpu_toolchain_data = exec_script("setup_toolchain.py",
- [
- visual_studio_path,
- windows_sdk_path,
- visual_studio_runtime_dirs,
- target_os,
- target_cpu,
- "environment." + target_cpu,
- goma_disabled,
- ],
- "scope")
+ if (ninja_use_custom_environment_files) {
+ target_cpu_toolchain_data = exec_script("setup_toolchain.py",
+ [
+ visual_studio_path,
+ windows_sdk_path,
+ visual_studio_runtime_dirs,
+ target_os,
+ target_cpu,
+ "environment." + target_cpu,
+ goma_disabled,
+ ],
+ "scope")
+ } else {
+ target_cpu_toolchain_data = exec_script("setup_toolchain.py",
+ [
+ target_os,
+ target_cpu,
+ "environment." + target_cpu,
+ ],
+ "scope")
+ }
msvc_toolchain(target_cpu) {
environment = "environment." + target_cpu
@@ -388,17 +398,27 @@ if (target_os == "win" &&
}
# 64-bit toolchains.
-x64_toolchain_data = exec_script("setup_toolchain.py",
- [
- visual_studio_path,
- windows_sdk_path,
- visual_studio_runtime_dirs,
- "win",
- "x64",
- "environment.x64",
- goma_disabled,
- ],
- "scope")
+if (ninja_use_custom_environment_files) {
+ x64_toolchain_data = exec_script("setup_toolchain.py",
+ [
+ visual_studio_path,
+ windows_sdk_path,
+ visual_studio_runtime_dirs,
+ "win",
+ "x64",
+ "environment.x64",
+ goma_disabled,
+ ],
+ "scope")
+} else {
+ x64_toolchain_data = exec_script("setup_toolchain.py",
+ [
+ "win",
+ "x64",
+ "environment.x64",
+ ],
+ "scope")
+}
template("win_x64_toolchains") {
msvc_toolchain(target_name) {
diff --git a/chromium/build/toolchain/win/setup_toolchain.py b/chromium/build/toolchain/win/setup_toolchain.py
index fce62521a38..152aeb7da44 100644
--- a/chromium/build/toolchain/win/setup_toolchain.py
+++ b/chromium/build/toolchain/win/setup_toolchain.py
@@ -182,20 +182,28 @@ def _LowercaseDict(d):
def main():
- if len(sys.argv) != 8:
+ if len(sys.argv) != 8 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> <goma_disabled>')
+ print('or setup_toolchain.py <target_os> <target_cpu>'
+ '<environment block name|none>')
sys.exit(2)
- 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) == 8:
+ 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]
+ goma_disabled = sys.argv[7]
+ else:
+ target_os = sys.argv[1]
+ target_cpu = sys.argv[2]
+ environment_block_name = sys.argv[3]
+
if (environment_block_name == 'none'):
environment_block_name = ''
- goma_disabled = sys.argv[7]
if (target_os == 'winuwp'):
target_store = True
@@ -210,46 +218,49 @@ def main():
vc_lib_um_path = ''
include = ''
- # TODO(scottmg|goma): Do we need an equivalent of
- # ninja_use_custom_environment_files?
+ ninja_use_custom_environment_files = (len(sys.argv) == 8)
for cpu in cpus:
- if cpu == target_cpu:
+ if cpu != target_cpu:
+ continue
+ if not ninja_use_custom_environment_files:
+ env = os.environ
+ else:
# Extract environment variables for subprocesses.
env = _LoadToolchainEnv(cpu, win_sdk_path, target_store)
env['PATH'] = runtime_dirs + os.pathsep + env['PATH']
env['GOMA_DISABLED'] = goma_disabled
- for path in env['PATH'].split(os.pathsep):
- if os.path.exists(os.path.join(path, 'cl.exe')):
- vc_bin_dir = os.path.realpath(path)
- break
-
- for path in env['LIB'].split(';'):
- if os.path.exists(os.path.join(path, 'msvcrt.lib')):
- vc_lib_path = os.path.realpath(path)
- break
-
- for path in env['LIB'].split(';'):
- if os.path.exists(os.path.join(path, 'atls.lib')):
- vc_lib_atlmfc_path = os.path.realpath(path)
- break
-
- for path in env['LIB'].split(';'):
- if os.path.exists(os.path.join(path, 'User32.Lib')):
- vc_lib_um_path = os.path.realpath(path)
- break
-
- # The separator for INCLUDE here must match the one used in
- # _LoadToolchainEnv() above.
- include = [p.replace('"', r'\"') for p in env['INCLUDE'].split(';') if p]
- include_I = ' '.join(['"/I' + i + '"' for i in include])
- include_imsvc = ' '.join(['"-imsvc' + i + '"' for i in include])
-
- if (environment_block_name != ''):
- env_block = _FormatAsEnvironmentBlock(env)
- with open(environment_block_name, 'wb') as f:
- f.write(env_block)
+ for path in env['PATH'].split(os.pathsep):
+ if os.path.exists(os.path.join(path, 'cl.exe')):
+ vc_bin_dir = os.path.realpath(path)
+ break
+
+ for path in env['LIB'].split(';'):
+ if os.path.exists(os.path.join(path, 'msvcrt.lib')):
+ vc_lib_path = os.path.realpath(path)
+ break
+
+ for path in env['LIB'].split(';'):
+ if os.path.exists(os.path.join(path, 'atls.lib')):
+ vc_lib_atlmfc_path = os.path.realpath(path)
+ break
+
+ for path in env['LIB'].split(';'):
+ if os.path.exists(os.path.join(path, 'User32.Lib')):
+ vc_lib_um_path = os.path.realpath(path)
+ break
+
+ # The separator for INCLUDE here must match the one used in
+ # _LoadToolchainEnv() above.
+ include = [p.replace('"', r'\"') for p in env['INCLUDE'].split(';') if p]
+ include_I = ' '.join(['"/I' + i + '"' for i in include])
+ include_imsvc = ' '.join(['"-imsvc' + i + '"' for i in include])
+
+ if (environment_block_name != ''):
+ env_block = _FormatAsEnvironmentBlock(env)
+ with open(environment_block_name, 'wb') as f:
+ f.write(env_block)
assert vc_bin_dir
print 'vc_bin_dir = ' + gn_helpers.ToGNString(vc_bin_dir)
diff --git a/chromium/tools/gn/bootstrap/bootstrap.py b/chromium/tools/gn/bootstrap/bootstrap.py
index d3694cbb425..dd2ffce1b76 100755
--- a/chromium/tools/gn/bootstrap/bootstrap.py
+++ b/chromium/tools/gn/bootstrap/bootstrap.py
@@ -119,21 +119,13 @@ def windows_prepare_toolchain(tempdir):
return _locals
- toolchain_paths = CallPythonScopeScript(
- [sys.executable,
- os.path.join(SRC_ROOT, "build", "vs_toolchain.py"),
- "get_toolchain_dir"],
- cwd=tempdir)
-
windows_x64_toolchain = CallPythonScopeScript(
[sys.executable,
os.path.join(SRC_ROOT, "build", "toolchain",
"win", "setup_toolchain.py"),
- toolchain_paths["vs_path"],
- toolchain_paths["sdk_path"],
- toolchain_paths["runtime_dirs"],
+ "win",
"x64",
- "true"
+ "environment.x64"
],
cwd=tempdir)