1 # Copyright © 2017 Intel Corporation
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:
10 # The above copyright notice and this permission notice shall be included in
11 # all copies or substantial portions of the Software.
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
21 inc_util = include_directories('.')
25 files_mesa_util = files(
50 'fast_idiv_by_const.c',
51 'fast_idiv_by_const.h',
52 'format_r11g11b10f.h',
83 'perf/u_trace_priv.h',
98 'register_allocate.c',
99 'register_allocate.h',
118 'texcompress_rgtc_tmp.h',
124 'u_debug_describe.c',
125 'u_debug_describe.h',
166 files_drirc = files('00-mesa-defaults.conf')
168 install_data(files_drirc, install_dir : join_paths(get_option('datadir'), 'drirc.d'))
171 prog_xmllint = find_program('xmllint', required : false, native : true)
172 if prog_xmllint.found()
174 'drirc xml validation',
176 args : ['--noout', '--valid', files_drirc],
182 files_xmlconfig = files(
187 files_xmlconfig += custom_target(
189 input: ['driconf_static.py', '00-mesa-defaults.conf'],
190 output: 'driconf_static.h',
192 prog_python, '@INPUT0@', '@INPUT1@', '@OUTPUT@'
196 format_srgb = custom_target(
198 input : ['format_srgb.py'],
199 output : 'format_srgb.c',
200 command : [prog_python, '@INPUT0@'],
204 deps_for_libmesa_util = [
218 if with_platform_android
219 deps_for_libmesa_util += dep_android
220 files_debug_stack = files('u_debug_stack_android.cpp')
222 files_debug_stack = files(
229 if with_platform_haiku
230 deps_for_libmesa_util += dep_network
234 files_mesa_util += files(
235 'perf/u_perfetto.cc',
238 deps_for_libmesa_util += dep_perfetto
241 u_trace_py = files('perf/u_trace.py')
243 libmesa_util_sse41 = static_library(
245 files('streaming-load-memcpy.c'),
246 c_args : [c_msvc_compat_args, sse41_args],
247 include_directories : [inc_include, inc_src, inc_mesa],
248 gnu_symbol_visibility : 'hidden',
251 _libmesa_util = static_library(
253 [files_mesa_util, files_debug_stack, format_srgb],
254 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
255 dependencies : deps_for_libmesa_util,
256 link_with: [libmesa_format, libmesa_util_sse41],
257 c_args : [c_msvc_compat_args],
258 gnu_symbol_visibility : 'hidden',
259 build_by_default : false
262 idep_mesautil = declare_dependency(
263 link_with : _libmesa_util,
264 include_directories : [inc_util, inc_gallium],
265 dependencies : [dep_zlib, dep_clock, dep_thread, dep_atomic, dep_m, dep_valgrind, dep_futex],
269 if not (with_platform_android or with_platform_windows)
270 xmlconfig_deps += dep_expat
272 xmlconfig_deps += dep_regex
274 _libxmlconfig = static_library(
277 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
278 dependencies : [idep_mesautil, dep_m, xmlconfig_deps],
281 '-DSYSCONFDIR="@0@"'.format(
282 join_paths(get_option('prefix'), get_option('sysconfdir'))
284 '-DDATADIR="@0@"'.format(
285 join_paths(get_option('prefix'), get_option('datadir'))
288 gnu_symbol_visibility : 'hidden',
289 build_by_default : false,
292 idep_xmlconfig = declare_dependency(
293 dependencies : xmlconfig_deps,
294 link_with : _libxmlconfig,
297 files_xxd = files('xxd.py')
298 glsl2spirv = files('glsl2spirv.py')
301 # DRI_CONF macros use designated initializers (required for union
302 # initializaiton), so we need c++2a since gtest forces us to use c++
303 if host_machine.system() != 'windows' and cpp.has_argument('-std=c++2a')
305 executable('xmlconfig_test',
306 files('tests/xmlconfig.cpp'),
307 include_directories : [inc_include, inc_src],
308 dependencies : [idep_mesautil, idep_xmlconfig, idep_gtest],
309 override_options : ['cpp_std=c++2a'],
310 cpp_args: ['-Wno-write-strings']
313 env: ['HOME=' + join_paths(meson.current_source_dir(),
314 'tests', 'drirc_home'),
315 'DRIRC_CONFIGDIR=' + join_paths(meson.current_source_dir(),
316 'tests', 'drirc_configdir')],
317 protocol : gtest_test_protocol,
321 files_util_tests = files(
322 'tests/bitset_test.cpp',
323 'tests/blob_test.cpp',
324 'tests/dag_test.cpp',
325 'tests/fast_idiv_by_const_test.cpp',
326 'tests/fast_urem_by_const_test.cpp',
327 'tests/half_float_test.cpp',
328 'tests/int_min_max.cpp',
329 'tests/mesa-sha1_test.cpp',
330 'tests/rb_tree_test.cpp',
331 'tests/register_allocate_test.cpp',
332 'tests/roundeven_test.cpp',
333 'tests/set_test.cpp',
334 'tests/string_buffer_test.cpp',
335 'tests/timespec_test.cpp',
336 'tests/u_atomic_test.cpp',
337 'tests/u_call_once_test.cpp',
338 'tests/u_debug_stack_test.cpp',
339 'tests/u_debug_test.cpp',
340 'tests/u_printf_test.cpp',
341 'tests/u_qsort_test.cpp',
342 'tests/vector_test.cpp',
345 # FIXME: this test cause a big timeout on MacOS
346 if host_machine.system() != 'darwin'
347 files_util_tests += files(
348 'tests/sparse_array_test.cpp',
353 files_util_tests += files(
354 'tests/cache_test.cpp',
363 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
364 dependencies : [idep_mesautil, idep_gtest],
367 protocol : gtest_test_protocol,
371 process_test_exe = executable(
373 files('tests/process_test.c'),
374 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
375 dependencies : idep_mesautil,
376 c_args : [c_msvc_compat_args],
378 if (host_machine.system() == 'windows' and build_machine.system() != 'windows')
379 # This conversion is only required on mingw crosscompilers, otherwise we hit at least one of these issues
380 # https://gitlab.freedesktop.org/mesa/mesa/-/issues/2690
381 # https://gitlab.freedesktop.org/mesa/mesa/-/issues/2788
382 prog_winepath = find_program('winepath')
383 process_test_exe_full_path = run_command(
384 prog_winepath, '-w', process_test_exe.full_path(),
388 process_test_exe_full_path = process_test_exe.full_path()
395 env: ['BUILD_FULL_PATH='+process_test_exe_full_path]
398 subdir('tests/hash_table')
400 subdir('tests/format')