xref: /aosp_15_r20/external/mesa3d/src/nouveau/vulkan/meson.build (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1# Copyright © 2022 Collabora Ltd. and Red Hat Inc.
2# SPDX-License-Identifier: MIT
3nvk_files = files(
4  '../../gallium/auxiliary/tgsi/tgsi_from_mesa.c',
5  'nvk_acceleration_structure.c',
6  'nvk_buffer.c',
7  'nvk_buffer.h',
8  'nvk_buffer_view.c',
9  'nvk_buffer_view.h',
10  'nvk_cmd_buffer.c',
11  'nvk_cmd_buffer.h',
12  'nvk_cmd_clear.c',
13  'nvk_cmd_copy.c',
14  'nvk_cmd_dispatch.c',
15  'nvk_cmd_draw.c',
16  'nvk_cmd_meta.c',
17  'nvk_cmd_pool.c',
18  'nvk_cmd_pool.h',
19  'nvk_codegen.c',
20  'nvk_debug.h',
21  'nvk_descriptor_set.h',
22  'nvk_descriptor_set.c',
23  'nvk_descriptor_set_layout.c',
24  'nvk_descriptor_set_layout.h',
25  'nvk_descriptor_table.c',
26  'nvk_descriptor_table.h',
27  'nvk_descriptor_types.h',
28  'nvk_device.c',
29  'nvk_device.h',
30  'nvk_device_memory.c',
31  'nvk_device_memory.h',
32  'nvk_edb_bview_cache.c',
33  'nvk_edb_bview_cache.h',
34  'nvk_event.c',
35  'nvk_event.h',
36  'nvk_format.c',
37  'nvk_format.h',
38  'nvk_heap.c',
39  'nvk_heap.h',
40  'nvk_image.c',
41  'nvk_image.h',
42  'nvk_image_view.c',
43  'nvk_image_view.h',
44  'nvk_instance.c',
45  'nvk_instance.h',
46  'nvk_mme.c',
47  'nvk_mme.h',
48  'nvk_nir_lower_descriptors.c',
49  'nvk_physical_device.c',
50  'nvk_physical_device.h',
51  'nvk_private.h',
52  'nvk_query_pool.c',
53  'nvk_query_pool.h',
54  'nvk_queue.c',
55  'nvk_queue.h',
56  'nvk_sampler.c',
57  'nvk_sampler.h',
58  'nvk_shader.c',
59  'nvk_shader.h',
60  'nvk_upload_queue.c',
61  'nvk_upload_queue.h',
62  'nvk_wsi.c',
63  'nvk_wsi.h',
64  'nvkmd/nouveau/nvkmd_nouveau.h',
65  'nvkmd/nouveau/nvkmd_nouveau_ctx.c',
66  'nvkmd/nouveau/nvkmd_nouveau_dev.c',
67  'nvkmd/nouveau/nvkmd_nouveau_mem.c',
68  'nvkmd/nouveau/nvkmd_nouveau_pdev.c',
69  'nvkmd/nouveau/nvkmd_nouveau_va.c',
70  'nvkmd/nvkmd.c',
71  'nvkmd/nvkmd.h',
72)
73
74nvk_entrypoints = custom_target(
75  'nvk_entrypoints',
76  input : [vk_entrypoints_gen, vk_api_xml],
77  output : ['nvk_entrypoints.h', 'nvk_entrypoints.c'],
78  command : [
79    prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
80    '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'nvk',
81    '--beta', with_vulkan_beta.to_string(),
82  ],
83  depend_files : vk_entrypoints_gen_depend_files,
84)
85
86nvk_deps = [
87  dep_libdrm,
88  idep_nak,
89  idep_nil,
90  idep_nir,
91  idep_mesautil,
92  idep_nouveau_mme,
93  idep_nouveau_ws,
94  idep_nvidia_headers,
95  idep_vulkan_runtime,
96  idep_vulkan_util,
97  idep_vulkan_wsi,
98  idep_vulkan_wsi_headers,
99]
100
101libnvk = static_library(
102  'nvk',
103  [
104    nvk_entrypoints,
105    cl_generated,
106    nvk_files,
107    sha1_h,
108  ],
109  include_directories : [
110    inc_gallium,
111    inc_gallium_aux,
112    inc_include,
113    inc_src,
114  ],
115  link_with : [libnouveau_codegen],
116  dependencies : [nvk_deps, idep_nouveau_codegen],
117  gnu_symbol_visibility : 'hidden',
118)
119
120libvulkan_nouveau = shared_library(
121  'vulkan_nouveau',
122  link_whole : [libnvk],
123  link_args: [ld_args_build_id],
124  gnu_symbol_visibility : 'hidden',
125  install : true,
126)
127
128icd_lib_path = join_paths(get_option('prefix'), get_option('libdir'))
129icd_file_name = 'libvulkan_nouveau.so'
130if with_platform_windows
131  icd_lib_path = import('fs').relative_to(get_option('bindir'), with_vulkan_icd_dir)
132  icd_file_name = 'vulkan_nouveau.dll'
133endif
134
135nouveau_icd = custom_target(
136  'nouveau_icd',
137  input : [vk_icd_gen, vk_api_xml],
138  output : 'nouveau_icd.@[email protected]'.format(host_machine.cpu()),
139  command : [
140    prog_python, '@INPUT0@',
141    '--api-version', '1.3', '--xml', '@INPUT1@',
142    '--lib-path', join_paths(icd_lib_path, icd_file_name),
143    '--out', '@OUTPUT@',
144  ],
145  build_by_default : true,
146  install_dir : with_vulkan_icd_dir,
147  install_tag : 'runtime',
148  install : true,
149)
150
151_dev_icdname = 'nouveau_devenv_icd.@[email protected]'.format(host_machine.cpu())
152custom_target(
153  'nouveau_devenv_icd',
154  input : [vk_icd_gen, vk_api_xml],
155  output : _dev_icdname,
156  command : [
157    prog_python, '@INPUT0@',
158    '--api-version', '1.3', '--xml', '@INPUT1@',
159    '--lib-path', meson.current_build_dir() / icd_file_name,
160    '--out', '@OUTPUT@',
161  ],
162  build_by_default : true,
163)
164
165devenv.append('VK_DRIVER_FILES', meson.current_build_dir() / _dev_icdname)
166# Deprecated: replaced by VK_DRIVER_FILES above
167devenv.append('VK_ICD_FILENAMES', meson.current_build_dir() / _dev_icdname)
168
169if with_tests and not with_platform_android
170  test(
171    'nvk_mme',
172    executable(
173      'test_nvk_mme',
174      files('test_nvk_mme.c'),
175      dependencies : [nvk_deps],
176      link_with : [libnvk],
177    )
178  )
179endif
180