meson: tests: add helper binaries build support

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
This commit is contained in:
Pavel Hrdina 2020-06-02 19:15:22 +02:00
parent 5369dd8f6e
commit c1cfbe62e5

View File

@ -579,3 +579,37 @@ foreach data : tests
)
test(data['name'], test_bin, env: tests_env)
endforeach
# helpers:
# each entry is a dictionary with following items:
# * name - name of the test which is also used as default source file name (required)
# * sources - override default sources based on name (optional, default [ '$name.c' ])
# * c_args - args used by test (optional, default [])
# * include - include_directories (optional, default [])
# * link_with - compiled libraries to link with (optional, default [])
helpers = []
foreach data : helpers
helper_sources = '@0@.c'.format(data['name'])
helper_bin = executable(
data['name'],
[
data.get('sources', helper_sources),
],
c_args: [
data.get('c_args', []),
],
dependencies: [
tests_dep,
],
include_directories: [
data.get('include', []),
],
link_with: [
data['link_with'],
],
export_dynamic: true,
)
endforeach