meson.build revision 8a1362ad
101e04c3fSmrg# Copyright © 2017 Intel Corporation
201e04c3fSmrg
301e04c3fSmrg# Permission is hereby granted, free of charge, to any person obtaining a copy
401e04c3fSmrg# of this software and associated documentation files (the "Software"), to deal
501e04c3fSmrg# in the Software without restriction, including without limitation the rights
601e04c3fSmrg# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
701e04c3fSmrg# copies of the Software, and to permit persons to whom the Software is
801e04c3fSmrg# furnished to do so, subject to the following conditions:
901e04c3fSmrg
1001e04c3fSmrg# The above copyright notice and this permission notice shall be included in
1101e04c3fSmrg# all copies or substantial portions of the Software.
1201e04c3fSmrg
1301e04c3fSmrg# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1401e04c3fSmrg# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1501e04c3fSmrg# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1601e04c3fSmrg# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1701e04c3fSmrg# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1801e04c3fSmrg# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1901e04c3fSmrg# SOFTWARE.
2001e04c3fSmrg
2101e04c3fSmrginc_util = include_directories('.')
2201e04c3fSmrg
2301e04c3fSmrgsubdir('xmlpool')
2401e04c3fSmrg
2501e04c3fSmrgfiles_mesa_util = files(
2601e04c3fSmrg  'bigmath.h',
2701e04c3fSmrg  'bitscan.c',
2801e04c3fSmrg  'bitscan.h',
2901e04c3fSmrg  'bitset.h',
3001e04c3fSmrg  'build_id.c',
3101e04c3fSmrg  'build_id.h',
3201e04c3fSmrg  'crc32.c',
3301e04c3fSmrg  'crc32.h',
348a1362adSmaya  'dag.c',
3501e04c3fSmrg  'debug.c',
3601e04c3fSmrg  'debug.h',
3701e04c3fSmrg  'disk_cache.c',
3801e04c3fSmrg  'disk_cache.h',
3901e04c3fSmrg  'fast_idiv_by_const.c',
4001e04c3fSmrg  'fast_idiv_by_const.h',
4101e04c3fSmrg  'format_r11g11b10f.h',
4201e04c3fSmrg  'format_rgb9e5.h',
4301e04c3fSmrg  'format_srgb.h',
4401e04c3fSmrg  'futex.h',
4501e04c3fSmrg  'half_float.c',
4601e04c3fSmrg  'half_float.h',
4701e04c3fSmrg  'hash_table.c',
4801e04c3fSmrg  'hash_table.h',
4901e04c3fSmrg  'list.h',
5001e04c3fSmrg  'macros.h',
5101e04c3fSmrg  'mesa-sha1.c',
5201e04c3fSmrg  'mesa-sha1.h',
5301e04c3fSmrg  'os_time.c',
5401e04c3fSmrg  'os_time.h',
558a1362adSmaya  'os_file.c',
5601e04c3fSmrg  'os_misc.c',
5701e04c3fSmrg  'os_misc.h',
5801e04c3fSmrg  'u_process.c',
5901e04c3fSmrg  'u_process.h',
6001e04c3fSmrg  'sha1/sha1.c',
6101e04c3fSmrg  'sha1/sha1.h',
6201e04c3fSmrg  'ralloc.c',
6301e04c3fSmrg  'ralloc.h',
6401e04c3fSmrg  'rand_xor.c',
6501e04c3fSmrg  'rand_xor.h',
6601e04c3fSmrg  'rb_tree.c',
6701e04c3fSmrg  'rb_tree.h',
6801e04c3fSmrg  'register_allocate.c',
6901e04c3fSmrg  'register_allocate.h',
7001e04c3fSmrg  'rgtc.c',
7101e04c3fSmrg  'rgtc.h',
7201e04c3fSmrg  'rounding.h',
7301e04c3fSmrg  'set.c',
7401e04c3fSmrg  'set.h',
7501e04c3fSmrg  'simple_list.h',
7601e04c3fSmrg  'simple_mtx.h',
7701e04c3fSmrg  'slab.c',
7801e04c3fSmrg  'slab.h',
7901e04c3fSmrg  'string_buffer.c',
8001e04c3fSmrg  'string_buffer.h',
8101e04c3fSmrg  'strndup.h',
8201e04c3fSmrg  'strtod.c',
8301e04c3fSmrg  'strtod.h',
8401e04c3fSmrg  'texcompress_rgtc_tmp.h',
8501e04c3fSmrg  'u_atomic.c',
8601e04c3fSmrg  'u_atomic.h',
8701e04c3fSmrg  'u_dynarray.h',
8801e04c3fSmrg  'u_endian.h',
8901e04c3fSmrg  'u_queue.c',
9001e04c3fSmrg  'u_queue.h',
9101e04c3fSmrg  'u_string.h',
9201e04c3fSmrg  'u_thread.h',
9301e04c3fSmrg  'u_vector.c',
9401e04c3fSmrg  'u_vector.h',
9501e04c3fSmrg  'u_math.c',
9601e04c3fSmrg  'u_math.h',
9701e04c3fSmrg  'u_debug.c',
9801e04c3fSmrg  'u_debug.h',
9901e04c3fSmrg  'u_cpu_detect.c',
10001e04c3fSmrg  'u_cpu_detect.h',
10101e04c3fSmrg  'vma.c',
10201e04c3fSmrg  'vma.h',
10301e04c3fSmrg)
10401e04c3fSmrg
1058a1362adSmayafiles_drirc = files('00-mesa-defaults.conf')
1068a1362adSmaya
1078a1362adSmayainstall_data(files_drirc, install_dir : join_paths(get_option('datadir'), 'drirc.d'))
1088a1362adSmaya
1098a1362adSmayaif with_tests
1108a1362adSmaya  prog_xmllint = find_program('xmllint', required : false, native : true)
1118a1362adSmaya  if prog_xmllint.found()
1128a1362adSmaya    test(
1138a1362adSmaya      'drirc xml validation',
1148a1362adSmaya      prog_xmllint,
1158a1362adSmaya      args : ['--noout', '--valid', files_drirc],
1168a1362adSmaya      suite : ['util'],
1178a1362adSmaya    )
1188a1362adSmaya  endif
1198a1362adSmayaendif
12001e04c3fSmrg
12101e04c3fSmrgfiles_xmlconfig = files(
12201e04c3fSmrg  'xmlconfig.c',
12301e04c3fSmrg  'xmlconfig.h',
12401e04c3fSmrg)
12501e04c3fSmrg
12601e04c3fSmrgformat_srgb = custom_target(
12701e04c3fSmrg  'format_srgb',
12801e04c3fSmrg  input : ['format_srgb.py'],
12901e04c3fSmrg  output : 'format_srgb.c',
13001e04c3fSmrg  command : [prog_python, '@INPUT0@'],
13101e04c3fSmrg  capture : true,
13201e04c3fSmrg)
13301e04c3fSmrg
13401e04c3fSmrglibmesa_util = static_library(
13501e04c3fSmrg  'mesa_util',
13601e04c3fSmrg  [files_mesa_util, format_srgb],
13701e04c3fSmrg  include_directories : inc_common,
13801e04c3fSmrg  dependencies : [dep_zlib, dep_clock, dep_thread, dep_atomic, dep_m],
13901e04c3fSmrg  c_args : [c_msvc_compat_args, c_vis_args],
14001e04c3fSmrg  build_by_default : false
14101e04c3fSmrg)
14201e04c3fSmrg
14301e04c3fSmrglibxmlconfig = static_library(
14401e04c3fSmrg  'xmlconfig',
14501e04c3fSmrg  files_xmlconfig,
14601e04c3fSmrg  include_directories : inc_common,
14701e04c3fSmrg  link_with : libmesa_util,
14801e04c3fSmrg  dependencies : [dep_expat, dep_m],
14901e04c3fSmrg  c_args : [
15001e04c3fSmrg    c_msvc_compat_args, c_vis_args,
15101e04c3fSmrg    '-DSYSCONFDIR="@0@"'.format(
15201e04c3fSmrg      join_paths(get_option('prefix'), get_option('sysconfdir'))
15301e04c3fSmrg    ),
15401e04c3fSmrg    '-DDATADIR="@0@"'.format(
15501e04c3fSmrg      join_paths(get_option('prefix'), get_option('datadir'))
15601e04c3fSmrg    ),
15701e04c3fSmrg  ],
15801e04c3fSmrg  build_by_default : false,
15901e04c3fSmrg)
16001e04c3fSmrg
16101e04c3fSmrgif with_tests
16201e04c3fSmrg  test(
16301e04c3fSmrg    'u_atomic',
16401e04c3fSmrg    executable(
16501e04c3fSmrg      'u_atomic_test',
16601e04c3fSmrg      files('u_atomic_test.c'),
16701e04c3fSmrg      include_directories : inc_common,
16801e04c3fSmrg      link_with : libmesa_util,
16901e04c3fSmrg      c_args : [c_msvc_compat_args],
1708a1362adSmaya    ),
1718a1362adSmaya    suite : ['util'],
17201e04c3fSmrg  )
17301e04c3fSmrg
17401e04c3fSmrg  test(
17501e04c3fSmrg    'roundeven',
17601e04c3fSmrg    executable(
17701e04c3fSmrg      'roundeven_test',
17801e04c3fSmrg      files('roundeven_test.c'),
17901e04c3fSmrg      include_directories : inc_common,
18001e04c3fSmrg      c_args : [c_msvc_compat_args],
18101e04c3fSmrg      dependencies : [dep_m],
1828a1362adSmaya    ),
1838a1362adSmaya    suite : ['util'],
18401e04c3fSmrg  )
18501e04c3fSmrg
18601e04c3fSmrg  test(
18701e04c3fSmrg    'mesa-sha1',
18801e04c3fSmrg    executable(
18901e04c3fSmrg      'mesa-sha1_test',
19001e04c3fSmrg      files('mesa-sha1_test.c'),
19101e04c3fSmrg      include_directories : inc_common,
19201e04c3fSmrg      link_with : libmesa_util,
19301e04c3fSmrg      c_args : [c_msvc_compat_args],
1948a1362adSmaya    ),
1958a1362adSmaya    suite : ['util'],
1968a1362adSmaya  )
1978a1362adSmaya
1988a1362adSmaya  test(
1998a1362adSmaya    'bitset',
2008a1362adSmaya    executable(
2018a1362adSmaya       'bitset_test',
2028a1362adSmaya       files('bitset_test.cpp'),
2038a1362adSmaya       include_directories : inc_common,
2048a1362adSmaya       dependencies : [dep_thread, dep_dl, idep_gtest],
2058a1362adSmaya       link_with : libmesa_util,
2068a1362adSmaya     ),
2078a1362adSmaya     suite : ['util'],
20801e04c3fSmrg  )
20901e04c3fSmrg
21001e04c3fSmrg  subdir('tests/fast_idiv_by_const')
21101e04c3fSmrg  subdir('tests/hash_table')
21201e04c3fSmrg  subdir('tests/string_buffer')
21301e04c3fSmrg  subdir('tests/vma')
21401e04c3fSmrg  subdir('tests/set')
21501e04c3fSmrgendif
216