• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_image.c',
64  'vk_image.h',
65  'vk_instance.c',
66  'vk_instance.h',
67  'vk_log.c',
68  'vk_log.h',
69  'vk_meta_object_list.c',
70  'vk_meta_object_list.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_synchronization.c',
97  'vk_synchronization.h',
98  'vk_video.c',
99  'vk_video.h',
100  'vk_ycbcr_conversion.c',
101  'vk_ycbcr_conversion.h',
102)
103
104vulkan_runtime_deps = [
105  vulkan_wsi_deps,
106  idep_mesautil,
107  idep_vulkan_util,
108]
109
110vulkan_compiler_files = files(
111  'vk_graphics_state.c',
112  'vk_graphics_state.h',
113  'vk_meta.c',
114  'vk_meta.h',
115  'vk_meta_blit_resolve.c',
116  'vk_meta_draw_rects.c',
117  'vk_meta_clear.c',
118  'vk_nir.c',
119  'vk_nir.h',
120  'vk_nir_convert_ycbcr.c',
121  'vk_nir_convert_ycbcr.h',
122  'vk_pipeline.c',
123  'vk_pipeline.h',
124  'vk_pipeline_cache.c',
125  'vk_pipeline_cache.h',
126  'vk_shader.c',
127  'vk_shader.h',
128  'vk_shader_module.c',
129  'vk_shader_module.h',
130  'vk_texcompress_etc2.c',
131  'vk_texcompress_etc2.h',
132)
133
134if with_vk_compiler
135  vulkan_runtime_deps += [idep_vtn, idep_nir]
136  vulkan_runtime_files += vulkan_compiler_files
137endif
138
139if dep_libdrm.found()
140  vulkan_runtime_files += files('vk_drm_syncobj.c', 'vk_drm_syncobj.h')
141  vulkan_runtime_deps += dep_libdrm
142endif
143
144if with_platform_android
145  vulkan_runtime_files += files('vk_android.c', 'vk_android.h')
146  vulkan_runtime_deps += dep_android
147endif
148
149if prog_glslang.found() and with_vk_compiler
150  vulkan_runtime_files += files('vk_texcompress_astc.c', 'vk_texcompress_astc.h')
151  vulkan_runtime_files += custom_target(
152    'astc_spv.h',
153    input : astc_decoder_glsl_file,
154    output : 'astc_spv.h',
155    command : [prog_glslang, '-V', '-S', 'comp', '-x', '-o', '@OUTPUT@', '@INPUT@'] + glslang_quiet,
156    )
157endif
158
159vk_common_entrypoints = custom_target(
160  'vk_common_entrypoints',
161  input : [vk_entrypoints_gen, vk_api_xml],
162  output : ['vk_common_entrypoints.h', 'vk_common_entrypoints.c'],
163  command : [
164    prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
165    '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'vk_common',
166    '--beta', with_vulkan_beta.to_string()
167  ],
168  depend_files : vk_entrypoints_gen_depend_files,
169)
170
171vk_cmd_queue = custom_target(
172  'vk_cmd_queue',
173  input : [vk_cmd_queue_gen, vk_api_xml],
174  output : ['vk_cmd_queue.c', 'vk_cmd_queue.h'],
175  command : [
176    prog_python, '@INPUT0@', '--xml', '@INPUT1@',
177    '--out-c', '@OUTPUT0@', '--out-h', '@OUTPUT1@',
178    '--beta', with_vulkan_beta.to_string()
179  ],
180  depend_files : vk_cmd_queue_gen_depend_files,
181)
182
183vk_cmd_enqueue_entrypoints = custom_target(
184  'vk_cmd_enqueue_entrypoints',
185  input : [vk_entrypoints_gen, vk_api_xml],
186  output : ['vk_cmd_enqueue_entrypoints.h', 'vk_cmd_enqueue_entrypoints.c'],
187  command : [
188    prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
189    '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@',
190    '--prefix', 'vk_cmd_enqueue', '--prefix', 'vk_cmd_enqueue_unless_primary',
191    '--beta', with_vulkan_beta.to_string()
192  ],
193  depend_files : vk_entrypoints_gen_depend_files,
194)
195
196vk_dispatch_trampolines = custom_target(
197  'vk_dispatch_trampolines',
198  input : [vk_dispatch_trampolines_gen, vk_api_xml],
199  output : ['vk_dispatch_trampolines.c', 'vk_dispatch_trampolines.h'],
200  command : [
201    prog_python, '@INPUT0@', '--xml', '@INPUT1@',
202    '--out-c', '@OUTPUT0@', '--out-h', '@OUTPUT1@',
203    '--beta', with_vulkan_beta.to_string()
204  ],
205  depend_files : vk_dispatch_trampolines_gen_depend_files,
206)
207
208vk_physical_device_features = custom_target(
209  'vk_physical_device_features',
210  input : [vk_physical_device_features_gen, vk_api_xml],
211  output : ['vk_physical_device_features.c', 'vk_physical_device_features.h'],
212  command : [
213    prog_python, '@INPUT0@', '--xml', '@INPUT1@',
214    '--out-c', '@OUTPUT0@', '--out-h', '@OUTPUT1@',
215    '--beta', with_vulkan_beta.to_string()
216  ],
217  depend_files : vk_physical_device_features_gen_depend_files,
218)
219
220vk_physical_device_properties = custom_target(
221  'vk_physical_device_properties',
222  input : [vk_physical_device_properties_gen, vk_api_xml],
223  output : ['vk_physical_device_properties.c', 'vk_physical_device_properties.h'],
224  command : [
225    prog_python, '@INPUT0@', '--xml', '@INPUT1@',
226    '--out-c', '@OUTPUT0@', '--out-h', '@OUTPUT1@',
227    '--beta', with_vulkan_beta.to_string()
228  ],
229  depend_files : vk_physical_device_properties_gen_depend_files,
230)
231
232vk_synchronization_helpers = custom_target(
233  'vk_synchronization_helpers',
234  input : [vk_synchronization_helpers_gen, vk_api_xml],
235  output : 'vk_synchronization_helpers.c',
236  command : [
237    prog_python, '@INPUT0@', '--xml', '@INPUT1@',
238    '--out-c', '@OUTPUT0@',
239    '--beta', with_vulkan_beta.to_string()
240  ],
241  depend_files : vk_synchronization_helpers_gen_depend_files,
242)
243
244vk_format_info = custom_target(
245  'vk_format_info',
246  input : ['vk_format_info_gen.py', vk_api_xml],
247  output : ['vk_format_info.c', 'vk_format_info.h'],
248  command : [
249    prog_python, '@INPUT0@', '--xml', '@INPUT1@',
250    '--out-c', '@OUTPUT0@', '--out-h', '@OUTPUT1@'
251  ],
252)
253
254libvulkan_runtime = static_library(
255  'vulkan_runtime',
256  [vulkan_runtime_files, vk_common_entrypoints,
257   vk_cmd_queue, vk_cmd_enqueue_entrypoints,
258   vk_dispatch_trampolines, vk_physical_device_features,
259   vk_physical_device_properties, vk_synchronization_helpers,
260   vk_format_info],
261  include_directories : [inc_include, inc_src],
262  dependencies : vulkan_runtime_deps,
263  c_args : c_msvc_compat_args,
264  gnu_symbol_visibility : 'hidden',
265  build_by_default : false,
266)
267
268idep_vulkan_runtime_headers = declare_dependency(
269  sources : [vk_cmd_queue[1], vk_physical_device_features[1], vk_physical_device_properties[1]],
270  include_directories : include_directories('.'),
271)
272
273idep_vulkan_common_entrypoints_h = declare_dependency(
274  sources : [vk_common_entrypoints[0]]
275)
276
277# This is likely a bug in the Meson VS backend, as MSVC with ninja works fine.
278# See this discussion here:
279# https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10506
280if get_option('backend').startswith('vs')
281  idep_vulkan_runtime = declare_dependency(
282    link_with : libvulkan_runtime,
283    dependencies : idep_vulkan_runtime_headers
284  )
285else
286  idep_vulkan_runtime = declare_dependency(
287    # Instruct users of this library to link with --whole-archive.  Otherwise,
288    # our weak function overloads may not resolve properly.
289    link_whole : libvulkan_runtime,
290    dependencies : [idep_vulkan_runtime_headers, idep_vulkan_common_entrypoints_h]
291  )
292endif
293