From de4b6e5093eefd637172f336cabf32d744911547 Mon Sep 17 00:00:00 2001 From: Hanspeter Portner Date: Fri, 5 May 2023 12:01:22 +0200 Subject: [PATCH] Add build-test configure option --- meson.build | 38 ++++++++++++++++++++------------------ meson_options.txt | 4 ++++ 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/meson.build b/meson.build index 6935975..4e7a9b6 100644 --- a/meson.build +++ b/meson.build @@ -13,7 +13,7 @@ varchunk = subproject('varchunk') reuse = find_program('reuse', required : false) version = get_option('version') - +build_tests = get_option('build-tests') add_project_arguments('-DOSC2FTDIDMX_VERSION="'+version+'"', language : 'c') add_project_arguments('-D_GNU_SOURCE', language : 'c') @@ -51,21 +51,23 @@ configure_file( install_man(join_paths(meson.current_build_dir(), 'osc2ftdidmx.1')) -test_srcs = [ - join_paths('src', 'osc2ftdidmx.c'), - join_paths('test', 'test.c') -] - -test_osc2ftdidmx = executable('test_osc2ftdidmx', test_srcs, - include_directories : incs, - dependencies : deps, - install : false) - -test('Test', test_osc2ftdidmx) - -if reuse.found() - test('REUSE', reuse, args : [ - '--root', meson.current_source_dir(), - 'lint' - ]) +if build_tests + test_srcs = [ + join_paths('src', 'osc2ftdidmx.c'), + join_paths('test', 'test.c') + ] + + test_osc2ftdidmx = executable('test_osc2ftdidmx', test_srcs, + include_directories : incs, + dependencies : deps, + install : false) + + test('Test', test_osc2ftdidmx) + + if reuse.found() + test('REUSE', reuse, args : [ + '--root', meson.current_source_dir(), + 'lint' + ]) + endif endif diff --git a/meson_options.txt b/meson_options.txt index cd4d9ed..898d596 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,4 +1,8 @@ # SPDX-FileCopyrightText: Hanspeter Portner # SPDX-License-Identifier: CC0-1.0 +option('build-tests', + type : 'boolean', + value : true) + option('version', type : 'string', value : '0.5.32') -- 2.45.2