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