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