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',
162 'indices/u_indices.h',
163 'indices/u_indices_priv.h',
164 'indices/u_primconvert.c',
165 'indices/u_primconvert.h',
170 files_drirc = files('00-mesa-defaults.conf')
172 install_data(files_drirc, install_dir : join_paths(get_option('datadir'), 'drirc.d'))
175 prog_xmllint = find_program('xmllint', required : false, native : true)
176 if prog_xmllint.found()
178 'drirc xml validation',
180 args : ['--noout', '--valid', files_drirc],
186 files_xmlconfig = files(
191 files_xmlconfig += custom_target(
193 input: ['driconf_static.py', '00-mesa-defaults.conf'],
194 output: 'driconf_static.h',
196 prog_python, '@INPUT0@', '@INPUT1@', '@OUTPUT@'
200 format_srgb = custom_target(
202 input : ['format_srgb.py'],
203 output : 'format_srgb.c',
204 command : [prog_python, '@INPUT0@'],
208 deps_for_libmesa_util = [
222 if with_platform_android
223 deps_for_libmesa_util += dep_android
224 files_debug_stack = files('u_debug_stack_android.cpp')
226 files_debug_stack = files(
233 if with_platform_haiku
234 deps_for_libmesa_util += dep_network
238 files_mesa_util += files(
239 'perf/u_perfetto.cc',
242 deps_for_libmesa_util += dep_perfetto
245 u_trace_py = files('perf/u_trace.py')
247 u_indices_gen_c = custom_target(
249 input : 'indices/u_indices_gen.py',
250 output : 'u_indices_gen.c',
251 command : [prog_python, '@INPUT@', '@OUTPUT@'],
254 u_unfilled_gen_c = custom_target(
256 input : 'indices/u_unfilled_gen.py',
257 output : 'u_unfilled_gen.c',
258 command : [prog_python, '@INPUT@', '@OUTPUT@'],
261 libmesa_util_sse41 = static_library(
263 files('streaming-load-memcpy.c'),
264 c_args : [c_msvc_compat_args, sse41_args],
265 include_directories : [inc_include, inc_src, inc_mesa],
266 gnu_symbol_visibility : 'hidden',
269 _libmesa_util = static_library(
271 [files_mesa_util, files_debug_stack, format_srgb, u_indices_gen_c, u_unfilled_gen_c],
272 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
273 dependencies : deps_for_libmesa_util,
274 link_with: [libmesa_format, libmesa_util_sse41],
275 c_args : [c_msvc_compat_args],
276 gnu_symbol_visibility : 'hidden',
277 build_by_default : false
280 idep_mesautil = declare_dependency(
281 link_with : _libmesa_util,
282 include_directories : [inc_util, inc_gallium],
283 dependencies : [dep_zlib, dep_clock, dep_thread, dep_atomic, dep_m, dep_valgrind, dep_futex],
287 if not (with_platform_android or with_platform_windows)
288 xmlconfig_deps += dep_expat
290 xmlconfig_deps += dep_regex
292 _libxmlconfig = static_library(
295 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
296 dependencies : [idep_mesautil, dep_m, xmlconfig_deps],
299 '-DSYSCONFDIR="@0@"'.format(
300 join_paths(get_option('prefix'), get_option('sysconfdir'))
302 '-DDATADIR="@0@"'.format(
303 join_paths(get_option('prefix'), get_option('datadir'))
306 gnu_symbol_visibility : 'hidden',
307 build_by_default : false,
310 idep_xmlconfig = declare_dependency(
311 dependencies : xmlconfig_deps,
312 link_with : _libxmlconfig,
315 files_xxd = files('xxd.py')
316 glsl2spirv = files('glsl2spirv.py')
319 # DRI_CONF macros use designated initializers (required for union
320 # initializaiton), so we need c++2a since gtest forces us to use c++
321 if host_machine.system() != 'windows' and cpp.has_argument('-std=c++2a')
323 executable('xmlconfig_test',
324 files('tests/xmlconfig.cpp'),
325 include_directories : [inc_include, inc_src],
326 dependencies : [idep_mesautil, idep_xmlconfig, idep_gtest],
327 override_options : ['cpp_std=c++2a'],
328 cpp_args: ['-Wno-write-strings']
331 env: ['HOME=' + join_paths(meson.current_source_dir(),
332 'tests', 'drirc_home'),
333 'DRIRC_CONFIGDIR=' + join_paths(meson.current_source_dir(),
334 'tests', 'drirc_configdir')],
335 protocol : gtest_test_protocol,
339 files_util_tests = files(
340 'tests/bitset_test.cpp',
341 'tests/blob_test.cpp',
342 'tests/dag_test.cpp',
343 'tests/fast_idiv_by_const_test.cpp',
344 'tests/fast_urem_by_const_test.cpp',
345 'tests/half_float_test.cpp',
346 'tests/int_min_max.cpp',
347 'tests/mesa-sha1_test.cpp',
348 'tests/rb_tree_test.cpp',
349 'tests/register_allocate_test.cpp',
350 'tests/roundeven_test.cpp',
351 'tests/set_test.cpp',
352 'tests/string_buffer_test.cpp',
353 'tests/timespec_test.cpp',
354 'tests/u_atomic_test.cpp',
355 'tests/u_call_once_test.cpp',
356 'tests/u_debug_stack_test.cpp',
357 'tests/u_debug_test.cpp',
358 'tests/u_printf_test.cpp',
359 'tests/u_qsort_test.cpp',
360 'tests/vector_test.cpp',
363 # FIXME: this test cause a big timeout on MacOS
364 if host_machine.system() != 'darwin'
365 files_util_tests += files(
366 'tests/sparse_array_test.cpp',
371 files_util_tests += files(
372 'tests/cache_test.cpp',
381 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
382 dependencies : [idep_mesautil, idep_gtest],
385 protocol : gtest_test_protocol,
389 process_test_exe = executable(
391 files('tests/process_test.c'),
392 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
393 dependencies : idep_mesautil,
394 c_args : [c_msvc_compat_args],
396 if (host_machine.system() == 'windows' and build_machine.system() != 'windows')
397 # This conversion is only required on mingw crosscompilers, otherwise we hit at least one of these issues
398 # https://gitlab.freedesktop.org/mesa/mesa/-/issues/2690
399 # https://gitlab.freedesktop.org/mesa/mesa/-/issues/2788
400 prog_winepath = find_program('winepath')
401 process_test_exe_full_path = run_command(
402 prog_winepath, '-w', process_test_exe.full_path(),
406 process_test_exe_full_path = process_test_exe.full_path()
413 env: ['BUILD_FULL_PATH='+process_test_exe_full_path]
416 subdir('tests/hash_table')
418 subdir('tests/format')