1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
build / toolchain / win / BUILD.gn [blame]
# Copyright 2013 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/win/visual_studio_version.gni")
import("//build/toolchain/win/toolchain.gni")
assert(is_win, "Should only be running on Windows")
# Setup the Visual Studio state.
#
# Its arguments are the VS path and the compiler wrapper tool. It will write
# "environment.x86" and "environment.x64" to the build directory and return a
# list to us.
# Copy the VS runtime DLL for the default toolchain to the root build directory
# so things will run.
if (current_toolchain == default_toolchain) {
if (is_debug) {
configuration_name = "Debug"
} else {
configuration_name = "Release"
}
exec_script("../../vs_toolchain.py",
[
"copy_dlls",
rebase_path(root_build_dir),
configuration_name,
target_cpu,
])
}
if (target_cpu == "x86" || target_cpu == "x64") {
win_toolchains("x86") {
toolchain_arch = "x86"
}
win_toolchains("x64") {
toolchain_arch = "x64"
}
}
if (target_cpu == "arm64") {
win_toolchains("arm64") {
toolchain_arch = "arm64"
}
win_toolchains("x64") {
toolchain_arch = "x64"
}
}
# The nacl_win64 toolchain is nearly identical to the plain x64 toolchain.
# It's used solely for building nacl64.exe (//components/nacl/broker:nacl64).
# The only reason it's a separate toolchain is so that it can force
# is_component_build to false in the toolchain_args() block, because
# building nacl64.exe in component style does not work.
win_toolchains("nacl_win64") {
toolchain_arch = "x64"
toolchain_args = {
is_component_build = false
}
}
# WinUWP toolchains. Only define these when targeting them.
if (target_os == "winuwp") {
assert(target_cpu == "x64" || target_cpu == "x86" || target_cpu == "arm" ||
target_cpu == "arm64")
# Note that //build/toolchain/win/win_toolchain_data.gni collects the output
# of setup_toolchain.py, however it's not compatible with the UWP toolchain,
# as the UWP toolchain requires the `environment.store_$CPU` variable, instead
# of the usual `environment.$CPU`.
store_cpu_toolchain_data =
exec_script("//build/toolchain/win/setup_toolchain.py",
[
visual_studio_path,
windows_sdk_path,
visual_studio_runtime_dirs,
target_os,
target_cpu,
"environment.store_" + target_cpu,
],
"scope")
msvc_toolchain("uwp_" + target_cpu) {
environment = "environment.store_" + target_cpu
cl = "\"${store_cpu_toolchain_data.vc_bin_dir}/cl.exe\""
toolchain_args = {
current_os = "winuwp"
current_cpu = target_cpu
is_clang = false
}
}
}