v3d/tex: don't configure tmu config 1 if not needed
[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 'list.h',
59 'macros.h',
60 'mesa-sha1.c',
61 'mesa-sha1.h',
62 'os_time.c',
63 'os_time.h',
64 'os_file.c',
65 'os_misc.c',
66 'os_misc.h',
67 'os_socket.c',
68 'os_socket.h',
69 'u_process.c',
70 'u_process.h',
71 'sha1/sha1.c',
72 'sha1/sha1.h',
73 'ralloc.c',
74 'ralloc.h',
75 'rand_xor.c',
76 'rand_xor.h',
77 'rb_tree.c',
78 'rb_tree.h',
79 'register_allocate.c',
80 'register_allocate.h',
81 'rgtc.c',
82 'rgtc.h',
83 'rounding.h',
84 'set.c',
85 'set.h',
86 'simple_list.h',
87 'simple_mtx.h',
88 'slab.c',
89 'slab.h',
90 'softfloat.c',
91 'softfloat.h',
92 'sparse_array.c',
93 'sparse_array.h',
94 'string_buffer.c',
95 'string_buffer.h',
96 'strndup.h',
97 'strtod.c',
98 'strtod.h',
99 'texcompress_rgtc_tmp.h',
100 'timespec.h',
101 'u_atomic.c',
102 'u_atomic.h',
103 'u_dynarray.h',
104 'u_endian.h',
105 'u_queue.c',
106 'u_queue.h',
107 'u_string.h',
108 'u_thread.h',
109 'u_vector.c',
110 'u_vector.h',
111 'u_math.c',
112 'u_math.h',
113 'u_memset.h',
114 'u_mm.c',
115 'u_mm.h',
116 'u_debug.c',
117 'u_debug.h',
118 'u_debug_memory.c',
119 'u_cpu_detect.c',
120 'u_cpu_detect.h',
121 'vma.c',
122 'vma.h',
123 'xxhash.h',
124 )
125
126 files_drirc = files('00-mesa-defaults.conf')
127
128 install_data(files_drirc, install_dir : join_paths(get_option('datadir'), 'drirc.d'))
129
130 if with_tests
131 prog_xmllint = find_program('xmllint', required : false, native : true)
132 if prog_xmllint.found()
133 test(
134 'drirc xml validation',
135 prog_xmllint,
136 args : ['--noout', '--valid', files_drirc],
137 suite : ['util'],
138 )
139 endif
140 endif
141
142 files_xmlconfig = files(
143 'xmlconfig.c',
144 'xmlconfig.h',
145 )
146
147 format_srgb = custom_target(
148 'format_srgb',
149 input : ['format_srgb.py'],
150 output : 'format_srgb.c',
151 command : [prog_python, '@INPUT0@'],
152 capture : true,
153 )
154
155 deps_for_libmesa_util = [
156 dep_zlib,
157 dep_clock,
158 dep_thread,
159 dep_atomic,
160 dep_m,
161 dep_valgrind,
162 dep_zstd,
163 ]
164
165 if with_platform_android
166 deps_for_libmesa_util += dep_android
167 endif
168
169 _libmesa_util = static_library(
170 'mesa_util',
171 [files_mesa_util, format_srgb],
172 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
173 dependencies : deps_for_libmesa_util,
174 link_with: libmesa_format,
175 c_args : [c_msvc_compat_args, c_vis_args],
176 build_by_default : false
177 )
178
179 idep_mesautil = declare_dependency(
180 link_with : _libmesa_util,
181 include_directories : inc_util,
182 dependencies : [dep_zlib, dep_clock, dep_thread, dep_atomic, dep_m],
183 )
184
185 _libxmlconfig = static_library(
186 'xmlconfig',
187 files_xmlconfig,
188 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
189 dependencies : [idep_mesautil, dep_expat, dep_m],
190 c_args : [
191 c_msvc_compat_args, c_vis_args,
192 '-DSYSCONFDIR="@0@"'.format(
193 join_paths(get_option('prefix'), get_option('sysconfdir'))
194 ),
195 '-DDATADIR="@0@"'.format(
196 join_paths(get_option('prefix'), get_option('datadir'))
197 ),
198 ],
199 build_by_default : false,
200 )
201
202 idep_xmlconfig = declare_dependency(
203 dependencies : [idep_xmlconfig_headers, 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 cc.get_id() == 'gcc')
291 # This conversion is only required on mingw
292 process_test_exe_full_path = run_command(
293 'winepath', '-w', process_test_exe.full_path()
294 ).stdout().strip()
295 else
296 process_test_exe_full_path = process_test_exe.full_path()
297 endif
298
299 test(
300 'process',
301 process_test_exe,
302 suite : ['util'],
303 env: ['BUILD_FULL_PATH='+process_test_exe_full_path]
304 )
305
306 subdir('tests/fast_idiv_by_const')
307 subdir('tests/fast_urem_by_const')
308 subdir('tests/hash_table')
309 if not (host_machine.system() == 'windows' and cc.get_id() == 'gcc')
310 # FIXME: These tests fail with mingw, but not with msvc.
311 subdir('tests/string_buffer')
312 endif
313 if cc.has_header('sys/time.h') # MinGW has this, but Vanilla windows doesn't
314 subdir('tests/timespec')
315 endif
316 subdir('tests/vma')
317 subdir('tests/set')
318 # FIXME: this test on the Wine version in GitLab CI
319 if host_machine.system() != 'windows'
320 subdir('tests/sparse_array')
321 endif
322 subdir('tests/format')
323 subdir('tests/vector')
324 endif