xref: /aosp_15_r20/external/mesa3d/src/util/format/Android.bp (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1/*
2 * Copyright (C) 2023 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package {
18    // See: http://go/android-license-faq
19    default_applicable_licenses: ["external_mesa3d_license"],
20}
21
22filegroup {
23    name: "mesa_u_format_yaml",
24    srcs: ["u_format.yaml"],
25}
26
27python_binary_host {
28    name: "u_format_table_gen",
29    main: "u_format_table.py",
30    srcs: [
31        "u_format_table.py",
32        "u_format_pack.py",
33        "u_format_parse.py",
34    ],
35    libs: [
36        "pyyaml",
37    ],
38}
39
40genrule {
41    name: "u_format_pack_header",
42    srcs: [":mesa_u_format_yaml"],
43    out: ["u_format_pack.h"],
44    tools: ["u_format_table_gen"],
45    cmd: "python3 $(location u_format_table_gen) " +
46        "$(location :mesa_u_format_yaml) --header " +
47        "&> $(location u_format_pack.h)",
48}
49
50genrule {
51    name: "u_format_gen_header",
52    srcs: [":mesa_u_format_yaml"],
53    out: ["util/format/u_format_gen.h"],
54    tools: ["u_format_table_gen"],
55    cmd: "python3 $(location u_format_table_gen) " +
56        "$(location :mesa_u_format_yaml) --enums " +
57        "&> $(location util/format/u_format_gen.h)",
58}
59
60genrule {
61    name: "u_format_table_impl",
62    srcs: [":mesa_u_format_yaml"],
63    out: ["u_format_table.c"],
64    tools: ["u_format_table_gen"],
65    cmd: "python3 $(location u_format_table_gen) " +
66        "$(location :mesa_u_format_yaml) " +
67        " &> $(location u_format_table.c)",
68}
69
70cc_library_static {
71    name: "mesa_util_format",
72    vendor: true,
73    host_supported: true,
74    defaults: [
75        "mesa_common_defaults",
76    ],
77    header_libs: [
78        "mesa_common_headers",
79        "mesa_util_headers",
80    ],
81    generated_headers: [
82        "u_format_pack_header",
83        "u_format_gen_header",
84    ],
85    generated_sources: [
86        "u_format_table_impl",
87        "format_srgb_impl",
88    ],
89    srcs: [
90        "u_format.c",
91        "u_format_bptc.c",
92        "u_format_etc.c",
93        "u_format_fxt1.c",
94        "u_format_latc.c",
95        "u_format_other.c",
96        "u_format_rgtc.c",
97        "u_format_s3tc.c",
98        "u_format_tests.c",
99        "u_format_unpack_neon.c",
100        "u_format_yuv.c",
101        "u_format_zs.c",
102    ],
103}
104