[glib: 1/2] build: Add glib_debug option
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/2] build: Add glib_debug option
- Date: Wed, 20 Jan 2021 19:01:44 +0000 (UTC)
commit 670b84ca3068eb4ec584812fad2cdcb8dc35683b
Author: Ole André Vadla Ravnås <oleavr gmail com>
Date: Wed Jan 20 00:37:22 2021 +0100
build: Add glib_debug option
To allow disabling debug infrastructure in builds with debug symbols.
docs/macros.txt | 4 ++++
meson.build | 3 ++-
meson_options.txt | 6 ++++++
3 files changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/docs/macros.txt b/docs/macros.txt
index aa326a4dc..ec449f17f 100644
--- a/docs/macros.txt
+++ b/docs/macros.txt
@@ -5,6 +5,10 @@ GLib's configure options and corresponding macros
none
--buildtype={debug,debugoptimized} [debugoptimized is the default]
-DG_ENABLE_DEBUG -g
+-Dglib_debug=disabled
+ Omits G_ENABLE_DEBUG when implied by --buildtype/-Ddebug
+-Dglib_debug=enabled
+ Defines G_ENABLE_DEBUG regardless of --buildtype/-Ddebug
-Dglib_asserts=false
-DG_DISABLE_ASSERT
-Dglib_checks=false
diff --git a/meson.build b/meson.build
index 00c4789e9..f226c4f0f 100644
--- a/meson.build
+++ b/meson.build
@@ -235,7 +235,8 @@ endif
# Use debug/optimization flags to determine whether to enable debug or disable
# cast checks
glib_debug_cflags = []
-if get_option('debug')
+glib_debug = get_option('glib_debug')
+if glib_debug.enabled() or (glib_debug.auto() and get_option('debug'))
glib_debug_cflags += ['-DG_ENABLE_DEBUG']
message('Enabling various debug infrastructure')
elif get_option('optimization') in ['2', '3', 's']
diff --git a/meson_options.txt b/meson_options.txt
index a42136f78..072765361 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -105,6 +105,12 @@ option('oss_fuzz',
value : 'disabled',
description : 'Indicate oss-fuzz build environment')
+option('glib_debug',
+ type : 'feature',
+ value : 'auto',
+ yield : true,
+ description : 'Enable GLib debug infrastructure (see docs/macros.txt)')
+
option('glib_assert',
type : 'boolean',
value : true,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]