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