| 1 |
# Copyright 2025 LunarG, Inc. |
| 2 |
# Copyright 2025 Google LLC |
| 3 |
# SPDX-License-Identifier: MIT |
| 4 |
|
| 5 |
kk_device_dispatch_table_dependencies = declare_dependency( |
| 6 |
sources : [ |
| 7 |
kk_dispatch_trampolines[1], |
| 8 |
], |
| 9 |
) |
| 10 |
|
| 11 |
# Unsure if needed, just making sure we don't royally mess up the dependencies |
| 12 |
kk_device_dispatch_table_dependencies_list = [ |
| 13 |
vulkan_lite_runtime_deps, |
| 14 |
kk_device_dispatch_table_dependencies, |
| 15 |
idep_nir, |
| 16 |
idep_mesautil, |
| 17 |
idep_vulkan_runtime, |
| 18 |
idep_vulkan_util, |
| 19 |
idep_vulkan_wsi, |
| 20 |
idep_vulkan_wsi_headers, |
| 21 |
idep_libkk_shaders_h, |
| 22 |
] |
| 23 |
|
| 24 |
libkk_device_dispatch_table = static_library( |
| 25 |
'kk_device_dispatch_table', |
| 26 |
kk_dispatch_trampolines, |
| 27 |
include_directories : [inc_include, inc_src], |
| 28 |
dependencies : kk_device_dispatch_table_dependencies_list, |
| 29 |
c_args : c_msvc_compat_args, |
| 30 |
gnu_symbol_visibility : 'hidden', |
| 31 |
build_by_default : false, |
| 32 |
) |
| 33 |
|
| 34 |
idep_kk_device_dispatch_table = declare_dependency( |
| 35 |
# Instruct users of this library to link with --whole-archive. Otherwise, |
| 36 |
# our weak function overloads may not resolve properly. |
| 37 |
link_whole : [libkk_device_dispatch_table] |
| 38 |
) |
| 39 |
|
| 40 |
kk_files = files( |
| 41 |
'kk_bo.h', |
| 42 |
'kk_bo.c', |
| 43 |
'kk_buffer_view.h', |
| 44 |
'kk_buffer_view.c', |
| 45 |
'kk_buffer.h', |
| 46 |
'kk_buffer.c', |
| 47 |
'kk_cmd_buffer.h', |
| 48 |
'kk_cmd_buffer.c', |
| 49 |
'kk_cmd_clear.c', |
| 50 |
'kk_cmd_copy.c', |
| 51 |
'kk_cmd_dispatch.c', |
| 52 |
'kk_cmd_draw.c', |
| 53 |
'kk_cmd_meta.c', |
| 54 |
'kk_cmd_pool.h', |
| 55 |
'kk_cmd_pool.c', |
| 56 |
'kk_debug.h', |
| 57 |
'kk_debug.c', |
| 58 |
'kk_descriptor_set_layout.h', |
| 59 |
'kk_descriptor_set_layout.c', |
| 60 |
'kk_descriptor_set.h', |
| 61 |
'kk_descriptor_set.c', |
| 62 |
'kk_device_lib.c', |
| 63 |
'kk_device_memory.h', |
| 64 |
'kk_device_memory.c', |
| 65 |
'kk_device.h', |
| 66 |
'kk_device.c', |
| 67 |
'kk_encoder.h', |
| 68 |
'kk_encoder.c', |
| 69 |
'kk_event.h', |
| 70 |
'kk_event.c', |
| 71 |
'kk_format.h', |
| 72 |
'kk_format.c', |
| 73 |
'kk_image_layout.h', |
| 74 |
'kk_image_layout.c', |
| 75 |
'kk_image_view.h', |
| 76 |
'kk_image_view.c', |
| 77 |
'kk_image.h', |
| 78 |
'kk_image.c', |
| 79 |
'kk_instance.h', |
| 80 |
'kk_instance.c', |
| 81 |
'kk_nir_lower_descriptors.c', |
| 82 |
'kk_nir_lower_multiview.c', |
| 83 |
'kk_nir_lower_textures.c', |
| 84 |
'kk_nir_lower_vbo.h', |
| 85 |
'kk_nir_lower_vbo.c', |
| 86 |
'kk_physical_device.h', |
| 87 |
'kk_physical_device.c', |
| 88 |
'kk_query_pool.h', |
| 89 |
'kk_query_pool.c', |
| 90 |
'kk_query_table.h', |
| 91 |
'kk_query_table.c', |
| 92 |
'kk_queue.h', |
| 93 |
'kk_queue.c', |
| 94 |
'kk_sampler.h', |
| 95 |
'kk_sampler.c', |
| 96 |
'kk_shader.h', |
| 97 |
'kk_shader.c', |
| 98 |
'kk_sync.h', |
| 99 |
'kk_sync.c', |
| 100 |
'kk_wsi.h', |
| 101 |
'kk_wsi.c', |
| 102 |
) |
| 103 |
|
| 104 |
kk_entrypoints = custom_target( |
| 105 |
'kk_entrypoints', |
| 106 |
input : [vk_entrypoints_gen, vk_api_xml], |
| 107 |
output : ['kk_entrypoints.h', 'kk_entrypoints.c'], |
| 108 |
command : [ |
| 109 |
prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak', |
| 110 |
'--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'kk', |
| 111 |
'--beta', with_vulkan_beta.to_string() |
| 112 |
], |
| 113 |
depend_files : vk_entrypoints_gen_depend_files, |
| 114 |
) |
| 115 |
|
| 116 |
relative_dir = fs.relative_to(meson.global_source_root(), meson.global_build_root()) |
| 117 |
|
| 118 |
kk_deps = [ |
| 119 |
idep_nir, |
| 120 |
idep_mesautil, |
| 121 |
idep_vulkan_runtime, |
| 122 |
idep_vulkan_util, |
| 123 |
idep_vulkan_wsi, |
| 124 |
idep_vulkan_wsi_headers, |
| 125 |
kk_device_dispatch_table_dependencies, |
| 126 |
idep_kk_device_dispatch_table, |
| 127 |
idep_msl_to_nir, |
| 128 |
idep_mtl_bridge, |
| 129 |
idep_libkk, |
| 130 |
idep_libkk_shaders_h, |
| 131 |
] |
| 132 |
|
| 133 |
libkk = static_library( |
| 134 |
'kk', |
| 135 |
[ |
| 136 |
kk_files, |
| 137 |
kk_entrypoints, |
| 138 |
sha1_h, |
| 139 |
], |
| 140 |
include_directories : [ |
| 141 |
inc_include, |
| 142 |
inc_src, |
| 143 |
], |
| 144 |
dependencies : [kk_deps], |
| 145 |
gnu_symbol_visibility : 'hidden', |
| 146 |
) |
| 147 |
|
| 148 |
# Happens with macOS ld linker: |
| 149 |
# "-Wl,-undefined,dynamic_lookup" required, otherwise, linker will complain about undefined symbols |
| 150 |
libvulkan_kosmickrisp = shared_library( |
| 151 |
'vulkan_kosmickrisp', |
| 152 |
link_whole: [libkk], |
| 153 |
link_args: [ld_args_build_id, '-Wl,-undefined,dynamic_lookup'], |
| 154 |
gnu_symbol_visibility : 'hidden', |
| 155 |
install : true, |
| 156 |
) |
| 157 |
|
| 158 |
icd_file_name = libname_prefix + 'vulkan_kosmickrisp.' + libname_suffix |
| 159 |
|
| 160 |
kosmickrisp_mesa_icd = custom_target( |
| 161 |
'kosmickrisp_mesa_icd', |
| 162 |
input : [vk_icd_gen, vk_api_xml], |
| 163 |
output : 'kosmickrisp_mesa_icd.' + vulkan_manifest_suffix, |
| 164 |
command : [ |
| 165 |
prog_python, '@INPUT0@', |
| 166 |
'--api-version', '1.3', '--xml', '@INPUT1@', |
| 167 |
'--icd-lib-path', vulkan_icd_lib_path, |
| 168 |
'--icd-filename', icd_file_name, |
| 169 |
'--out', '@OUTPUT@', |
| 170 |
], |
| 171 |
build_by_default : true, |
| 172 |
install_dir : with_vulkan_icd_dir, |
| 173 |
install_tag : 'runtime', |
| 174 |
install : true, |
| 175 |
) |
| 176 |
|
| 177 |
kosmickrisp_icd = custom_target( |
| 178 |
'kosmickrisp_mesa_devenv_icd', |
| 179 |
input : [vk_icd_gen, vk_api_xml], |
| 180 |
output : 'kosmickrisp_mesa_devenv_icd.@[email protected]'.format(host_machine.cpu()), |
| 181 |
command : [ |
| 182 |
prog_python, '@INPUT0@', |
| 183 |
'--api-version', '1.3', '--xml', '@INPUT1@', |
| 184 |
'--icd-lib-path', meson.current_build_dir(), |
| 185 |
'--icd-filename', icd_file_name, |
| 186 |
'--out', '@OUTPUT@', |
| 187 |
], |
| 188 |
build_by_default : true, |
| 189 |
) |
| 190 |
|
| 191 |
devenv.append('VK_DRIVER_FILES', kosmickrisp_icd.full_path()) |