xref: /aosp_15_r20/external/mesa3d/src/broadcom/vulkan/meson.build (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1# Copyright © 2019 Raspberry Pi Ltd
2# SPDX-License-Identifier: MIT
3
4v3dv_entrypoints = custom_target(
5  'v3dv_entrypoints',
6  input : [vk_entrypoints_gen, vk_api_xml],
7  output : ['v3dv_entrypoints.h', 'v3dv_entrypoints.c'],
8  command : [
9    prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
10    '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'v3dv',
11    '--beta', with_vulkan_beta.to_string(),
12    '--device-prefix', 'ver42',
13    '--device-prefix', 'ver71',
14  ],
15  depend_files : vk_entrypoints_gen_depend_files,
16)
17
18libv3dv_files = files(
19  'v3dv_bo.c',
20  'v3dv_cl.c',
21  'v3dv_cmd_buffer.c',
22  'v3dv_debug.h',
23  'v3dv_descriptor_set.c',
24  'v3dv_device.c',
25  'v3dv_event.c',
26  'v3dv_formats.c',
27  'v3dv_image.c',
28  'v3dv_limits.h',
29  'v3dv_meta_clear.c',
30  'v3dv_meta_copy.c',
31  'v3dv_pass.c',
32  'v3dv_pipeline.c',
33  'v3dv_pipeline_cache.c',
34  'v3dv_private.h',
35  'v3dv_query.c',
36  'v3dv_queue.c',
37  'v3dv_uniforms.c',
38  'v3dv_wsi.c',
39) + [v3d_xml_pack]
40
41files_per_version = files(
42  'v3dvx_cmd_buffer.c',
43  'v3dvx_descriptor_set.c',
44  'v3dvx_device.c',
45  'v3dvx_formats.c',
46  'v3dvx_image.c',
47  'v3dvx_pipeline.c',
48  'v3dvx_meta_common.c',
49  'v3dvx_pipeline.c',
50  'v3dvx_query.c',
51  'v3dvx_queue.c',
52)
53
54v3d_versions = ['42', '71']
55
56v3dv_flags = [v3d_simulator_arg]
57
58v3dv_deps = [
59  dep_dl,
60  dep_libdrm,
61  dep_valgrind,
62  dep_v3d_hw,
63  idep_nir,
64  idep_nir_headers,
65  idep_vulkan_util,
66  idep_vulkan_runtime,
67  idep_vulkan_wsi,
68  idep_mesautil,
69]
70
71if with_platform_x11
72  v3dv_deps += dep_xcb_dri3
73endif
74
75if with_platform_wayland
76  v3dv_deps += dep_wayland_client
77  libv3dv_files += [wayland_drm_client_protocol_h, wayland_drm_protocol_c]
78endif
79
80if with_platform_android
81  v3dv_deps += [dep_android, idep_u_gralloc]
82  v3dv_flags += '-DVK_USE_PLATFORM_ANDROID_KHR'
83  libv3dv_files += files('v3dv_android.c')
84endif
85
86per_version_libs = []
87foreach ver : v3d_versions
88  per_version_libs += static_library(
89    'v3dv-v' + ver,
90    [files_per_version, v3d_xml_pack, v3dv_entrypoints[0]],
91    include_directories : [
92      inc_src, inc_include, inc_broadcom,
93      inc_util,
94    ],
95    c_args : [v3dv_flags, '-DV3D_VERSION=' + ver],
96    gnu_symbol_visibility : 'hidden',
97    dependencies : [v3dv_deps],
98)
99endforeach
100
101libvulkan_broadcom = shared_library(
102  'vulkan_broadcom',
103  [libv3dv_files, v3dv_entrypoints, sha1_h],
104  include_directories : [
105    inc_include, inc_src, inc_broadcom, inc_util,
106  ],
107  link_with : [
108    libbroadcom_cle,
109    libbroadcom_v3d,
110    per_version_libs,
111  ],
112  dependencies : v3dv_deps,
113  c_args : v3dv_flags,
114  link_args : [vulkan_icd_link_args, '-Wl,--build-id=sha1', ld_args_bsymbolic, ld_args_gc_sections],
115  link_depends : vulkan_icd_link_depends,
116  gnu_symbol_visibility : 'hidden',
117  install : true,
118)
119
120if with_symbols_check
121  test(
122    'v3dv symbols check',
123    symbols_check,
124    args : [
125      '--lib', libvulkan_broadcom,
126      '--symbols-file', vulkan_icd_symbols,
127      symbols_check_args,
128    ],
129    suite : ['broadcom'],
130  )
131endif
132
133broadcom_icd = custom_target(
134  'broadcom_icd',
135  input : [vk_icd_gen, vk_api_xml],
136  output : 'broadcom_icd.@[email protected]'.format(host_machine.cpu()),
137  command : [
138    prog_python, '@INPUT0@',
139    '--api-version', '1.3', '--xml', '@INPUT1@',
140    '--lib-path', join_paths(get_option('prefix'), get_option('libdir'),
141    		  	     'libvulkan_broadcom.so'),
142    '--out', '@OUTPUT@',
143  ],
144  build_by_default : true,
145  install_dir : with_vulkan_icd_dir,
146  install_tag : 'runtime',
147  install : true,
148)
149
150_dev_icdname = 'broadcom_devenv_icd.@[email protected]'.format(host_machine.cpu())
151_dev_icd = custom_target(
152  'broadcom_devenv_icd',
153  input : [vk_icd_gen, vk_api_xml],
154  output : _dev_icdname,
155  command : [
156    prog_python, '@INPUT0@',
157    '--api-version', '1.3', '--xml', '@INPUT1@',
158    '--lib-path', meson.current_build_dir() / 'libvulkan_broadcom.so',
159    '--out', '@OUTPUT@',
160  ],
161  build_by_default : true,
162)
163
164devenv.append('VK_DRIVER_FILES', _dev_icd.full_path())
165# Deprecated: replaced by VK_DRIVER_FILES above
166devenv.append('VK_ICD_FILENAMES', _dev_icd.full_path())
167