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