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