[tracker/sam/meson-debug-flags] build: Use specific Meson options to enable debug flags




commit 11c06aefa2941a486f2d04f8f97ec9bd90e6630b
Author: Sam Thursfield <sam afuera me uk>
Date:   Mon Sep 21 16:33:38 2020 +0200

    build: Use specific Meson options to enable debug flags
    
    Based on https://gitlab.gnome.org/GNOME/gtk/-/commit/eaef24c527833232bd4725789b0f35304de8123b
    
    Note that TRACKER_DEBUG is disabled in most distro builds as they
    pass `--buildtype=plain`. I recommend distros add `-DG_ENABLE_DEBUG`
    to Tracker's CFLAGS as the overhead is minimal and it helps users to
    provide useful bug reports.

 meson.build | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/meson.build b/meson.build
index 75ccc5f4f..274be7c10 100644
--- a/meson.build
+++ b/meson.build
@@ -75,13 +75,14 @@ add_project_arguments(['-D', 'TRACKER_COMPILATION'],
                       language: 'vala')
 
 debug_cflags = []
-buildtype = get_option('buildtype')
-if buildtype.startswith('debug')
+debug = get_option('debug')
+optimization = get_option('optimization')
+if debug
   debug_cflags += '-DG_ENABLE_DEBUG'
-  if buildtype == 'debug'
+  if optimization in ['0', 'g']
     debug_cflags += '-DG_ENABLE_CONSISTENCY_CHECKS'
   endif
-elif buildtype == 'release'
+elif optimization in ['2', '3', 's']
   debug_cflags += '-DG_DISABLE_CAST_CHECKS'
 endif
 


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