This patch adds the meson build system as alternative to the autotools build system. v2: Thanks to Alexandros for his comments that lead to the following changes: - Fix logic for platforms so that the ones selected by 'auto' don't fail if the dependencies are missing, but fail when explicitely requested - declare project version differently - set a minimun meson version - clean up some braces - reformat some code - squesh remaining separate patches v3: require meson 0.46 (Gurchetan) v4: set minimum gbm version to 18.0.0 v5: - fix gbm version requirement (Gurchetan) - don't duplicate glx files (Gurchetan) Fixes: #129 Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>macos/master
parent
ecba12cdac
commit
17c2368f97
@ -0,0 +1,9 @@ |
||||
#mesondefine VERSION |
||||
#mesondefine HAVE_SYS_UIO_H |
||||
#mesondefine HAVE_PTHREAD |
||||
#mesondefine HAVE_EPOXY_EGL_H |
||||
#mesondefine HAVE_EPOXY_GLX_H |
||||
#mesondefine ENABLE_GBM_ALLOCATION |
||||
#mesondefine HAVE_FUNC_ATTRIBUTE_VISIBILITY |
||||
#mesondefine HAVE_EVENTFD_H |
||||
#mesondefine HAVE_DLFCN_H |
@ -0,0 +1,183 @@ |
||||
############################################################################# |
||||
# |
||||
# Copyright (C) 2019 Collabora Ltd |
||||
# |
||||
# 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. |
||||
# |
||||
|
||||
project( |
||||
'virglrenderer', 'c', |
||||
version: '0.8.1', |
||||
license : 'MIT', |
||||
meson_version : '>= 0.46', |
||||
default_options : ['buildtype=release', 'b_ndebug=if-release', 'c_std=gnu11'] |
||||
) |
||||
|
||||
binary_age = 1 |
||||
revision = 4 |
||||
interface_age = 0 |
||||
|
||||
cc = meson.get_compiler('c') |
||||
|
||||
add_project_arguments('-DHAVE_CONFIG_H=1', language : 'c') |
||||
add_project_arguments('-D_GNU_SOURCE=1', language : 'c') |
||||
|
||||
add_project_arguments('-Wall', language : 'c') |
||||
add_project_arguments('-Wextra', language : 'c') |
||||
|
||||
warnings = [ |
||||
'-Werror=implicit-function-declaration', |
||||
'-Werror=missing-prototypes', |
||||
'-Wmissing-prototypes', |
||||
'-Werror=int-to-pointer-cast' |
||||
] |
||||
|
||||
foreach w : warnings |
||||
if cc.has_argument(w) |
||||
add_project_arguments(w, language : 'c') |
||||
endif |
||||
endforeach |
||||
|
||||
prog_python = import('python').find_installation('python3') |
||||
|
||||
libdrm_dep = dependency('libdrm', version : '>=2.4.50') |
||||
thread_dep = dependency('threads') |
||||
epoxy_dep = dependency('epoxy') |
||||
m_dep = cc.find_library('m') |
||||
|
||||
conf_data = configuration_data() |
||||
conf_data.set('VERSION', '0.8.1') |
||||
|
||||
if cc.has_header('sys/uio.h') |
||||
conf_data.set('HAVE_SYS_UIO_H', 1) |
||||
endif |
||||
|
||||
if cc.has_header('dlfcn.h') |
||||
conf_data.set('HAVE_DLFCN_H', 1) |
||||
endif |
||||
|
||||
if cc.has_header('pthread.h') |
||||
conf_data.set('HAVE_PTHREAD', 1) |
||||
endif |
||||
|
||||
if cc.has_header('sys/eventfd.h') |
||||
conf_data.set('HAVE_EVENTFD_H', 1) |
||||
endif |
||||
|
||||
debug_enabled = get_option('debug') |
||||
|
||||
if debug_enabled |
||||
add_global_arguments('-DDEBUG=1', language : 'c') |
||||
endif |
||||
|
||||
platforms = get_option('platforms') |
||||
|
||||
require_egl = platforms.contains('egl') |
||||
require_glx = platforms.contains('glx') |
||||
auto_egl_glx = platforms.contains('auto') |
||||
|
||||
with_egl = require_egl or auto_egl_glx |
||||
with_glx = require_glx or auto_egl_glx |
||||
|
||||
have_egl = false |
||||
have_glx = false |
||||
|
||||
if with_egl |
||||
if cc.has_header('epoxy/egl.h') and epoxy_dep.get_pkgconfig_variable('epoxy_has_egl') == '1' |
||||
gbm_dep = dependency('gbm', version: '>= 18.0.0', required: require_egl) |
||||
have_egl = gbm_dep.found() |
||||
conf_data.set('HAVE_EPOXY_EGL_H', 1) |
||||
else |
||||
assert(not require_egl, |
||||
'egl was explicitely requested but it is not supported by epoxy') |
||||
endif |
||||
endif |
||||
|
||||
if with_glx |
||||
if cc.has_header('epoxy/glx.h') and epoxy_dep.get_pkgconfig_variable('epoxy_has_glx') == '1' |
||||
glx_dep = dependency('x11', required: require_glx) |
||||
have_glx = glx_dep.found() |
||||
conf_data.set('HAVE_EPOXY_GLX_H', 1) |
||||
else |
||||
assert(not require_glx, |
||||
'glx was explicitely requested but it is not supported by epoxy') |
||||
endif |
||||
endif |
||||
|
||||
if cc.compiles('void __attribute__((hidden)) func() {}') |
||||
conf_data.set('HAVE_FUNC_ATTRIBUTE_VISIBILITY', 1) |
||||
endif |
||||
|
||||
with_gbm_allocation = get_option('gbm_allocation') |
||||
if with_gbm_allocation |
||||
conf_data.set('ENABLE_GBM_ALLOCATION', 1) |
||||
endif |
||||
|
||||
configure_file(input : 'config.h.meson', |
||||
output : 'config.h', |
||||
configuration : conf_data) |
||||
|
||||
pkgconf_data = configuration_data() |
||||
pkgconf_data.set('PACKAGE_VERSION', meson.project_version()) |
||||
pkgconf_data.set('prefix', get_option('prefix')) |
||||
pkgconf_data.set('exec_prefix', '${prefix}') |
||||
pkgconf_data.set('libdir', '${prefix}/' + get_option('libdir')) |
||||
pkgconf_data.set('includedir', '${prefix}/' + get_option('includedir')) |
||||
|
||||
pkg_config = configure_file(input : 'virglrenderer.pc.in', |
||||
output : 'virglrenderer.pc', |
||||
configuration : pkgconf_data) |
||||
|
||||
install_data(pkg_config, |
||||
install_dir: get_option('libdir') + '/pkgconfig') |
||||
|
||||
inc_configuration = include_directories('.') |
||||
|
||||
with_fuzzer = get_option('fuzzer') |
||||
with_tests = get_option('tests') |
||||
with_valgrind = get_option('valgrind') |
||||
|
||||
subdir('src') |
||||
subdir('vtest') |
||||
|
||||
if with_tests |
||||
subdir('tests') |
||||
endif |
||||
|
||||
lines = [ |
||||
'', |
||||
'prefix: ' + get_option('prefix'), |
||||
'libdir: ' + get_option('libdir'), |
||||
'', |
||||
'c_args: ' + (' ').join(get_option('c_args')), |
||||
'', |
||||
] |
||||
|
||||
lines += 'egl: ' + (have_egl ? 'yes' : 'no') |
||||
lines += 'glx: ' + (have_glx ? 'yes' : 'no') |
||||
lines += '' |
||||
lines += 'gbm_alloc: ' + (with_gbm_allocation ? 'yes' : 'no' ) |
||||
lines += '' |
||||
lines += 'debug: ' + (debug_enabled ? 'yes' : 'no' ) |
||||
lines += 'tests: ' + (with_tests ? 'yes' : 'no' ) |
||||
lines += 'fuzzer: ' + (with_fuzzer ? 'yes' : 'no' ) |
||||
|
||||
indent = ' ' |
||||
summary = indent + ('\n' + indent).join(lines) |
||||
message('\n\nConfiguration summary:\n@0@\n'.format(summary)) |
@ -0,0 +1,60 @@ |
||||
############################################################################# |
||||
# |
||||
# Copyright (C) 2019 Collabora Ltd |
||||
# |
||||
# 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. |
||||
# |
||||
|
||||
option( |
||||
'platforms', |
||||
type : 'array', |
||||
value : ['auto'], |
||||
choices : [ |
||||
'egl', 'glx', 'auto' |
||||
], |
||||
description : 'Platforms support, set to auto to enable all.' |
||||
) |
||||
|
||||
option( |
||||
'gbm_allocation', |
||||
type : 'boolean', |
||||
value : 'false', |
||||
description : 'enable support for gbm_allocations' |
||||
) |
||||
|
||||
option( |
||||
'tests', |
||||
type : 'boolean', |
||||
value : 'false', |
||||
description : 'enable unit tests' |
||||
) |
||||
|
||||
option( |
||||
'fuzzer', |
||||
type : 'boolean', |
||||
value : 'false', |
||||
description : 'enable unit tests' |
||||
) |
||||
|
||||
option( |
||||
'valgrind', |
||||
type : 'boolean', |
||||
value : 'false', |
||||
description : 'enable running unit tests with valgrind' |
||||
) |
@ -0,0 +1,133 @@ |
||||
############################################################################# |
||||
# |
||||
# Copyright (C) 2019 Collabora Ltd |
||||
# |
||||
# 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. |
||||
# |
||||
|
||||
sources_libgallium = [ |
||||
'include/c99_compat.h', |
||||
'include/no_extern_c.h', |
||||
'include/pipe/p_config.h', |
||||
'include/pipe/p_defines.h', |
||||
'include/pipe/p_context.h', |
||||
'include/pipe/p_state.h', |
||||
'include/pipe/p_format.h', |
||||
'include/pipe/p_shader_tokens.h', |
||||
'include/pipe/p_screen.h', |
||||
'include/pipe/p_compiler.h', |
||||
'include/pipe/p_video_enums.h', |
||||
'include/c11/threads_win32.h', |
||||
'include/c11/threads.h', |
||||
'include/c11/threads_posix.h', |
||||
'auxiliary/util/u_format.h', |
||||
'auxiliary/util/u_memory.h', |
||||
'auxiliary/util/u_rect.h', |
||||
'auxiliary/util/u_surface.h', |
||||
'auxiliary/util/u_math.h', |
||||
'auxiliary/util/rgtc.h', |
||||
'auxiliary/util/u_format.c', |
||||
'auxiliary/util/u_debug.h', |
||||
'auxiliary/util/u_inlines.h', |
||||
'auxiliary/util/u_texture.c', |
||||
'auxiliary/util/u_pointer.h', |
||||
'auxiliary/util/u_hash_table.c', |
||||
'auxiliary/util/u_debug_describe.h', |
||||
'auxiliary/util/u_dual_blend.h', |
||||
'auxiliary/util/u_texture.h', |
||||
'auxiliary/util/u_hash_table.h', |
||||
'auxiliary/util/u_box.h', |
||||
'auxiliary/util/u_debug.c', |
||||
'auxiliary/util/u_cpu_detect.c', |
||||
'auxiliary/util/u_pack_color.h', |
||||
'auxiliary/util/u_double_list.h', |
||||
'auxiliary/util/u_debug_refcnt.h', |
||||
'auxiliary/util/u_bitmask.c', |
||||
'auxiliary/util/u_cpu_detect.h', |
||||
'auxiliary/util/u_bitmask.h', |
||||
'auxiliary/util/u_format_s3tc.h', |
||||
'auxiliary/util/u_string.h', |
||||
'auxiliary/util/u_surface.c', |
||||
'auxiliary/util/u_math.c', |
||||
'auxiliary/util/u_half.h', |
||||
'auxiliary/util/u_prim.h', |
||||
'auxiliary/util/u_debug_describe.c', |
||||
'auxiliary/util/u_atomic.h', |
||||
'auxiliary/cso_cache/cso_hash.h', |
||||
'auxiliary/cso_cache/cso_cache.h', |
||||
'auxiliary/cso_cache/cso_cache.c', |
||||
'auxiliary/cso_cache/cso_hash.c', |
||||
'auxiliary/tgsi/tgsi_opcode_tmp.h', |
||||
'auxiliary/tgsi/tgsi_dump.c', |
||||
'auxiliary/tgsi/tgsi_ureg.c', |
||||
'auxiliary/tgsi/tgsi_build.c', |
||||
'auxiliary/tgsi/tgsi_build.h', |
||||
'auxiliary/tgsi/tgsi_util.h', |
||||
'auxiliary/tgsi/tgsi_iterate.h', |
||||
'auxiliary/tgsi/tgsi_scan.c', |
||||
'auxiliary/tgsi/tgsi_info.c', |
||||
'auxiliary/tgsi/tgsi_parse.h', |
||||
'auxiliary/tgsi/tgsi_text.h', |
||||
'auxiliary/tgsi/tgsi_strings.h', |
||||
'auxiliary/tgsi/tgsi_ureg.h', |
||||
'auxiliary/tgsi/tgsi_parse.c', |
||||
'auxiliary/tgsi/tgsi_transform.h', |
||||
'auxiliary/tgsi/tgsi_info.h', |
||||
'auxiliary/tgsi/tgsi_text.c', |
||||
'auxiliary/tgsi/tgsi_strings.c', |
||||
'auxiliary/tgsi/tgsi_sanity.c', |
||||
'auxiliary/tgsi/tgsi_scan.h', |
||||
'auxiliary/tgsi/tgsi_iterate.c', |
||||
'auxiliary/tgsi/tgsi_dump.h', |
||||
'auxiliary/tgsi/tgsi_util.c', |
||||
'auxiliary/tgsi/tgsi_sanity.h', |
||||
'auxiliary/tgsi/tgsi_transform.c', |
||||
'auxiliary/os/os_memory_aligned.h', |
||||
'auxiliary/os/os_thread.h', |
||||
'auxiliary/os/os_mman.h', |
||||
'auxiliary/os/os_misc.h', |
||||
'auxiliary/os/os_memory.h', |
||||
'auxiliary/os/os_memory_debug.h', |
||||
'auxiliary/os/os_memory_stdc.h', |
||||
'auxiliary/os/os_misc.c', |
||||
] |
||||
|
||||
inc_gallium = include_directories('include', 'auxiliary', 'auxiliary/util') |
||||
|
||||
u_format_table_c = custom_target( |
||||
'u_format_table.c', |
||||
input : ['auxiliary/util/u_format_table.py', 'auxiliary/util/u_format.csv'], |
||||
output : 'u_format_table.c', |
||||
command : [prog_python, '@INPUT@'], |
||||
depend_files : files('auxiliary/util/u_format_parse.py'), |
||||
capture : true, |
||||
) |
||||
|
||||
libgallium = static_library( |
||||
'gallium', |
||||
[sources_libgallium, u_format_table_c], |
||||
include_directories : [ |
||||
inc_gallium |
||||
], |
||||
) |
||||
|
||||
gallium_dep = declare_dependency( |
||||
link_with: libgallium, |
||||
include_directories: inc_gallium |
||||
) |
@ -0,0 +1,102 @@ |
||||
############################################################################# |
||||
# |
||||
# Copyright (C) 2019 Collabora Ltd |
||||
# |
||||
# 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. |
||||
# |
||||
|
||||
subdir('gallium') |
||||
|
||||
virglrenderer_sources = [ |
||||
'iov.c', |
||||
'virgl_hw.h', |
||||
'virgl_protocol.h', |
||||
'virglrenderer.c', |
||||
'virglrenderer.h', |
||||
'vrend_blitter.c', |
||||
'vrend_blitter.h', |
||||
'vrend_debug.c', |
||||
'vrend_debug.h', |
||||
'vrend_decode.c', |
||||
'vrend_formats.c', |
||||
'vrend_iov.h', |
||||
'vrend_object.c', |
||||
'vrend_object.h', |
||||
'vrend_renderer.c', |
||||
'vrend_renderer.h', |
||||
'vrend_shader.c', |
||||
'vrend_shader.h', |
||||
'vrend_strbuf.h', |
||||
'vrend_tweaks.c', |
||||
'vrend_tweaks.h' |
||||
] |
||||
|
||||
virglrenderer_egl_sources = [ |
||||
'virgl_gbm.c', |
||||
'virgl_gbm.h', |
||||
'virgl_egl_context.c', |
||||
'virgl_egl.h', |
||||
] |
||||
|
||||
virglrenderer_glx_sources = [ |
||||
'virgl_glx_context.c', |
||||
'virgl_glx.h', |
||||
] |
||||
|
||||
virglrenderer_depends = [ |
||||
gallium_dep, |
||||
epoxy_dep, |
||||
libdrm_dep, |
||||
thread_dep, |
||||
m_dep |
||||
] |
||||
|
||||
if have_egl |
||||
virglrenderer_sources += virglrenderer_egl_sources |
||||
virglrenderer_depends += [gbm_dep] |
||||
endif |
||||
|
||||
if have_glx |
||||
virglrenderer_sources += virglrenderer_glx_sources |
||||
virglrenderer_depends += [glx_dep] |
||||
endif |
||||
|
||||
libvirglrenderer = shared_library( |
||||
'virglrenderer', |
||||
virglrenderer_sources, |
||||
include_directories: [inc_gallium, inc_configuration], |
||||
dependencies : virglrenderer_depends, |
||||
version : binary_age.to_string() + '.' |
||||
+ revision.to_string() + '.' |
||||
+ interface_age.to_string(), |
||||
install : true |
||||
) |
||||
|
||||
libvirglrenderer_inc = [ |
||||
inc_gallium, |
||||
inc_configuration, |
||||
include_directories('.') |
||||
] |
||||
|
||||
libvirglrenderer_dep = declare_dependency( |
||||
link_with: libvirglrenderer, |
||||
include_directories: libvirglrenderer_inc |
||||
) |
||||
|
||||
install_headers('virglrenderer.h', subdir : 'virgl') |
@ -0,0 +1,33 @@ |
||||
############################################################################# |
||||
# |
||||
# Copyright (C) 2019 Collabora Ltd |
||||
# |
||||
# 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. |
||||
# |
||||
|
||||
assert(cc.has_argument('-fsanitize=fuzzer'), |
||||
'Fuzzer enabled but compiler does not support "-fsanitize=fuzzer"') |
||||
|
||||
virgl_fuzzer = executable( |
||||
'virgl_fuzzer', |
||||
'virgl_fuzzer.c', |
||||
c_args : [ '-fsanitize=address', '-fsanitize=fuzzer' ], |
||||
link_args : [ '-fsanitize=address', '-fsanitize=fuzzer' ], |
||||
dependencies : [libvirglrenderer_dep, epoxy_dep] |
||||
) |
@ -0,0 +1,72 @@ |
||||
############################################################################# |
||||
# |
||||
# Copyright (C) 2019 Collabora Ltd |
||||
# |
||||
# 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. |
||||
# |
||||
|
||||
check_dep = dependency('check') |
||||
|
||||
libvrtest_sources = [ |
||||
'testvirgl.c', |
||||
'testvirgl.h', |
||||
'testvirgl_encode.c', |
||||
'testvirgl_encode.h', |
||||
] |
||||
|
||||
libvrtest = library( |
||||
'vrtest', |
||||
libvrtest_sources, |
||||
dependencies : [ |
||||
libvirglrenderer_dep, |
||||
gallium_dep, |
||||
check_dep |
||||
] |
||||
) |
||||
|
||||
tests = [ |
||||
['test_virgl_init', 'test_virgl_init.c'], |
||||
['test_virgl_resource', 'test_virgl_resource.c'], |
||||
['test_virgl_transfer', 'test_virgl_transfer.c'], |
||||
['test_virgl_cmd', 'test_virgl_cmd.c'], |
||||
['test_virgl_strbuf', 'test_virgl_strbuf.c'] |
||||
] |
||||
|
||||
foreach t : tests |
||||
test_virgl = executable(t[0], t[1], link_with: libvrtest, |
||||
dependencies : [libvirglrenderer_dep, check_dep]) |
||||
test(t[0], test_virgl) |
||||
endforeach |
||||
|
||||
if with_valgrind |
||||
valgrind = find_program('valgrind') |
||||
surpression_path = join_paths(meson.current_source_dir(), 'valgrind.suppressions') |
||||
args = ['--leak-check=full', '--quiet', '--error-exitcode=3', |
||||
'--suppressions='+ surpression_path] |
||||
foreach t : tests |
||||
test('valgrind-' + t[0], |
||||
valgrind, |
||||
args : args + [join_paths(meson.current_build_dir(), t[0])], |
||||
timeout : 1800) |
||||
endforeach |
||||
endif |
||||
|
||||
if with_fuzzer |
||||
subdir('fuzzer') |
||||
endif |
@ -0,0 +1,60 @@ |
||||
############################################################################# |
||||
# |
||||
# Copyright (C) 2019 Collabora Ltd |
||||
# |
||||
# 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. |
||||
# |
||||
|
||||
virgl_test_server_sources = [ |
||||
'util.c', |
||||
'util.h', |
||||
'vtest_shm.c', |
||||
'vtest_shm.h', |
||||
'vtest_server.c', |
||||
'vtest_renderer.c', |
||||
'vtest_protocol.h', |
||||
'vtest.h' |
||||
] |
||||
|
||||
|
||||
virgl_test_server = executable( |
||||
'virgl_test_server', |
||||
virgl_test_server_sources, |
||||
dependencies : libvirglrenderer_dep, |
||||
install : true |
||||
) |
||||
|
||||
if with_fuzzer |
||||
assert(cc.has_argument('-fsanitize=fuzzer'), |
||||
'Fuzzer enabled but compiler does not support "-fsanitize=fuzzer"') |
||||
|
||||
vtest_obj = virgl_test_server.extract_objects(['util.c', |
||||
'vtest_shm.c', |
||||
'vtest_renderer.c' |
||||
]) |
||||
|
||||
vtest_fuzzer = executable( |
||||
'vtest_fuzzer', |
||||
'vtest_fuzzer.c', |
||||
c_args : [ '-fsanitize=address', '-fsanitize=fuzzer' ], |
||||
link_args : [ '-fsanitize=address', '-fsanitize=fuzzer' ], |
||||
objects : vtest_obj, |
||||
dependencies : libvirglrenderer_dep |
||||
) |
||||
endif |
Loading…
Reference in new issue