95aff3b442fbdc18cf753a30fcb4a5246b9c9ce5
[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 'bigmath.h',
27 'bitscan.c',
28 'bitscan.h',
29 'bitset.h',
30 'build_id.c',
31 'build_id.h',
32 'crc32.c',
33 'crc32.h',
34 'dag.c',
35 'debug.c',
36 'debug.h',
37 'disk_cache.c',
38 'disk_cache.h',
39 'fast_idiv_by_const.c',
40 'fast_idiv_by_const.h',
41 'format_r11g11b10f.h',
42 'format_rgb9e5.h',
43 'format_srgb.h',
44 'futex.h',
45 'half_float.c',
46 'half_float.h',
47 'hash_table.c',
48 'hash_table.h',
49 'list.h',
50 'macros.h',
51 'mesa-sha1.c',
52 'mesa-sha1.h',
53 'os_time.c',
54 'os_time.h',
55 'os_file.c',
56 'os_misc.c',
57 'os_misc.h',
58 'u_process.c',
59 'u_process.h',
60 'sha1/sha1.c',
61 'sha1/sha1.h',
62 'ralloc.c',
63 'ralloc.h',
64 'rand_xor.c',
65 'rand_xor.h',
66 'rb_tree.c',
67 'rb_tree.h',
68 'register_allocate.c',
69 'register_allocate.h',
70 'rgtc.c',
71 'rgtc.h',
72 'rounding.h',
73 'set.c',
74 'set.h',
75 'simple_list.h',
76 'simple_mtx.h',
77 'slab.c',
78 'slab.h',
79 'string_buffer.c',
80 'string_buffer.h',
81 'strndup.h',
82 'strtod.c',
83 'strtod.h',
84 'texcompress_rgtc_tmp.h',
85 'timespec.h',
86 'u_atomic.c',
87 'u_atomic.h',
88 'u_dynarray.h',
89 'u_endian.h',
90 'u_queue.c',
91 'u_queue.h',
92 'u_string.h',
93 'u_thread.h',
94 'u_vector.c',
95 'u_vector.h',
96 'u_math.c',
97 'u_math.h',
98 'u_debug.c',
99 'u_debug.h',
100 'u_cpu_detect.c',
101 'u_cpu_detect.h',
102 'vma.c',
103 'vma.h',
104 )
105
106 files_drirc = files('00-mesa-defaults.conf')
107
108 install_data(files_drirc, install_dir : join_paths(get_option('datadir'), 'drirc.d'))
109
110 if with_tests
111 prog_xmllint = find_program('xmllint', required : false, native : true)
112 if prog_xmllint.found()
113 test(
114 'drirc xml validation',
115 prog_xmllint,
116 args : ['--noout', '--valid', files_drirc],
117 suite : ['util'],
118 )
119 endif
120 endif
121
122 files_xmlconfig = files(
123 'xmlconfig.c',
124 'xmlconfig.h',
125 )
126
127 format_srgb = custom_target(
128 'format_srgb',
129 input : ['format_srgb.py'],
130 output : 'format_srgb.c',
131 command : [prog_python, '@INPUT0@'],
132 capture : true,
133 )
134
135 _libmesa_util = static_library(
136 'mesa_util',
137 [files_mesa_util, format_srgb],
138 include_directories : inc_common,
139 dependencies : [dep_zlib, dep_clock, dep_thread, dep_atomic, dep_m],
140 c_args : [c_msvc_compat_args, c_vis_args],
141 build_by_default : false
142 )
143
144 idep_mesautil = declare_dependency(
145 link_with : _libmesa_util,
146 include_directories : inc_util,
147 dependencies : [dep_zlib, dep_clock, dep_thread, dep_atomic, dep_m],
148 )
149
150 _libxmlconfig = static_library(
151 'xmlconfig',
152 files_xmlconfig,
153 include_directories : inc_common,
154 dependencies : [idep_mesautil, dep_expat, dep_m],
155 c_args : [
156 c_msvc_compat_args, c_vis_args,
157 '-DSYSCONFDIR="@0@"'.format(
158 join_paths(get_option('prefix'), get_option('sysconfdir'))
159 ),
160 '-DDATADIR="@0@"'.format(
161 join_paths(get_option('prefix'), get_option('datadir'))
162 ),
163 ],
164 build_by_default : false,
165 )
166
167 idep_xmlconfig = declare_dependency(
168 sources : xmlpool_options_h,
169 include_directories : inc_util,
170 link_with : _libxmlconfig,
171 dependencies : dep_expat,
172 )
173
174 if with_tests
175 test(
176 'u_atomic',
177 executable(
178 'u_atomic_test',
179 files('u_atomic_test.c'),
180 include_directories : inc_common,
181 dependencies : idep_mesautil,
182 c_args : [c_msvc_compat_args],
183 ),
184 suite : ['util'],
185 )
186
187 test(
188 'roundeven',
189 executable(
190 'roundeven_test',
191 files('roundeven_test.c'),
192 include_directories : inc_common,
193 c_args : [c_msvc_compat_args],
194 dependencies : [dep_m],
195 ),
196 suite : ['util'],
197 )
198
199 test(
200 'mesa-sha1',
201 executable(
202 'mesa-sha1_test',
203 files('mesa-sha1_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 'bitset',
213 executable(
214 'bitset_test',
215 files('bitset_test.cpp'),
216 include_directories : inc_common,
217 dependencies : [idep_mesautil, idep_gtest],
218 ),
219 suite : ['util'],
220 )
221
222 subdir('tests/fast_idiv_by_const')
223 subdir('tests/fast_urem_by_const')
224 subdir('tests/hash_table')
225 subdir('tests/string_buffer')
226 subdir('tests/timespec')
227 subdir('tests/vma')
228 subdir('tests/set')
229 endif