[gtkmm-documentation] Meson build: Don't require gtkmm unconditionally
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm-documentation] Meson build: Don't require gtkmm unconditionally
- Date: Sun, 27 Dec 2020 12:36:32 +0000 (UTC)
commit a80eb80edaacf48a5fe013d4696bb6c542652cf1
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Sun Dec 27 13:20:41 2020 +0100
Meson build: Don't require gtkmm unconditionally
Require gtkmm and giomm only if build-examples=true
or a tarball is being built.
examples/meson.build | 23 ++++++++++++-----------
meson.build | 21 ++++++++++++++++++---
2 files changed, 30 insertions(+), 14 deletions(-)
---
diff --git a/examples/meson.build b/examples/meson.build
index 6a90079..b783cfa 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -1,19 +1,20 @@
# examples
-# input: gnome, gtkmm_dep, giomm_dep, compile_schemas, copy_to_subdir,
-# project_build_root, python3
-# output: build_examples_by_default
+# input: gnome, gtkmm_dep, giomm_dep, compile_schemas, copy_to_subdir, python3,
+# project_build_root, build_examples_by_default, can_build_examples
+# output: -
-# examples/book/input/main.cc must know if mkfifo() exists.
-has_mkfifo = cpp_compiler.has_function('mkfifo')
-
-meson_backend = find_program(meson.backend(), required: true)
-build_examples_by_default = get_option('build-examples')
-test_timeout = 80 # max seconds per test
examples_targets = []
-subdir('book')
-subdir('others')
+if can_build_examples
+ # examples/book/input/main.cc must know if mkfifo() exists.
+ has_mkfifo = cpp_compiler.has_function('mkfifo')
+
+ meson_backend = find_program(meson.backend(), required: true)
+ test_timeout = 80 # max seconds per test
+ subdir('book')
+ subdir('others')
+endif
# 'ninja examples' builds all example programs.
# alias_target(), added in Meson 0.52.0, is an alternative to run_target().
diff --git a/meson.build b/meson.build
index 762f683..31bb788 100644
--- a/meson.build
+++ b/meson.build
@@ -17,8 +17,9 @@ if not python_version.version_compare(python_version_req)
endif
gtkmm_pcname = 'gtkmm-4.0'
-gtkmm_dep = dependency(gtkmm_pcname, version: '>=4.0.0')
-giomm_dep = dependency('giomm-2.68', version: '>=2.68.0')
+gtkmm_req = '>= 4.0.0'
+giomm_pcname = 'giomm-2.68'
+giomm_req = '>= 2.68.0'
gnome = import('gnome')
# Installation directories are relative to {prefix}.
@@ -43,6 +44,8 @@ cpp_compiler = meson.get_compiler('cpp')
is_dist_check = project_source_root.contains('dist-unpack') and \
project_build_root.contains('dist-build')
+# Options
+build_examples_by_default = get_option('build-examples')
if is_dist_check
message('Looks like a tarball is being tested. ' + \
'Option "dist-warnings" is used instead of "warnings".')
@@ -51,6 +54,12 @@ else
warning_level = get_option('warnings')
endif
+must_be_able_to_build_examples = build_examples_by_default or is_dist_check
+
+gtkmm_dep = dependency(gtkmm_pcname, version: gtkmm_req, required: must_be_able_to_build_examples)
+giomm_dep = dependency(giomm_pcname, version: giomm_req, required: must_be_able_to_build_examples)
+can_build_examples = gtkmm_dep.found() and giomm_dep.found()
+
warning_flags = []
if warning_level == 'min'
warning_flags = ['-Wall']
@@ -88,6 +97,12 @@ if not meson.is_subproject()
endif
# Print a summary.
+explain_ex = ''
+if not can_build_examples
+ explain_ex = ' (requires @0@ @1@ and @2@ @3@)'
+ explain_ex = explain_ex.format(gtkmm_pcname, gtkmm_req, giomm_pcname, giomm_req)
+endif
+
validate = get_option('validation') and can_parse_and_validate
explain_val = ''
if get_option('validation') and not validate
@@ -111,7 +126,7 @@ summary = [
'------',
meson.project_name() + ' ' + meson.project_version(),
'',
- ' Build examples: @0@'.format(build_examples_by_default),
+ ' Build examples: @0@@1@'.format(build_examples_by_default, explain_ex),
' Compiler warnings: @0@'.format(warning_level),
' XML validation: @0@@1@'.format(validate, explain_val),
'Build translations: @0@@1@'.format(build_translations, explain_trans),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]