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