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