1# Copyright © 2017 Intel Corporation 2 3# Permission is hereby granted, free of charge, to any person obtaining a copy 4# of this software and associated documentation files (the "Software"), to deal 5# in the Software without restriction, including without limitation the rights 6# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7# copies of the Software, and to permit persons to whom the Software is 8# furnished to do so, subject to the following conditions: 9 10# The above copyright notice and this permission notice shall be included in 11# all copies or substantial portions of the Software. 12 13# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19# SOFTWARE. 20 21# Mesa-local imports in the Python files must be declared here for correct 22# dependency tracking. 23 24vulkan_runtime_files = files( 25 'rmv/vk_rmv_common.c', 26 'rmv/vk_rmv_common.h', 27 'rmv/vk_rmv_exporter.c', 28 'rmv/vk_rmv_tokens.h', 29 'vk_acceleration_structure.c', 30 'vk_acceleration_structure.h', 31 'vk_blend.c', 32 'vk_blend.h', 33 'vk_buffer.c', 34 'vk_buffer.h', 35 'vk_buffer_view.c', 36 'vk_buffer_view.h', 37 'vk_cmd_copy.c', 38 'vk_cmd_enqueue.c', 39 'vk_command_buffer.c', 40 'vk_command_buffer.h', 41 'vk_command_pool.c', 42 'vk_command_pool.h', 43 'vk_debug_report.c', 44 'vk_debug_report.h', 45 'vk_debug_utils.c', 46 'vk_debug_utils.h', 47 'vk_deferred_operation.c', 48 'vk_deferred_operation.h', 49 'vk_descriptor_set_layout.c', 50 'vk_descriptor_set_layout.h', 51 'vk_descriptors.c', 52 'vk_descriptors.h', 53 'vk_descriptor_update_template.c', 54 'vk_descriptor_update_template.h', 55 'vk_device.c', 56 'vk_device.h', 57 'vk_device_memory.c', 58 'vk_device_memory.h', 59 'vk_fence.c', 60 'vk_fence.h', 61 'vk_framebuffer.c', 62 'vk_framebuffer.h', 63 'vk_graphics_state.c', 64 'vk_graphics_state.h', 65 'vk_image.c', 66 'vk_image.h', 67 'vk_instance.c', 68 'vk_instance.h', 69 'vk_log.c', 70 'vk_log.h', 71 'vk_object.c', 72 'vk_object.h', 73 'vk_physical_device.c', 74 'vk_physical_device.h', 75 'vk_pipeline_layout.c', 76 'vk_pipeline_layout.h', 77 'vk_query_pool.c', 78 'vk_query_pool.h', 79 'vk_queue.c', 80 'vk_queue.h', 81 'vk_render_pass.c', 82 'vk_sampler.c', 83 'vk_sampler.h', 84 'vk_semaphore.c', 85 'vk_semaphore.h', 86 'vk_standard_sample_locations.c', 87 'vk_standard_sample_locations.h', 88 'vk_sync.c', 89 'vk_sync.h', 90 'vk_sync_binary.c', 91 'vk_sync_binary.h', 92 'vk_sync_dummy.c', 93 'vk_sync_dummy.h', 94 'vk_sync_timeline.c', 95 'vk_sync_timeline.h', 96 'vk_synchronization2.c', 97 'vk_video.c', 98 'vk_video.h', 99 'vk_ycbcr_conversion.c', 100 'vk_ycbcr_conversion.h', 101) 102 103vulkan_runtime_deps = [ 104 vulkan_wsi_deps, 105 idep_mesautil, 106 idep_vulkan_util, 107] 108 109vulkan_nir_files = files( 110 'vk_meta.c', 111 'vk_meta.h', 112 'vk_meta_blit_resolve.c', 113 'vk_meta_draw_rects.c', 114 'vk_meta_clear.c', 115 'vk_nir.c', 116 'vk_nir.h', 117 'vk_nir_convert_ycbcr.c', 118 'vk_nir_convert_ycbcr.h', 119 'vk_pipeline.c', 120 'vk_pipeline.h', 121 'vk_pipeline_cache.c', 122 'vk_pipeline_cache.h', 123 'vk_shader_module.c', 124 'vk_shader_module.h', 125) 126 127vulkan_runtime_args = [] 128vulkan_runtime_link_args = [] 129inc_vulkan_runtime = [inc_include, inc_src] 130if with_vk_no_nir 131 vulkan_runtime_args += '-DVK_NO_NIR' 132else 133 vulkan_runtime_deps += idep_vtn 134 vulkan_runtime_deps += idep_nir 135 vulkan_runtime_link_args += libcompiler 136 vulkan_runtime_files += vulkan_nir_files 137 inc_vulkan_runtime += inc_gallium 138endif 139 140if dep_libdrm.found() 141 vulkan_runtime_files += files('vk_drm_syncobj.c', 'vk_drm_syncobj.h') 142 vulkan_runtime_deps += dep_libdrm 143endif 144 145if with_platform_android 146 vulkan_runtime_files += files('vk_android.c', 'vk_android.h') 147 vulkan_runtime_deps += dep_android 148endif 149 150vk_common_entrypoints = custom_target( 151 'vk_common_entrypoints', 152 input : [vk_entrypoints_gen, vk_api_xml], 153 output : ['vk_common_entrypoints.h', 'vk_common_entrypoints.c'], 154 command : [ 155 prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak', 156 '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'vk_common', 157 '--beta', with_vulkan_beta.to_string() 158 ], 159 depend_files : vk_entrypoints_gen_depend_files, 160) 161 162vk_cmd_queue = custom_target( 163 'vk_cmd_queue', 164 input : [vk_cmd_queue_gen, vk_api_xml], 165 output : ['vk_cmd_queue.c', 'vk_cmd_queue.h'], 166 command : [ 167 prog_python, '@INPUT0@', '--xml', '@INPUT1@', 168 '--out-c', '@OUTPUT0@', '--out-h', '@OUTPUT1@', 169 '--beta', with_vulkan_beta.to_string() 170 ], 171 depend_files : vk_cmd_queue_gen_depend_files, 172) 173 174vk_cmd_enqueue_entrypoints = custom_target( 175 'vk_cmd_enqueue_entrypoints', 176 input : [vk_entrypoints_gen, vk_api_xml], 177 output : ['vk_cmd_enqueue_entrypoints.h', 'vk_cmd_enqueue_entrypoints.c'], 178 command : [ 179 prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak', 180 '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', 181 '--prefix', 'vk_cmd_enqueue', '--prefix', 'vk_cmd_enqueue_unless_primary', 182 '--beta', with_vulkan_beta.to_string() 183 ], 184 depend_files : vk_entrypoints_gen_depend_files, 185) 186 187vk_dispatch_trampolines = custom_target( 188 'vk_dispatch_trampolines', 189 input : [vk_dispatch_trampolines_gen, vk_api_xml], 190 output : ['vk_dispatch_trampolines.c', 'vk_dispatch_trampolines.h'], 191 command : [ 192 prog_python, '@INPUT0@', '--xml', '@INPUT1@', 193 '--out-c', '@OUTPUT0@', '--out-h', '@OUTPUT1@', 194 '--beta', with_vulkan_beta.to_string() 195 ], 196 depend_files : vk_dispatch_trampolines_gen_depend_files, 197) 198 199vk_physical_device_features = custom_target( 200 'vk_physical_device_features', 201 input : [vk_physical_device_features_gen, vk_api_xml], 202 output : ['vk_physical_device_features.c', 'vk_physical_device_features.h'], 203 command : [ 204 prog_python, '@INPUT0@', '--xml', '@INPUT1@', 205 '--out-c', '@OUTPUT0@', '--out-h', '@OUTPUT1@', 206 '--beta', with_vulkan_beta.to_string() 207 ], 208 depend_files : vk_physical_device_features_gen_depend_files, 209) 210 211vk_physical_device_properties = custom_target( 212 'vk_physical_device_properties', 213 input : [vk_physical_device_properties_gen, vk_api_xml], 214 output : ['vk_physical_device_properties.c', 'vk_physical_device_properties.h'], 215 command : [ 216 prog_python, '@INPUT0@', '--xml', '@INPUT1@', 217 '--out-c', '@OUTPUT0@', '--out-h', '@OUTPUT1@', 218 '--beta', with_vulkan_beta.to_string() 219 ], 220 depend_files : vk_physical_device_properties_gen_depend_files, 221) 222 223vk_format_info = custom_target( 224 'vk_format_info', 225 input : ['vk_format_info_gen.py', vk_api_xml], 226 output : ['vk_format_info.c', 'vk_format_info.h'], 227 command : [ 228 prog_python, '@INPUT0@', '--xml', '@INPUT1@', 229 '--out-c', '@OUTPUT0@', '--out-h', '@OUTPUT1@' 230 ], 231) 232 233libvulkan_runtime = static_library( 234 'vulkan_runtime', 235 [vulkan_runtime_files, vk_common_entrypoints, 236 vk_cmd_queue, vk_cmd_enqueue_entrypoints, 237 vk_dispatch_trampolines, vk_physical_device_features, 238 vk_physical_device_properties, vk_format_info], 239 include_directories : inc_vulkan_runtime, 240 dependencies : vulkan_runtime_deps, 241 # For glsl_type_singleton 242 link_with : vulkan_runtime_link_args, 243 c_args : [c_msvc_compat_args, vulkan_runtime_args], 244 gnu_symbol_visibility : 'hidden', 245 build_by_default : false, 246) 247 248idep_vulkan_runtime_headers = declare_dependency( 249 sources : [vk_cmd_queue[1], vk_physical_device_features[1], vk_physical_device_properties[1]], 250 include_directories : include_directories('.'), 251) 252 253idep_vulkan_common_entrypoints_h = declare_dependency( 254 sources : [vk_common_entrypoints[0]] 255) 256 257# This is likely a bug in the Meson VS backend, as MSVC with ninja works fine. 258# See this discussion here: 259# https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10506 260if get_option('backend').startswith('vs') 261 idep_vulkan_runtime = declare_dependency( 262 link_with : libvulkan_runtime, 263 dependencies : idep_vulkan_runtime_headers 264 ) 265else 266 idep_vulkan_runtime = declare_dependency( 267 # Instruct users of this library to link with --whole-archive. Otherwise, 268 # our weak function overloads may not resolve properly. 269 link_whole : libvulkan_runtime, 270 dependencies : idep_vulkan_runtime_headers 271 ) 272endif 273