2017-09-15 01:57:17 +01:00
|
|
|
# Copyright © 2017 Intel Corporation
|
|
|
|
|
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
# of this software and associated documentation files (the "Software"), to deal
|
|
|
|
# in the Software without restriction, including without limitation the rights
|
|
|
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
# copies of the Software, and to permit persons to whom the Software is
|
|
|
|
# furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
# The above copyright notice and this permission notice shall be included in
|
|
|
|
# all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
# SOFTWARE.
|
|
|
|
|
|
|
|
inc_util = include_directories('.')
|
|
|
|
|
2019-06-27 23:05:31 +01:00
|
|
|
subdir('format')
|
2017-09-21 04:11:32 +01:00
|
|
|
subdir('xmlpool')
|
|
|
|
|
2017-09-15 01:57:17 +01:00
|
|
|
files_mesa_util = files(
|
2018-01-18 20:29:14 +00:00
|
|
|
'anon_file.h',
|
|
|
|
'anon_file.c',
|
2017-12-29 21:30:32 +00:00
|
|
|
'bigmath.h',
|
2017-09-15 01:57:17 +01:00
|
|
|
'bitscan.c',
|
|
|
|
'bitscan.h',
|
|
|
|
'bitset.h',
|
2019-09-18 20:32:00 +01:00
|
|
|
'blob.c',
|
|
|
|
'blob.h',
|
2017-09-15 01:57:17 +01:00
|
|
|
'build_id.c',
|
|
|
|
'build_id.h',
|
|
|
|
'crc32.c',
|
|
|
|
'crc32.h',
|
2019-02-27 19:12:59 +00:00
|
|
|
'dag.c',
|
2017-09-15 01:57:17 +01:00
|
|
|
'debug.c',
|
|
|
|
'debug.h',
|
|
|
|
'disk_cache.c',
|
|
|
|
'disk_cache.h',
|
2018-09-06 15:01:34 +01:00
|
|
|
'double.c',
|
|
|
|
'double.h',
|
2018-09-23 17:57:51 +01:00
|
|
|
'fast_idiv_by_const.c',
|
|
|
|
'fast_idiv_by_const.h',
|
2017-09-15 01:57:17 +01:00
|
|
|
'format_r11g11b10f.h',
|
|
|
|
'format_rgb9e5.h',
|
|
|
|
'format_srgb.h',
|
2017-10-22 16:38:26 +01:00
|
|
|
'futex.h',
|
2017-09-15 01:57:17 +01:00
|
|
|
'half_float.c',
|
|
|
|
'half_float.h',
|
|
|
|
'hash_table.c',
|
|
|
|
'hash_table.h',
|
|
|
|
'list.h',
|
|
|
|
'macros.h',
|
|
|
|
'mesa-sha1.c',
|
|
|
|
'mesa-sha1.h',
|
2017-10-22 16:38:44 +01:00
|
|
|
'os_time.c',
|
|
|
|
'os_time.h',
|
2019-01-28 15:44:12 +00:00
|
|
|
'os_file.c',
|
2018-10-29 18:21:07 +00:00
|
|
|
'os_misc.c',
|
|
|
|
'os_misc.h',
|
2018-07-10 23:00:13 +01:00
|
|
|
'u_process.c',
|
|
|
|
'u_process.h',
|
2017-09-15 01:57:17 +01:00
|
|
|
'sha1/sha1.c',
|
|
|
|
'sha1/sha1.h',
|
|
|
|
'ralloc.c',
|
|
|
|
'ralloc.h',
|
|
|
|
'rand_xor.c',
|
|
|
|
'rand_xor.h',
|
2018-04-05 16:21:49 +01:00
|
|
|
'rb_tree.c',
|
|
|
|
'rb_tree.h',
|
2017-09-15 01:57:17 +01:00
|
|
|
'register_allocate.c',
|
|
|
|
'register_allocate.h',
|
|
|
|
'rgtc.c',
|
|
|
|
'rgtc.h',
|
|
|
|
'rounding.h',
|
|
|
|
'set.c',
|
|
|
|
'set.h',
|
|
|
|
'simple_list.h',
|
2017-10-16 08:06:49 +01:00
|
|
|
'simple_mtx.h',
|
2017-09-15 01:57:17 +01:00
|
|
|
'slab.c',
|
|
|
|
'slab.h',
|
2019-02-12 08:51:31 +00:00
|
|
|
'softfloat.c',
|
|
|
|
'softfloat.h',
|
2019-10-05 20:07:50 +01:00
|
|
|
'sparse_array.c',
|
|
|
|
'sparse_array.h',
|
2017-09-15 01:57:17 +01:00
|
|
|
'string_buffer.c',
|
|
|
|
'string_buffer.h',
|
|
|
|
'strndup.h',
|
|
|
|
'strtod.c',
|
|
|
|
'strtod.h',
|
|
|
|
'texcompress_rgtc_tmp.h',
|
2019-07-29 10:54:04 +01:00
|
|
|
'timespec.h',
|
2017-09-15 01:57:17 +01:00
|
|
|
'u_atomic.c',
|
|
|
|
'u_atomic.h',
|
|
|
|
'u_dynarray.h',
|
|
|
|
'u_endian.h',
|
|
|
|
'u_queue.c',
|
|
|
|
'u_queue.h',
|
|
|
|
'u_string.h',
|
|
|
|
'u_thread.h',
|
|
|
|
'u_vector.c',
|
|
|
|
'u_vector.h',
|
2018-08-17 01:20:38 +01:00
|
|
|
'u_math.c',
|
|
|
|
'u_math.h',
|
2018-10-01 19:55:27 +01:00
|
|
|
'u_debug.c',
|
|
|
|
'u_debug.h',
|
2018-10-01 19:59:21 +01:00
|
|
|
'u_cpu_detect.c',
|
|
|
|
'u_cpu_detect.h',
|
2018-01-07 01:28:01 +00:00
|
|
|
'vma.c',
|
|
|
|
'vma.h',
|
2017-09-15 01:57:17 +01:00
|
|
|
)
|
|
|
|
|
2019-02-26 12:32:04 +00:00
|
|
|
files_drirc = files('00-mesa-defaults.conf')
|
|
|
|
|
|
|
|
install_data(files_drirc, install_dir : join_paths(get_option('datadir'), 'drirc.d'))
|
|
|
|
|
|
|
|
if with_tests
|
|
|
|
prog_xmllint = find_program('xmllint', required : false, native : true)
|
|
|
|
if prog_xmllint.found()
|
|
|
|
test(
|
|
|
|
'drirc xml validation',
|
|
|
|
prog_xmllint,
|
|
|
|
args : ['--noout', '--valid', files_drirc],
|
|
|
|
suite : ['util'],
|
|
|
|
)
|
|
|
|
endif
|
|
|
|
endif
|
2017-09-15 01:57:17 +01:00
|
|
|
|
|
|
|
files_xmlconfig = files(
|
|
|
|
'xmlconfig.c',
|
|
|
|
'xmlconfig.h',
|
|
|
|
)
|
|
|
|
|
|
|
|
format_srgb = custom_target(
|
|
|
|
'format_srgb',
|
|
|
|
input : ['format_srgb.py'],
|
|
|
|
output : 'format_srgb.c',
|
2018-08-09 09:27:26 +01:00
|
|
|
command : [prog_python, '@INPUT0@'],
|
2017-09-15 01:57:17 +01:00
|
|
|
capture : true,
|
|
|
|
)
|
|
|
|
|
2019-09-03 19:43:40 +01:00
|
|
|
deps_for_libmesa_util = [
|
|
|
|
dep_zlib,
|
|
|
|
dep_clock,
|
|
|
|
dep_thread,
|
|
|
|
dep_atomic,
|
|
|
|
dep_m,
|
2019-09-18 20:32:00 +01:00
|
|
|
dep_valgrind,
|
2019-10-31 20:26:00 +00:00
|
|
|
dep_zstd,
|
2019-09-03 19:43:40 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
if with_platform_android
|
|
|
|
deps_for_libmesa_util += dep_android
|
|
|
|
endif
|
|
|
|
|
2019-07-22 14:50:15 +01:00
|
|
|
_libmesa_util = static_library(
|
2017-09-15 01:57:17 +01:00
|
|
|
'mesa_util',
|
|
|
|
[files_mesa_util, format_srgb],
|
|
|
|
include_directories : inc_common,
|
2019-09-03 19:43:40 +01:00
|
|
|
dependencies : deps_for_libmesa_util,
|
2019-06-27 23:05:31 +01:00
|
|
|
link_with: libmesa_format,
|
2017-09-15 01:57:17 +01:00
|
|
|
c_args : [c_msvc_compat_args, c_vis_args],
|
|
|
|
build_by_default : false
|
|
|
|
)
|
|
|
|
|
2019-07-22 14:50:15 +01:00
|
|
|
idep_mesautil = declare_dependency(
|
|
|
|
link_with : _libmesa_util,
|
|
|
|
include_directories : inc_util,
|
|
|
|
dependencies : [dep_zlib, dep_clock, dep_thread, dep_atomic, dep_m],
|
|
|
|
)
|
|
|
|
|
2019-07-22 15:25:28 +01:00
|
|
|
_libxmlconfig = static_library(
|
2017-09-15 01:57:17 +01:00
|
|
|
'xmlconfig',
|
|
|
|
files_xmlconfig,
|
|
|
|
include_directories : inc_common,
|
2019-07-22 14:50:15 +01:00
|
|
|
dependencies : [idep_mesautil, dep_expat, dep_m],
|
2018-01-23 18:28:08 +00:00
|
|
|
c_args : [
|
|
|
|
c_msvc_compat_args, c_vis_args,
|
|
|
|
'-DSYSCONFDIR="@0@"'.format(
|
|
|
|
join_paths(get_option('prefix'), get_option('sysconfdir'))
|
|
|
|
),
|
2018-08-06 04:41:33 +01:00
|
|
|
'-DDATADIR="@0@"'.format(
|
|
|
|
join_paths(get_option('prefix'), get_option('datadir'))
|
|
|
|
),
|
2018-01-23 18:28:08 +00:00
|
|
|
],
|
2017-09-15 01:57:17 +01:00
|
|
|
build_by_default : false,
|
|
|
|
)
|
|
|
|
|
2019-10-27 00:48:36 +01:00
|
|
|
idep_xmlconfig = declare_dependency(
|
|
|
|
dependencies : [idep_xmlconfig_headers, dep_expat],
|
2019-07-22 15:25:28 +01:00
|
|
|
link_with : _libxmlconfig,
|
2019-05-22 16:37:10 +01:00
|
|
|
)
|
|
|
|
|
2017-09-15 01:57:17 +01:00
|
|
|
if with_tests
|
2017-12-12 00:13:31 +00:00
|
|
|
test(
|
|
|
|
'u_atomic',
|
|
|
|
executable(
|
|
|
|
'u_atomic_test',
|
|
|
|
files('u_atomic_test.c'),
|
|
|
|
include_directories : inc_common,
|
2019-07-22 14:50:15 +01:00
|
|
|
dependencies : idep_mesautil,
|
2019-09-18 20:32:00 +01:00
|
|
|
c_args : [c_msvc_compat_args],
|
|
|
|
),
|
|
|
|
suite : ['util'],
|
|
|
|
)
|
|
|
|
|
|
|
|
test(
|
|
|
|
'blob',
|
|
|
|
executable(
|
|
|
|
'blob_test',
|
|
|
|
files('blob_test.c'),
|
|
|
|
include_directories : inc_common,
|
|
|
|
dependencies : idep_mesautil,
|
2019-09-19 21:05:51 +01:00
|
|
|
c_args : [c_msvc_compat_args],
|
|
|
|
),
|
|
|
|
suite : ['util'],
|
|
|
|
)
|
|
|
|
|
|
|
|
test(
|
|
|
|
'rb_tree',
|
|
|
|
executable(
|
|
|
|
'rb_tree_test',
|
|
|
|
files('rb_tree_test.c'),
|
|
|
|
include_directories : inc_common,
|
|
|
|
dependencies : idep_mesautil,
|
2017-12-12 00:13:31 +00:00
|
|
|
c_args : [c_msvc_compat_args],
|
2018-11-19 21:44:15 +00:00
|
|
|
),
|
|
|
|
suite : ['util'],
|
2017-09-15 01:57:17 +01:00
|
|
|
)
|
|
|
|
|
2017-12-12 00:13:31 +00:00
|
|
|
test(
|
|
|
|
'roundeven',
|
|
|
|
executable(
|
|
|
|
'roundeven_test',
|
|
|
|
files('roundeven_test.c'),
|
|
|
|
include_directories : inc_common,
|
|
|
|
c_args : [c_msvc_compat_args],
|
|
|
|
dependencies : [dep_m],
|
2018-11-19 21:44:15 +00:00
|
|
|
),
|
|
|
|
suite : ['util'],
|
2017-09-15 01:57:17 +01:00
|
|
|
)
|
|
|
|
|
2018-05-23 01:32:21 +01:00
|
|
|
# FIXME: this test crashes on windows
|
|
|
|
if host_machine.system() != 'windows'
|
|
|
|
test(
|
|
|
|
'mesa-sha1',
|
|
|
|
executable(
|
|
|
|
'mesa-sha1_test',
|
|
|
|
files('mesa-sha1_test.c'),
|
|
|
|
include_directories : inc_common,
|
|
|
|
link_with : _libmesa_util,
|
|
|
|
c_args : [c_msvc_compat_args],
|
|
|
|
),
|
|
|
|
suite : ['util'],
|
|
|
|
)
|
|
|
|
endif
|
2017-11-27 11:33:48 +00:00
|
|
|
|
2019-04-29 03:24:58 +01:00
|
|
|
test(
|
|
|
|
'bitset',
|
|
|
|
executable(
|
|
|
|
'bitset_test',
|
|
|
|
files('bitset_test.cpp'),
|
|
|
|
include_directories : inc_common,
|
2019-07-23 11:25:53 +01:00
|
|
|
dependencies : [idep_mesautil, idep_gtest],
|
2019-04-29 03:24:58 +01:00
|
|
|
),
|
|
|
|
suite : ['util'],
|
|
|
|
)
|
|
|
|
|
2018-09-13 15:56:20 +01:00
|
|
|
subdir('tests/fast_idiv_by_const')
|
2019-03-29 14:08:17 +00:00
|
|
|
subdir('tests/fast_urem_by_const')
|
2017-09-15 01:57:17 +01:00
|
|
|
subdir('tests/hash_table')
|
2019-10-08 21:38:01 +01:00
|
|
|
if not (host_machine.system() == 'windows' and cc.get_id() == 'gcc')
|
|
|
|
# FIXME: These tests fail with mingw, but not with msvc.
|
|
|
|
subdir('tests/string_buffer')
|
|
|
|
endif
|
2019-09-20 20:19:52 +01:00
|
|
|
if cc.has_header('sys/time.h') # MinGW has this, but Vanilla windows doesn't
|
|
|
|
subdir('tests/timespec')
|
|
|
|
endif
|
2018-05-05 01:11:13 +01:00
|
|
|
subdir('tests/vma')
|
2018-07-06 19:26:13 +01:00
|
|
|
subdir('tests/set')
|
2019-10-05 20:07:50 +01:00
|
|
|
subdir('tests/sparse_array')
|
2017-09-15 01:57:17 +01:00
|
|
|
endif
|