xref: /aosp_15_r20/external/mesa3d/src/asahi/vulkan/meson.build (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1# Copyright © 2022 Collabora Ltd. and Red Hat Inc.
2# SPDX-License-Identifier: MIT
3hk_files = files(
4  'hk_buffer.c',
5  'hk_buffer.h',
6  'hk_buffer_view.c',
7  'hk_buffer_view.h',
8  'hk_cmd_buffer.c',
9  'hk_cmd_buffer.h',
10  'hk_cmd_clear.c',
11  'hk_cmd_dispatch.c',
12  'hk_cmd_draw.c',
13  'hk_cmd_meta.c',
14  'hk_cmd_pool.c',
15  'hk_cmd_pool.h',
16  'hk_descriptor_set.h',
17  'hk_descriptor_set.c',
18  'hk_descriptor_set_layout.c',
19  'hk_descriptor_set_layout.h',
20  'hk_descriptor_table.c',
21  'hk_descriptor_table.h',
22  'hk_device.c',
23  'hk_device.h',
24  'hk_device_memory.c',
25  'hk_device_memory.h',
26  'hk_event.c',
27  'hk_event.h',
28  'hk_format.c',
29  'hk_image.c',
30  'hk_image.h',
31  'hk_image_view.c',
32  'hk_image_view.h',
33  'hk_instance.c',
34  'hk_instance.h',
35  'hk_nir_lower_descriptors.c',
36  'hk_nir_passthrough_gs.c',
37  'hk_physical_device.c',
38  'hk_physical_device.h',
39  'hk_private.h',
40  'hk_query_pool.c',
41  'hk_query_pool.h',
42  'hk_queue.c',
43  'hk_queue.h',
44  'hk_sampler.c',
45  'hk_sampler.h',
46  'hk_shader.c',
47  'hk_shader.h',
48  'hk_wsi.c',
49  'hk_wsi.h'
50)
51
52hk_entrypoints = custom_target(
53  'hk_entrypoints',
54  input : [vk_entrypoints_gen, vk_api_xml],
55  output : ['hk_entrypoints.h', 'hk_entrypoints.c'],
56  command : [
57    prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
58    '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'hk',
59    '--beta', with_vulkan_beta.to_string(),
60  ],
61  depend_files : vk_entrypoints_gen_depend_files,
62)
63
64hk_deps = [
65  dep_libdrm,
66  idep_nir,
67  idep_vulkan_runtime,
68  idep_vulkan_util,
69  idep_vulkan_wsi,
70  idep_vulkan_wsi_headers,
71  idep_agx_pack,
72]
73
74libhk = static_library(
75  'hk',
76  [
77    hk_entrypoints,
78    hk_files,
79    libagx_shaders,
80    sha1_h,
81  ],
82  include_directories : [
83    inc_gallium,
84    inc_gallium_aux,
85    inc_include,
86    inc_src,
87    inc_asahi,
88  ],
89  link_with : [libasahi_lib, libasahi_layout, libasahi_compiler],
90  c_args : ['-Wno-c2x-extensions'],
91  dependencies : [hk_deps],
92  gnu_symbol_visibility : 'hidden',
93)
94
95libvulkan_asahi = shared_library(
96  'vulkan_asahi',
97  link_whole : [libhk],
98  link_args: [ld_args_build_id],
99  gnu_symbol_visibility : 'hidden',
100  install : true,
101)
102
103icd_lib_path = join_paths(get_option('prefix'), get_option('libdir'))
104icd_file_name = 'libvulkan_asahi.so'
105if with_platform_windows
106  icd_lib_path = import('fs').relative_to(get_option('bindir'), with_vulkan_icd_dir)
107  icd_file_name = 'vulkan_asahi.dll'
108endif
109
110asahi_icd = custom_target(
111  'asahi_icd',
112  input : [vk_icd_gen, vk_api_xml],
113  output : 'asahi_icd.@[email protected]'.format(host_machine.cpu()),
114  command : [
115    prog_python, '@INPUT0@',
116    '--api-version', '1.3', '--xml', '@INPUT1@',
117    '--lib-path', join_paths(icd_lib_path, icd_file_name),
118    '--out', '@OUTPUT@',
119  ],
120  build_by_default : true,
121  install_dir : with_vulkan_icd_dir,
122  install_tag : 'runtime',
123  install : true,
124)
125
126_dev_icdname = 'asahi_devenv_icd.@[email protected]'.format(host_machine.cpu())
127custom_target(
128  'asahi_devenv_icd',
129  input : [vk_icd_gen, vk_api_xml],
130  output : _dev_icdname,
131  command : [
132    prog_python, '@INPUT0@',
133    '--api-version', '1.3', '--xml', '@INPUT1@',
134    '--lib-path', meson.current_build_dir() / icd_file_name,
135    '--out', '@OUTPUT@',
136  ],
137  build_by_default : true,
138)
139
140devenv.append('VK_DRIVER_FILES', meson.current_build_dir() / _dev_icdname)
141# Deprecated: replaced by VK_DRIVER_FILES above
142devenv.append('VK_ICD_FILENAMES', meson.current_build_dir() / _dev_icdname)
143