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