From b9e27e284c481e876370e2eb73f95d0953fb9cda Mon Sep 17 00:00:00 2001 From: Mart Raudsepp Date: Sun, 23 Aug 2020 11:49:44 +0300 Subject: [PATCH] meson: Allow disabling build of tests Fixes https://gitlab.gnome.org/GNOME/folks/-/issues/121 --- meson.build | 21 +++++++++++++-------- meson_options.txt | 1 + 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/meson.build b/meson.build index 53d7dcc6..123edb5c 100644 --- a/meson.build +++ b/meson.build @@ -54,6 +54,7 @@ folks_backend_dir = get_option('libdir') / 'folks' / '@0@'.format(folks_module_v bluez_backend_enabled = get_option('bluez_backend') docs_enabled = get_option('docs') eds_backend_enabled = get_option('eds_backend') +tests_enabled = get_option('tests') installed_tests_enabled = get_option('installed_tests') ofono_backend_enabled = get_option('ofono_backend') telepathy_backend_enabled = get_option('telepathy_backend') @@ -130,13 +131,15 @@ endif if bluez_backend_enabled libebook_dep = dependency('libebook-1.2', version: '>=' + min_eds_version) - # Needed for the BlueZ tests - pymod = import('python') - py_installation = pymod.find_installation('python3', - modules: [ - 'dbusmock', - ], - ) + if tests_enabled + # Needed for the BlueZ tests + pymod = import('python') + py_installation = pymod.find_installation('python3', + modules: [ + 'dbusmock', + ], + ) + endif endif if import_tool_enabled @@ -233,7 +236,9 @@ subdir('tools') subdir('po') # Tests -subdir('tests') +if tests_enabled + subdir('tests') +endif if docs_enabled subdir('docs') diff --git a/meson_options.txt b/meson_options.txt index 43cd586a..62a9603c 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -11,6 +11,7 @@ option('inspect_tool', type: 'boolean', value: true, description: 'Enable buildi # Profiling option('profiling', type: 'boolean', value: false, description: 'Enable profiling code') # Test options +option('tests', type: 'boolean', value: true, description: 'Build tests programs') option('installed_tests', type: 'boolean', value: false, description: 'Install test programs') # Docs option('docs', type: 'boolean', value: false, description: 'Enable documentation generation') -- 2.20.1