blob: cbc59cb04a2dfdfae822ba346b1281e7d768269c [file] [log] [blame]
Bob Badour2549c512021-02-12 18:19:11 -08001package {
2 default_applicable_licenses: ["external_llvm_license"],
3}
4
5// Added automatically by a large-scale-change that took the approach of
6// 'apply every license found to every target'. While this makes sure we respect
7// every license restriction, it may not be entirely correct.
8//
9// e.g. GPL in an MIT project might only apply to the contrib/ directory.
10//
11// Please consider splitting the single license below into multiple licenses,
12// taking care not to lose any license_kind information, and overriding the
13// default license using the 'licenses: [...]' property on targets as needed.
14//
15// For unused files, consider creating a 'fileGroup' with "//visibility:private"
16// to attach the license to, and including a comment whether the files may be
17// used in the current project.
18//
19// large-scale-change included anything that looked like it might be a license
20// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
21//
22// Please consider removing redundant or irrelevant files from 'license_text:'.
23//
24// large-scale-change filtered out the below license kinds as false-positives:
25// SPDX-license-identifier-GPL
26// SPDX-license-identifier-GPL-3.0
27// See: http://go/android-license-faq
28license {
29 name: "external_llvm_license",
30 visibility: [":__subpackages__"],
31 license_kinds: [
32 "SPDX-license-identifier-Apache-2.0",
33 "SPDX-license-identifier-BSD",
34 "SPDX-license-identifier-MIT",
35 "SPDX-license-identifier-NCSA",
36 "legacy_permissive",
37 "legacy_unencumbered",
38 ],
39 license_text: [
40 "LICENSE.TXT",
41 "NOTICE",
42 ],
43}
44
Colin Cross8a3437f2016-12-13 13:01:18 -080045cc_defaults {
Colin Cross4094d252016-11-21 17:18:40 -080046 name: "llvm-defaults",
Colin Cross8a3437f2016-12-13 13:01:18 -080047 defaults: ["llvm-defaults-no-generated-headers"],
48 header_libs: ["llvm-headers"],
Chih-Hung Hsieha8de0682017-08-09 10:27:27 -070049 tidy_checks: [
50 "-google-build-*",
51 "-google-global-*",
52 ],
Evgenii Stepanov2d76ce52019-01-04 17:37:15 -080053 sanitize: {
54 hwaddress: false, // code size b/112437884
55 },
Colin Cross8a3437f2016-12-13 13:01:18 -080056}
57
58// This module defines all of the defaults used to compiled llvm, except for
59// the generated headers. It is necessary to avoid a circular dependency
60// from the tblgen tool used to generate the headers to the generated headers.
61llvm_defaults {
62 name: "llvm-defaults-no-generated-headers",
Colin Cross4094d252016-11-21 17:18:40 -080063
64 host_supported: true,
Victor Khimenkod07e61b2020-07-02 01:32:56 +020065 // TODO(b/153609531): remove when no longer needed.
66 native_bridge_supported: true,
Colin Cross4094d252016-11-21 17:18:40 -080067
68 cflags: [
69 "-D_GNU_SOURCE",
70 "-D__STDC_LIMIT_MACROS",
71 "-D__STDC_CONSTANT_MACROS",
72 "-D__STDC_FORMAT_MACROS",
73 "-fomit-frame-pointer",
74 "-Wall",
75 "-W",
Yi Kongfccb4bf2018-01-03 12:55:42 -080076 "-Wno-cast-qual",
Colin Cross4094d252016-11-21 17:18:40 -080077 "-Wno-sign-compare",
78 "-Wno-unused-parameter",
79 "-Wno-maybe-uninitialized",
80 "-Wno-missing-field-initializers",
Chih-Hung Hsieh53d37e52018-09-05 15:41:45 -070081 "-Wno-implicit-fallthrough",
Colin Cross4094d252016-11-21 17:18:40 -080082 "-Wwrite-strings",
83 "-Werror",
84 "-Dsprintf=sprintf",
85 ],
86
87 cppflags: [
88 "-Wno-sign-promo",
89 "-std=c++11",
90 ],
91
Chih-Hung Hsieha8de0682017-08-09 10:27:27 -070092 tidy_checks: [
93 "-google-build-*",
94 "-google-global-*",
95 ],
96
Colin Cross8a3437f2016-12-13 13:01:18 -080097 header_libs: ["llvm-headers-no-generated-headers"],
Colin Cross4094d252016-11-21 17:18:40 -080098
99 target: {
100 android: {
101 cflags: [
102 "-finline-functions",
103 ],
Dan Willemsena8808712017-10-16 20:08:05 -0700104 },
105 linux: {
Colin Cross4094d252016-11-21 17:18:40 -0800106 cppflags: [
107 "-Woverloaded-virtual",
108 ],
Colin Cross4094d252016-11-21 17:18:40 -0800109 },
110 host: {
Colin Cross4094d252016-11-21 17:18:40 -0800111 cppflags: [
112 "-fno-rtti",
113 "-fno-exceptions",
114 ],
115 },
116 windows: {
Colin Cross4094d252016-11-21 17:18:40 -0800117 // Disable certain warnings for use with mingw.
118 // We also must undefine WIN32_LEAN_AND_MEAN, since it is being passed globally
119 // on the command line, and LLVM defines this internally itself.
120 cflags: [
121 "-Wno-array-bounds",
122 "-Wno-comment",
123 "-UWIN32_LEAN_AND_MEAN",
124 ],
125
126 host_ldlibs: ["-luuid"],
127 },
Dan Willemsena32f6632017-10-02 10:41:09 -0700128 linux_glibc: {
Colin Cross4094d252016-11-21 17:18:40 -0800129 host_ldlibs: [
Colin Cross4094d252016-11-21 17:18:40 -0800130 "-lgcc_s",
131 ],
132 },
133 darwin: {
134 cppflags: [
135 "-Wno-deprecated-declarations",
136 "-Woverloaded-virtual",
137 ],
Colin Cross4094d252016-11-21 17:18:40 -0800138 },
139 },
140}
141
Colin Cross8a3437f2016-12-13 13:01:18 -0800142cc_library_headers {
143 name: "llvm-headers-no-generated-headers",
Jiyong Park764e92662017-08-10 20:09:55 +0900144 vendor_available: true,
Justin Yun1dce3072020-11-11 18:19:21 +0900145 product_available: true,
Colin Cross8a3437f2016-12-13 13:01:18 -0800146 host_supported: true,
Victor Khimenkod07e61b2020-07-02 01:32:56 +0200147 // TODO(b/153609531): remove when no longer needed.
148 native_bridge_supported: true,
Colin Cross8a3437f2016-12-13 13:01:18 -0800149 export_include_dirs: ["include"],
150 target: {
151 android: {
152 export_include_dirs: ["device/include"],
153 },
154 host: {
155 export_include_dirs: ["host/include"],
156 },
Dan Willemsen399e4742017-03-15 16:58:24 -0700157 linux_bionic: {
158 enabled: true,
159 },
Colin Cross8a3437f2016-12-13 13:01:18 -0800160 windows: {
161 enabled: true,
162 },
163 },
164}
165
166cc_library_headers {
167 name: "llvm-headers",
Jiyong Park764e92662017-08-10 20:09:55 +0900168 vendor_available: true,
Justin Yun1dce3072020-11-11 18:19:21 +0900169 product_available: true,
Colin Cross8a3437f2016-12-13 13:01:18 -0800170 host_supported: true,
Victor Khimenkod07e61b2020-07-02 01:32:56 +0200171 // TODO(b/153609531): remove when no longer needed.
172 native_bridge_supported: true,
Colin Cross8a3437f2016-12-13 13:01:18 -0800173 header_libs: ["llvm-headers-no-generated-headers"],
174 export_header_lib_headers: ["llvm-headers-no-generated-headers"],
Colin Cross4094d252016-11-21 17:18:40 -0800175 generated_headers: [
176 "llvm-gen-attributes",
177 "llvm-gen-intrinsics",
178 ],
Colin Cross8a3437f2016-12-13 13:01:18 -0800179 export_generated_headers: [
180 "llvm-gen-attributes",
181 "llvm-gen-intrinsics",
182 ],
183 target: {
184 windows: {
185 enabled: true,
186 },
187 },
Colin Cross4094d252016-11-21 17:18:40 -0800188}
189
190llvm_tblgen {
191 name: "llvm-gen-attributes",
192 in: "include/llvm/IR/Attributes.td",
193 outs: ["llvm/IR/Attributes.inc"],
194}
195
196llvm_tblgen {
197 name: "llvm-gen-intrinsics",
198 in: "include/llvm/IR/Intrinsics.td",
199 outs: ["llvm/IR/Intrinsics.gen"],
200}
201
Colin Crossd0b692652016-12-08 09:49:38 -0800202force_build_llvm_components_defaults {
203 name: "force_build_llvm_components",
204 // Host build disabled by soong/llvm.go unless FORCE_BUILD_LLVM_COMPONENTS
205 // environment variable is set
206}
207
Colin Cross4094d252016-11-21 17:18:40 -0800208// LLVM shared library build
209
210llvm_arm_static_libraries = [
211 "libLLVMARMCodeGen",
212 "libLLVMARMAsmParser",
213 "libLLVMARMAsmPrinter",
214 "libLLVMARMInfo",
215 "libLLVMARMDesc",
216 "libLLVMARMDisassembler",
217]
218
219llvm_x86_static_libraries = [
220 "libLLVMX86CodeGen",
221 "libLLVMX86Info",
222 "libLLVMX86Desc",
223 "libLLVMX86AsmParser",
224 "libLLVMX86AsmPrinter",
225 "libLLVMX86Utils",
226 "libLLVMX86Disassembler",
227]
228
229llvm_mips_static_libraries = [
230 "libLLVMMipsCodeGen",
231 "libLLVMMipsInfo",
232 "libLLVMMipsDesc",
233 "libLLVMMipsAsmParser",
234 "libLLVMMipsAsmPrinter",
235 "libLLVMMipsDisassembler",
236]
237
238llvm_aarch64_static_libraries = [
239 "libLLVMAArch64CodeGen",
240 "libLLVMAArch64Info",
241 "libLLVMAArch64Desc",
242 "libLLVMAArch64AsmParser",
243 "libLLVMAArch64AsmPrinter",
244 "libLLVMAArch64Utils",
245 "libLLVMAArch64Disassembler",
246]
247
Tim Klein4a6bb552019-05-13 23:55:43 +0100248cc_library {
Colin Cross4094d252016-11-21 17:18:40 -0800249 host_supported: true,
Pirama Arumuga Nainarc6f1de72017-08-03 11:31:35 -0700250 name: "libLLVM_android",
Tim Klein4a6bb552019-05-13 23:55:43 +0100251 vendor_available: true,
Justin Yun1dce3072020-11-11 18:19:21 +0900252 product_available: true,
Colin Crossd0b692652016-12-08 09:49:38 -0800253 defaults: [
254 "llvm-defaults",
255 "force_build_llvm_components",
256 ],
Colin Cross4094d252016-11-21 17:18:40 -0800257
258 whole_static_libs: [
259 // pre static libraries
260 "libLLVMLinker",
261 "libLLVMipo",
262 "libLLVMDebugInfoDWARF",
263 "libLLVMDebugInfoPDB",
264 "libLLVMSymbolize",
265 "libLLVMIRReader",
266 "libLLVMBitWriter",
267 "libLLVMBitReader",
268
269 // post static libraries
270 "libLLVMLTO",
271 "libLLVMAsmPrinter",
272 "libLLVMSelectionDAG",
273 "libLLVMCodeGen",
274 "libLLVMDebugInfoCodeView",
275 "libLLVMObject",
276 "libLLVMScalarOpts",
277 "libLLVMInstCombine",
278 "libLLVMInstrumentation",
279 "libLLVMTransformObjCARC",
280 "libLLVMTransformUtils",
281 "libLLVMAnalysis",
282 "libLLVMTarget",
283 "libLLVMGlobalISel",
284 "libLLVMMCDisassembler",
285 "libLLVMMC",
286 "libLLVMMCParser",
287 "libLLVMCore",
288 "libLLVMAsmParser",
289 "libLLVMOption",
290 "libLLVMSupport",
291 "libLLVMVectorize",
292 "libLLVMProfileData",
293 "libLLVMProfileDataCoverage",
294 "libLLVMLibDriver",
Nicolas Norveza5aee7a2017-06-23 13:56:49 -0700295 "libLLVMExecutionEngine",
296 "libLLVMRuntimeDyld",
297 "libLLVMMCJIT",
298 "libLLVMOrcJIT",
Colin Cross4094d252016-11-21 17:18:40 -0800299 ],
300
Colin Cross7e5fa1a2016-12-06 16:42:05 -0800301 export_include_dirs: ["include"],
302
Colin Cross4094d252016-11-21 17:18:40 -0800303 target: {
304 host: {
305 // Host build pulls in all ARM, Mips, X86 components.
Nicolas Norveza5aee7a2017-06-23 13:56:49 -0700306 whole_static_libs: llvm_arm_static_libraries +
Colin Cross4094d252016-11-21 17:18:40 -0800307 llvm_aarch64_static_libraries +
308 llvm_mips_static_libraries +
309 llvm_x86_static_libraries,
Colin Cross7e5fa1a2016-12-06 16:42:05 -0800310 export_include_dirs: ["host/include"],
Colin Cross4094d252016-11-21 17:18:40 -0800311 },
312 windows: {
Colin Crossd4da2d92016-12-01 14:49:11 -0800313 enabled: true,
Colin Cross4094d252016-11-21 17:18:40 -0800314 host_ldlibs: [
315 "-limagehlp",
316 "-lpsapi",
317 "-lole32",
318 "-lversion",
319 ],
320 },
Colin Cross7e5fa1a2016-12-06 16:42:05 -0800321 android: {
322 export_include_dirs: ["device/include"],
323 },
Colin Cross4094d252016-11-21 17:18:40 -0800324 android_arm: {
Miao Wang1c75a852020-01-30 14:18:41 -0800325 whole_static_libs: llvm_arm_static_libraries +
326 llvm_aarch64_static_libraries,
Colin Cross4094d252016-11-21 17:18:40 -0800327 },
328 android_x86: {
329 whole_static_libs: llvm_x86_static_libraries +
330 llvm_arm_static_libraries +
331 llvm_aarch64_static_libraries,
332 },
333 android_x86_64: {
334 whole_static_libs: llvm_x86_static_libraries +
335 llvm_arm_static_libraries +
336 llvm_aarch64_static_libraries,
337 },
Colin Cross4094d252016-11-21 17:18:40 -0800338 android_arm64: {
339 whole_static_libs: llvm_aarch64_static_libraries +
340 llvm_arm_static_libraries,
341 },
342 },
343}
344
345subdirs = [
346 "soong",
Colin Crossd4da2d92016-12-01 14:49:11 -0800347 "lib",
348 "tools/*",
Colin Cross4094d252016-11-21 17:18:40 -0800349 "utils/*",
350]