diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2020-04-03 17:32:51 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2020-04-03 18:41:55 +0530 |
commit | eaef24c527833232bd4725789b0f35304de8123b (patch) | |
tree | cc55814b1b32ff4f2b1c658b0f9028067e5ac7fb /meson.build | |
parent | 777435c4708713f74279a02fb51910b1fbc841b4 (diff) | |
download | gtk+-eaef24c527833232bd4725789b0f35304de8123b.tar.gz |
meson: Fix check for builtype arguments
`get_option('buildtype')` will return `'custom'` for most combinations
of `-Doptimization` and `-Ddebug`, but those two will always be set
correctly if only `-Dbuildtype` is set. So we should look at those
options directly.
For the two-way mapping between `buildtype` and `optimization`
+ `debug`, see this table:
https://mesonbuild.com/Builtin-options.html#build-type-options
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/meson.build b/meson.build index 7eee560a6d..bf63c1330e 100644 --- a/meson.build +++ b/meson.build @@ -60,14 +60,17 @@ add_project_arguments('-DGTK_VERSION="@0@"'.format(meson.project_version()), lan add_project_arguments('-D_GNU_SOURCE', language: 'c') +# Use debug/optimization flags to determine whether to enable debug or disable +# cast checks 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' + if optimization in ['0', 'g'] gtk_debug_cflags += '-DG_ENABLE_CONSISTENCY_CHECKS' endif -elif buildtype == 'release' +elif optimization in ['2', '3', 's'] gtk_debug_cflags += '-DG_DISABLE_CAST_CHECKS' endif |