util: fix process_test path
[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 subdir('xmlpool')
25
26 files_mesa_util = files(
27 'anon_file.h',
28 'anon_file.c',
29 'bigmath.h',
30 'bitscan.c',
31 'bitscan.h',
32 'bitset.h',
33 'blob.c',
34 'blob.h',
35 'build_id.c',
36 'build_id.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 'fnv1a.h',
49 'format_r11g11b10f.h',
50 'format_rgb9e5.h',
51 'format_srgb.h',
52 'futex.h',
53 'half_float.c',
54 'half_float.h',
55 'hash_table.c',
56 'hash_table.h',
57 'list.h',
58 'macros.h',
59 'mesa-sha1.c',
60 'mesa-sha1.h',
61 'os_time.c',
62 'os_time.h',
63 'os_file.c',
64 'os_misc.c',
65 'os_misc.h',
66 'os_socket.c',
67 'os_socket.h',
68 'u_process.c',
69 'u_process.h',
70 'sha1/sha1.c',
71 'sha1/sha1.h',
72 'ralloc.c',
73 'ralloc.h',
74 'rand_xor.c',
75 'rand_xor.h',
76 'rb_tree.c',
77 'rb_tree.h',
78 'register_allocate.c',
79 'register_allocate.h',
80 'rgtc.c',
81 'rgtc.h',
82 'rounding.h',
83 'set.c',
84 'set.h',
85 'simple_list.h',
86 'simple_mtx.h',
87 'slab.c',
88 'slab.h',
89 'softfloat.c',
90 'softfloat.h',
91 'sparse_array.c',
92 'sparse_array.h',
93 'string_buffer.c',
94 'string_buffer.h',
95 'strndup.h',
96 'strtod.c',
97 'strtod.h',
98 'texcompress_rgtc_tmp.h',
99 'timespec.h',
100 'u_atomic.c',
101 'u_atomic.h',
102 'u_dynarray.h',
103 'u_endian.h',
104 'u_queue.c',
105 'u_queue.h',
106 'u_string.h',
107 'u_thread.h',
108 'u_vector.c',
109 'u_vector.h',
110 'u_math.c',
111 'u_math.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_common,
171 dependencies : deps_for_libmesa_util,
172 link_with: libmesa_format,
173 c_args : [c_msvc_compat_args, c_vis_args],
174 build_by_default : false
175 )
176
177 idep_mesautil = declare_dependency(
178 link_with : _libmesa_util,
179 include_directories : inc_util,
180 dependencies : [dep_zlib, dep_clock, dep_thread, dep_atomic, dep_m],
181 )
182
183 _libxmlconfig = static_library(
184 'xmlconfig',
185 files_xmlconfig,
186 include_directories : inc_common,
187 dependencies : [idep_mesautil, dep_expat, dep_m],
188 c_args : [
189 c_msvc_compat_args, c_vis_args,
190 '-DSYSCONFDIR="@0@"'.format(
191 join_paths(get_option('prefix'), get_option('sysconfdir'))
192 ),
193 '-DDATADIR="@0@"'.format(
194 join_paths(get_option('prefix'), get_option('datadir'))
195 ),
196 ],
197 build_by_default : false,
198 )
199
200 idep_xmlconfig = declare_dependency(
201 dependencies : [idep_xmlconfig_headers, dep_expat],
202 link_with : _libxmlconfig,
203 )
204
205 if with_tests
206 test(
207 'u_atomic',
208 executable(
209 'u_atomic_test',
210 files('u_atomic_test.c'),
211 include_directories : inc_common,
212 dependencies : idep_mesautil,
213 c_args : [c_msvc_compat_args],
214 ),
215 suite : ['util'],
216 )
217
218 test(
219 'blob',
220 executable(
221 'blob_test',
222 files('blob_test.c'),
223 include_directories : inc_common,
224 dependencies : idep_mesautil,
225 c_args : [c_msvc_compat_args],
226 ),
227 suite : ['util'],
228 )
229
230 test(
231 'rb_tree',
232 executable(
233 'rb_tree_test',
234 files('rb_tree_test.c'),
235 include_directories : inc_common,
236 dependencies : idep_mesautil,
237 c_args : [c_msvc_compat_args],
238 ),
239 suite : ['util'],
240 )
241
242 test(
243 'roundeven',
244 executable(
245 'roundeven_test',
246 files('roundeven_test.c'),
247 include_directories : inc_common,
248 c_args : [c_msvc_compat_args],
249 dependencies : [dep_m],
250 ),
251 suite : ['util'],
252 should_fail : meson.get_cross_property('xfail', '').contains('roundeven'),
253 )
254
255 # FIXME: this test crashes on windows
256 if host_machine.system() != 'windows'
257 test(
258 'mesa-sha1',
259 executable(
260 'mesa-sha1_test',
261 files('mesa-sha1_test.c'),
262 include_directories : inc_common,
263 link_with : _libmesa_util,
264 c_args : [c_msvc_compat_args],
265 ),
266 suite : ['util'],
267 )
268 endif
269
270 test(
271 'bitset',
272 executable(
273 'bitset_test',
274 files('bitset_test.cpp'),
275 include_directories : inc_common,
276 dependencies : [idep_mesautil, idep_gtest],
277 ),
278 suite : ['util'],
279 )
280
281 process_test_exe = executable(
282 'process_test',
283 files('process_test.c'),
284 include_directories : inc_common,
285 dependencies : idep_mesautil,
286 c_args : [c_msvc_compat_args],
287 )
288 if (host_machine.system() == 'windows' and cc.get_id() == 'gcc')
289 # This conversion is only required on mingw
290 process_test_exe_full_path = run_command(
291 'winepath', '-w', process_test_exe.full_path()
292 ).stdout().strip()
293 else
294 process_test_exe_full_path = process_test_exe.full_path()
295 endif
296
297 test(
298 'process',
299 process_test_exe,
300 suite : ['util'],
301 env: ['BUILD_FULL_PATH='+process_test_exe_full_path]
302 )
303
304 subdir('tests/fast_idiv_by_const')
305 subdir('tests/fast_urem_by_const')
306 subdir('tests/hash_table')
307 if not (host_machine.system() == 'windows' and cc.get_id() == 'gcc')
308 # FIXME: These tests fail with mingw, but not with msvc.
309 subdir('tests/string_buffer')
310 endif
311 if cc.has_header('sys/time.h') # MinGW has this, but Vanilla windows doesn't
312 subdir('tests/timespec')
313 endif
314 subdir('tests/vma')
315 subdir('tests/set')
316 # FIXME: this test on the Wine version in GitLab CI
317 if host_machine.system() != 'windows'
318 subdir('tests/sparse_array')
319 endif
320 subdir('tests/format')
321 subdir('tests/vector')
322 endif