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