1// Set up common variables for usage across the libjpeg-turbo modules 2 3package { 4 default_applicable_licenses: ["external_libjpeg-turbo_license"], 5} 6 7// Added automatically by a large-scale-change that took the approach of 8// 'apply every license found to every target'. While this makes sure we respect 9// every license restriction, it may not be entirely correct. 10// 11// e.g. GPL in an MIT project might only apply to the contrib/ directory. 12// 13// Please consider splitting the single license below into multiple licenses, 14// taking care not to lose any license_kind information, and overriding the 15// default license using the 'licenses: [...]' property on targets as needed. 16// 17// For unused files, consider creating a 'fileGroup' with "//visibility:private" 18// to attach the license to, and including a comment whether the files may be 19// used in the current project. 20// See: http://go/android-license-faq 21license { 22 name: "external_libjpeg-turbo_license", 23 visibility: [":__subpackages__"], 24 license_kinds: [ 25 "SPDX-license-identifier-BSD", 26 "SPDX-license-identifier-Beerware", 27 "SPDX-license-identifier-MIT", 28 "SPDX-license-identifier-Zlib", 29 "legacy_notice", 30 "legacy_unencumbered", 31 ], 32 license_text: [ 33 "LICENSE.md", 34 ], 35} 36 37cc_defaults { 38 name: "libjpeg-defaults", 39 cflags: [ 40 "-DWITH_SIMD", 41 "-DNO_GETENV", 42 43 "-O3", 44 "-fstrict-aliasing", 45 46 "-Werror", 47 "-Wno-sign-compare", 48 "-Wno-unused-parameter", 49 ], 50 srcs: [ 51 "jaricom.c", 52 "jcapimin.c", 53 "jcapistd.c", 54 "jcarith.c", 55 "jccoefct.c", 56 "jccolor.c", 57 "jcdctmgr.c", 58 "jchuff.c", 59 "jcicc.c", 60 "jcinit.c", 61 "jcmainct.c", 62 "jcmarker.c", 63 "jcmaster.c", 64 "jcomapi.c", 65 "jcparam.c", 66 "jcphuff.c", 67 "jcprepct.c", 68 "jcsample.c", 69 "jctrans.c", 70 "jdapimin.c", 71 "jdapistd.c", 72 "jdarith.c", 73 "jdatadst.c", 74 "jdatasrc.c", 75 "jdcoefct.c", 76 "jdcolor.c", 77 "jddctmgr.c", 78 "jdhuff.c", 79 "jdicc.c", 80 "jdinput.c", 81 "jdmainct.c", 82 "jdmarker.c", 83 "jdmaster.c", 84 "jdmerge.c", 85 "jdphuff.c", 86 "jdpostct.c", 87 "jdsample.c", 88 "jdtrans.c", 89 "jerror.c", 90 "jfdctflt.c", 91 "jfdctfst.c", 92 "jfdctint.c", 93 "jidctflt.c", 94 "jidctfst.c", 95 "jidctint.c", 96 "jidctred.c", 97 "jmemmgr.c", 98 "jmemnobs.c", 99 "jpeg_nbits_table.c", 100 "jquant1.c", 101 "jquant2.c", 102 "jutils.c", 103 ], 104 105 arch: { 106 arm: { 107 // By default, the build system generates ARM target binaries in 108 // thumb mode, where each instruction is 16 bits wide. Defining 109 // this variable as arm forces the build system to generate object 110 // files in 32-bit arm mode. This is the same setting previously 111 // used by libjpeg and it provides a small performance benefit. 112 instruction_set: "arm", 113 // ARM v7 NEON 114 srcs: [ 115 "simd/arm/aarch32/jchuff-neon.c", 116 "simd/arm/aarch32/jsimd.c", 117 "simd/arm/jccolor-neon.c", 118 "simd/arm/jcgray-neon.c", 119 "simd/arm/jcphuff-neon.c", 120 "simd/arm/jcsample-neon.c", 121 "simd/arm/jdcolor-neon.c", 122 "simd/arm/jdmerge-neon.c", 123 "simd/arm/jdsample-neon.c", 124 "simd/arm/jfdctfst-neon.c", 125 "simd/arm/jfdctint-neon.c", 126 "simd/arm/jidctfst-neon.c", 127 "simd/arm/jidctint-neon.c", 128 "simd/arm/jidctred-neon.c", 129 "simd/arm/jquanti-neon.c", 130 ], 131 cflags: ["-DNEON_INTRINSICS"], 132 local_include_dirs: ["simd/arm"], 133 }, 134 arm64: { 135 // ARM v8 64-bit NEON 136 srcs: [ 137 "simd/arm/aarch64/jchuff-neon.c", 138 "simd/arm/aarch64/jsimd.c", 139 "simd/arm/jccolor-neon.c", 140 "simd/arm/jcgray-neon.c", 141 "simd/arm/jcphuff-neon.c", 142 "simd/arm/jcsample-neon.c", 143 "simd/arm/jdcolor-neon.c", 144 "simd/arm/jdmerge-neon.c", 145 "simd/arm/jdsample-neon.c", 146 "simd/arm/jfdctfst-neon.c", 147 "simd/arm/jfdctint-neon.c", 148 "simd/arm/jidctfst-neon.c", 149 "simd/arm/jidctint-neon.c", 150 "simd/arm/jidctred-neon.c", 151 "simd/arm/jquanti-neon.c", 152 ], 153 cflags: ["-DNEON_INTRINSICS"], 154 local_include_dirs: ["simd/arm"], 155 }, 156 x86: { 157 // x86 MMX and SSE2 158 srcs: [ 159 "simd/i386/jccolor-avx2.asm", 160 "simd/i386/jccolor-mmx.asm", 161 "simd/i386/jccolor-sse2.asm", 162 "simd/i386/jcgray-avx2.asm", 163 "simd/i386/jcgray-mmx.asm", 164 "simd/i386/jcgray-sse2.asm", 165 "simd/i386/jchuff-sse2.asm", 166 "simd/i386/jcphuff-sse2.asm", 167 "simd/i386/jcsample-avx2.asm", 168 "simd/i386/jcsample-mmx.asm", 169 "simd/i386/jcsample-sse2.asm", 170 "simd/i386/jdcolor-avx2.asm", 171 "simd/i386/jdcolor-mmx.asm", 172 "simd/i386/jdcolor-sse2.asm", 173 "simd/i386/jdmerge-avx2.asm", 174 "simd/i386/jdmerge-mmx.asm", 175 "simd/i386/jdmerge-sse2.asm", 176 "simd/i386/jdsample-avx2.asm", 177 "simd/i386/jdsample-mmx.asm", 178 "simd/i386/jdsample-sse2.asm", 179 "simd/i386/jfdctflt-3dn.asm", 180 "simd/i386/jfdctflt-sse.asm", 181 "simd/i386/jfdctfst-mmx.asm", 182 "simd/i386/jfdctfst-sse2.asm", 183 "simd/i386/jfdctint-avx2.asm", 184 "simd/i386/jfdctint-mmx.asm", 185 "simd/i386/jfdctint-sse2.asm", 186 "simd/i386/jidctflt-3dn.asm", 187 "simd/i386/jidctflt-sse.asm", 188 "simd/i386/jidctflt-sse2.asm", 189 "simd/i386/jidctfst-mmx.asm", 190 "simd/i386/jidctfst-sse2.asm", 191 "simd/i386/jidctint-avx2.asm", 192 "simd/i386/jidctint-mmx.asm", 193 "simd/i386/jidctint-sse2.asm", 194 "simd/i386/jidctred-mmx.asm", 195 "simd/i386/jidctred-sse2.asm", 196 "simd/i386/jquant-3dn.asm", 197 "simd/i386/jquant-mmx.asm", 198 "simd/i386/jquant-sse.asm", 199 "simd/i386/jquantf-sse2.asm", 200 "simd/i386/jquanti-avx2.asm", 201 "simd/i386/jquanti-sse2.asm", 202 "simd/i386/jsimd.c", 203 "simd/i386/jsimdcpu.asm", 204 ], 205 asflags: [ 206 "-DPIC", 207 "-D__x86__", 208 ], 209 local_include_dirs: ["simd/nasm"], 210 }, 211 x86_64: { 212 // x86-64 SSE2 213 srcs: [ 214 "simd/x86_64/jccolor-avx2.asm", 215 "simd/x86_64/jccolor-sse2.asm", 216 "simd/x86_64/jcgray-avx2.asm", 217 "simd/x86_64/jcgray-sse2.asm", 218 "simd/x86_64/jchuff-sse2.asm", 219 "simd/x86_64/jcphuff-sse2.asm", 220 "simd/x86_64/jcsample-avx2.asm", 221 "simd/x86_64/jcsample-sse2.asm", 222 "simd/x86_64/jdcolor-avx2.asm", 223 "simd/x86_64/jdcolor-sse2.asm", 224 "simd/x86_64/jdmerge-avx2.asm", 225 "simd/x86_64/jdmerge-sse2.asm", 226 "simd/x86_64/jdsample-avx2.asm", 227 "simd/x86_64/jdsample-sse2.asm", 228 "simd/x86_64/jfdctflt-sse.asm", 229 "simd/x86_64/jfdctfst-sse2.asm", 230 "simd/x86_64/jfdctint-avx2.asm", 231 "simd/x86_64/jfdctint-sse2.asm", 232 "simd/x86_64/jidctflt-sse2.asm", 233 "simd/x86_64/jidctfst-sse2.asm", 234 "simd/x86_64/jidctint-avx2.asm", 235 "simd/x86_64/jidctint-sse2.asm", 236 "simd/x86_64/jidctred-sse2.asm", 237 "simd/x86_64/jquantf-sse2.asm", 238 "simd/x86_64/jquanti-avx2.asm", 239 "simd/x86_64/jquanti-sse2.asm", 240 "simd/x86_64/jsimd.c", 241 "simd/x86_64/jsimdcpu.asm", 242 ], 243 asflags: [ 244 "-DPIC", 245 "-D__x86_64__", 246 ], 247 local_include_dirs: ["simd/nasm"], 248 }, 249 }, 250 251 target: { 252 linux: { 253 asflags: [ 254 "-DELF", 255 ], 256 }, 257 darwin: { 258 asflags: [ 259 "-DMACHO", 260 ], 261 }, 262 windows_x86: { 263 asflags: [ 264 "-DWIN32", 265 ], 266 }, 267 windows_x86_64: { 268 asflags: [ 269 "-DWIN64", 270 ], 271 }, 272 }, 273} 274 275// Build as a shared library. 276cc_library { 277 name: "libjpeg", 278 host_supported: true, 279 vendor_available: true, 280 product_available: true, 281 vndk: { 282 enabled: true, 283 }, 284 defaults: ["libjpeg-defaults"], 285 export_include_dirs: ["."], 286 target: { 287 windows: { 288 enabled: true, 289 }, 290 }, 291} 292 293// Build static library against the NDK 294cc_library_static { 295 name: "libjpeg_static_ndk", 296 defaults: ["libjpeg-defaults"], 297 export_include_dirs: ["."], 298 sdk_version: "17", 299} 300 301// Definition for TJBench 302cc_binary { 303 name: "tjbench", 304 305 whole_static_libs: ["libjpeg"], 306 307 multilib: { 308 lib32: { 309 stem: "tj32", 310 }, 311 lib64: { 312 stem: "tj64", 313 }, 314 }, 315 316 compile_multilib: "both", 317 318 cflags: [ 319 "-DBMP_SUPPORTED", 320 "-DPPM_SUPPORTED", 321 "-Werror", 322 "-Wno-unused-parameter", 323 ], 324 325 srcs: [ 326 "jdatadst-tj.c", 327 "jdatasrc-tj.c", 328 "rdbmp.c", 329 "rdppm.c", 330 "tjbench.c", 331 "tjutil.c", 332 "transupp.c", 333 "turbojpeg.c", 334 "wrbmp.c", 335 "wrppm.c", 336 ], 337} 338