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