Bob Badour | 2549c51 | 2021-02-12 18:19:11 -0800 | [diff] [blame] | 1 | package { |
| 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 |
| 28 | license { |
| 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 Cross | 8a3437f | 2016-12-13 13:01:18 -0800 | [diff] [blame] | 45 | cc_defaults { |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 46 | name: "llvm-defaults", |
Colin Cross | 8a3437f | 2016-12-13 13:01:18 -0800 | [diff] [blame] | 47 | defaults: ["llvm-defaults-no-generated-headers"], |
| 48 | header_libs: ["llvm-headers"], |
Chih-Hung Hsieh | a8de068 | 2017-08-09 10:27:27 -0700 | [diff] [blame] | 49 | tidy_checks: [ |
| 50 | "-google-build-*", |
| 51 | "-google-global-*", |
| 52 | ], |
Evgenii Stepanov | 2d76ce5 | 2019-01-04 17:37:15 -0800 | [diff] [blame] | 53 | sanitize: { |
| 54 | hwaddress: false, // code size b/112437884 |
| 55 | }, |
Colin Cross | 5a418bcd | 2022-11-01 09:16:06 -0700 | [diff] [blame] | 56 | arch: { |
| 57 | riscv64: { |
| 58 | enabled: false, |
| 59 | }, |
| 60 | }, |
Colin Cross | 8a3437f | 2016-12-13 13:01:18 -0800 | [diff] [blame] | 61 | } |
| 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. |
| 66 | llvm_defaults { |
| 67 | name: "llvm-defaults-no-generated-headers", |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 68 | |
| 69 | host_supported: true, |
Victor Khimenko | d07e61b | 2020-07-02 01:32:56 +0200 | [diff] [blame] | 70 | // TODO(b/153609531): remove when no longer needed. |
| 71 | native_bridge_supported: true, |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 72 | |
Ryan Prichard | 722f2dd | 2024-04-10 22:44:35 -0700 | [diff] [blame] | 73 | cpp_std: "c++11", |
| 74 | |
Yi Kong | a2a04f3 | 2024-05-28 02:25:43 +0900 | [diff] [blame] | 75 | // Optimize for size. It is only used by Renderscript, which is deprecated and is rarely |
| 76 | // used. |
| 77 | optimize_for_size: true, |
| 78 | |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 79 | 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 Kong | fccb4bf | 2018-01-03 12:55:42 -0800 | [diff] [blame] | 87 | "-Wno-cast-qual", |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 88 | "-Wno-sign-compare", |
| 89 | "-Wno-unused-parameter", |
| 90 | "-Wno-maybe-uninitialized", |
| 91 | "-Wno-missing-field-initializers", |
Chih-Hung Hsieh | 53d37e5 | 2018-09-05 15:41:45 -0700 | [diff] [blame] | 92 | "-Wno-implicit-fallthrough", |
Ryan Prichard | 722f2dd | 2024-04-10 22:44:35 -0700 | [diff] [blame] | 93 | "-Wno-deprecated-declarations", |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 94 | "-Wwrite-strings", |
| 95 | "-Werror", |
| 96 | "-Dsprintf=sprintf", |
| 97 | ], |
| 98 | |
| 99 | cppflags: [ |
| 100 | "-Wno-sign-promo", |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 101 | ], |
| 102 | |
Chih-Hung Hsieh | a8de068 | 2017-08-09 10:27:27 -0700 | [diff] [blame] | 103 | tidy_checks: [ |
| 104 | "-google-build-*", |
| 105 | "-google-global-*", |
| 106 | ], |
| 107 | |
Colin Cross | 8a3437f | 2016-12-13 13:01:18 -0800 | [diff] [blame] | 108 | header_libs: ["llvm-headers-no-generated-headers"], |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 109 | |
| 110 | target: { |
| 111 | android: { |
| 112 | cflags: [ |
| 113 | "-finline-functions", |
| 114 | ], |
Dan Willemsen | a880871 | 2017-10-16 20:08:05 -0700 | [diff] [blame] | 115 | }, |
| 116 | linux: { |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 117 | cppflags: [ |
| 118 | "-Woverloaded-virtual", |
| 119 | ], |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 120 | }, |
| 121 | host: { |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 122 | cppflags: [ |
| 123 | "-fno-rtti", |
| 124 | "-fno-exceptions", |
| 125 | ], |
| 126 | }, |
| 127 | windows: { |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 128 | // 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 Willemsen | a32f663 | 2017-10-02 10:41:09 -0700 | [diff] [blame] | 139 | linux_glibc: { |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 140 | host_ldlibs: [ |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 141 | "-lgcc_s", |
| 142 | ], |
| 143 | }, |
| 144 | darwin: { |
| 145 | cppflags: [ |
| 146 | "-Wno-deprecated-declarations", |
| 147 | "-Woverloaded-virtual", |
| 148 | ], |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 149 | }, |
| 150 | }, |
| 151 | } |
| 152 | |
Colin Cross | 8a3437f | 2016-12-13 13:01:18 -0800 | [diff] [blame] | 153 | cc_library_headers { |
| 154 | name: "llvm-headers-no-generated-headers", |
Jiyong Park | 764e9266 | 2017-08-10 20:09:55 +0900 | [diff] [blame] | 155 | vendor_available: true, |
Justin Yun | 1dce307 | 2020-11-11 18:19:21 +0900 | [diff] [blame] | 156 | product_available: true, |
Colin Cross | 8a3437f | 2016-12-13 13:01:18 -0800 | [diff] [blame] | 157 | host_supported: true, |
Victor Khimenko | d07e61b | 2020-07-02 01:32:56 +0200 | [diff] [blame] | 158 | // TODO(b/153609531): remove when no longer needed. |
| 159 | native_bridge_supported: true, |
Colin Cross | 8a3437f | 2016-12-13 13:01:18 -0800 | [diff] [blame] | 160 | 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 Willemsen | 399e474 | 2017-03-15 16:58:24 -0700 | [diff] [blame] | 168 | linux_bionic: { |
| 169 | enabled: true, |
| 170 | }, |
Colin Cross | 8a3437f | 2016-12-13 13:01:18 -0800 | [diff] [blame] | 171 | windows: { |
| 172 | enabled: true, |
| 173 | }, |
| 174 | }, |
| 175 | } |
| 176 | |
| 177 | cc_library_headers { |
| 178 | name: "llvm-headers", |
Jiyong Park | 764e9266 | 2017-08-10 20:09:55 +0900 | [diff] [blame] | 179 | vendor_available: true, |
Justin Yun | 1dce307 | 2020-11-11 18:19:21 +0900 | [diff] [blame] | 180 | product_available: true, |
Colin Cross | 8a3437f | 2016-12-13 13:01:18 -0800 | [diff] [blame] | 181 | host_supported: true, |
Victor Khimenko | d07e61b | 2020-07-02 01:32:56 +0200 | [diff] [blame] | 182 | // TODO(b/153609531): remove when no longer needed. |
| 183 | native_bridge_supported: true, |
Colin Cross | 8a3437f | 2016-12-13 13:01:18 -0800 | [diff] [blame] | 184 | header_libs: ["llvm-headers-no-generated-headers"], |
| 185 | export_header_lib_headers: ["llvm-headers-no-generated-headers"], |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 186 | generated_headers: [ |
| 187 | "llvm-gen-attributes", |
| 188 | "llvm-gen-intrinsics", |
| 189 | ], |
Colin Cross | 8a3437f | 2016-12-13 13:01:18 -0800 | [diff] [blame] | 190 | export_generated_headers: [ |
| 191 | "llvm-gen-attributes", |
| 192 | "llvm-gen-intrinsics", |
| 193 | ], |
| 194 | target: { |
| 195 | windows: { |
| 196 | enabled: true, |
| 197 | }, |
| 198 | }, |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 199 | } |
| 200 | |
| 201 | llvm_tblgen { |
| 202 | name: "llvm-gen-attributes", |
| 203 | in: "include/llvm/IR/Attributes.td", |
| 204 | outs: ["llvm/IR/Attributes.inc"], |
| 205 | } |
| 206 | |
| 207 | llvm_tblgen { |
| 208 | name: "llvm-gen-intrinsics", |
| 209 | in: "include/llvm/IR/Intrinsics.td", |
| 210 | outs: ["llvm/IR/Intrinsics.gen"], |
| 211 | } |
| 212 | |
Colin Cross | d0b69265 | 2016-12-08 09:49:38 -0800 | [diff] [blame] | 213 | force_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 Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 219 | // LLVM shared library build |
| 220 | |
| 221 | llvm_arm_static_libraries = [ |
| 222 | "libLLVMARMCodeGen", |
| 223 | "libLLVMARMAsmParser", |
| 224 | "libLLVMARMAsmPrinter", |
| 225 | "libLLVMARMInfo", |
| 226 | "libLLVMARMDesc", |
| 227 | "libLLVMARMDisassembler", |
| 228 | ] |
| 229 | |
| 230 | llvm_x86_static_libraries = [ |
| 231 | "libLLVMX86CodeGen", |
| 232 | "libLLVMX86Info", |
| 233 | "libLLVMX86Desc", |
| 234 | "libLLVMX86AsmParser", |
| 235 | "libLLVMX86AsmPrinter", |
| 236 | "libLLVMX86Utils", |
| 237 | "libLLVMX86Disassembler", |
| 238 | ] |
| 239 | |
| 240 | llvm_mips_static_libraries = [ |
| 241 | "libLLVMMipsCodeGen", |
| 242 | "libLLVMMipsInfo", |
| 243 | "libLLVMMipsDesc", |
| 244 | "libLLVMMipsAsmParser", |
| 245 | "libLLVMMipsAsmPrinter", |
| 246 | "libLLVMMipsDisassembler", |
| 247 | ] |
| 248 | |
| 249 | llvm_aarch64_static_libraries = [ |
| 250 | "libLLVMAArch64CodeGen", |
| 251 | "libLLVMAArch64Info", |
| 252 | "libLLVMAArch64Desc", |
| 253 | "libLLVMAArch64AsmParser", |
| 254 | "libLLVMAArch64AsmPrinter", |
| 255 | "libLLVMAArch64Utils", |
| 256 | "libLLVMAArch64Disassembler", |
| 257 | ] |
| 258 | |
Tim Klein | 4a6bb55 | 2019-05-13 23:55:43 +0100 | [diff] [blame] | 259 | cc_library { |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 260 | host_supported: true, |
Pirama Arumuga Nainar | c6f1de7 | 2017-08-03 11:31:35 -0700 | [diff] [blame] | 261 | name: "libLLVM_android", |
Tim Klein | 4a6bb55 | 2019-05-13 23:55:43 +0100 | [diff] [blame] | 262 | vendor_available: true, |
Justin Yun | 1dce307 | 2020-11-11 18:19:21 +0900 | [diff] [blame] | 263 | product_available: true, |
Colin Cross | d0b69265 | 2016-12-08 09:49:38 -0800 | [diff] [blame] | 264 | defaults: [ |
| 265 | "llvm-defaults", |
| 266 | "force_build_llvm_components", |
| 267 | ], |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 268 | |
| 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 Norvez | a5aee7a | 2017-06-23 13:56:49 -0700 | [diff] [blame] | 306 | "libLLVMExecutionEngine", |
| 307 | "libLLVMRuntimeDyld", |
| 308 | "libLLVMMCJIT", |
| 309 | "libLLVMOrcJIT", |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 310 | ], |
| 311 | |
Colin Cross | 7e5fa1a | 2016-12-06 16:42:05 -0800 | [diff] [blame] | 312 | export_include_dirs: ["include"], |
| 313 | |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 314 | target: { |
| 315 | host: { |
| 316 | // Host build pulls in all ARM, Mips, X86 components. |
Nicolas Norvez | a5aee7a | 2017-06-23 13:56:49 -0700 | [diff] [blame] | 317 | whole_static_libs: llvm_arm_static_libraries + |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 318 | llvm_aarch64_static_libraries + |
| 319 | llvm_mips_static_libraries + |
| 320 | llvm_x86_static_libraries, |
Colin Cross | 7e5fa1a | 2016-12-06 16:42:05 -0800 | [diff] [blame] | 321 | export_include_dirs: ["host/include"], |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 322 | }, |
| 323 | windows: { |
Colin Cross | d4da2d9 | 2016-12-01 14:49:11 -0800 | [diff] [blame] | 324 | enabled: true, |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 325 | host_ldlibs: [ |
| 326 | "-limagehlp", |
| 327 | "-lpsapi", |
| 328 | "-lole32", |
| 329 | "-lversion", |
| 330 | ], |
| 331 | }, |
Colin Cross | 7e5fa1a | 2016-12-06 16:42:05 -0800 | [diff] [blame] | 332 | android: { |
| 333 | export_include_dirs: ["device/include"], |
| 334 | }, |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 335 | android_arm: { |
Miao Wang | 1c75a85 | 2020-01-30 14:18:41 -0800 | [diff] [blame] | 336 | whole_static_libs: llvm_arm_static_libraries + |
| 337 | llvm_aarch64_static_libraries, |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 338 | }, |
| 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 Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 349 | android_arm64: { |
| 350 | whole_static_libs: llvm_aarch64_static_libraries + |
| 351 | llvm_arm_static_libraries, |
| 352 | }, |
| 353 | }, |
| 354 | } |
| 355 | |
| 356 | subdirs = [ |
| 357 | "soong", |
Colin Cross | d4da2d9 | 2016-12-01 14:49:11 -0800 | [diff] [blame] | 358 | "lib", |
| 359 | "tools/*", |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 360 | "utils/*", |
| 361 | ] |