meson: allow disabling tests

The new meson build system support diverges from former build system
where the tests were not built until required.

This has caused an issue in NixOS[1] due to broken build of tests in
Darwin platform, so this patch allows the control if tests should be
build or not.

1. https://github.com/NixOS/nixpkgs/pull/235210

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
main
Otavio Salvador 2023-06-01 10:12:50 -03:00 committed by David Gibson
parent f088e381f2
commit bdc5c8793a
2 changed files with 6 additions and 4 deletions

View File

@ -134,8 +134,8 @@ if not meson.is_cross_build()
if py.found() and swig.found()
subdir('pylibfdt')
endif

if get_option('tools')
subdir('tests')
endif
endif

if get_option('tests')
subdir('tests')
endif

View File

@ -10,3 +10,5 @@ option('python', type: 'feature', value: 'auto',
description: 'Build pylibfdt Python library')
option('static-build', type: 'boolean', value: false,
description: 'Build static binaries')
option('tests', type: 'boolean', value: true,
description: 'Build tests')