xref: /aosp_15_r20/external/mesa3d/src/virtio/vulkan/meson.build (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1# Copyright 2019 Google LLC
2# SPDX-License-Identifier: MIT
3#
4# based in part on anv and radv which are:
5# Copyright © 2017 Intel Corporation
6
7vn_entrypoints = custom_target(
8  'vn_entrypoints',
9  input : [vk_entrypoints_gen, vk_api_xml],
10  output : ['vn_entrypoints.h', 'vn_entrypoints.c'],
11  command : [
12    prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
13    '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'vn',
14    '--beta', with_vulkan_beta.to_string()
15  ],
16)
17
18virtio_icd = custom_target(
19  'virtio_icd',
20  input : [vk_icd_gen, vk_api_xml],
21  output : 'virtio_icd.@[email protected]'.format(host_machine.cpu()),
22  command : [
23    prog_python, '@INPUT0@',
24    '--api-version', '1.3', '--xml', '@INPUT1@',
25    '--lib-path', join_paths(get_option('prefix'), get_option('libdir'),
26                             'libvulkan_virtio.so'),
27    '--out', '@OUTPUT@',
28  ],
29  build_by_default : true,
30  install_dir : with_vulkan_icd_dir,
31  install_tag : 'runtime',
32  install : true,
33)
34
35_dev_icdname = 'virtio_devenv_icd.@[email protected]'.format(host_machine.cpu())
36_dev_icd = custom_target(
37  'virtio_devenv_icd',
38  input : [vk_icd_gen, vk_api_xml],
39  output : _dev_icdname,
40  command : [
41    prog_python, '@INPUT0@',
42    '--api-version', '1.3', '--xml', '@INPUT1@',
43    '--lib-path', meson.current_build_dir() / 'libvulkan_virtio.so',
44    '--out', '@OUTPUT@',
45  ],
46  build_by_default : true,
47)
48
49devenv.append('VK_DRIVER_FILES', _dev_icd.full_path())
50# Deprecated: replaced by VK_DRIVER_FILES above
51devenv.append('VK_ICD_FILENAMES', _dev_icd.full_path())
52
53libvn_files = files(
54  'vn_buffer.c',
55  'vn_command_buffer.c',
56  'vn_common.c',
57  'vn_cs.c',
58  'vn_descriptor_set.c',
59  'vn_device.c',
60  'vn_device_memory.c',
61  'vn_feedback.c',
62  'vn_icd.c',
63  'vn_image.c',
64  'vn_instance.c',
65  'vn_physical_device.c',
66  'vn_pipeline.c',
67  'vn_query_pool.c',
68  'vn_queue.c',
69  'vn_render_pass.c',
70  'vn_ring.c',
71  'vn_renderer_internal.c',
72  'vn_renderer_util.c',
73  'vn_renderer_virtgpu.c',
74  'vn_renderer_vtest.c',
75)
76
77vn_deps = [
78  dep_libdrm,
79  dep_thread,
80  idep_mesautil,
81  idep_vulkan_util,
82  idep_vulkan_lite_runtime,
83  idep_vulkan_wsi,
84  idep_xmlconfig,
85]
86
87vn_flags = [
88  no_override_init_args,
89] + cc.get_supported_arguments([
90  '-Werror=switch',
91])
92
93vn_libs = []
94
95if with_platform_wayland or with_platform_x11
96  libvn_files += files('vn_wsi.c')
97  vn_flags += '-DVN_USE_WSI_PLATFORM'
98endif
99
100if with_platform_wayland
101  vn_deps += dep_wayland_client
102endif
103
104if with_platform_x11
105  vn_deps += dep_xcb_dri3
106endif
107
108if with_platform_android
109  libvn_files += files('vn_android.c')
110  vn_deps += [dep_android, idep_u_gralloc]
111endif
112
113libvulkan_virtio = shared_library(
114  'vulkan_virtio',
115  [libvn_files, vn_entrypoints, sha1_h],
116  include_directories : [
117    inc_include, inc_src, inc_virtio,
118  ],
119  link_with : vn_libs,
120  dependencies : [vn_deps],
121  c_args : [vn_flags],
122  link_args : [vulkan_icd_link_args, ld_args_bsymbolic, ld_args_gc_sections],
123  link_depends : vulkan_icd_link_depends,
124  gnu_symbol_visibility : 'hidden',
125  install : true,
126)
127