OSDN Git Service

Merge remote-tracking branch 'mesa/18.3' into oreo-x86
[android-x86/external-mesa.git] / src / intel / vulkan / meson.build
1 # Copyright © 2017-2019 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],
26   output : ['anv_entrypoints.h', 'anv_entrypoints.c'],
27   command : [
28     prog_python, '@INPUT0@', '--xml', '@INPUT1@',
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],
37   output : 'anv_extensions.c',
38   command : [
39     prog_python, '@INPUT0@', '--xml', '@INPUT1@',
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],
48   output : 'anv_extensions.h',
49   command : [
50     prog_python, '@INPUT0@', '--xml', '@INPUT1@',
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_python, '@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_python, '@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 libanv_gen_libs = []
85 anv_gen_files = files(
86   'genX_blorp_exec.c',
87   'genX_cmd_buffer.c',
88   'genX_gpu_memcpy.c',
89   'genX_pipeline.c',
90   'genX_query.c',
91   'genX_state.c',
92 )
93 foreach g : [['70', ['gen7_cmd_buffer.c']], ['75', ['gen7_cmd_buffer.c']],
94              ['80', ['gen8_cmd_buffer.c']], ['90', ['gen8_cmd_buffer.c']],
95              ['100', ['gen8_cmd_buffer.c']], ['110', ['gen8_cmd_buffer.c']]]
96   _gen = g[0]
97   libanv_gen_libs += static_library(
98     'anv_gen@0@'.format(_gen),
99     [anv_gen_files, g[1], anv_entrypoints[0], anv_extensions_h],
100     include_directories : [
101       inc_common, inc_compiler, inc_drm_uapi, inc_intel, inc_vulkan_util,
102       inc_vulkan_wsi,
103     ],
104     c_args : [
105       c_vis_args, no_override_init_args, c_sse2_args,
106       '-DGEN_VERSIONx10=@0@'.format(_gen),
107     ],
108     dependencies : [dep_libdrm, dep_valgrind, idep_nir_headers],
109   )
110 endforeach
111
112 libanv_files = files(
113   'anv_allocator.c',
114   'anv_batch_chain.c',
115   'anv_blorp.c',
116   'anv_cmd_buffer.c',
117   'anv_descriptor_set.c',
118   'anv_device.c',
119   'anv_dump.c',
120   'anv_formats.c',
121   'anv_genX.h',
122   'anv_image.c',
123   'anv_intel.c',
124   'anv_nir.h',
125   'anv_nir_add_base_work_group_id.c',
126   'anv_nir_apply_pipeline_layout.c',
127   'anv_nir_lower_input_attachments.c',
128   'anv_nir_lower_multiview.c',
129   'anv_nir_lower_push_constants.c',
130   'anv_nir_lower_ycbcr_textures.c',
131   'anv_pass.c',
132   'anv_pipeline.c',
133   'anv_pipeline_cache.c',
134   'anv_private.h',
135   'anv_queue.c',
136   'anv_util.c',
137   'anv_wsi.c',
138   'vk_format_info.h',
139 )
140
141 anv_deps = [
142   dep_libdrm,
143   dep_valgrind,
144   idep_nir_headers,
145 ]
146 anv_flags = [
147   c_vis_args,
148   no_override_init_args,
149   c_sse2_args,
150 ]
151
152 if with_platform_x11
153   anv_deps += dep_xcb_dri3
154   anv_flags += [
155     '-DVK_USE_PLATFORM_XCB_KHR',
156     '-DVK_USE_PLATFORM_XLIB_KHR',
157   ]
158   libanv_files += files('anv_wsi_x11.c')
159 endif
160
161 if with_platform_wayland
162   anv_deps += dep_wayland_client
163   anv_flags += '-DVK_USE_PLATFORM_WAYLAND_KHR'
164   libanv_files += files('anv_wsi_wayland.c')
165 endif
166
167 if with_platform_drm
168   anv_flags += '-DVK_USE_PLATFORM_DISPLAY_KHR'
169   libanv_files += files('anv_wsi_display.c')
170 endif
171
172 if with_xlib_lease
173   anv_deps += [dep_xcb_xrandr, dep_xlib_xrandr]
174   anv_flags += '-DVK_USE_PLATFORM_XLIB_XRANDR_EXT'
175 endif
176
177 libanv_common = static_library(
178   'anv_common',
179   [
180     libanv_files, anv_entrypoints, anv_extensions_c, anv_extensions_h, sha1_h,
181     gen_xml_pack,
182   ],
183   include_directories : [
184     inc_common, inc_intel, inc_compiler, inc_drm_uapi, inc_vulkan_util,
185     inc_vulkan_wsi,
186   ],
187   c_args : anv_flags,
188   dependencies : anv_deps,
189 )
190
191 libvulkan_intel = shared_library(
192   'vulkan_intel',
193   [files('anv_gem.c'), anv_entrypoints[0], anv_extensions_h],
194   include_directories : [
195     inc_common, inc_intel, inc_compiler, inc_drm_uapi, inc_vulkan_util,
196     inc_vulkan_wsi,
197   ],
198   link_whole : [libanv_common, libanv_gen_libs],
199   link_with : [
200     libintel_compiler, libintel_common, libintel_dev, libisl, libblorp,
201     libvulkan_util, libvulkan_wsi, libmesa_util,
202   ],
203   dependencies : [
204     dep_thread, dep_dl, dep_m, anv_deps, idep_nir,
205   ],
206   c_args : anv_flags,
207   link_args : ['-Wl,--build-id=sha1', ld_args_bsymbolic, ld_args_gc_sections],
208   install : true,
209 )
210
211 if with_tests
212   libvulkan_intel_test = static_library(
213     'vulkan_intel_test',
214     [files('anv_gem_stubs.c'), anv_entrypoints[0], anv_extensions_h],
215     include_directories : [
216       inc_common, inc_intel, inc_compiler, inc_drm_uapi, inc_vulkan_util,
217       inc_vulkan_wsi,
218     ],
219     link_whole : libanv_common,
220     link_with : [
221       libanv_gen_libs, libintel_compiler, libintel_common, libintel_dev,
222       libisl, libblorp, libvulkan_util, libvulkan_wsi, libmesa_util,
223     ],
224     dependencies : [
225       dep_thread, dep_dl, dep_m, anv_deps, idep_nir,
226     ],
227     c_args : anv_flags,
228   )
229
230   foreach t : ['block_pool_no_free', 'state_pool_no_free',
231                'state_pool_free_list_only', 'state_pool']
232     test(
233       'anv_@0@'.format(t),
234       executable(
235         t,
236         ['tests/@0@.c'.format(t), anv_entrypoints[0], anv_extensions_h],
237         link_with : libvulkan_intel_test,
238         dependencies : [dep_libdrm, dep_thread, dep_m, dep_valgrind],
239         include_directories : [
240           inc_common, inc_intel, inc_compiler, inc_vulkan_util, inc_vulkan_wsi,
241         ],
242       )
243     )
244   endforeach
245 endif