summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2020-04-03 17:17:17 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2020-04-03 17:17:17 +0530
commita2e37c9cb83ff2b95184527ed594f2b9a829404e (patch)
tree83adb3ddfd92afd8f0ebeda338d4b4c125a85b95 /meson.build
parent2a773323f1f7b5510ee0de7a1ea0ac8bec0e05d4 (diff)
downloadpango-a2e37c9cb83ff2b95184527ed594f2b9a829404e.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.build16
1 files changed, 9 insertions, 7 deletions
diff --git a/meson.build b/meson.build
index d4cff2af..e8cb1cef 100644
--- a/meson.build
+++ b/meson.build
@@ -172,17 +172,19 @@ foreach h: checked_headers
endif
endforeach
-buildtype = get_option('buildtype')
-if buildtype.startswith('debug')
- pango_debug_cflags = [ '-DPANGO_ENABLE_DEBUG', ]
-elif buildtype == 'release'
- pango_debug_cflags = [ '-DG_DISABLE_CAST_CHECKS', ]
+# Use debug/optimization flags to determine whether to enable debug or disable
+# cast checks
+pango_debug_cflags = []
+if get_option('debug')
+ pango_debug_cflags = [ '-DPANGO_ENABLE_DEBUG' ]
+ message('Enabling various debug infrastructure')
+elif get_option('optimization') in ['2', '3', 's']
+ pango_debug_cflags = [ '-DG_DISABLE_CAST_CHECKS' ]
+ message('Disabling cast checks')
# TODO: We may want a configuration argument to add `G_DISABLE_CHECKS`
# and `G_DISABLE_ASSERT` from the build, for specific build environments.
# On the other hand, those who need these symbols can inject them in their
# build as well.
-else
- pango_debug_cflags = []
endif
# Dependencies