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