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.
This commit is contained in:
Ting-Wei Lan 2020-05-03 18:12:57 +08:00
parent 9151187e3e
commit 6d9a3e3ade

View File

@ -57,13 +57,14 @@ add_project_arguments('-DGTK_VERSION="@0@"'.format(meson.project_version()), lan
add_project_arguments('-D_GNU_SOURCE', language: 'c') add_project_arguments('-D_GNU_SOURCE', language: 'c')
gtk_debug_cflags = [] gtk_debug_cflags = []
buildtype = get_option('buildtype') debug = get_option('debug')
if buildtype.startswith('debug') optimization = get_option('optimization')
if debug
gtk_debug_cflags += '-DG_ENABLE_DEBUG' gtk_debug_cflags += '-DG_ENABLE_DEBUG'
# if buildtype == 'debug' if optimization in ['0', 'g']
# gtk_debug_cflags += '-DG_ENABLE_CONSISTENCY_CHECKS' gtk_debug_cflags += '-DG_ENABLE_CONSISTENCY_CHECKS'
# endif endif
elif buildtype == 'release' elif optimization in ['2', '3', 's']
gtk_debug_cflags += '-DG_DISABLE_CAST_CHECKS' gtk_debug_cflags += '-DG_DISABLE_CAST_CHECKS'
endif endif