BUILD.gn
2.23 KB
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
import("//llvm/utils/gn/build/symlink_or_copy.gni")
import("//llvm/utils/gn/build/write_cmake_config.gni")
import("//llvm/version.gni")
symlinks = [
# target_name, symlink_target pairs: GN doesn't support '+' in rule names.
[
"clangxx",
"clang++",
],
[
"clang-cl",
"clang-cl",
],
[
"clang-cpp",
"clang-cpp",
],
]
foreach(target, symlinks) {
symlink_or_copy(target[0]) {
deps = [
":clang",
]
source = "clang"
output = "$root_out_dir/bin/${target[1]}"
}
}
# //:clang depends on this symlink target, see comment in //BUILD.gn.
group("symlinks") {
deps = []
foreach(target, symlinks) {
deps += [ ":${target[0]}" ]
}
}
if (host_os == "mac") {
write_cmake_config("write_info_plist") {
input = "Info.plist.in"
output = "$target_gen_dir/Info.plist"
values = [
"TOOL_INFO_BUILD_VERSION=$llvm_version_major.$llvm_version_minor",
"TOOL_INFO_NAME=clang",
"TOOL_INFO_UTI=org.llvm.clang",
"TOOL_INFO_VERSION=$llvm_version",
]
}
}
executable("clang") {
configs += [ "//llvm/utils/gn/build:clang_code" ]
deps = [
"//clang/include/clang/Config",
"//clang/lib/Basic",
"//clang/lib/CodeGen",
"//clang/lib/Driver",
"//clang/lib/Frontend",
"//clang/lib/FrontendTool",
"//clang/lib/Headers",
"//clang/tools/clang-offload-bundler",
"//clang/tools/clang-offload-wrapper",
"//llvm/include/llvm/Config:llvm-config",
"//llvm/lib/Analysis",
"//llvm/lib/CodeGen",
"//llvm/lib/IR",
"//llvm/lib/MC",
"//llvm/lib/MC/MCParser",
"//llvm/lib/Option",
"//llvm/lib/Support",
"//llvm/lib/Target:TargetsToBuild",
"//llvm/lib/Transforms/IPO",
"//llvm/lib/Transforms/InstCombine",
"//llvm/lib/Transforms/Instrumentation",
"//llvm/lib/Transforms/ObjCARC",
"//llvm/lib/Transforms/Scalar",
"//llvm/lib/Transforms/Utils",
"//llvm/lib/Transforms/Vectorize",
]
if (host_os == "mac") {
deps += [ ":write_info_plist" ]
plist = get_target_outputs(":write_info_plist")
ldflags = [ "-Wl,-sectcreate,__TEXT,__info_plist," +
rebase_path(plist[0], root_out_dir) ]
}
sources = [
"cc1_main.cpp",
"cc1as_main.cpp",
"cc1gen_reproducer_main.cpp",
"driver.cpp",
]
}