summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2022-12-02 13:07:39 +0100
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2022-12-02 13:07:39 +0100
commitf0c9755836307bd5d9fc2c6cc6ee666eb58b101e (patch)
tree9ed6a700a3120eed1d546a9032a91e23f6e373d7
parent863ee6494bbb2587c662ea20243897eebf146b21 (diff)
downloadmm-common-f0c9755836307bd5d9fc2c6cc6ee666eb58b101e.tar.gz
skeletonmm: Add build-tests option
and simplify lookup of python command. See libsigcplusplus PR#83 and PR#84
-rw-r--r--skeletonmm/meson.build9
-rw-r--r--skeletonmm/meson_options.txt2
-rw-r--r--skeletonmm/tests/meson.build9
3 files changed, 11 insertions, 9 deletions
diff --git a/skeletonmm/meson.build b/skeletonmm/meson.build
index 2bd9340..4f3bc8d 100644
--- a/skeletonmm/meson.build
+++ b/skeletonmm/meson.build
@@ -42,12 +42,7 @@ macos_darwin_versions = [
project_source_root = meson.current_source_dir()
project_build_root = meson.current_build_dir()
-python3 = import('python').find_installation()
-python_version = python3.language_version()
-python_version_req = '>= 3.5'
-if not python_version.version_compare(python_version_req)
- error('Requires Python @0@, found @1@.'.format(python_version_req, python_version))
-endif
+python3 = find_program('python3', version: '>= 3.5')
# Do we build from a git repository?
# Suppose we do if and only if the meson.build file is tracked by git.
@@ -82,6 +77,7 @@ build_documentation_opt = get_option('build-documentation')
build_documentation = build_documentation_opt == 'true' or \
(build_documentation_opt == 'if-maintainer-mode' and maintainer_mode)
build_examples = get_option('build-examples')
+build_tests = get_option('build-tests')
# Installation directories are relative to {prefix}.
install_prefix = get_option('prefix')
@@ -264,6 +260,7 @@ summary = [
' Build deprecated API: @0@'.format(build_deprecated_api),
'Build HTML documentation: @0@@1@'.format(build_documentation_opt, real_build_documentation),
' Build example programs: @0@'.format(build_examples),
+ ' Build test programs: @0@'.format(build_tests),
'Directories:',
' prefix: @0@'.format(install_prefix),
' includedir: @0@'.format(install_prefix / install_includedir),
diff --git a/skeletonmm/meson_options.txt b/skeletonmm/meson_options.txt
index 5cf429d..e1c73a2 100644
--- a/skeletonmm/meson_options.txt
+++ b/skeletonmm/meson_options.txt
@@ -10,3 +10,5 @@ option('build-documentation', type: 'combo', choices: ['false', 'if-maintainer-m
value: 'if-maintainer-mode', description: 'Build and install the documentation')
option('build-examples', type: 'boolean', value: true,
description: 'Build example programs')
+option('build-tests', type: 'boolean', value: true,
+ description: 'Build test programs')
diff --git a/skeletonmm/tests/meson.build b/skeletonmm/tests/meson.build
index e77edbe..2d83d54 100644
--- a/skeletonmm/tests/meson.build
+++ b/skeletonmm/tests/meson.build
@@ -1,6 +1,6 @@
# tests
-# input: gnome, skeletonmm_own_dep
+# input: gnome, skeletonmm_own_dep, build_tests
tests = [
# [[dir-name], exe-name, [sources]]
@@ -30,8 +30,11 @@ foreach ex : tests
exe_file = executable(ex_name, ex_sources, resources,
dependencies: skeletonmm_own_dep,
implicit_include_directories: false,
- build_by_default: true
+ build_by_default: build_tests
)
- test(dir.underscorify(), exe_file)
+ # If exe_file is a test program, it is built by default unconditionally.
+ if build_tests
+ test(ex_name, exe_file)
+ endif
endforeach