radv,vulkan: add a new x11 wsi drirc workaround for DOOM Eternal
[mesa.git] / src / util / 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 inc_util = include_directories('.')
22
23 subdir('format')
24
25 files_mesa_util = files(
26 'anon_file.h',
27 'anon_file.c',
28 'bigmath.h',
29 'bitscan.c',
30 'bitscan.h',
31 'bitset.h',
32 'blob.c',
33 'blob.h',
34 'build_id.c',
35 'build_id.h',
36 'compiler.h',
37 'crc32.c',
38 'crc32.h',
39 'dag.c',
40 'debug.c',
41 'debug.h',
42 'disk_cache.c',
43 'disk_cache.h',
44 'double.c',
45 'double.h',
46 'fast_idiv_by_const.c',
47 'fast_idiv_by_const.h',
48 'format_r11g11b10f.h',
49 'format_rgb9e5.h',
50 'format_srgb.h',
51 'futex.h',
52 'half_float.c',
53 'half_float.h',
54 'hash_table.c',
55 'hash_table.h',
56 'list.h',
57 'macros.h',
58 'mesa-sha1.c',
59 'mesa-sha1.h',
60 'os_time.c',
61 'os_time.h',
62 'os_file.c',
63 'os_misc.c',
64 'os_misc.h',
65 'os_socket.c',
66 'os_socket.h',
67 'u_process.c',
68 'u_process.h',
69 'sha1/sha1.c',
70 'sha1/sha1.h',
71 'ralloc.c',
72 'ralloc.h',
73 'rand_xor.c',
74 'rand_xor.h',
75 'rb_tree.c',
76 'rb_tree.h',
77 'register_allocate.c',
78 'register_allocate.h',
79 'rgtc.c',
80 'rgtc.h',
81 'rounding.h',
82 'set.c',
83 'set.h',
84 'simple_list.h',
85 'simple_mtx.h',
86 'slab.c',
87 'slab.h',
88 'softfloat.c',
89 'softfloat.h',
90 'sparse_array.c',
91 'sparse_array.h',
92 'string_buffer.c',
93 'string_buffer.h',
94 'strndup.h',
95 'strtod.c',
96 'strtod.h',
97 'texcompress_rgtc_tmp.h',
98 'timespec.h',
99 'u_atomic.c',
100 'u_atomic.h',
101 'u_dynarray.h',
102 'u_endian.h',
103 'u_queue.c',
104 'u_queue.h',
105 'u_string.h',
106 'u_thread.h',
107 'u_vector.c',
108 'u_vector.h',
109 'u_math.c',
110 'u_math.h',
111 'u_memset.h',
112 'u_mm.c',
113 'u_mm.h',
114 'u_debug.c',
115 'u_debug.h',
116 'u_debug_memory.c',
117 'u_cpu_detect.c',
118 'u_cpu_detect.h',
119 'vma.c',
120 'vma.h',
121 'xxhash.h',
122 )
123
124 files_drirc = files('00-mesa-defaults.conf')
125
126 install_data(files_drirc, install_dir : join_paths(get_option('datadir'), 'drirc.d'))
127
128 if with_tests
129 prog_xmllint = find_program('xmllint', required : false, native : true)
130 if prog_xmllint.found()
131 test(
132 'drirc xml validation',
133 prog_xmllint,
134 args : ['--noout', '--valid', files_drirc],
135 suite : ['util'],
136 )
137 endif
138 endif
139
140 files_xmlconfig = files(
141 'xmlconfig.c',
142 'xmlconfig.h',
143 )
144
145 format_srgb = custom_target(
146 'format_srgb',
147 input : ['format_srgb.py'],
148 output : 'format_srgb.c',
149 command : [prog_python, '@INPUT0@'],
150 capture : true,
151 )
152
153 deps_for_libmesa_util = [
154 dep_zlib,
155 dep_clock,
156 dep_thread,
157 dep_atomic,
158 dep_m,
159 dep_valgrind,
160 dep_zstd,
161 ]
162
163 if with_platform_android
164 deps_for_libmesa_util += dep_android
165 endif
166
167 _libmesa_util = static_library(
168 'mesa_util',
169 [files_mesa_util, format_srgb],
170 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
171 dependencies : deps_for_libmesa_util,
172 link_with: libmesa_format,
173 c_args : [c_msvc_compat_args],
174 gnu_symbol_visibility : 'hidden',
175 build_by_default : false
176 )
177
178 idep_mesautil = declare_dependency(
179 link_with : _libmesa_util,
180 include_directories : inc_util,
181 dependencies : [dep_zlib, dep_clock, dep_thread, dep_atomic, dep_m],
182 )
183
184 _libxmlconfig = static_library(
185 'xmlconfig',
186 files_xmlconfig,
187 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
188 dependencies : [idep_mesautil, dep_expat, dep_m],
189 c_args : [
190 c_msvc_compat_args,
191 '-DSYSCONFDIR="@0@"'.format(
192 join_paths(get_option('prefix'), get_option('sysconfdir'))
193 ),
194 '-DDATADIR="@0@"'.format(
195 join_paths(get_option('prefix'), get_option('datadir'))
196 ),
197 ],
198 gnu_symbol_visibility : 'hidden',
199 build_by_default : false,
200 )
201
202 idep_xmlconfig = declare_dependency(
203 dependencies : dep_expat,
204 link_with : _libxmlconfig,
205 )
206
207 if with_tests
208 test(
209 'u_atomic',
210 executable(
211 'u_atomic_test',
212 files('u_atomic_test.c'),
213 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
214 dependencies : idep_mesautil,
215 c_args : [c_msvc_compat_args],
216 ),
217 suite : ['util'],
218 )
219
220 test(
221 'blob',
222 executable(
223 'blob_test',
224 files('blob_test.c'),
225 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
226 dependencies : idep_mesautil,
227 c_args : [c_msvc_compat_args],
228 ),
229 suite : ['util'],
230 )
231
232 test(
233 'rb_tree',
234 executable(
235 'rb_tree_test',
236 files('rb_tree_test.c'),
237 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
238 dependencies : idep_mesautil,
239 c_args : [c_msvc_compat_args],
240 ),
241 suite : ['util'],
242 )
243
244 test(
245 'roundeven',
246 executable(
247 'roundeven_test',
248 files('roundeven_test.c'),
249 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
250 c_args : [c_msvc_compat_args],
251 dependencies : [dep_m],
252 ),
253 suite : ['util'],
254 should_fail : meson.get_cross_property('xfail', '').contains('roundeven'),
255 )
256
257 # FIXME: this test crashes on windows
258 if host_machine.system() != 'windows'
259 test(
260 'mesa-sha1',
261 executable(
262 'mesa-sha1_test',
263 files('mesa-sha1_test.c'),
264 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
265 link_with : _libmesa_util,
266 c_args : [c_msvc_compat_args],
267 ),
268 suite : ['util'],
269 )
270 endif
271
272 test(
273 'bitset',
274 executable(
275 'bitset_test',
276 files('bitset_test.cpp'),
277 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
278 dependencies : [idep_mesautil, idep_gtest],
279 ),
280 suite : ['util'],
281 )
282
283 process_test_exe = executable(
284 'process_test',
285 files('process_test.c'),
286 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
287 dependencies : idep_mesautil,
288 c_args : [c_msvc_compat_args],
289 )
290 if (host_machine.system() == 'windows' and build_machine.system() != 'windows')
291 # This conversion is only required on mingw crosscompilers, otherwise we hit at least one of these issues
292 # https://gitlab.freedesktop.org/mesa/mesa/-/issues/2690
293 # https://gitlab.freedesktop.org/mesa/mesa/-/issues/2788
294 prog_winepath = find_program('winepath')
295 process_test_exe_full_path = run_command(
296 prog_winepath, '-w', process_test_exe.full_path()
297 ).stdout().strip()
298 else
299 process_test_exe_full_path = process_test_exe.full_path()
300 endif
301
302 test(
303 'process',
304 process_test_exe,
305 suite : ['util'],
306 env: ['BUILD_FULL_PATH='+process_test_exe_full_path]
307 )
308
309 subdir('tests/fast_idiv_by_const')
310 subdir('tests/fast_urem_by_const')
311 subdir('tests/hash_table')
312 if not (host_machine.system() == 'windows' and cc.get_id() == 'gcc')
313 # FIXME: These tests fail with mingw, but not with msvc.
314 subdir('tests/string_buffer')
315 endif
316 if cc.has_header('sys/time.h') # MinGW has this, but Vanilla windows doesn't
317 subdir('tests/timespec')
318 endif
319 subdir('tests/vma')
320 subdir('tests/set')
321 subdir('tests/sparse_array')
322 subdir('tests/format')
323 subdir('tests/vector')
324 endif