1package { 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 45cc_defaults { 46 name: "llvm-defaults", 47 defaults: ["llvm-defaults-no-generated-headers"], 48 header_libs: ["llvm-headers"], 49 tidy_checks: [ 50 "-google-build-*", 51 "-google-global-*", 52 ], 53 sanitize: { 54 hwaddress: false, // code size b/112437884 55 }, 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. 61llvm_defaults { 62 name: "llvm-defaults-no-generated-headers", 63 64 host_supported: true, 65 // TODO(b/153609531): remove when no longer needed. 66 native_bridge_supported: true, 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", 76 "-Wno-cast-qual", 77 "-Wno-sign-compare", 78 "-Wno-unused-parameter", 79 "-Wno-maybe-uninitialized", 80 "-Wno-missing-field-initializers", 81 "-Wno-implicit-fallthrough", 82 "-Wwrite-strings", 83 "-Werror", 84 "-Dsprintf=sprintf", 85 ], 86 87 cppflags: [ 88 "-Wno-sign-promo", 89 "-std=c++11", 90 ], 91 92 tidy_checks: [ 93 "-google-build-*", 94 "-google-global-*", 95 ], 96 97 header_libs: ["llvm-headers-no-generated-headers"], 98 99 target: { 100 android: { 101 cflags: [ 102 "-finline-functions", 103 ], 104 }, 105 linux: { 106 cppflags: [ 107 "-Woverloaded-virtual", 108 ], 109 }, 110 host: { 111 cppflags: [ 112 "-fno-rtti", 113 "-fno-exceptions", 114 ], 115 }, 116 windows: { 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 }, 128 linux_glibc: { 129 host_ldlibs: [ 130 "-lgcc_s", 131 ], 132 }, 133 darwin: { 134 cppflags: [ 135 "-Wno-deprecated-declarations", 136 "-Woverloaded-virtual", 137 ], 138 }, 139 }, 140} 141 142cc_library_headers { 143 name: "llvm-headers-no-generated-headers", 144 vendor_available: true, 145 product_available: true, 146 host_supported: true, 147 // TODO(b/153609531): remove when no longer needed. 148 native_bridge_supported: true, 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 }, 157 linux_bionic: { 158 enabled: true, 159 }, 160 windows: { 161 enabled: true, 162 }, 163 }, 164} 165 166cc_library_headers { 167 name: "llvm-headers", 168 vendor_available: true, 169 product_available: true, 170 host_supported: true, 171 // TODO(b/153609531): remove when no longer needed. 172 native_bridge_supported: true, 173 header_libs: ["llvm-headers-no-generated-headers"], 174 export_header_lib_headers: ["llvm-headers-no-generated-headers"], 175 generated_headers: [ 176 "llvm-gen-attributes", 177 "llvm-gen-intrinsics", 178 ], 179 export_generated_headers: [ 180 "llvm-gen-attributes", 181 "llvm-gen-intrinsics", 182 ], 183 target: { 184 windows: { 185 enabled: true, 186 }, 187 }, 188} 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 202force_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 208// 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 248cc_library { 249 host_supported: true, 250 name: "libLLVM_android", 251 vendor_available: true, 252 product_available: true, 253 defaults: [ 254 "llvm-defaults", 255 "force_build_llvm_components", 256 ], 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", 295 "libLLVMExecutionEngine", 296 "libLLVMRuntimeDyld", 297 "libLLVMMCJIT", 298 "libLLVMOrcJIT", 299 ], 300 301 export_include_dirs: ["include"], 302 303 target: { 304 host: { 305 // Host build pulls in all ARM, Mips, X86 components. 306 whole_static_libs: llvm_arm_static_libraries + 307 llvm_aarch64_static_libraries + 308 llvm_mips_static_libraries + 309 llvm_x86_static_libraries, 310 export_include_dirs: ["host/include"], 311 }, 312 windows: { 313 enabled: true, 314 host_ldlibs: [ 315 "-limagehlp", 316 "-lpsapi", 317 "-lole32", 318 "-lversion", 319 ], 320 }, 321 android: { 322 export_include_dirs: ["device/include"], 323 }, 324 android_arm: { 325 whole_static_libs: llvm_arm_static_libraries + 326 llvm_aarch64_static_libraries, 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 }, 338 android_arm64: { 339 whole_static_libs: llvm_aarch64_static_libraries + 340 llvm_arm_static_libraries, 341 }, 342 }, 343} 344 345subdirs = [ 346 "soong", 347 "lib", 348 "tools/*", 349 "utils/*", 350] 351