Move blob from compiler/ to util/
[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 'string_buffer.c',
88 'string_buffer.h',
89 'strndup.h',
90 'strtod.c',
91 'strtod.h',
92 'texcompress_rgtc_tmp.h',
93 'timespec.h',
94 'u_atomic.c',
95 'u_atomic.h',
96 'u_dynarray.h',
97 'u_endian.h',
98 'u_queue.c',
99 'u_queue.h',
100 'u_string.h',
101 'u_thread.h',
102 'u_vector.c',
103 'u_vector.h',
104 'u_math.c',
105 'u_math.h',
106 'u_debug.c',
107 'u_debug.h',
108 'u_cpu_detect.c',
109 'u_cpu_detect.h',
110 'vma.c',
111 'vma.h',
112 )
113
114 files_drirc = files('00-mesa-defaults.conf')
115
116 install_data(files_drirc, install_dir : join_paths(get_option('datadir'), 'drirc.d'))
117
118 if with_tests
119 prog_xmllint = find_program('xmllint', required : false, native : true)
120 if prog_xmllint.found()
121 test(
122 'drirc xml validation',
123 prog_xmllint,
124 args : ['--noout', '--valid', files_drirc],
125 suite : ['util'],
126 )
127 endif
128 endif
129
130 files_xmlconfig = files(
131 'xmlconfig.c',
132 'xmlconfig.h',
133 )
134
135 format_srgb = custom_target(
136 'format_srgb',
137 input : ['format_srgb.py'],
138 output : 'format_srgb.c',
139 command : [prog_python, '@INPUT0@'],
140 capture : true,
141 )
142
143 deps_for_libmesa_util = [
144 dep_zlib,
145 dep_clock,
146 dep_thread,
147 dep_atomic,
148 dep_m,
149 dep_valgrind,
150 ]
151
152 if with_platform_android
153 deps_for_libmesa_util += dep_android
154 endif
155
156 _libmesa_util = static_library(
157 'mesa_util',
158 [files_mesa_util, format_srgb],
159 include_directories : inc_common,
160 dependencies : deps_for_libmesa_util,
161 c_args : [c_msvc_compat_args, c_vis_args],
162 build_by_default : false
163 )
164
165 idep_mesautil = declare_dependency(
166 link_with : _libmesa_util,
167 include_directories : inc_util,
168 dependencies : [dep_zlib, dep_clock, dep_thread, dep_atomic, dep_m],
169 )
170
171 _libxmlconfig = static_library(
172 'xmlconfig',
173 files_xmlconfig,
174 include_directories : inc_common,
175 dependencies : [idep_mesautil, dep_expat, dep_m],
176 c_args : [
177 c_msvc_compat_args, c_vis_args,
178 '-DSYSCONFDIR="@0@"'.format(
179 join_paths(get_option('prefix'), get_option('sysconfdir'))
180 ),
181 '-DDATADIR="@0@"'.format(
182 join_paths(get_option('prefix'), get_option('datadir'))
183 ),
184 ],
185 build_by_default : false,
186 )
187
188 idep_xmlconfig = declare_dependency(
189 sources : xmlpool_options_h,
190 include_directories : inc_util,
191 link_with : _libxmlconfig,
192 dependencies : dep_expat,
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 'roundeven',
222 executable(
223 'roundeven_test',
224 files('roundeven_test.c'),
225 include_directories : inc_common,
226 c_args : [c_msvc_compat_args],
227 dependencies : [dep_m],
228 ),
229 suite : ['util'],
230 )
231
232 test(
233 'mesa-sha1',
234 executable(
235 'mesa-sha1_test',
236 files('mesa-sha1_test.c'),
237 include_directories : inc_common,
238 dependencies : idep_mesautil,
239 c_args : [c_msvc_compat_args],
240 ),
241 suite : ['util'],
242 )
243
244 test(
245 'bitset',
246 executable(
247 'bitset_test',
248 files('bitset_test.cpp'),
249 include_directories : inc_common,
250 dependencies : [idep_mesautil, idep_gtest],
251 ),
252 suite : ['util'],
253 )
254
255 subdir('tests/fast_idiv_by_const')
256 subdir('tests/fast_urem_by_const')
257 subdir('tests/hash_table')
258 subdir('tests/string_buffer')
259 subdir('tests/timespec')
260 subdir('tests/vma')
261 subdir('tests/set')
262 endif