• 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.
23vk_extensions_depend_files = [
24]
25vk_extensions_gen_depend_files = [
26  files('vk_extensions.py'),
27  vk_extensions_depend_files,
28]
29vk_dispatch_table_gen_depend_files = [
30  files('vk_extensions.py'),
31  vk_extensions_depend_files,
32]
33vk_entrypoints_gen_depend_files = [
34  files('vk_dispatch_table_gen.py'),
35  vk_dispatch_table_gen_depend_files,
36]
37vk_cmd_queue_gen_depend_files = [
38  files('vk_dispatch_table_gen.py'),
39  vk_dispatch_table_gen_depend_files,
40]
41vk_commands_gen_depend_files = [
42  files('vk_dispatch_table_gen.py'),
43  vk_dispatch_table_gen_depend_files,
44]
45vk_physical_device_features_gen_depend_files = [
46]
47
48vk_entrypoints_gen = files('vk_entrypoints_gen.py')
49vk_extensions_gen = files('vk_extensions_gen.py')
50vk_icd_gen = files('vk_icd_gen.py')
51vk_commands_gen = files('vk_commands_gen.py')
52
53files_vulkan_util = files(
54  'vk_alloc.c',
55  'vk_alloc.h',
56  'vk_cmd_copy.c',
57  'vk_command_buffer.c',
58  'vk_command_buffer.h',
59  'vk_debug_report.c',
60  'vk_debug_report.h',
61  'vk_debug_utils.c',
62  'vk_debug_utils.h',
63  'vk_deferred_operation.c',
64  'vk_deferred_operation.h',
65  'vk_descriptors.c',
66  'vk_descriptors.h',
67  'vk_device.c',
68  'vk_device.h',
69  'vk_format.c',
70  'vk_image.c',
71  'vk_image.h',
72  'vk_instance.c',
73  'vk_instance.h',
74  'vk_log.c',
75  'vk_log.h',
76  'vk_object.c',
77  'vk_object.h',
78  'vk_physical_device.c',
79  'vk_physical_device.h',
80  'vk_queue.c',
81  'vk_queue.h',
82  'vk_render_pass.c',
83  'vk_shader_module.c',
84  'vk_shader_module.h',
85  'vk_synchronization2.c',
86  'vk_util.c',
87  'vk_util.h',
88)
89
90vk_common_entrypoints = custom_target(
91  'vk_common_entrypoints',
92  input : [vk_entrypoints_gen, vk_api_xml],
93  output : ['vk_common_entrypoints.h', 'vk_common_entrypoints.c'],
94  command : [
95    prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
96    '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'vk_common',
97  ],
98  depend_files : vk_entrypoints_gen_depend_files,
99)
100
101vk_dispatch_table = custom_target(
102  'vk_dispatch_table',
103  input : ['vk_dispatch_table_gen.py', vk_api_xml],
104  output : ['vk_dispatch_table.c', 'vk_dispatch_table.h'],
105  command : [
106    prog_python, '@INPUT0@', '--xml', '@INPUT1@',
107    '--out-c', '@OUTPUT0@', '--out-h', '@OUTPUT1@'
108  ],
109  depend_files : vk_dispatch_table_gen_depend_files,
110)
111
112vk_enum_to_str = custom_target(
113  'vk_enum_to_str',
114  input : ['gen_enum_to_str.py', vk_api_xml],
115  output : ['vk_enum_to_str.c', 'vk_enum_to_str.h', 'vk_enum_defines.h'],
116  command : [
117    prog_python, '@INPUT0@', '--xml', '@INPUT1@',
118    '--outdir', meson.current_build_dir()
119  ],
120)
121
122vk_extensions = custom_target(
123  'vk_extensions',
124  input : ['vk_extensions_gen.py', vk_api_xml],
125  output : ['vk_extensions.c', 'vk_extensions.h'],
126  command : [
127    prog_python, '@INPUT0@', '--xml', '@INPUT1@',
128    '--out-c', '@OUTPUT0@', '--out-h', '@OUTPUT1@'
129  ],
130  depend_files : vk_extensions_gen_depend_files,
131)
132
133vk_cmd_queue = custom_target(
134  'vk_cmd_queue',
135  input : ['vk_cmd_queue_gen.py', vk_api_xml],
136  output : ['vk_cmd_queue.c', 'vk_cmd_queue.h'],
137  command : [
138    prog_python, '@INPUT0@', '--xml', '@INPUT1@',
139    '--out-c', '@OUTPUT0@', '--out-h', '@OUTPUT1@'
140  ],
141  depend_files : vk_cmd_queue_gen_depend_files,
142)
143
144vk_physical_device_features = custom_target(
145  'vk_physical_device_features',
146  input : ['vk_physical_device_features.py', vk_api_xml],
147  output : ['vk_physical_device_features.c'],
148  command : [
149    prog_python, '@INPUT0@', '--xml', '@INPUT1@',
150    '--out-c', '@OUTPUT0@'
151  ],
152  depend_files : vk_physical_device_features_gen_depend_files,
153)
154
155libvulkan_util = static_library(
156  'vulkan_util',
157  [files_vulkan_util, vk_common_entrypoints, vk_dispatch_table,
158   vk_enum_to_str, vk_extensions, vk_cmd_queue, vk_physical_device_features],
159  include_directories : [inc_include, inc_src, inc_gallium],
160  dependencies : [vulkan_wsi_deps, idep_mesautil, idep_nir_headers],
161  # For glsl_type_singleton
162  link_with : libcompiler,
163  c_args : [vulkan_wsi_args],
164  gnu_symbol_visibility : 'hidden',
165  build_by_default : false,
166)
167
168idep_vulkan_util_headers = declare_dependency(
169  sources : [vk_dispatch_table[1], vk_enum_to_str[1], vk_extensions[1]],
170  include_directories : include_directories('.')
171)
172
173# This is likely a bug in the Meson VS backend, as MSVC with ninja works fine.
174# See this discussion here:
175# https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10506
176if get_option('backend').startswith('vs')
177  idep_vulkan_util = declare_dependency(
178    link_with : libvulkan_util,
179    dependencies : idep_vulkan_util_headers
180  )
181else
182  idep_vulkan_util = declare_dependency(
183    # Instruct users of this library to link with --whole-archive.  Otherwise,
184    # our weak function overloads may not resolve properly.
185    link_whole : libvulkan_util,
186    dependencies : idep_vulkan_util_headers
187  )
188endif
189