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_indirect.c', 17 'nvk_cmd_meta.c', 18 'nvk_cmd_pool.c', 19 'nvk_cmd_pool.h', 20 'nvk_codegen.c', 21 'nvk_debug.h', 22 'nvk_descriptor_set.h', 23 'nvk_descriptor_set.c', 24 'nvk_descriptor_set_layout.c', 25 'nvk_descriptor_set_layout.h', 26 'nvk_descriptor_table.c', 27 'nvk_descriptor_table.h', 28 'nvk_descriptor_types.h', 29 'nvk_device.c', 30 'nvk_device.h', 31 'nvk_device_memory.c', 32 'nvk_device_memory.h', 33 'nvk_edb_bview_cache.c', 34 'nvk_edb_bview_cache.h', 35 'nvk_event.c', 36 'nvk_event.h', 37 'nvk_format.c', 38 'nvk_format.h', 39 'nvk_heap.c', 40 'nvk_heap.h', 41 'nvk_host_copy.c', 42 'nvk_image.c', 43 'nvk_image.h', 44 'nvk_image_view.c', 45 'nvk_image_view.h', 46 'nvk_indirect_execution_set.c', 47 'nvk_indirect_execution_set.h', 48 'nvk_instance.c', 49 'nvk_instance.h', 50 'nvk_mme.c', 51 'nvk_mme.h', 52 'nvk_nir_lower_descriptors.c', 53 'nvk_physical_device.c', 54 'nvk_physical_device.h', 55 'nvk_private.h', 56 'nvk_query_pool.c', 57 'nvk_query_pool.h', 58 'nvk_queue.c', 59 'nvk_queue.h', 60 'nvk_sampler.c', 61 'nvk_sampler.h', 62 'nvk_shader.c', 63 'nvk_shader.h', 64 'nvk_upload_queue.c', 65 'nvk_upload_queue.h', 66 'nvk_wsi.c', 67 'nvk_wsi.h', 68 'nvkmd/nouveau/nvkmd_nouveau.h', 69 'nvkmd/nouveau/nvkmd_nouveau_ctx.c', 70 'nvkmd/nouveau/nvkmd_nouveau_dev.c', 71 'nvkmd/nouveau/nvkmd_nouveau_mem.c', 72 'nvkmd/nouveau/nvkmd_nouveau_pdev.c', 73 'nvkmd/nouveau/nvkmd_nouveau_va.c', 74 'nvkmd/nvkmd.c', 75 'nvkmd/nvkmd.h', 76) 77 78nvk_entrypoints = custom_target( 79 'nvk_entrypoints', 80 input : [vk_entrypoints_gen, vk_api_xml], 81 output : ['nvk_entrypoints.h', 'nvk_entrypoints.c'], 82 command : [ 83 prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak', 84 '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'nvk', 85 '--beta', with_vulkan_beta.to_string(), 86 ], 87 depend_files : vk_entrypoints_gen_depend_files, 88) 89 90nvk_deps = [ 91 dep_libdrm, 92 idep_nak, 93 idep_nil, 94 idep_nir, 95 idep_mesautil, 96 idep_nouveau_mme, 97 idep_nouveau_ws, 98 idep_nvidia_headers, 99 idep_vulkan_runtime, 100 idep_vulkan_util, 101 idep_vulkan_wsi, 102 idep_vulkan_wsi_headers, 103] 104 105nvk_flags = [] 106 107if with_platform_android 108 nvk_deps += [dep_android, idep_u_gralloc] 109 nvk_flags += '-DVK_USE_PLATFORM_ANDROID_KHR' 110 nvk_files += files('nvk_android.c') 111endif 112 113libnvk = static_library( 114 'nvk', 115 [ 116 nvk_entrypoints, 117 cl_generated, 118 nvk_files, 119 sha1_h, 120 ], 121 include_directories : [ 122 inc_gallium, 123 inc_gallium_aux, 124 inc_include, 125 inc_src, 126 ], 127 link_with : [libnouveau_codegen], 128 dependencies : [nvk_deps, idep_nouveau_codegen], 129 c_args : [no_override_init_args, nvk_flags], 130 gnu_symbol_visibility : 'hidden', 131) 132 133libvulkan_nouveau = shared_library( 134 'vulkan_nouveau', 135 link_whole : [libnvk], 136 link_args: [ld_args_build_id, ld_args_bsymbolic, ld_args_gc_sections], 137 gnu_symbol_visibility : 'hidden', 138 install : true, 139) 140 141icd_lib_path = join_paths(get_option('prefix'), get_option('libdir')) 142icd_file_name = 'libvulkan_nouveau.so' 143if with_platform_windows 144 icd_lib_path = import('fs').relative_to(get_option('bindir'), with_vulkan_icd_dir) 145 icd_file_name = 'vulkan_nouveau.dll' 146endif 147 148nouveau_icd = custom_target( 149 'nouveau_icd', 150 input : [vk_icd_gen, vk_api_xml], 151 output : 'nouveau_icd.@0@.json'.format(host_machine.cpu()), 152 command : [ 153 prog_python, '@INPUT0@', 154 '--api-version', '1.4', '--xml', '@INPUT1@', 155 '--lib-path', join_paths(icd_lib_path, icd_file_name), 156 '--out', '@OUTPUT@', 157 ], 158 build_by_default : true, 159 install_dir : with_vulkan_icd_dir, 160 install_tag : 'runtime', 161 install : true, 162) 163 164_dev_icdname = 'nouveau_devenv_icd.@0@.json'.format(host_machine.cpu()) 165custom_target( 166 'nouveau_devenv_icd', 167 input : [vk_icd_gen, vk_api_xml], 168 output : _dev_icdname, 169 command : [ 170 prog_python, '@INPUT0@', 171 '--api-version', '1.4', '--xml', '@INPUT1@', 172 '--lib-path', meson.current_build_dir() / icd_file_name, 173 '--out', '@OUTPUT@', 174 ], 175 build_by_default : true, 176) 177 178devenv.append('VK_DRIVER_FILES', meson.current_build_dir() / _dev_icdname) 179# Deprecated: replaced by VK_DRIVER_FILES above 180devenv.append('VK_ICD_FILENAMES', meson.current_build_dir() / _dev_icdname) 181 182if with_tests and not with_platform_android 183 test( 184 'nvk_mme', 185 executable( 186 'test_nvk_mme', 187 files('test_nvk_mme.c'), 188 dependencies : [nvk_deps], 189 link_with : [libnvk], 190 ) 191 ) 192endif 193