From c1cfbe62e59f6c8eb0f6b8286fbe7a8044bc82fc Mon Sep 17 00:00:00 2001 From: Pavel Hrdina Date: Tue, 2 Jun 2020 19:15:22 +0200 Subject: [PATCH] meson: tests: add helper binaries build support Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa Reviewed-by: Neal Gompa --- tests/meson.build | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) 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