anv/extensions: Generate a header file with extension tables
[mesa.git] / src / intel / vulkan / meson.build
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 anv_entrypoints = custom_target(
22 'anv_entrypoints.[ch]',
23 input : ['anv_entrypoints_gen.py', vk_api_xml, vk_android_native_buffer_xml,
24 'anv_extensions.py'],
25 output : ['anv_entrypoints.h', 'anv_entrypoints.c'],
26 command : [
27 prog_python2, '@INPUT0@', '--xml', '@INPUT1@', '--xml', '@INPUT2@',
28 '--outdir', meson.current_build_dir(),
29 ],
30 depend_files : files('anv_extensions.py'),
31 )
32
33 anv_extensions_c = custom_target(
34 'anv_extensions.c',
35 input : ['anv_extensions_gen.py', vk_api_xml, vk_android_native_buffer_xml,
36 'anv_extensions.py'],
37 output : 'anv_extensions.c',
38 command : [
39 prog_python2, '@INPUT0@', '--xml', '@INPUT1@', '--xml', '@INPUT2@',
40 '--out-c', '@OUTPUT@',
41 ],
42 )
43
44 anv_extensions_h = custom_target(
45 'anv_extensions.h',
46 input : ['anv_extensions_gen.py', vk_api_xml, vk_android_native_buffer_xml,
47 'anv_extensions.py'],
48 output : 'anv_extensions.h',
49 command : [
50 prog_python2, '@INPUT0@', '--xml', '@INPUT1@', '--xml', '@INPUT2@',
51 '--out-h', '@OUTPUT@',
52 ],
53 )
54
55 intel_icd = custom_target(
56 'intel_icd',
57 input : 'anv_icd.py',
58 output : 'intel_icd.@0@.json'.format(host_machine.cpu()),
59 command : [
60 prog_python2, '@INPUT@',
61 '--lib-path', join_paths(get_option('prefix'), get_option('libdir')),
62 '--out', '@OUTPUT@',
63 ],
64 depend_files : files('anv_extensions.py'),
65 build_by_default : true,
66 install_dir : with_vulkan_icd_dir,
67 install : true,
68 )
69
70 dev_icd = custom_target(
71 'dev_icd',
72 input : 'anv_icd.py',
73 output : 'dev_icd.@0@.json'.format(host_machine.cpu()),
74 command : [
75 prog_python2, '@INPUT@', '--lib-path', meson.current_build_dir(),
76 '--out', '@OUTPUT@'
77 ],
78 depend_files : files('anv_extensions.py'),
79 build_by_default : true,
80 install : false,
81 )
82
83 # TODO: workaround for anv_entrypoints combining the .h and .c files in it's
84 # output. See issue #2346
85 block_entrypoints = custom_target(
86 'block_entrypoints',
87 command : [prog_touch, '@OUTPUT@'],
88 output : 'null',
89 depends : anv_entrypoints,
90 )
91
92 libanv_gen_libs = []
93 anv_gen_files = files(
94 'genX_blorp_exec.c',
95 'genX_cmd_buffer.c',
96 'genX_gpu_memcpy.c',
97 'genX_pipeline.c',
98 'genX_query.c',
99 'genX_state.c',
100 )
101 foreach g : [['70', ['gen7_cmd_buffer.c']], ['75', ['gen7_cmd_buffer.c']],
102 ['80', ['gen8_cmd_buffer.c']], ['90', ['gen8_cmd_buffer.c']],
103 ['100', ['gen8_cmd_buffer.c']]]
104 _gen = g[0]
105 libanv_gen_libs += static_library(
106 'libanv_gen@0@'.format(_gen),
107 [anv_gen_files, g[1], block_entrypoints],
108 include_directories : [
109 inc_common, inc_compiler, inc_drm_uapi, inc_intel, inc_vulkan_util,
110 inc_vulkan_wsi,
111 ],
112 c_args : [
113 c_vis_args, no_override_init_args, '-msse2',
114 '-DGEN_VERSIONx10=@0@'.format(_gen),
115 ],
116 dependencies : [dep_libdrm, dep_valgrind, idep_nir_headers],
117 )
118 endforeach
119
120 libanv_files = files(
121 'anv_allocator.c',
122 'anv_batch_chain.c',
123 'anv_blorp.c',
124 'anv_cmd_buffer.c',
125 'anv_descriptor_set.c',
126 'anv_device.c',
127 'anv_dump.c',
128 'anv_formats.c',
129 'anv_genX.h',
130 'anv_image.c',
131 'anv_intel.c',
132 'anv_nir.h',
133 'anv_nir_apply_pipeline_layout.c',
134 'anv_nir_lower_input_attachments.c',
135 'anv_nir_lower_multiview.c',
136 'anv_nir_lower_push_constants.c',
137 'anv_nir_lower_ycbcr_textures.c',
138 'anv_pass.c',
139 'anv_pipeline.c',
140 'anv_pipeline_cache.c',
141 'anv_private.h',
142 'anv_queue.c',
143 'anv_util.c',
144 'anv_wsi.c',
145 'vk_format_info.h',
146 )
147
148 anv_deps = [
149 dep_libdrm,
150 dep_valgrind,
151 idep_nir_headers,
152 ]
153 anv_flags = [
154 c_vis_args,
155 no_override_init_args,
156 '-msse2',
157 ]
158
159 if with_platform_x11
160 anv_deps += dep_xcb_dri3
161 anv_flags += [
162 '-DVK_USE_PLATFORM_XCB_KHR',
163 '-DVK_USE_PLATFORM_XLIB_KHR',
164 ]
165 libanv_files += files('anv_wsi_x11.c')
166 endif
167
168 if with_platform_wayland
169 anv_deps += dep_wayland_client
170 anv_flags += '-DVK_USE_PLATFORM_WAYLAND_KHR'
171 libanv_files += files('anv_wsi_wayland.c')
172 endif
173
174 libanv_common = static_library(
175 'anv_common',
176 [libanv_files, anv_entrypoints, anv_extensions_c, anv_extensions_h],
177 include_directories : [
178 inc_common, inc_intel, inc_compiler, inc_drm_uapi, inc_vulkan_util,
179 inc_vulkan_wsi,
180 ],
181 c_args : anv_flags,
182 dependencies : anv_deps,
183 )
184
185 libvulkan_intel = shared_library(
186 'vulkan_intel',
187 [files('anv_gem.c'), block_entrypoints, anv_extensions_h],
188 include_directories : [
189 inc_common, inc_intel, inc_compiler, inc_drm_uapi, inc_vulkan_util,
190 inc_vulkan_wsi,
191 ],
192 link_whole : [libanv_common, libanv_gen_libs],
193 link_with : [
194 libintel_compiler, libintel_common, libisl, libblorp, libvulkan_util,
195 libvulkan_wsi, libmesa_util,
196 ],
197 dependencies : [
198 dep_thread, dep_dl, dep_m, anv_deps, idep_nir,
199 ],
200 c_args : anv_flags,
201 link_args : ['-Wl,--build-id=sha1', ld_args_bsymbolic, ld_args_gc_sections],
202 install : true,
203 )
204
205 if with_tests
206 libvulkan_intel_test = static_library(
207 'vulkan_intel_test',
208 [files('anv_gem_stubs.c'), block_entrypoints, anv_extensions_h],
209 include_directories : [
210 inc_common, inc_intel, inc_compiler, inc_drm_uapi, inc_vulkan_util,
211 inc_vulkan_wsi,
212 ],
213 link_whole : libanv_common,
214 link_with : [
215 libanv_gen_libs, libintel_compiler, libintel_common, libisl, libblorp,
216 libvulkan_util, libvulkan_wsi, libmesa_util,
217 ],
218 dependencies : [
219 dep_thread, dep_dl, dep_m, anv_deps, idep_nir,
220 ],
221 c_args : anv_flags,
222 )
223
224 foreach t : ['block_pool_no_free', 'state_pool_no_free',
225 'state_pool_free_list_only', 'state_pool']
226 test(
227 'anv_@0@'.format(t),
228 executable(
229 t,
230 ['tests/@0@.c'.format(t), dummy_cpp, block_entrypoints],
231 link_with : libvulkan_intel_test,
232 dependencies : [dep_libdrm, dep_thread, dep_m, dep_valgrind],
233 include_directories : [
234 inc_common, inc_intel, inc_compiler, inc_vulkan_util, inc_vulkan_wsi,
235 ],
236 )
237 )
238 endforeach
239 endif