xref: /aosp_15_r20/external/libvpx/Android.bp.in (revision fb1b10ab9aebc7c7068eedab379b749d7e3900be)
1package {
2    default_applicable_licenses: ["external_libvpx_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// See: http://go/android-license-faq
19license {
20    name: "external_libvpx_license",
21    visibility: [":__subpackages__"],
22    license_kinds: [
23        "SPDX-license-identifier-BSD",
24        "SPDX-license-identifier-ISC",
25        "legacy_unencumbered",
26    ],
27    license_text: [
28        "NOTICE",
29    ],
30}
31
32cc_defaults {
33    name: "libvpx_defaults",
34
35    cflags: [
36        "-O3",
37    ],
38
39    min_sdk_version: "29",
40    apex_available: [
41        "//apex_available:platform",
42        "com.android.media.swcodec",
43    ],
44
45    target: {
46        darwin: {
47            enabled: false,
48        },
49        android: {
50            sanitize: {
51                cfi: true,
52                config: {
53                    cfi_assembly_support: true,
54                },
55            },
56        },
57    },
58
59    arch: {
60        // configured to require the neon unit
61        arm: {
62            local_include_dirs: ["config/arm-neon"],
63        },
64
65        arm64: {
66            local_include_dirs: ["config/arm64"],
67        },
68
69        riscv64: {
70            local_include_dirs: ["config/generic"],
71        },
72
73        x86: {
74            local_include_dirs: ["config/x86"],
75        },
76
77        x86_64: {
78            local_include_dirs: ["config/x86_64"],
79        },
80    },
81}
82
83cc_library_static {
84    name: "libvpx_neon_dotprod",
85    defaults: ["libvpx_defaults"],
86    host_supported: true,
87    vendor_available: true,
88    visibility: ["//visibility:private"],
89
90    cflags: [
91        "-Xclang -target-feature",
92        // This comment prevents bpfmt from sorting the flags incorrectly.
93        "-Xclang +dotprod",
94    ],
95
96    arch: {
97        arm64: {
98            srcs: libvpx_arm64_neon_dotprod_c_srcs,
99        },
100    },
101}
102
103cc_library_static {
104    name: "libvpx_neon_i8mm",
105    defaults: ["libvpx_defaults"],
106    host_supported: true,
107    vendor_available: true,
108    visibility: ["//visibility:private"],
109
110    cflags: [
111        "-Xclang -target-feature",
112        // This comment prevents bpfmt from sorting the flags incorrectly.
113        "-Xclang +dotprod",
114        // This comment prevents bpfmt from sorting the flags incorrectly.
115        "-Xclang -target-feature",
116        // This comment prevents bpfmt from sorting the flags incorrectly.
117        "-Xclang +i8mm",
118    ],
119
120    arch: {
121        arm64: {
122            srcs: libvpx_arm64_neon_i8mm_c_srcs,
123        },
124    },
125}
126
127cc_library_static {
128    name: "libvpx_sve",
129    defaults: ["libvpx_defaults"],
130    host_supported: true,
131    vendor_available: true,
132    visibility: ["//visibility:private"],
133
134    cflags: [
135        "-Xclang -target-feature",
136        // This comment prevents bpfmt from sorting the flags incorrectly.
137        "-Xclang +dotprod",
138        // This comment prevents bpfmt from sorting the flags incorrectly.
139        "-Xclang -target-feature",
140        // This comment prevents bpfmt from sorting the flags incorrectly.
141        "-Xclang +i8mm",
142        // This comment prevents bpfmt from sorting the flags incorrectly.
143        "-Xclang -target-feature",
144        // This comment prevents bpfmt from sorting the flags incorrectly.
145        "-Xclang +sve",
146    ],
147
148    arch: {
149        arm64: {
150            srcs: libvpx_arm64_sve_c_srcs,
151        },
152    },
153}
154
155cc_library {
156    name: "libvpx",
157    defaults: [ "libvpx_defaults" ],
158    vendor_available: true,
159    host_supported: true,
160    version_script: "exports.lds",
161
162    arch: {
163        // configured to require the neon unit
164        arm: {
165            // Want arm, not thumb, optimized
166            instruction_set: "arm",
167
168            srcs: libvpx_arm_neon_c_srcs + libvpx_arm_neon_asm_srcs,
169        },
170
171        arm64: {
172            srcs: libvpx_arm64_c_srcs,
173            whole_static_libs: [
174                "libvpx_neon_dotprod",
175                "libvpx_neon_i8mm",
176                "libvpx_sve",
177            ],
178        },
179
180        riscv64: {
181            srcs: libvpx_generic_c_srcs,
182        },
183
184        x86: {
185            srcs: libvpx_x86_c_srcs + libvpx_x86_asm_srcs,
186            cflags: [
187                "-mssse3",
188            ],
189        },
190
191        x86_64: {
192            srcs: libvpx_x86_64_c_srcs + libvpx_x86_64_asm_srcs,
193            cflags: [
194                "-mssse3",
195            ],
196        },
197    },
198
199    cflags: [
200        "-Wno-unused-parameter",
201    ],
202
203    export_include_dirs: ["."],
204
205    sanitize: {
206        integer_overflow: true,
207        misc_undefined: ["bounds"],
208        blocklist: "libvpx_blocklist.txt",
209    },
210}
211
212cc_library {
213    name: "libvpxrc",
214    defaults: [ "libvpx_defaults" ],
215    vendor_available: true,
216    static_libs: [ "libvpx" ],
217
218    arch: {
219        x86_64: {
220            srcs: libvpxrc_x86_64_c_srcs +
221                libvpxrc_x86_64_cc_srcs +
222                libvpxrc_x86_64_asm_srcs,
223            cflags: [
224                "-mssse3",
225            ],
226        },
227    },
228
229    export_include_dirs: ["."],
230}
231
232cc_library_headers {
233    name: "libvpx_headers",
234    vendor_available: true,
235    host_supported: true,
236
237    arch: {
238        arm: {
239            export_include_dirs: ["config/arm-neon"],
240        },
241
242        arm64: {
243            export_include_dirs: ["config/arm64"],
244        },
245
246        riscv64: {
247            export_include_dirs: ["config/generic"],
248        },
249
250        x86: {
251            export_include_dirs: ["config/x86"],
252        },
253
254        x86_64: {
255            export_include_dirs: ["config/x86_64"],
256        },
257    },
258
259    export_include_dirs: ["."],
260}
261
262cc_fuzz {
263    name: "vp9_dec_fuzzer",
264    defaults: [ "libvpx_defaults" ],
265    host_supported: true,
266    srcs: [
267        "examples/vpx_dec_fuzzer.cc",
268    ],
269
270    cflags: ["-DDECODER=vp9"],
271    static_libs: [
272        "libvpx",
273    ],
274}
275
276cc_fuzz {
277    name: "vp8_dec_fuzzer",
278    defaults: [ "libvpx_defaults" ],
279    host_supported: true,
280    srcs: [
281        "examples/vpx_dec_fuzzer.cc",
282    ],
283
284    cflags: ["-DDECODER=vp8"],
285    static_libs: [
286        "libvpx",
287    ],
288}
289