From: Pavel Hrdina Date: Tue, 2 Jun 2020 17:15:22 +0000 (+0200) Subject: meson: tests: add helper binaries build support X-Git-Tag: v6.7.0-rc1~294 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c1cfbe62e59f6c8eb0f6b8286fbe7a8044bc82fc;p=thirdparty%2Flibvirt.git meson: tests: add helper binaries build support Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa Reviewed-by: Neal Gompa --- diff --git a/tests/meson.build b/tests/meson.build index edb07e339f..d1f35d9a48 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -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