summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2017-05-10 12:03:01 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2017-05-10 12:03:01 +0100
commitdaccf61dcf37e2cb2d346b0290cd239bbef757ff (patch)
treecfbf8f2b565b6ad8ca4bad5b438df77622a5412c /meson.build
parent7ec9c36891ee7bcd8914b9667d029c3040bcdfb0 (diff)
downloadgtk+-daccf61dcf37e2cb2d346b0290cd239bbef757ff.tar.gz
meson: Use buildtype to determine the debugging flags
Meson has a `--buildtype` option which allows us to avoid defining an ad hoc `--enable-debug=yes|no|minimum` option ourselves.
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build17
1 files changed, 16 insertions, 1 deletions
diff --git a/meson.build b/meson.build
index b16d3c10d8..860b1b117d 100644
--- a/meson.build
+++ b/meson.build
@@ -58,7 +58,22 @@ gtk_micro_version = gtk_version.split('.')[2].to_int()
gtk_interface_age = 0
add_project_arguments('-DGTK_VERSION="@0@"'.format(meson.project_version()), language: 'c')
-add_project_arguments('-D_GNU_SOURCE', language : 'c')
+add_project_arguments('-D_GNU_SOURCE', language: 'c')
+
+gtk_debug_cflags = []
+buildtype = get_option('buildtype')
+if buildtype == 'debugoptimized' or buildtype == 'debug'
+ gtk_debug_cflags += '-DG_ENABLE_DEBUG'
+ if buildtype == 'debug'
+ gtk_debug_cflags += '-DG_ENABLE_CONSISTENCY_CHECKS'
+ else
+ gtk_debug_cflags += '-DG_DISABLE_CAST_CHECKS'
+ endif
+else
+ gtk_debug_cflags += [ '-DG_DISABLE_ASSERT', '-DG_DISABLE_CAST_CHECKS', '-DG_DISABLE_CHECKS', ]
+endif
+
+add_project_arguments(gtk_debug_cflags, language: 'c')
# Define a string for the earliest version that this release has
# backwards binary compatibility with for all interfaces a module