forked from timniederhausen/gn-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.gni
127 lines (110 loc) · 4.25 KB
/
settings.gni
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
if (is_clang) {
import("//build/toolchain/clang.gni")
}
declare_args() {
# Desired version of Visual Studio.
# If visual_studio_path is set, this must be
# the version of the VS installation at the visual_studio_path.
#
# Use "2013" for Visual Studio 2013 or "latest" for automatically
# choosing the highest version (visual_studio_path must be unset in
# this case).
visual_studio_version = "latest"
# The path of your MSVC installation.
#
# If this is set you must set visual_studio_version as well.
# Autodetected based on visual_studio_version.
visual_studio_path = ""
# Windows SDK version to use.
# Can either be a full Windows 10 SDK number (e.g. 10.0.10240.0),
# "8.1" for the Windows 8.1 SDK or "default" to use the VS default version.
windows_sdk_version = "default"
# Microsoft compiler version number clang-cl will report in _MSC_VER
# (Defaults to the default version associated with the chosen VS version.)
clang_msc_ver = 0
# Allows us to avoid multiple toolchain.py invocations for multi-toolchain builds.
cached_toolchain_data = ""
}
assert(visual_studio_version != "", "visual_studio_version must be non-empty")
assert(visual_studio_path == "" || visual_studio_version != "latest",
"You must set visual_studio_version if you set visual_studio_path")
if (is_clang) {
sys_include_prefix = "-imsvc"
_clang_base_path_arg = clang_base_path
_clang_msc_ver = "" + clang_msc_ver
} else {
# MSVC doesn't have the concept of system headers.
sys_include_prefix = "/I"
_clang_base_path_arg = ""
_clang_msc_ver = ""
}
if (host_os == "win") {
clang_cl = "clang-cl.exe"
} else {
clang_cl = "clang-cl"
}
if (visual_studio_path == "") {
# can't pass empty args
visual_studio_path = "default"
}
if (cached_toolchain_data != "") {
toolchain_data = cached_toolchain_data
} else {
toolchain_data = exec_script("toolchain.py",
[
"setup_toolchain",
visual_studio_version,
visual_studio_path,
sys_include_prefix,
windows_sdk_version,
# Don't use clang_base_path directly, so we can
# skip clang detection if not needed
# (i.e. !is_clang).
_clang_base_path_arg,
_clang_msc_ver,
],
"scope")
}
visual_studio_version = toolchain_data.visual_studio_version
visual_studio_path = toolchain_data.visual_studio_path
# Full path to the Windows SDK, not including a backslash at the end.
windows_sdk_path = toolchain_data.windows_sdk_path
# Value of the _MSC_VER variable.
# see: https://msdn.microsoft.com/en-us/library/b0084kay.aspx
msc_ver = toolchain_data.msc_ver
# Value of the _MSC_FULL_VER variable.
# see: https://msdn.microsoft.com/en-us/library/b0084kay.aspx
msc_full_ver = toolchain_data.msc_full_ver
if (is_clang) {
win_clang_version = toolchain_data.clang_version
}
# current_toolchain_data: Settings specific to current_os/current_cpu
if (current_os == "win") {
if (current_cpu == "x86") {
assert(defined(toolchain_data.x86))
current_toolchain_data = toolchain_data.x86
} else if (current_cpu == "x64") {
assert(defined(toolchain_data.x64))
current_toolchain_data = toolchain_data.x64
} else if (current_cpu == "arm") {
assert(defined(toolchain_data.arm))
current_toolchain_data = toolchain_data.arm
} else if (current_cpu == "arm64") {
assert(defined(toolchain_data.arm64))
current_toolchain_data = toolchain_data.arm64
}
} else if (current_os == "winuwp") {
if (current_cpu == "x86") {
assert(defined(toolchain_data.x86_uwp))
current_toolchain_data = toolchain_data.x86_uwp
} else if (current_cpu == "x64") {
assert(defined(toolchain_data.x64_uwp))
current_toolchain_data = toolchain_data.x64_uwp
} else if (current_cpu == "arm") {
assert(defined(toolchain_data.arm_uwp))
current_toolchain_data = toolchain_data.arm_uwp
} else if (current_cpu == "arm64") {
assert(defined(toolchain_data.arm64_uwp))
current_toolchain_data = toolchain_data.arm64_uwp
}
}