llvm.org GIT mirror llvm / 5442e13
[gn build] Add build files for clang, clang-offload-bundler, and clang/lib/Headers With this, the GN build can build clang! Differential Revision: https://reviews.llvm.org/D55981 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349991 91177308-0d34-0410-b5e6-96231b3b80d8 Nico Weber 9 months ago
4 changed file(s) with 254 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
0 group("default") {
11 deps = [
2 "//clang/lib/ARCMigrate",
3 "//clang/lib/AST",
4 "//clang/lib/ASTMatchers",
5 "//clang/lib/CodeGen",
6 "//clang/lib/CrossTU",
7 "//clang/lib/Driver",
8 "//clang/lib/Frontend",
9 "//clang/lib/Frontend/Rewrite",
10 "//clang/lib/FrontendTool",
11 "//clang/lib/Index",
12 "//clang/lib/Parse",
13 "//clang/lib/Serialization",
14 "//clang/lib/StaticAnalyzer/Checkers",
15 "//clang/lib/StaticAnalyzer/Core",
16 "//clang/lib/StaticAnalyzer/Frontend",
2 ":clang",
173 "//clang/tools/clang-format",
184 "//lld/test",
195 "//llvm/tools/llvm-cat",
4935 # update symlinks (in particular, on Windows it doesn't copy the new lld to its
5036 # new locations).
5137 # That seems simpler, more explicit, and good enough.
38 group("clang") {
39 deps = [
40 "//clang/tools/driver:symlinks",
41 ]
42 }
5243 group("lld") {
5344 deps = [
5445 "//lld/tools/lld:symlinks",
0 import("//clang/utils/TableGen/clang_tablegen.gni")
1 import("//llvm/version.gni")
2
3 # Generate arm_neon.h
4 clang_tablegen("arm_neon") {
5 args = [ "-gen-arm-neon" ]
6 td_file = "//clang/include/clang/Basic/arm_neon.td"
7 output_name = "arm_neon.h"
8 }
9
10 # Generate arm_fp16.h
11 clang_tablegen("arm_fp16") {
12 args = [ "-gen-arm-fp16" ]
13 td_file = "//clang/include/clang/Basic/arm_fp16.td"
14 output_name = "arm_fp16.h"
15 }
16
17 output_dir = "$root_out_dir/lib/clang/$llvm_version/include"
18
19 copy("arm_headers") {
20 visibility = [ ":Headers" ]
21 deps = [
22 ":arm_fp16",
23 ":arm_neon",
24 ]
25 sources = get_target_outputs(":arm_neon") + get_target_outputs(":arm_fp16")
26 outputs = [
27 "$output_dir/{{source_file_part}}",
28 ]
29 }
30
31 copy("Headers") {
32 deps = [
33 ":arm_headers",
34 ]
35
36 # Tell `gn format` to not reorder the sources list: Its order matches CMake,
37 # and the ordering is alphabetical but ignores leading underscores.
38 # NOSORT
39 sources = [
40 "adxintrin.h",
41 "altivec.h",
42 "ammintrin.h",
43 "arm_acle.h",
44 "armintr.h",
45 "arm64intr.h",
46 "avx2intrin.h",
47 "avx512bwintrin.h",
48 "avx512bitalgintrin.h",
49 "avx512vlbitalgintrin.h",
50 "avx512cdintrin.h",
51 "avx512vpopcntdqintrin.h",
52 "avx512dqintrin.h",
53 "avx512erintrin.h",
54 "avx512fintrin.h",
55 "avx512ifmaintrin.h",
56 "avx512ifmavlintrin.h",
57 "avx512pfintrin.h",
58 "avx512vbmiintrin.h",
59 "avx512vbmivlintrin.h",
60 "avx512vbmi2intrin.h",
61 "avx512vlvbmi2intrin.h",
62 "avx512vlbwintrin.h",
63 "avx512vlcdintrin.h",
64 "avx512vldqintrin.h",
65 "avx512vlintrin.h",
66 "avx512vpopcntdqvlintrin.h",
67 "avx512vnniintrin.h",
68 "avx512vlvnniintrin.h",
69 "avxintrin.h",
70 "bmi2intrin.h",
71 "bmiintrin.h",
72 "__clang_cuda_builtin_vars.h",
73 "__clang_cuda_cmath.h",
74 "__clang_cuda_complex_builtins.h",
75 "__clang_cuda_device_functions.h",
76 "__clang_cuda_intrinsics.h",
77 "__clang_cuda_libdevice_declares.h",
78 "__clang_cuda_math_forward_declares.h",
79 "__clang_cuda_runtime_wrapper.h",
80 "cetintrin.h",
81 "cldemoteintrin.h",
82 "clzerointrin.h",
83 "cpuid.h",
84 "clflushoptintrin.h",
85 "clwbintrin.h",
86 "emmintrin.h",
87 "f16cintrin.h",
88 "float.h",
89 "fma4intrin.h",
90 "fmaintrin.h",
91 "fxsrintrin.h",
92 "gfniintrin.h",
93 "htmintrin.h",
94 "htmxlintrin.h",
95 "ia32intrin.h",
96 "immintrin.h",
97 "intrin.h",
98 "inttypes.h",
99 "invpcidintrin.h",
100 "iso646.h",
101 "limits.h",
102 "lwpintrin.h",
103 "lzcntintrin.h",
104 "mm3dnow.h",
105 "mmintrin.h",
106 "mm_malloc.h",
107 "module.modulemap",
108 "movdirintrin.h",
109 "msa.h",
110 "mwaitxintrin.h",
111 "nmmintrin.h",
112 "opencl-c.h",
113 "pconfigintrin.h",
114 "pkuintrin.h",
115 "pmmintrin.h",
116 "popcntintrin.h",
117 "prfchwintrin.h",
118 "ptwriteintrin.h",
119 "rdseedintrin.h",
120 "rtmintrin.h",
121 "s390intrin.h",
122 "sgxintrin.h",
123 "shaintrin.h",
124 "smmintrin.h",
125 "stdalign.h",
126 "stdarg.h",
127 "stdatomic.h",
128 "stdbool.h",
129 "stddef.h",
130 "__stddef_max_align_t.h",
131 "stdint.h",
132 "stdnoreturn.h",
133 "tbmintrin.h",
134 "tgmath.h",
135 "tmmintrin.h",
136 "unwind.h",
137 "vadefs.h",
138 "vaesintrin.h",
139 "varargs.h",
140 "vecintrin.h",
141 "vpclmulqdqintrin.h",
142 "waitpkgintrin.h",
143 "wbnoinvdintrin.h",
144 "wmmintrin.h",
145 "__wmmintrin_aes.h",
146 "__wmmintrin_pclmul.h",
147 "x86intrin.h",
148 "xmmintrin.h",
149 "xopintrin.h",
150 "xsavecintrin.h",
151 "xsaveintrin.h",
152 "xsaveoptintrin.h",
153 "xsavesintrin.h",
154 "xtestintrin.h",
155 "cuda_wrappers/algorithm",
156 "cuda_wrappers/complex",
157 "cuda_wrappers/new",
158 ]
159 outputs = [
160 "$output_dir/{{source_target_relative}}",
161 ]
162 }
0 executable("clang-offload-bundler") {
1 configs += [ "//llvm/utils/gn/build:clang_code" ]
2 deps = [
3 "//clang/lib/Basic",
4 "//llvm/lib/Bitcode/Writer",
5 "//llvm/lib/IR",
6 "//llvm/lib/Object",
7 "//llvm/lib/Support",
8 ]
9 sources = [
10 "ClangOffloadBundler.cpp",
11 ]
12 }
0 import("//llvm/utils/gn/build/symlink_or_copy.gni")
1
2 symlinks = [
3 # target_name, symlink_target pairs: GN doesn't support '+' in rule names.
4 [
5 "clangxx",
6 "clang++",
7 ],
8 [
9 "clang-cl",
10 "clang-cl",
11 ],
12 [
13 "clang-cpp",
14 "clang-cpp",
15 ],
16 ]
17 foreach(target, symlinks) {
18 symlink_or_copy(target[0]) {
19 deps = [
20 ":clang",
21 ]
22 source = "clang"
23 output = "$root_out_dir/bin/${target[1]}"
24 }
25 }
26
27 # //:clang depends on this symlink target, see comment in //BUILD.gn.
28 group("symlinks") {
29 deps = []
30 foreach(target, symlinks) {
31 deps += [ ":${target[0]}" ]
32 }
33 }
34
35 executable("clang") {
36 configs += [ "//llvm/utils/gn/build:clang_code" ]
37 deps = [
38 "//clang/include/clang/Config",
39 "//clang/lib/Basic",
40 "//clang/lib/CodeGen",
41 "//clang/lib/Driver",
42 "//clang/lib/Frontend",
43 "//clang/lib/FrontendTool",
44 "//clang/lib/Headers",
45 "//clang/tools/clang-offload-bundler",
46 "//llvm/include/llvm/Config:llvm-config",
47 "//llvm/lib/Analysis",
48 "//llvm/lib/CodeGen",
49 "//llvm/lib/IR",
50 "//llvm/lib/MC",
51 "//llvm/lib/MC/MCParser",
52 "//llvm/lib/Option",
53 "//llvm/lib/Support",
54 "//llvm/lib/Target:TargetsToBuild",
55 "//llvm/lib/Transforms/IPO",
56 "//llvm/lib/Transforms/InstCombine",
57 "//llvm/lib/Transforms/Instrumentation",
58 "//llvm/lib/Transforms/ObjCARC",
59 "//llvm/lib/Transforms/Scalar",
60 "//llvm/lib/Transforms/Utils",
61 "//llvm/lib/Transforms/Vectorize",
62 ]
63 sources = [
64 "cc1_main.cpp",
65 "cc1as_main.cpp",
66 "cc1gen_reproducer_main.cpp",
67 "driver.cpp",
68 ]
69
70 # FIXME: Info.plist embedding for mac builds.
71 }