build: make tests optional

Building the project as a meson subproject, meson inherits the warning level
from the parent project. Making the tests optional bypasses that issue and
reduces build time.

Signed-off-by: Simon Zeni <simon@bl4ckb0ne.ca>
Reviewed-by: Simon Ser <contact@emersion.fr>
This commit is contained in:
Simon Zeni 2022-07-28 06:18:33 -04:00 committed by Simon Ser
parent 003eb2a554
commit 46d1e99a5d
2 changed files with 10 additions and 1 deletions

View file

@ -34,6 +34,7 @@ config = configuration_data()
config.set10('UDEV', get_option('udev')) config.set10('UDEV', get_option('udev'))
with_freedreno_kgsl = get_option('freedreno-kgsl') with_freedreno_kgsl = get_option('freedreno-kgsl')
with_install_tests = get_option('install-test-programs') with_install_tests = get_option('install-test-programs')
with_tests = get_option('tests')
if ['freebsd', 'dragonfly', 'netbsd'].contains(host_machine.system()) if ['freebsd', 'dragonfly', 'netbsd'].contains(host_machine.system())
dep_pthread_stubs = dependency('pthread-stubs', version : '>= 0.4') dep_pthread_stubs = dependency('pthread-stubs', version : '>= 0.4')
@ -391,4 +392,6 @@ if with_man_pages
subdir('man') subdir('man')
endif endif
subdir('data') subdir('data')
subdir('tests') if with_tests
subdir('tests')
endif

View file

@ -134,3 +134,9 @@ option(
value : false, value : false,
description : 'Enable support for using udev instead of mknod.', description : 'Enable support for using udev instead of mknod.',
) )
option(
'tests',
type : 'boolean',
value : true,
description : 'Build test programs.',
)