xref: /aosp_15_r20/external/mesa3d/src/vulkan/runtime/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
22python_binary_host {
23    name: "vk_format_info_gen",
24    main: "vk_format_info_gen.py",
25    srcs: ["vk_format_info_gen.py"],
26    libs: [
27        "mako",
28    ],
29}
30
31genrule {
32    name: "vk_cmd_queue_header",
33    srcs: [":mesa_vulkan_xml"],
34    out: ["vk_cmd_queue.h"],
35    tools: ["vk_cmd_queue_gen"],
36    cmd: "python3 $(location vk_cmd_queue_gen) --xml " +
37        "$(location :mesa_vulkan_xml) --out-h " +
38        "$(location vk_cmd_queue.h) --out-c " +
39        "$(genDir)/placeholder.c --beta false",
40}
41
42genrule {
43    name: "vk_cmd_queue_impl",
44    srcs: [":mesa_vulkan_xml"],
45    out: ["vk_cmd_queue.c"],
46    tools: ["vk_cmd_queue_gen"],
47    cmd: "python3 $(location vk_cmd_queue_gen) --xml " +
48        "$(location :mesa_vulkan_xml) --out-c " +
49        "$(location vk_cmd_queue.c) --out-h " +
50        "$(genDir)/vk_cmd_queue.h --beta false",
51}
52
53genrule {
54    name: "vk_common_entrypoints_header",
55    srcs: [":mesa_vulkan_xml"],
56    out: ["vk_common_entrypoints.h"],
57    tools: ["vk_entrypoints_gen"],
58    cmd: "python3 $(location vk_entrypoints_gen) --xml " +
59        "$(location :mesa_vulkan_xml) --proto --weak --out-h " +
60        "$(location vk_common_entrypoints.h) --out-c " +
61        "$(genDir)/placeholder.c --prefix vk_common --beta false",
62}
63
64genrule {
65    name: "vk_common_entrypoints_impl",
66    srcs: [":mesa_vulkan_xml"],
67    out: ["vk_common_entrypoints.c"],
68    tools: ["vk_entrypoints_gen"],
69    cmd: "python3 $(location vk_entrypoints_gen) --xml " +
70        "$(location :mesa_vulkan_xml) --proto --weak --out-h " +
71        "$(genDir)/vk_common_entrypoints.h --out-c " +
72        "$(location vk_common_entrypoints.c) --prefix vk_common " +
73        "--beta false",
74}
75
76genrule {
77    name: "vk_cmd_enqueue_entrypoints_header",
78    srcs: [":mesa_vulkan_xml"],
79    out: ["vk_cmd_enqueue_entrypoints.h"],
80    tools: ["vk_entrypoints_gen"],
81    cmd: "python3 $(location vk_entrypoints_gen) --xml " +
82        "$(location :mesa_vulkan_xml) --proto --weak --out-h " +
83        "$(location vk_cmd_enqueue_entrypoints.h) --out-c " +
84        "$(genDir)/placeholder.c --prefix vk_cmd_enqueue " +
85        " --prefix vk_cmd_enqueue_unless_primary --beta false",
86}
87
88genrule {
89    name: "vk_cmd_enqueue_entrypoints_impl",
90    srcs: [":mesa_vulkan_xml"],
91    out: ["vk_cmd_enqueue_entrypoints.c"],
92    tools: ["vk_entrypoints_gen"],
93    cmd: "python3 $(location vk_entrypoints_gen) --xml " +
94        "$(location :mesa_vulkan_xml) --proto --weak --out-h " +
95        "$(genDir)/vk_cmd_enqueue_entrypoints.h --out-c " +
96        "$(location vk_cmd_enqueue_entrypoints.c) --prefix vk_cmd_enqueue " +
97        "--prefix vk_cmd_enqueue_unless_primary --beta false",
98}
99
100genrule {
101    name: "vk_dispatch_trampolines_header",
102    srcs: [":mesa_vulkan_xml"],
103    out: ["vk_dispatch_trampolines.h"],
104    tools: ["vk_dispatch_trampolines_gen"],
105    cmd: "python3 $(location vk_dispatch_trampolines_gen) --xml " +
106        "$(location :mesa_vulkan_xml) --out-h " +
107        "$(location vk_dispatch_trampolines.h) --out-c " +
108        "$(genDir)/placeholder.c --beta false",
109}
110
111genrule {
112    name: "vk_dispatch_trampolines_impl",
113    srcs: [":mesa_vulkan_xml"],
114    out: ["vk_dispatch_trampolines.c"],
115    tools: ["vk_dispatch_trampolines_gen"],
116    cmd: "python3 $(location vk_dispatch_trampolines_gen) --xml " +
117        "$(location :mesa_vulkan_xml)  --out-h " +
118        "$(genDir)/vk_dispatch_trampolines.h --out-c " +
119        "$(location vk_dispatch_trampolines.c) --beta false",
120}
121
122genrule {
123    name: "vk_physical_device_features_header",
124    srcs: [":mesa_vulkan_xml"],
125    out: ["vk_physical_device_features.h"],
126    tools: ["vk_physical_device_features_gen"],
127    cmd: "python3 $(location vk_physical_device_features_gen) --xml " +
128        "$(location :mesa_vulkan_xml) --out-h " +
129        "$(location vk_physical_device_features.h) --out-c " +
130        "$(genDir)/placeholder.c --beta false",
131}
132
133genrule {
134    name: "vk_physical_device_features_impl",
135    srcs: [":mesa_vulkan_xml"],
136    out: ["vk_physical_device_features.c"],
137    tools: ["vk_physical_device_features_gen"],
138    cmd: "python3 $(location vk_physical_device_features_gen) --xml " +
139        "$(location :mesa_vulkan_xml) --out-h " +
140        "$(genDir)/vk_physical_device_features.h --out-c " +
141        "$(location vk_physical_device_features.c) --beta false",
142}
143
144genrule {
145    name: "vk_physical_device_properties_header",
146    srcs: [":mesa_vulkan_xml"],
147    out: ["vk_physical_device_properties.h"],
148    tools: ["vk_physical_device_properties_gen"],
149    cmd: "python3 $(location vk_physical_device_properties_gen) --xml " +
150        "$(location :mesa_vulkan_xml) --out-h " +
151        "$(location vk_physical_device_properties.h) --out-c " +
152        "$(genDir)/placeholder.c --beta false",
153}
154
155genrule {
156    name: "vk_physical_device_properties_impl",
157    srcs: [":mesa_vulkan_xml"],
158    out: ["vk_physical_device_properties.c"],
159    tools: ["vk_physical_device_properties_gen"],
160    cmd: "python3 $(location vk_physical_device_properties_gen) --xml " +
161        "$(location :mesa_vulkan_xml) --out-h " +
162        "$(genDir)/vk_physical_device_properties.h --out-c " +
163        "$(location vk_physical_device_properties.c) --beta false",
164}
165
166genrule {
167    name: "vk_format_info_header",
168    srcs: [":mesa_vulkan_xml"],
169    out: ["vk_format_info.h"],
170    tools: ["vk_format_info_gen"],
171    cmd: "python3 $(location vk_format_info_gen) --xml " +
172        "$(location :mesa_vulkan_xml) --out-h " +
173        "$(location vk_format_info.h) --out-c " +
174        "$(genDir)/placeholder.c",
175}
176
177genrule {
178    name: "vk_format_info_impl",
179    srcs: [":mesa_vulkan_xml"],
180    out: ["vk_format_info.c"],
181    tools: ["vk_format_info_gen"],
182    cmd: "python3 $(location vk_format_info_gen) --xml " +
183        "$(location :mesa_vulkan_xml) --out-h " +
184        "$(genDir)/vk_format_info.h --out-c " +
185        "$(location vk_format_info.c)",
186}
187
188cc_library_static {
189    name: "mesa_vulkan_runtime",
190    vendor: true,
191    host_supported: true,
192    defaults: [
193        "mesa_common_defaults",
194    ],
195    header_libs: [
196        "mesa_common_headers",
197        "mesa_nir_headers",
198        "mesa_compiler_headers",
199    ],
200    static_libs: [
201        "libarect",
202        "mesa_util",
203        "mesa_vulkan_util",
204        "mesa_util_c11",
205        "mesa_util_format",
206        "mesa_compiler",
207    ],
208    generated_headers: [
209        "vk_cmd_queue_header",
210        "vk_common_entrypoints_header",
211        "vk_cmd_enqueue_entrypoints_header",
212        "vk_dispatch_trampolines_header",
213        "vk_physical_device_features_header",
214        "vk_physical_device_properties_header",
215        "vk_format_info_header",
216        "nir_builder_opcodes_header",
217        "nir_intrinsics_header",
218        "nir_intrinsics_indices_header",
219        "nir_opcodes_header",
220        "u_format_gen_header",
221        "spirv_info_header",
222        "builtin_types_header",
223    ],
224    generated_sources: [
225        "vk_cmd_queue_impl",
226        "vk_common_entrypoints_impl",
227        "vk_cmd_enqueue_entrypoints_impl",
228        "vk_dispatch_trampolines_impl",
229        "vk_physical_device_features_impl",
230        "vk_physical_device_properties_impl",
231        "vk_format_info_impl",
232    ],
233    srcs: [
234        "rmv/vk_rmv_common.c",
235        "rmv/vk_rmv_exporter.c",
236        "vk_acceleration_structure.c",
237        "vk_blend.c",
238        "vk_buffer.c",
239        "vk_buffer_view.c",
240        "vk_cmd_copy.c",
241        "vk_cmd_enqueue.c",
242        "vk_command_buffer.c",
243        "vk_command_pool.c",
244        "vk_debug_report.c",
245        "vk_debug_utils.c",
246        "vk_deferred_operation.c",
247        "vk_descriptor_set_layout.c",
248        "vk_descriptors.c",
249        "vk_descriptor_update_template.c",
250        "vk_device.c",
251        "vk_device_memory.c",
252        "vk_fence.c",
253        "vk_framebuffer.c",
254        "vk_image.c",
255        "vk_instance.c",
256        "vk_log.c",
257        "vk_object.c",
258        "vk_meta.c",
259        "vk_meta_object_list.c",
260        "vk_physical_device.c",
261        "vk_pipeline_layout.c",
262        "vk_query_pool.c",
263        "vk_queue.c",
264        "vk_render_pass.c",
265        "vk_sampler.c",
266        "vk_semaphore.c",
267        "vk_standard_sample_locations.c",
268        "vk_sync.c",
269        "vk_sync_binary.c",
270        "vk_sync_dummy.c",
271        "vk_sync_timeline.c",
272        "vk_video.c",
273        "vk_ycbcr_conversion.c",
274        "vk_graphics_state.c",
275    ],
276    export_include_dirs: [
277        ".",
278    ],
279    target: {
280        android: {
281            srcs: select(soong_config_variable("gfxstream", "mesa3d_platforms"), {
282                "none": [],
283                default: [
284                    "vk_android.c",
285                ],
286            }),
287            static_libs: [
288                "mesa_u_gralloc",
289            ],
290            shared_libs: [
291                "libnativewindow",
292                "libsync",
293                "libcutils",
294            ],
295            header_libs: [
296                "hwvulkan_headers",
297                "libnativewindow_headers",
298            ],
299        },
300    },
301}
302