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




commit ceae733999641d1a4f5d3accfa50557c10a4bb4b
Author: Sam Thursfield <sam afuera me uk>
Date:   Mon Sep 21 16:38:04 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 Miners' CFLAGS as the overhead is minimal and it helps users
    to provide useful bug reports.
    
    See also: https://gitlab.gnome.org/GNOME/tracker/-/merge_requests/316

 meson.build | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/meson.build b/meson.build
index eae27e5ad..e2e0620d2 100644
--- a/meson.build
+++ b/meson.build
@@ -121,13 +121,14 @@ add_project_arguments('-DG_LOG_DOMAIN="Tracker"', language: 'c')
 add_project_arguments('-DG_LOG_STRUCTURED=1', language: 'c')
 
 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]