[gtkmm-documentation] Meson build: Set default value of the 'warnings' option to 'min'



commit 42e0a2457cf1f99a7e7666870b9c7101f6e42dad
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Tue Mar 31 15:58:17 2020 +0200

    Meson build: Set default value of the 'warnings' option to 'min'
    
    And add 'dist-warnings' with default value 'fatal'. It's used when a
    tarball is tested by 'ninja dist' or 'meson dist'.

 meson.build       | 16 ++++++++++++++--
 meson_options.txt | 14 ++++++++------
 2 files changed, 22 insertions(+), 8 deletions(-)
---
diff --git a/meson.build b/meson.build
index fd901a1..5d28b05 100644
--- a/meson.build
+++ b/meson.build
@@ -9,7 +9,7 @@ project('gtkmm-documentation', 'c', 'cpp',
   license: 'GPLv2'
 )
 
-python3 = import('python').find_installation('python3')
+python3 = import('python').find_installation()
 python_version = python3.language_version()
 python_version_req = '>= 3.5'
 if not python_version.version_compare(python_version_req)
@@ -38,7 +38,19 @@ extra_dist_cmd = script_dir / 'extra-dist-cmd.py'
 
 cpp_compiler = meson.get_compiler('cpp')
 
-warning_level = get_option('warnings')
+# Are we testing a dist tarball while it's being built?
+# There ought to be a better way. https://github.com/mesonbuild/meson/issues/6866
+is_dist_check = project_source_root.contains('dist-unpack') and \
+                project_build_root.contains('dist-build')
+
+if is_dist_check
+  message('Looks like a tarball is being tested. ' + \
+          'Option "dist-warnings" is used instead of "warnings".')
+  warning_level = get_option('dist-warnings')
+else
+  warning_level = get_option('warnings')
+endif
+
 warning_flags = []
 if warning_level == 'min'
   warning_flags = ['-Wall']
diff --git a/meson_options.txt b/meson_options.txt
index 62dbad2..95b8d50 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,10 +1,12 @@
-option('warnings', type: 'combo', choices : ['no', 'min', 'max', 'fatal'], value : 'fatal',
-  description : 'Compiler warning level')
+option('warnings', type: 'combo', choices: ['no', 'min', 'max', 'fatal'], value: 'min',
+  description: 'Compiler warning level')
+option('dist-warnings', type: 'combo', choices: ['no', 'min', 'max', 'fatal'], value: 'fatal',
+  description: 'Compiler warning level when a tarball is created')
 option('build-examples', type: 'boolean', value: false,
-  description : 'Build all example programs')
+  description: 'Build all example programs')
 option('validation', type: 'boolean', value: true,
-  description : 'Validate the untranslated XML file')
+  description: 'Validate the untranslated XML file')
 option('build-translations', type: 'boolean', value: true,
-  description : 'Build translated tutorials (built during installation)')
+  description: 'Build translated tutorials (built during installation)')
 option('build-pdf', type: 'boolean', value: false,
-  description : 'Build tutorial PDF file')
+  description: 'Build tutorial PDF file')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]