1// Set up common variables for usage across the libjpeg-turbo modules 2 3cc_defaults { 4 name: "libjpeg-defaults", 5 cflags: [ 6 "-O3", 7 "-fstrict-aliasing", 8 9 "-Wno-unused-parameter", 10 "-Werror", 11 ], 12 srcs: [ 13 "jcapimin.c", 14 "jcapistd.c", 15 "jaricom.c", 16 "jcarith.c", 17 "jccoefct.c", 18 "jccolor.c", 19 "jcdctmgr.c", 20 "jchuff.c", 21 "jcinit.c", 22 "jcmainct.c", 23 "jcmarker.c", 24 "jcmaster.c", 25 "jcomapi.c", 26 "jcparam.c", 27 "jcphuff.c", 28 "jcprepct.c", 29 "jcsample.c", 30 "jctrans.c", 31 "jdapimin.c", 32 "jdapistd.c", 33 "jdarith.c", 34 "jdatadst.c", 35 "jdatasrc.c", 36 "jdcoefct.c", 37 "jdcolor.c", 38 "jddctmgr.c", 39 "jdhuff.c", 40 "jdinput.c", 41 "jdmainct.c", 42 "jdmarker.c", 43 "jdmaster.c", 44 "jdmerge.c", 45 "jdphuff.c", 46 "jdpostct.c", 47 "jdsample.c", 48 "jdtrans.c", 49 "jerror.c", 50 "jfdctflt.c", 51 "jfdctfst.c", 52 "jfdctint.c", 53 "jidctflt.c", 54 "jidctfst.c", 55 "jidctint.c", 56 "jidctred.c", 57 "jmemmgr.c", 58 "jmemnobs.c", 59 "jquant1.c", 60 "jquant2.c", 61 "jutils.c", 62 ], 63 64 arch: { 65 arm: { 66 // By default, the build system generates ARM target binaries in 67 // thumb mode, where each instruction is 16 bits wide. Defining 68 // this variable as arm forces the build system to generate object 69 // files in 32-bit arm mode. This is the same setting previously 70 // used by libjpeg and it provides a small performance benefit. 71 instruction_set: "arm", 72 // ARM v7 NEON 73 srcs: [ 74 "simd/jsimd_arm_neon.S", 75 "simd/jsimd_arm.c", 76 ], 77 armv7_a_neon: { 78 // If we are certain that the ARM v7 device has NEON (and there 79 // is no need for a runtime check), we can indicate that with a 80 // flag. 81 cflags: ["-D__ARM_HAVE_NEON__"], 82 }, 83 }, 84 arm64: { 85 // ARM v8 64-bit NEON 86 srcs: [ 87 "simd/jsimd_arm64_neon.S", 88 "simd/jsimd_arm64.c", 89 ], 90 }, 91 x86: { 92 // x86 MMX and SSE2 93 srcs: [ 94 "simd/jsimd_i386.c", 95 "simd/jccolor-mmx.asm", 96 "simd/jccolor-sse2.asm", 97 "simd/jcgray-mmx.asm", 98 "simd/jcgray-sse2.asm", 99 "simd/jchuff-sse2.asm", 100 "simd/jcsample-mmx.asm", 101 "simd/jcsample-sse2.asm", 102 "simd/jdcolor-mmx.asm", 103 "simd/jdcolor-sse2.asm", 104 "simd/jdmerge-mmx.asm", 105 "simd/jdmerge-sse2.asm", 106 "simd/jdsample-mmx.asm", 107 "simd/jdsample-sse2.asm", 108 "simd/jfdctflt-3dn.asm", 109 "simd/jfdctflt-sse.asm", 110 "simd/jfdctfst-mmx.asm", 111 "simd/jfdctfst-sse2.asm", 112 "simd/jfdctint-mmx.asm", 113 "simd/jfdctint-sse2.asm", 114 "simd/jidctflt-3dn.asm", 115 "simd/jidctflt-sse2.asm", 116 "simd/jidctflt-sse.asm", 117 "simd/jidctfst-mmx.asm", 118 "simd/jidctfst-sse2.asm", 119 "simd/jidctint-mmx.asm", 120 "simd/jidctint-sse2.asm", 121 "simd/jidctred-mmx.asm", 122 "simd/jidctred-sse2.asm", 123 "simd/jquant-3dn.asm", 124 "simd/jquantf-sse2.asm", 125 "simd/jquanti-sse2.asm", 126 "simd/jquant-mmx.asm", 127 "simd/jquant-sse.asm", 128 "simd/jsimdcpu.asm", 129 ], 130 asflags: [ 131 "-DPIC", 132 "-DELF", 133 ], 134 local_include_dirs: ["simd"], 135 }, 136 x86_64: { 137 // x86-64 SSE2 138 srcs: [ 139 "simd/jsimd_x86_64.c", 140 "simd/jccolor-sse2-64.asm", 141 "simd/jcgray-sse2-64.asm", 142 "simd/jchuff-sse2-64.asm", 143 "simd/jcsample-sse2-64.asm", 144 "simd/jdcolor-sse2-64.asm", 145 "simd/jdmerge-sse2-64.asm", 146 "simd/jdsample-sse2-64.asm", 147 "simd/jfdctflt-sse-64.asm", 148 "simd/jfdctfst-sse2-64.asm", 149 "simd/jfdctint-sse2-64.asm", 150 "simd/jidctflt-sse2-64.asm", 151 "simd/jidctfst-sse2-64.asm", 152 "simd/jidctint-sse2-64.asm", 153 "simd/jidctred-sse2-64.asm", 154 "simd/jquantf-sse2-64.asm", 155 "simd/jquanti-sse2-64.asm", 156 ], 157 asflags: [ 158 "-D__x86_64__", 159 "-DPIC", 160 "-DELF", 161 ], 162 local_include_dirs: ["simd"], 163 }, 164 mips: { 165 srcs: ["jsimd_none.c"], 166 }, 167 mips64: { 168 srcs: ["jsimd_none.c"], 169 }, 170 }, 171} 172 173// Also build as a shared library. 174cc_library { 175 name: "libjpeg", 176 vendor_available: true, 177 defaults: ["libjpeg-defaults"], 178 export_include_dirs: ["."], 179} 180 181// Build static library against the NDK 182cc_library_static { 183 name: "libjpeg_static_ndk", 184 defaults: ["libjpeg-defaults"], 185 export_include_dirs: ["."], 186 sdk_version: "17", 187} 188 189// Definition for TJBench 190cc_binary { 191 name: "tjbench", 192 193 whole_static_libs: ["libjpeg"], 194 195 multilib: { 196 lib32: { 197 stem: "tj32", 198 }, 199 lib64: { 200 stem: "tj64", 201 }, 202 }, 203 204 compile_multilib: "both", 205 206 cflags: [ 207 "-DBMP_SUPPORTED", 208 "-DPPM_SUPPORTED", 209 "-Wno-unused-parameter", 210 "-Werror", 211 ], 212 213 srcs: [ 214 "tjbench.c", 215 "bmp.c", 216 "tjutil.c", 217 "rdbmp.c", 218 "rdppm.c", 219 "wrbmp.c", 220 "wrppm.c", 221 "turbojpeg.c", 222 "transupp.c", 223 "jdatadst-tj.c", 224 "jdatasrc-tj.c", 225 ], 226} 227