From f34a44e7759f1f84da56263cba183a9ac108382e Mon Sep 17 00:00:00 2001 From: Harry van Haaren Date: Sat, 3 Mar 2018 21:16:21 +0000 Subject: [PATCH] meson: add tests and option to disable them This enables building the Luppp unit tests with Meson, and adds an option to disable building those tests. For a release, the option should probably be off - although currently it has no significant impact on the result. Signed-off-by: Harry van Haaren --- meson.build | 12 +++++++++--- meson_options.txt | 1 + src/meson.build | 4 ++++ src/tests/meson.build | 5 +++++ 4 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 meson_options.txt create mode 100644 src/tests/meson.build diff --git a/meson.build b/meson.build index 4d46d8a..230eaac 100644 --- a/meson.build +++ b/meson.build @@ -1,10 +1,16 @@ -project('openav_luppp', ['c','cpp']) +project( 'openav_luppp', ['c','cpp'], + default_options : [ + 'cpp_std=c++11', + ]) conf_data = configuration_data() conf_data.set('version', '1.1.1') -#add_project_arguments('-std=c99', language : 'c') -#add_project_arguments('-std=c++11', language : 'cpp') + +if(get_option('tests') == true) + add_project_arguments('-DBUILD_TESTS', language : 'cpp') +endif + add_project_arguments('-Wno-unused-variable', language : 'cpp') add_project_arguments('-Wno-reorder', language : 'cpp') add_project_arguments('-Wno-sign-compare', language : 'cpp') diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..701b984 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1 @@ +option('tests', type : 'boolean', value : true, description : 'Build tests') diff --git a/src/meson.build b/src/meson.build index 1af9470..7e02ce8 100644 --- a/src/meson.build +++ b/src/meson.build @@ -30,3 +30,7 @@ subdir('controller') subdir('observer') subdir('state') subdir('avtk') + +if(get_option('tests') == true) + subdir('tests') +endif diff --git a/src/tests/meson.build b/src/tests/meson.build new file mode 100644 index 0000000..2a5604d --- /dev/null +++ b/src/tests/meson.build @@ -0,0 +1,5 @@ +luppp_src += files( + 'diskreadertest.cxx', + 'diskwritertest.cxx', + 'goptionstest.cxx', + 'gridlogictests.cxx')