blob: 7e46bb4a58f2f6c17011b7e6549e228b4c33bf4a [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 Cross5a418bcd2022-11-01 09:16:06 -070056 arch: {
57 riscv64: {
58 enabled: false,
59 },
60 },
Colin Cross8a3437f2016-12-13 13:01:18 -080061}
62
63// This module defines all of the defaults used to compiled llvm, except for
64// the generated headers. It is necessary to avoid a circular dependency
65// from the tblgen tool used to generate the headers to the generated headers.
66llvm_defaults {
67 name: "llvm-defaults-no-generated-headers",
Colin Cross4094d252016-11-21 17:18:40 -080068
69 host_supported: true,
Victor Khimenkod07e61b2020-07-02 01:32:56 +020070 // TODO(b/153609531): remove when no longer needed.
71 native_bridge_supported: true,
Colin Cross4094d252016-11-21 17:18:40 -080072
Ryan Prichard722f2dd2024-04-10 22:44:35 -070073 cpp_std: "c++11",
74
Yi Konga2a04f32024-05-28 02:25:43 +090075 // Optimize for size. It is only used by Renderscript, which is deprecated and is rarely
76 // used.
77 optimize_for_size: true,
78
Colin Cross4094d252016-11-21 17:18:40 -080079 cflags: [
80 "-D_GNU_SOURCE",
81 "-D__STDC_LIMIT_MACROS",
82 "-D__STDC_CONSTANT_MACROS",
83 "-D__STDC_FORMAT_MACROS",
84 "-fomit-frame-pointer",
85 "-Wall",
86 "-W",
Yi Kongfccb4bf2018-01-03 12:55:42 -080087 "-Wno-cast-qual",
Colin Cross4094d252016-11-21 17:18:40 -080088 "-Wno-sign-compare",
89 "-Wno-unused-parameter",
90 "-Wno-maybe-uninitialized",
91 "-Wno-missing-field-initializers",
Chih-Hung Hsieh53d37e52018-09-05 15:41:45 -070092 "-Wno-implicit-fallthrough",
Ryan Prichard722f2dd2024-04-10 22:44:35 -070093 "-Wno-deprecated-declarations",
Colin Cross4094d252016-11-21 17:18:40 -080094 "-Wwrite-strings",
95 "-Werror",
96 "-Dsprintf=sprintf",
97 ],
98
99 cppflags: [
100 "-Wno-sign-promo",
Colin Cross4094d252016-11-21 17:18:40 -0800101 ],
102
Chih-Hung Hsieha8de0682017-08-09 10:27:27 -0700103 tidy_checks: [
104 "-google-build-*",
105 "-google-global-*",
106 ],
107
Colin Cross8a3437f2016-12-13 13:01:18 -0800108 header_libs: ["llvm-headers-no-generated-headers"],
Colin Cross4094d252016-11-21 17:18:40 -0800109
110 target: {
111 android: {
112 cflags: [
113 "-finline-functions",
114 ],
Dan Willemsena8808712017-10-16 20:08:05 -0700115 },
116 linux: {
Colin Cross4094d252016-11-21 17:18:40 -0800117 cppflags: [
118 "-Woverloaded-virtual",
119 ],
Colin Cross4094d252016-11-21 17:18:40 -0800120 },
121 host: {
Colin Cross4094d252016-11-21 17:18:40 -0800122 cppflags: [
123 "-fno-rtti",
124 "-fno-exceptions",
125 ],
126 },
127 windows: {
Colin Cross4094d252016-11-21 17:18:40 -0800128 // Disable certain warnings for use with mingw.
129 // We also must undefine WIN32_LEAN_AND_MEAN, since it is being passed globally
130 // on the command line, and LLVM defines this internally itself.
131 cflags: [
132 "-Wno-array-bounds",
133 "-Wno-comment",
134 "-UWIN32_LEAN_AND_MEAN",
135 ],
136
137 host_ldlibs: ["-luuid"],
138 },
Dan Willemsena32f6632017-10-02 10:41:09 -0700139 linux_glibc: {
Colin Cross4094d252016-11-21 17:18:40 -0800140 host_ldlibs: [
Colin Cross4094d252016-11-21 17:18:40 -0800141 "-lgcc_s",
142 ],
143 },
144 darwin: {
145 cppflags: [
146 "-Wno-deprecated-declarations",
147 "-Woverloaded-virtual",
148 ],
Colin Cross4094d252016-11-21 17:18:40 -0800149 },
150 },
151}
152
Colin Cross8a3437f2016-12-13 13:01:18 -0800153cc_library_headers {
154 name: "llvm-headers-no-generated-headers",
Jiyong Park764e92662017-08-10 20:09:55 +0900155 vendor_available: true,
Justin Yun1dce3072020-11-11 18:19:21 +0900156 product_available: true,
Colin Cross8a3437f2016-12-13 13:01:18 -0800157 host_supported: true,
Victor Khimenkod07e61b2020-07-02 01:32:56 +0200158 // TODO(b/153609531): remove when no longer needed.
159 native_bridge_supported: true,
Colin Cross8a3437f2016-12-13 13:01:18 -0800160 export_include_dirs: ["include"],
161 target: {
162 android: {
163 export_include_dirs: ["device/include"],
164 },
165 host: {
166 export_include_dirs: ["host/include"],
167 },
Dan Willemsen399e4742017-03-15 16:58:24 -0700168 linux_bionic: {
169 enabled: true,
170 },
Colin Cross8a3437f2016-12-13 13:01:18 -0800171 windows: {
172 enabled: true,
173 },
174 },
175}
176
177cc_library_headers {
178 name: "llvm-headers",
Jiyong Park764e92662017-08-10 20:09:55 +0900179 vendor_available: true,
Justin Yun1dce3072020-11-11 18:19:21 +0900180 product_available: true,
Colin Cross8a3437f2016-12-13 13:01:18 -0800181 host_supported: true,
Victor Khimenkod07e61b2020-07-02 01:32:56 +0200182 // TODO(b/153609531): remove when no longer needed.
183 native_bridge_supported: true,
Colin Cross8a3437f2016-12-13 13:01:18 -0800184 header_libs: ["llvm-headers-no-generated-headers"],
185 export_header_lib_headers: ["llvm-headers-no-generated-headers"],
Colin Cross4094d252016-11-21 17:18:40 -0800186 generated_headers: [
187 "llvm-gen-attributes",
188 "llvm-gen-intrinsics",
189 ],
Colin Cross8a3437f2016-12-13 13:01:18 -0800190 export_generated_headers: [
191 "llvm-gen-attributes",
192 "llvm-gen-intrinsics",
193 ],
194 target: {
195 windows: {
196 enabled: true,
197 },
198 },
Colin Cross4094d252016-11-21 17:18:40 -0800199}
200
201llvm_tblgen {
202 name: "llvm-gen-attributes",
203 in: "include/llvm/IR/Attributes.td",
204 outs: ["llvm/IR/Attributes.inc"],
205}
206
207llvm_tblgen {
208 name: "llvm-gen-intrinsics",
209 in: "include/llvm/IR/Intrinsics.td",
210 outs: ["llvm/IR/Intrinsics.gen"],
211}
212
Colin Crossd0b692652016-12-08 09:49:38 -0800213force_build_llvm_components_defaults {
214 name: "force_build_llvm_components",
215 // Host build disabled by soong/llvm.go unless FORCE_BUILD_LLVM_COMPONENTS
216 // environment variable is set
217}
218
Colin Cross4094d252016-11-21 17:18:40 -0800219// LLVM shared library build
220
221llvm_arm_static_libraries = [
222 "libLLVMARMCodeGen",
223 "libLLVMARMAsmParser",
224 "libLLVMARMAsmPrinter",
225 "libLLVMARMInfo",
226 "libLLVMARMDesc",
227 "libLLVMARMDisassembler",
228]
229
230llvm_x86_static_libraries = [
231 "libLLVMX86CodeGen",
232 "libLLVMX86Info",
233 "libLLVMX86Desc",
234 "libLLVMX86AsmParser",
235 "libLLVMX86AsmPrinter",
236 "libLLVMX86Utils",
237 "libLLVMX86Disassembler",
238]
239
240llvm_mips_static_libraries = [
241 "libLLVMMipsCodeGen",
242 "libLLVMMipsInfo",
243 "libLLVMMipsDesc",
244 "libLLVMMipsAsmParser",
245 "libLLVMMipsAsmPrinter",
246 "libLLVMMipsDisassembler",
247]
248
249llvm_aarch64_static_libraries = [
250 "libLLVMAArch64CodeGen",
251 "libLLVMAArch64Info",
252 "libLLVMAArch64Desc",
253 "libLLVMAArch64AsmParser",
254 "libLLVMAArch64AsmPrinter",
255 "libLLVMAArch64Utils",
256 "libLLVMAArch64Disassembler",
257]
258
Tim Klein4a6bb552019-05-13 23:55:43 +0100259cc_library {
Colin Cross4094d252016-11-21 17:18:40 -0800260 host_supported: true,
Pirama Arumuga Nainarc6f1de72017-08-03 11:31:35 -0700261 name: "libLLVM_android",
Tim Klein4a6bb552019-05-13 23:55:43 +0100262 vendor_available: true,
Justin Yun1dce3072020-11-11 18:19:21 +0900263 product_available: true,
Colin Crossd0b692652016-12-08 09:49:38 -0800264 defaults: [
265 "llvm-defaults",
266 "force_build_llvm_components",
267 ],
Colin Cross4094d252016-11-21 17:18:40 -0800268
269 whole_static_libs: [
270 // pre static libraries
271 "libLLVMLinker",
272 "libLLVMipo",
273 "libLLVMDebugInfoDWARF",
274 "libLLVMDebugInfoPDB",
275 "libLLVMSymbolize",
276 "libLLVMIRReader",
277 "libLLVMBitWriter",
278 "libLLVMBitReader",
279
280 // post static libraries
281 "libLLVMLTO",
282 "libLLVMAsmPrinter",
283 "libLLVMSelectionDAG",
284 "libLLVMCodeGen",
285 "libLLVMDebugInfoCodeView",
286 "libLLVMObject",
287 "libLLVMScalarOpts",
288 "libLLVMInstCombine",
289 "libLLVMInstrumentation",
290 "libLLVMTransformObjCARC",
291 "libLLVMTransformUtils",
292 "libLLVMAnalysis",
293 "libLLVMTarget",
294 "libLLVMGlobalISel",
295 "libLLVMMCDisassembler",
296 "libLLVMMC",
297 "libLLVMMCParser",
298 "libLLVMCore",
299 "libLLVMAsmParser",
300 "libLLVMOption",
301 "libLLVMSupport",
302 "libLLVMVectorize",
303 "libLLVMProfileData",
304 "libLLVMProfileDataCoverage",
305 "libLLVMLibDriver",
Nicolas Norveza5aee7a2017-06-23 13:56:49 -0700306 "libLLVMExecutionEngine",
307 "libLLVMRuntimeDyld",
308 "libLLVMMCJIT",
309 "libLLVMOrcJIT",
Colin Cross4094d252016-11-21 17:18:40 -0800310 ],
311
Colin Cross7e5fa1a2016-12-06 16:42:05 -0800312 export_include_dirs: ["include"],
313
Colin Cross4094d252016-11-21 17:18:40 -0800314 target: {
315 host: {
316 // Host build pulls in all ARM, Mips, X86 components.
Nicolas Norveza5aee7a2017-06-23 13:56:49 -0700317 whole_static_libs: llvm_arm_static_libraries +
Colin Cross4094d252016-11-21 17:18:40 -0800318 llvm_aarch64_static_libraries +
319 llvm_mips_static_libraries +
320 llvm_x86_static_libraries,
Colin Cross7e5fa1a2016-12-06 16:42:05 -0800321 export_include_dirs: ["host/include"],
Colin Cross4094d252016-11-21 17:18:40 -0800322 },
323 windows: {
Colin Crossd4da2d92016-12-01 14:49:11 -0800324 enabled: true,
Colin Cross4094d252016-11-21 17:18:40 -0800325 host_ldlibs: [
326 "-limagehlp",
327 "-lpsapi",
328 "-lole32",
329 "-lversion",
330 ],
331 },
Colin Cross7e5fa1a2016-12-06 16:42:05 -0800332 android: {
333 export_include_dirs: ["device/include"],
334 },
Colin Cross4094d252016-11-21 17:18:40 -0800335 android_arm: {
Miao Wang1c75a852020-01-30 14:18:41 -0800336 whole_static_libs: llvm_arm_static_libraries +
337 llvm_aarch64_static_libraries,
Colin Cross4094d252016-11-21 17:18:40 -0800338 },
339 android_x86: {
340 whole_static_libs: llvm_x86_static_libraries +
341 llvm_arm_static_libraries +
342 llvm_aarch64_static_libraries,
343 },
344 android_x86_64: {
345 whole_static_libs: llvm_x86_static_libraries +
346 llvm_arm_static_libraries +
347 llvm_aarch64_static_libraries,
348 },
Colin Cross4094d252016-11-21 17:18:40 -0800349 android_arm64: {
350 whole_static_libs: llvm_aarch64_static_libraries +
351 llvm_arm_static_libraries,
352 },
353 },
354}
355
356subdirs = [
357 "soong",
Colin Crossd4da2d92016-12-01 14:49:11 -0800358 "lib",
359 "tools/*",
Colin Cross4094d252016-11-21 17:18:40 -0800360 "utils/*",
361]