[totem] build: Improve debug handling



commit 0dbed5a475214003e93bb95517abc28a43e0bc42
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Fri Feb 16 12:11:52 2018 +0100

    build: Improve debug handling
    
    totem is considered a debug build if the build type is not
    `release`. However this is wrong, because `plain` type should not
    be considered a debug build.
    
    The way compiler flags are handled on debug build has also been
    changed by taking advantage of the `get_supported_arguments` helper
    function. This function was added in 0.43, so meson's version has
    been bumped.

 meson.build |   25 ++++++++-----------------
 1 files changed, 8 insertions(+), 17 deletions(-)
---
diff --git a/meson.build b/meson.build
index aa3267a..53cdd72 100644
--- a/meson.build
+++ b/meson.build
@@ -3,7 +3,7 @@ project(
   version: '3.26.0',
   license: 'GPL2+ with exception',
   default_options: 'buildtype=debugoptimized',
-  meson_version: '>= 0.41.0'
+  meson_version: '>= 0.43.0'
 )
 
 totem_version = meson.project_version()
@@ -39,15 +39,14 @@ current = 0
 revision = 0
 libversion = '@0@.@1@.@2@'.format(soversion, current, revision)
 
-totem_buildtype = get_option('buildtype')
+totem_debug = get_option('buildtype').contains('debug')
 
 cc = meson.get_compiler('c')
 
 config_h = configuration_data()
 
 # debug options
-config_h.set('GNOME_ENABLE_DEBUG', totem_buildtype != 'release',
-             description: 'Define if debugging is enabled')
+config_h.set('GNOME_ENABLE_DEBUG', totem_debug)
 
 # defines
 set_defines = [
@@ -87,7 +86,7 @@ common_flags = [
 
 warn_flags = []
 
-if totem_buildtype == 'debug' or totem_buildtype == 'debugoptimized'
+if totem_debug
   test_cflags = [
     '-fno-strict-aliasing',
     '-Wcast-align',
@@ -97,11 +96,7 @@ if totem_buildtype == 'debug' or totem_buildtype == 'debugoptimized'
     '-Wpointer-arith'
   ]
 
-  foreach cflag: test_cflags
-    if cc.has_argument(cflag)
-      common_flags += [cflag]
-    endif
-  endforeach
+  common_flags += cc.get_supported_arguments(test_cflags)
 
   test_cflags = [
     '-Werror=format=2',
@@ -114,15 +109,11 @@ if totem_buildtype == 'debug' or totem_buildtype == 'debugoptimized'
     '-Wstrict-prototypes'
   ]
 
-  foreach cflag: test_cflags
-    if cc.has_argument(cflag)
-      warn_flags += [cflag]
-    endif
-  endforeach
-
-  add_project_arguments(common_flags, language: 'c')
+  warn_flags += cc.get_supported_arguments(test_cflags)
 endif
 
+add_project_arguments(common_flags, language: 'c')
+
 glib_req_version = '>= 2.35.0'
 gtk_req_version = '>= 3.19.4'
 gst_req_version = '>= 1.6.0'


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