xref: /aosp_15_r20/external/mesa3d/src/util/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_drirc",
24    srcs: ["00-mesa-defaults.conf"],
25}
26
27python_binary_host {
28    name: "format_srgb_gen",
29    main: "format_srgb.py",
30    srcs: ["format_srgb.py"],
31}
32
33python_binary_host {
34    name: "driconf_static_gen",
35    main: "driconf_static.py",
36    srcs: ["driconf_static.py"],
37    libs: [
38        "mako",
39    ],
40}
41
42genrule {
43    name: "format_srgb_impl",
44    out: ["format_srgb.c"],
45    tools: ["format_srgb_gen"],
46    cmd: "python3 $(location format_srgb_gen) " +
47        "&> $(location format_srgb.c)",
48}
49
50genrule {
51    name: "driconf_static_header",
52    srcs: [":mesa_drirc"],
53    out: ["driconf_static.h"],
54    tools: ["driconf_static_gen"],
55    cmd: "python3 $(location driconf_static_gen) " +
56        "$(location :mesa_drirc) " +
57        "$(location driconf_static.h)",
58}
59
60cc_library_headers {
61    name: "mesa_util_headers",
62    host_supported: true,
63    vendor: true,
64    export_include_dirs: [
65        ".",
66    ],
67}
68
69cc_library_static {
70    name: "mesa_util",
71    host_supported: true,
72    vendor: true,
73    defaults: [
74        "mesa_common_defaults",
75    ],
76    generated_headers: [
77        "driconf_static_header",
78    ],
79    static_libs: [
80        "mesa_util_c11",
81    ],
82    shared_libs: [
83        "liblog",
84        "libcutils",
85    ],
86    srcs: [
87        "anon_file.c",
88        "bitscan.c",
89        "blob.c",
90        "build_id.c",
91        "compress.c",
92        "crc32.c",
93        "cnd_monotonic.c",
94        "dag.c",
95        "double.c",
96        "disk_cache.c",
97        "disk_cache_os.c",
98        "fast_idiv_by_const.c",
99        "fossilize_db.c",
100        "futex.c",
101        "half_float.c",
102        "hash_table.c",
103        "u_idalloc.c",
104        "log.c",
105        "memstream.c",
106        "mesa-sha1.c",
107        "mesa-blake3.c",
108        "os_time.c",
109        "os_file.c",
110        "os_memory_fd.c",
111        "os_misc.c",
112        "os_socket.c",
113        "perf/u_trace.c",
114        "u_process.c",
115        "u_qsort.cpp",
116        "rwlock.c",
117        "sha1/sha1.c",
118        "ralloc.c",
119        "rand_xor.c",
120        "rb_tree.c",
121        "register_allocate.c",
122        "rgtc.c",
123        "set.c",
124        "simple_mtx.c",
125        "slab.c",
126        "softfloat.c",
127        "sparse_array.c",
128        "string_buffer.c",
129        "strtod.c",
130        "u_atomic.c",
131        "u_call_once.c",
132        "u_dl.c",
133        "u_dynarray.c",
134        "u_hash_table.c",
135        "u_queue.c",
136        "u_thread.c",
137        "u_vector.c",
138        "u_math.c",
139        "u_mm.c",
140        "u_debug.c",
141        "u_debug_memory.c",
142        "u_cpu_detect.c",
143        "u_printf.c",
144        "u_worklist.c",
145        "vl_zscan_data.c",
146        "vma.c",
147        "mesa_cache_db.c",
148        "mesa_cache_db_multipart.c",
149        "xmlconfig.c",
150    ],
151    target: {
152        host: {
153            header_libs: [
154                "mesa_common_headers",
155            ],
156            cflags: [
157                "-DHAVE_PROGRAM_INVOCATION_NAME",
158            ],
159        },
160        android: {
161            header_libs: [
162                "mesa_common_headers",
163            ],
164            cflags: [
165                "-DHAVE_MEMFD_CREATE",
166            ],
167        },
168    },
169}
170