build/meson: Build and run tests

closes #97
This commit is contained in:
Christoph Haag 2021-01-07 22:13:14 +01:00
parent 726c752db2
commit 7a030e36ae
4 changed files with 62 additions and 0 deletions

View file

@ -231,6 +231,9 @@ if build_docs
subdir('doc')
endif
if not get_option('tests').disabled()
subdir('tests')
endif
#
# Final bits

View file

@ -12,6 +12,11 @@ option('docs',
value: 'auto',
description: 'Build the documentation')
option('tests',
type: 'feature',
value: 'auto',
description: 'Build the tests')
option('doxygen-warn-undocumented',
type: 'boolean',
value: false,

View file

@ -8,3 +8,4 @@ glad_include = include_directories('glad/include')
hungarian_include = include_directories('hungarian')
imgui_include = include_directories('imgui')
openxr_include = include_directories('openxr_includes')
catch2_include = include_directories('Catch2')

53
tests/meson.build Normal file
View file

@ -0,0 +1,53 @@
# Copyright 2020, Collabora, Ltd. SPDX-License-Identifier: BSL-1.0
tests_main = static_library(
'tests_main',
files(
'tests_main.cpp'
),
include_directories: [
catch2_include,
]
)
hack_deps = []
hack_src = [ '../src/xrt/targets/openxr/oxr_sdl2_hack.c']
hack_libs = []
hack_incs = [
glad_include,
imgui_include,
]
if sdl2.found()
hack_deps += sdl2
hack_src += [
'../src/external/imgui/imgui/cimgui_sdl.cpp',
'../src/external/imgui/imgui/imgui_impl_sdl.cpp',
'../src/external/imgui/imgui/imgui_impl_sdl.h',
]
hack_libs += lib_st_gui
hack_incs += [
st_include,
]
endif
tests_input_transform = executable(
'tests_input_transform',
files(
'tests_input_transform.cpp',
hack_src,
),
include_directories: [
xrt_include,
aux_include,
st_include,
openxr_include,
catch2_include,
] + hack_incs,
dependencies: [pthreads, driver_deps, compositor_deps, aux_ogl, aux_vk] + hack_deps,
link_whole: [lib_target_instance_no_comp, lib_st_oxr, lib_comp, driver_libs, tests_main] + hack_libs,
)
test('tests_input_transform', tests_input_transform)