meson.build revision b8e80941
1b8e80941Smrg# Copyright © 2017 Intel Corporation
2b8e80941Smrg
3b8e80941Smrg# Permission is hereby granted, free of charge, to any person obtaining a copy
4b8e80941Smrg# of this software and associated documentation files (the "Software"), to deal
5b8e80941Smrg# in the Software without restriction, including without limitation the rights
6b8e80941Smrg# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7b8e80941Smrg# copies of the Software, and to permit persons to whom the Software is
8b8e80941Smrg# furnished to do so, subject to the following conditions:
9b8e80941Smrg
10b8e80941Smrg# The above copyright notice and this permission notice shall be included in
11b8e80941Smrg# all copies or substantial portions of the Software.
12b8e80941Smrg
13b8e80941Smrg# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14b8e80941Smrg# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15b8e80941Smrg# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16b8e80941Smrg# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17b8e80941Smrg# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18b8e80941Smrg# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19b8e80941Smrg# SOFTWARE.
20b8e80941Smrg
21b8e80941Smrginc_util = include_directories('.')
22b8e80941Smrg
23b8e80941Smrgsubdir('xmlpool')
24b8e80941Smrg
25b8e80941Smrgfiles_mesa_util = files(
26b8e80941Smrg  'bigmath.h',
27b8e80941Smrg  'bitscan.c',
28b8e80941Smrg  'bitscan.h',
29b8e80941Smrg  'bitset.h',
30b8e80941Smrg  'build_id.c',
31b8e80941Smrg  'build_id.h',
32b8e80941Smrg  'crc32.c',
33b8e80941Smrg  'crc32.h',
34b8e80941Smrg  'dag.c',
35b8e80941Smrg  'debug.c',
36b8e80941Smrg  'debug.h',
37b8e80941Smrg  'disk_cache.c',
38b8e80941Smrg  'disk_cache.h',
39b8e80941Smrg  'fast_idiv_by_const.c',
40b8e80941Smrg  'fast_idiv_by_const.h',
41b8e80941Smrg  'format_r11g11b10f.h',
42b8e80941Smrg  'format_rgb9e5.h',
43b8e80941Smrg  'format_srgb.h',
44b8e80941Smrg  'futex.h',
45b8e80941Smrg  'half_float.c',
46b8e80941Smrg  'half_float.h',
47b8e80941Smrg  'hash_table.c',
48b8e80941Smrg  'hash_table.h',
49b8e80941Smrg  'list.h',
50b8e80941Smrg  'macros.h',
51b8e80941Smrg  'mesa-sha1.c',
52b8e80941Smrg  'mesa-sha1.h',
53b8e80941Smrg  'os_time.c',
54b8e80941Smrg  'os_time.h',
55b8e80941Smrg  'os_file.c',
56b8e80941Smrg  'os_misc.c',
57b8e80941Smrg  'os_misc.h',
58b8e80941Smrg  'u_process.c',
59b8e80941Smrg  'u_process.h',
60b8e80941Smrg  'sha1/sha1.c',
61b8e80941Smrg  'sha1/sha1.h',
62b8e80941Smrg  'ralloc.c',
63b8e80941Smrg  'ralloc.h',
64b8e80941Smrg  'rand_xor.c',
65b8e80941Smrg  'rand_xor.h',
66b8e80941Smrg  'rb_tree.c',
67b8e80941Smrg  'rb_tree.h',
68b8e80941Smrg  'register_allocate.c',
69b8e80941Smrg  'register_allocate.h',
70b8e80941Smrg  'rgtc.c',
71b8e80941Smrg  'rgtc.h',
72b8e80941Smrg  'rounding.h',
73b8e80941Smrg  'set.c',
74b8e80941Smrg  'set.h',
75b8e80941Smrg  'simple_list.h',
76b8e80941Smrg  'simple_mtx.h',
77b8e80941Smrg  'slab.c',
78b8e80941Smrg  'slab.h',
79b8e80941Smrg  'string_buffer.c',
80b8e80941Smrg  'string_buffer.h',
81b8e80941Smrg  'strndup.h',
82b8e80941Smrg  'strtod.c',
83b8e80941Smrg  'strtod.h',
84b8e80941Smrg  'texcompress_rgtc_tmp.h',
85b8e80941Smrg  'u_atomic.c',
86b8e80941Smrg  'u_atomic.h',
87b8e80941Smrg  'u_dynarray.h',
88b8e80941Smrg  'u_endian.h',
89b8e80941Smrg  'u_queue.c',
90b8e80941Smrg  'u_queue.h',
91b8e80941Smrg  'u_string.h',
92b8e80941Smrg  'u_thread.h',
93b8e80941Smrg  'u_vector.c',
94b8e80941Smrg  'u_vector.h',
95b8e80941Smrg  'u_math.c',
96b8e80941Smrg  'u_math.h',
97b8e80941Smrg  'u_debug.c',
98b8e80941Smrg  'u_debug.h',
99b8e80941Smrg  'u_cpu_detect.c',
100b8e80941Smrg  'u_cpu_detect.h',
101b8e80941Smrg  'vma.c',
102b8e80941Smrg  'vma.h',
103b8e80941Smrg)
104b8e80941Smrg
105b8e80941Smrgfiles_drirc = files('00-mesa-defaults.conf')
106b8e80941Smrg
107b8e80941Smrginstall_data(files_drirc, install_dir : join_paths(get_option('datadir'), 'drirc.d'))
108b8e80941Smrg
109b8e80941Smrgif with_tests
110b8e80941Smrg  prog_xmllint = find_program('xmllint', required : false, native : true)
111b8e80941Smrg  if prog_xmllint.found()
112b8e80941Smrg    test(
113b8e80941Smrg      'drirc xml validation',
114b8e80941Smrg      prog_xmllint,
115b8e80941Smrg      args : ['--noout', '--valid', files_drirc],
116b8e80941Smrg      suite : ['util'],
117b8e80941Smrg    )
118b8e80941Smrg  endif
119b8e80941Smrgendif
120b8e80941Smrg
121b8e80941Smrgfiles_xmlconfig = files(
122b8e80941Smrg  'xmlconfig.c',
123b8e80941Smrg  'xmlconfig.h',
124b8e80941Smrg)
125b8e80941Smrg
126b8e80941Smrgformat_srgb = custom_target(
127b8e80941Smrg  'format_srgb',
128b8e80941Smrg  input : ['format_srgb.py'],
129b8e80941Smrg  output : 'format_srgb.c',
130b8e80941Smrg  command : [prog_python, '@INPUT0@'],
131b8e80941Smrg  capture : true,
132b8e80941Smrg)
133b8e80941Smrg
134b8e80941Smrglibmesa_util = static_library(
135b8e80941Smrg  'mesa_util',
136b8e80941Smrg  [files_mesa_util, format_srgb],
137b8e80941Smrg  include_directories : inc_common,
138b8e80941Smrg  dependencies : [dep_zlib, dep_clock, dep_thread, dep_atomic, dep_m],
139b8e80941Smrg  c_args : [c_msvc_compat_args, c_vis_args],
140b8e80941Smrg  build_by_default : false
141b8e80941Smrg)
142b8e80941Smrg
143b8e80941Smrglibxmlconfig = static_library(
144b8e80941Smrg  'xmlconfig',
145b8e80941Smrg  files_xmlconfig,
146b8e80941Smrg  include_directories : inc_common,
147b8e80941Smrg  link_with : libmesa_util,
148b8e80941Smrg  dependencies : [dep_expat, dep_m],
149b8e80941Smrg  c_args : [
150b8e80941Smrg    c_msvc_compat_args, c_vis_args,
151b8e80941Smrg    '-DSYSCONFDIR="@0@"'.format(
152b8e80941Smrg      join_paths(get_option('prefix'), get_option('sysconfdir'))
153b8e80941Smrg    ),
154b8e80941Smrg    '-DDATADIR="@0@"'.format(
155b8e80941Smrg      join_paths(get_option('prefix'), get_option('datadir'))
156b8e80941Smrg    ),
157b8e80941Smrg  ],
158b8e80941Smrg  build_by_default : false,
159b8e80941Smrg)
160b8e80941Smrg
161b8e80941Smrgif with_tests
162b8e80941Smrg  test(
163b8e80941Smrg    'u_atomic',
164b8e80941Smrg    executable(
165b8e80941Smrg      'u_atomic_test',
166b8e80941Smrg      files('u_atomic_test.c'),
167b8e80941Smrg      include_directories : inc_common,
168b8e80941Smrg      link_with : libmesa_util,
169b8e80941Smrg      c_args : [c_msvc_compat_args],
170b8e80941Smrg    ),
171b8e80941Smrg    suite : ['util'],
172b8e80941Smrg  )
173b8e80941Smrg
174b8e80941Smrg  test(
175b8e80941Smrg    'roundeven',
176b8e80941Smrg    executable(
177b8e80941Smrg      'roundeven_test',
178b8e80941Smrg      files('roundeven_test.c'),
179b8e80941Smrg      include_directories : inc_common,
180b8e80941Smrg      c_args : [c_msvc_compat_args],
181b8e80941Smrg      dependencies : [dep_m],
182b8e80941Smrg    ),
183b8e80941Smrg    suite : ['util'],
184b8e80941Smrg  )
185b8e80941Smrg
186b8e80941Smrg  test(
187b8e80941Smrg    'mesa-sha1',
188b8e80941Smrg    executable(
189b8e80941Smrg      'mesa-sha1_test',
190b8e80941Smrg      files('mesa-sha1_test.c'),
191b8e80941Smrg      include_directories : inc_common,
192b8e80941Smrg      link_with : libmesa_util,
193b8e80941Smrg      c_args : [c_msvc_compat_args],
194b8e80941Smrg    ),
195b8e80941Smrg    suite : ['util'],
196b8e80941Smrg  )
197b8e80941Smrg
198b8e80941Smrg  test(
199b8e80941Smrg    'bitset',
200b8e80941Smrg    executable(
201b8e80941Smrg       'bitset_test',
202b8e80941Smrg       files('bitset_test.cpp'),
203b8e80941Smrg       include_directories : inc_common,
204b8e80941Smrg       dependencies : [dep_thread, dep_dl, idep_gtest],
205b8e80941Smrg       link_with : libmesa_util,
206b8e80941Smrg     ),
207b8e80941Smrg     suite : ['util'],
208b8e80941Smrg  )
209b8e80941Smrg
210b8e80941Smrg  subdir('tests/fast_idiv_by_const')
211b8e80941Smrg  subdir('tests/hash_table')
212b8e80941Smrg  subdir('tests/string_buffer')
213b8e80941Smrg  subdir('tests/vma')
214b8e80941Smrg  subdir('tests/set')
215b8e80941Smrgendif
216