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 | 8a3437f | 2016-12-13 13:01:18 -0800 | [diff] [blame] | 56 | } |
| 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. |
| 61 | llvm_defaults { |
| 62 | name: "llvm-defaults-no-generated-headers", |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 63 | |
| 64 | host_supported: true, |
Victor Khimenko | d07e61b | 2020-07-02 01:32:56 +0200 | [diff] [blame] | 65 | // TODO(b/153609531): remove when no longer needed. |
| 66 | native_bridge_supported: true, |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 67 | |
| 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 Kong | fccb4bf | 2018-01-03 12:55:42 -0800 | [diff] [blame] | 76 | "-Wno-cast-qual", |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 77 | "-Wno-sign-compare", |
| 78 | "-Wno-unused-parameter", |
| 79 | "-Wno-maybe-uninitialized", |
| 80 | "-Wno-missing-field-initializers", |
Chih-Hung Hsieh | 53d37e5 | 2018-09-05 15:41:45 -0700 | [diff] [blame] | 81 | "-Wno-implicit-fallthrough", |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 82 | "-Wwrite-strings", |
| 83 | "-Werror", |
| 84 | "-Dsprintf=sprintf", |
| 85 | ], |
| 86 | |
| 87 | cppflags: [ |
| 88 | "-Wno-sign-promo", |
| 89 | "-std=c++11", |
| 90 | ], |
| 91 | |
Chih-Hung Hsieh | a8de068 | 2017-08-09 10:27:27 -0700 | [diff] [blame] | 92 | tidy_checks: [ |
| 93 | "-google-build-*", |
| 94 | "-google-global-*", |
| 95 | ], |
| 96 | |
Colin Cross | 8a3437f | 2016-12-13 13:01:18 -0800 | [diff] [blame] | 97 | header_libs: ["llvm-headers-no-generated-headers"], |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 98 | |
| 99 | target: { |
| 100 | android: { |
| 101 | cflags: [ |
| 102 | "-finline-functions", |
| 103 | ], |
Dan Willemsen | a880871 | 2017-10-16 20:08:05 -0700 | [diff] [blame] | 104 | }, |
| 105 | linux: { |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 106 | cppflags: [ |
| 107 | "-Woverloaded-virtual", |
| 108 | ], |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 109 | }, |
| 110 | host: { |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 111 | cppflags: [ |
| 112 | "-fno-rtti", |
| 113 | "-fno-exceptions", |
| 114 | ], |
| 115 | }, |
| 116 | windows: { |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 117 | // 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 Willemsen | a32f663 | 2017-10-02 10:41:09 -0700 | [diff] [blame] | 128 | linux_glibc: { |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 129 | host_ldlibs: [ |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 130 | "-lgcc_s", |
| 131 | ], |
| 132 | }, |
| 133 | darwin: { |
| 134 | cppflags: [ |
| 135 | "-Wno-deprecated-declarations", |
| 136 | "-Woverloaded-virtual", |
| 137 | ], |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 138 | }, |
| 139 | }, |
| 140 | } |
| 141 | |
Colin Cross | 8a3437f | 2016-12-13 13:01:18 -0800 | [diff] [blame] | 142 | cc_library_headers { |
| 143 | name: "llvm-headers-no-generated-headers", |
Jiyong Park | 764e9266 | 2017-08-10 20:09:55 +0900 | [diff] [blame] | 144 | vendor_available: true, |
Justin Yun | 1dce307 | 2020-11-11 18:19:21 +0900 | [diff] [blame] | 145 | product_available: true, |
Colin Cross | 8a3437f | 2016-12-13 13:01:18 -0800 | [diff] [blame] | 146 | host_supported: true, |
Victor Khimenko | d07e61b | 2020-07-02 01:32:56 +0200 | [diff] [blame] | 147 | // TODO(b/153609531): remove when no longer needed. |
| 148 | native_bridge_supported: true, |
Colin Cross | 8a3437f | 2016-12-13 13:01:18 -0800 | [diff] [blame] | 149 | 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 Willemsen | 399e474 | 2017-03-15 16:58:24 -0700 | [diff] [blame] | 157 | linux_bionic: { |
| 158 | enabled: true, |
| 159 | }, |
Colin Cross | 8a3437f | 2016-12-13 13:01:18 -0800 | [diff] [blame] | 160 | windows: { |
| 161 | enabled: true, |
| 162 | }, |
| 163 | }, |
| 164 | } |
| 165 | |
| 166 | cc_library_headers { |
| 167 | name: "llvm-headers", |
Jiyong Park | 764e9266 | 2017-08-10 20:09:55 +0900 | [diff] [blame] | 168 | vendor_available: true, |
Justin Yun | 1dce307 | 2020-11-11 18:19:21 +0900 | [diff] [blame] | 169 | product_available: true, |
Colin Cross | 8a3437f | 2016-12-13 13:01:18 -0800 | [diff] [blame] | 170 | host_supported: true, |
Victor Khimenko | d07e61b | 2020-07-02 01:32:56 +0200 | [diff] [blame] | 171 | // TODO(b/153609531): remove when no longer needed. |
| 172 | native_bridge_supported: true, |
Colin Cross | 8a3437f | 2016-12-13 13:01:18 -0800 | [diff] [blame] | 173 | header_libs: ["llvm-headers-no-generated-headers"], |
| 174 | export_header_lib_headers: ["llvm-headers-no-generated-headers"], |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 175 | generated_headers: [ |
| 176 | "llvm-gen-attributes", |
| 177 | "llvm-gen-intrinsics", |
| 178 | ], |
Colin Cross | 8a3437f | 2016-12-13 13:01:18 -0800 | [diff] [blame] | 179 | export_generated_headers: [ |
| 180 | "llvm-gen-attributes", |
| 181 | "llvm-gen-intrinsics", |
| 182 | ], |
| 183 | target: { |
| 184 | windows: { |
| 185 | enabled: true, |
| 186 | }, |
| 187 | }, |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 188 | } |
| 189 | |
| 190 | llvm_tblgen { |
| 191 | name: "llvm-gen-attributes", |
| 192 | in: "include/llvm/IR/Attributes.td", |
| 193 | outs: ["llvm/IR/Attributes.inc"], |
| 194 | } |
| 195 | |
| 196 | llvm_tblgen { |
| 197 | name: "llvm-gen-intrinsics", |
| 198 | in: "include/llvm/IR/Intrinsics.td", |
| 199 | outs: ["llvm/IR/Intrinsics.gen"], |
| 200 | } |
| 201 | |
Colin Cross | d0b69265 | 2016-12-08 09:49:38 -0800 | [diff] [blame] | 202 | force_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 Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 208 | // LLVM shared library build |
| 209 | |
| 210 | llvm_arm_static_libraries = [ |
| 211 | "libLLVMARMCodeGen", |
| 212 | "libLLVMARMAsmParser", |
| 213 | "libLLVMARMAsmPrinter", |
| 214 | "libLLVMARMInfo", |
| 215 | "libLLVMARMDesc", |
| 216 | "libLLVMARMDisassembler", |
| 217 | ] |
| 218 | |
| 219 | llvm_x86_static_libraries = [ |
| 220 | "libLLVMX86CodeGen", |
| 221 | "libLLVMX86Info", |
| 222 | "libLLVMX86Desc", |
| 223 | "libLLVMX86AsmParser", |
| 224 | "libLLVMX86AsmPrinter", |
| 225 | "libLLVMX86Utils", |
| 226 | "libLLVMX86Disassembler", |
| 227 | ] |
| 228 | |
| 229 | llvm_mips_static_libraries = [ |
| 230 | "libLLVMMipsCodeGen", |
| 231 | "libLLVMMipsInfo", |
| 232 | "libLLVMMipsDesc", |
| 233 | "libLLVMMipsAsmParser", |
| 234 | "libLLVMMipsAsmPrinter", |
| 235 | "libLLVMMipsDisassembler", |
| 236 | ] |
| 237 | |
| 238 | llvm_aarch64_static_libraries = [ |
| 239 | "libLLVMAArch64CodeGen", |
| 240 | "libLLVMAArch64Info", |
| 241 | "libLLVMAArch64Desc", |
| 242 | "libLLVMAArch64AsmParser", |
| 243 | "libLLVMAArch64AsmPrinter", |
| 244 | "libLLVMAArch64Utils", |
| 245 | "libLLVMAArch64Disassembler", |
| 246 | ] |
| 247 | |
Tim Klein | 4a6bb55 | 2019-05-13 23:55:43 +0100 | [diff] [blame] | 248 | cc_library { |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 249 | host_supported: true, |
Pirama Arumuga Nainar | c6f1de7 | 2017-08-03 11:31:35 -0700 | [diff] [blame] | 250 | name: "libLLVM_android", |
Tim Klein | 4a6bb55 | 2019-05-13 23:55:43 +0100 | [diff] [blame] | 251 | vendor_available: true, |
Justin Yun | 1dce307 | 2020-11-11 18:19:21 +0900 | [diff] [blame] | 252 | product_available: true, |
Colin Cross | d0b69265 | 2016-12-08 09:49:38 -0800 | [diff] [blame] | 253 | defaults: [ |
| 254 | "llvm-defaults", |
| 255 | "force_build_llvm_components", |
| 256 | ], |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 257 | |
| 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 Norvez | a5aee7a | 2017-06-23 13:56:49 -0700 | [diff] [blame] | 295 | "libLLVMExecutionEngine", |
| 296 | "libLLVMRuntimeDyld", |
| 297 | "libLLVMMCJIT", |
| 298 | "libLLVMOrcJIT", |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 299 | ], |
| 300 | |
Colin Cross | 7e5fa1a | 2016-12-06 16:42:05 -0800 | [diff] [blame] | 301 | export_include_dirs: ["include"], |
| 302 | |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 303 | target: { |
| 304 | host: { |
| 305 | // Host build pulls in all ARM, Mips, X86 components. |
Nicolas Norvez | a5aee7a | 2017-06-23 13:56:49 -0700 | [diff] [blame] | 306 | whole_static_libs: llvm_arm_static_libraries + |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 307 | llvm_aarch64_static_libraries + |
| 308 | llvm_mips_static_libraries + |
| 309 | llvm_x86_static_libraries, |
Colin Cross | 7e5fa1a | 2016-12-06 16:42:05 -0800 | [diff] [blame] | 310 | export_include_dirs: ["host/include"], |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 311 | }, |
| 312 | windows: { |
Colin Cross | d4da2d9 | 2016-12-01 14:49:11 -0800 | [diff] [blame] | 313 | enabled: true, |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 314 | host_ldlibs: [ |
| 315 | "-limagehlp", |
| 316 | "-lpsapi", |
| 317 | "-lole32", |
| 318 | "-lversion", |
| 319 | ], |
| 320 | }, |
Colin Cross | 7e5fa1a | 2016-12-06 16:42:05 -0800 | [diff] [blame] | 321 | android: { |
| 322 | export_include_dirs: ["device/include"], |
| 323 | }, |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 324 | android_arm: { |
Miao Wang | 1c75a85 | 2020-01-30 14:18:41 -0800 | [diff] [blame] | 325 | whole_static_libs: llvm_arm_static_libraries + |
| 326 | llvm_aarch64_static_libraries, |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 327 | }, |
| 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 Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 338 | android_arm64: { |
| 339 | whole_static_libs: llvm_aarch64_static_libraries + |
| 340 | llvm_arm_static_libraries, |
| 341 | }, |
| 342 | }, |
| 343 | } |
| 344 | |
| 345 | subdirs = [ |
| 346 | "soong", |
Colin Cross | d4da2d9 | 2016-12-01 14:49:11 -0800 | [diff] [blame] | 347 | "lib", |
| 348 | "tools/*", |
Colin Cross | 4094d25 | 2016-11-21 17:18:40 -0800 | [diff] [blame] | 349 | "utils/*", |
| 350 | ] |