summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam@afuera.me.uk>2020-09-21 16:33:38 +0200
committerSam Thursfield <sam@afuera.me.uk>2020-09-22 16:33:25 +0200
commit11c06aefa2941a486f2d04f8f97ec9bd90e6630b (patch)
tree66d96dee682356435acde2ee87534f6f42bf8cab
parenta39b3ae720cbe4984be457a0f3edb0332d82da28 (diff)
downloadtracker-sam/meson-debug-flags.tar.gz
build: Use specific Meson options to enable debug flagssam/meson-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.
-rw-r--r--meson.build9
1 files 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