67b6981d8b5745c8df2893de335746e3b24eab15
[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 'u_atomic.c',
86 'u_atomic.h',
87 'u_dynarray.h',
88 'u_endian.h',
89 'u_queue.c',
90 'u_queue.h',
91 'u_string.h',
92 'u_thread.h',
93 'u_vector.c',
94 'u_vector.h',
95 'u_math.c',
96 'u_math.h',
97 'u_debug.c',
98 'u_debug.h',
99 'u_cpu_detect.c',
100 'u_cpu_detect.h',
101 'vma.c',
102 'vma.h',
103 )
104
105 files_drirc = files('00-mesa-defaults.conf')
106
107 install_data(files_drirc, install_dir : join_paths(get_option('datadir'), 'drirc.d'))
108
109 if with_tests
110 prog_xmllint = find_program('xmllint', required : false, native : true)
111 if prog_xmllint.found()
112 test(
113 'drirc xml validation',
114 prog_xmllint,
115 args : ['--noout', '--valid', files_drirc],
116 suite : ['util'],
117 )
118 endif
119 endif
120
121 files_xmlconfig = files(
122 'xmlconfig.c',
123 'xmlconfig.h',
124 )
125
126 format_srgb = custom_target(
127 'format_srgb',
128 input : ['format_srgb.py'],
129 output : 'format_srgb.c',
130 command : [prog_python, '@INPUT0@'],
131 capture : true,
132 )
133
134 libmesa_util = static_library(
135 'mesa_util',
136 [files_mesa_util, format_srgb],
137 include_directories : inc_common,
138 dependencies : [dep_zlib, dep_clock, dep_thread, dep_atomic, dep_m],
139 c_args : [c_msvc_compat_args, c_vis_args],
140 build_by_default : false
141 )
142
143 libxmlconfig = static_library(
144 'xmlconfig',
145 files_xmlconfig,
146 include_directories : inc_common,
147 link_with : libmesa_util,
148 dependencies : [dep_expat, dep_m],
149 c_args : [
150 c_msvc_compat_args, c_vis_args,
151 '-DSYSCONFDIR="@0@"'.format(
152 join_paths(get_option('prefix'), get_option('sysconfdir'))
153 ),
154 '-DDATADIR="@0@"'.format(
155 join_paths(get_option('prefix'), get_option('datadir'))
156 ),
157 ],
158 build_by_default : false,
159 )
160
161 idep_xmlconfig = declare_dependency(
162 sources : xmlpool_options_h,
163 include_directories : inc_util,
164 link_with : libxmlconfig,
165 dependencies : dep_expat,
166 )
167
168 if with_tests
169 test(
170 'u_atomic',
171 executable(
172 'u_atomic_test',
173 files('u_atomic_test.c'),
174 include_directories : inc_common,
175 link_with : libmesa_util,
176 c_args : [c_msvc_compat_args],
177 ),
178 suite : ['util'],
179 )
180
181 test(
182 'roundeven',
183 executable(
184 'roundeven_test',
185 files('roundeven_test.c'),
186 include_directories : inc_common,
187 c_args : [c_msvc_compat_args],
188 dependencies : [dep_m],
189 ),
190 suite : ['util'],
191 )
192
193 test(
194 'mesa-sha1',
195 executable(
196 'mesa-sha1_test',
197 files('mesa-sha1_test.c'),
198 include_directories : inc_common,
199 link_with : libmesa_util,
200 c_args : [c_msvc_compat_args],
201 ),
202 suite : ['util'],
203 )
204
205 test(
206 'bitset',
207 executable(
208 'bitset_test',
209 files('bitset_test.cpp'),
210 include_directories : inc_common,
211 dependencies : [dep_thread, dep_dl, idep_gtest],
212 link_with : libmesa_util,
213 ),
214 suite : ['util'],
215 )
216
217 subdir('tests/fast_idiv_by_const')
218 subdir('tests/fast_urem_by_const')
219 subdir('tests/hash_table')
220 subdir('tests/string_buffer')
221 subdir('tests/vma')
222 subdir('tests/set')
223 endif