From 6d9a3e3ade388a8367d6131adeae4dc933a1d78c Mon Sep 17 00:00:00 2001 From: Ting-Wei Lan Date: Sun, 3 May 2020 18:12:57 +0800 Subject: [PATCH] meson: Check for debug and optimization in the same way as GTK 4 This should make it more consistent for people who use both GTK 3 and GTK 4. It also makes it less likely to accidentally disable debug. --- meson.build | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index 976a84b6c0..ee0cae773b 100644 --- a/meson.build +++ b/meson.build @@ -57,13 +57,14 @@ add_project_arguments('-DGTK_VERSION="@0@"'.format(meson.project_version()), lan add_project_arguments('-D_GNU_SOURCE', language: 'c') gtk_debug_cflags = [] -buildtype = get_option('buildtype') -if buildtype.startswith('debug') +debug = get_option('debug') +optimization = get_option('optimization') +if debug gtk_debug_cflags += '-DG_ENABLE_DEBUG' -# if buildtype == 'debug' -# gtk_debug_cflags += '-DG_ENABLE_CONSISTENCY_CHECKS' -# endif -elif buildtype == 'release' + if optimization in ['0', 'g'] + gtk_debug_cflags += '-DG_ENABLE_CONSISTENCY_CHECKS' + endif +elif optimization in ['2', '3', 's'] gtk_debug_cflags += '-DG_DISABLE_CAST_CHECKS' endif