meson: add glib-checks option to disable API guards and such
authorTim-Philipp Müller <tim@centricular.com>
Wed, 19 Sep 2018 10:31:43 +0000 (11:31 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Wed, 19 Sep 2018 10:32:16 +0000 (11:32 +0100)
We want this enabled by default, also in releases, but people
may want to disable this for performance-critical workloads or
on embedded devices.

meson.build
meson_options.txt

index 6991a34..aaee483 100644 (file)
@@ -78,6 +78,12 @@ if glib_asserts.disabled() or (glib_asserts.auto() and not gst_version_is_dev)
   add_project_arguments('-DG_DISABLE_ASSERT', language: 'c')
 endif
 
+glib_checks = get_option('glib-checks')
+if glib_checks.disabled() or (glib_checks.auto() and not gst_version_is_dev)
+  message('Disabling GLib checks')
+  add_project_arguments('-DG_DISABLE_CHECKS', language: 'c')
+endif
+
 cdata = configuration_data()
 cdata.set_quoted('GST_API_VERSION', apiversion)
 cdata.set_quoted('GST_DATADIR', join_paths(prefix, get_option('datadir')))
index 98228a7..cd5bead 100644 (file)
@@ -34,6 +34,8 @@ option('gobject-cast-checks', type : 'feature', value : 'auto', yield : true,
        description: 'Enable run-time GObject cast checks (auto = enabled for development, disabled for stable releases)')
 option('glib-asserts', type : 'feature', value : 'enabled', yield : true,
        description: 'Enable GLib assertion (auto = enabled for development, disabled for stable releases)')
+option('glib-checks', type : 'feature', value : 'enabled', yield : true,
+       description: 'Enable GLib checks such as API guards (auto = enabled for development, disabled for stable releases)')
 
 # Common options
 option('package-name', type : 'string', yield : true,