meson: add options to disable gobject cast checks and glib asserts
[platform/upstream/gstreamer.git] / meson.build
index 9cd433e..3b50130 100644 (file)
@@ -14,6 +14,7 @@ if version_arr.length() == 4
 else
   gst_version_nano = 0
 endif
+gst_version_is_dev = gst_version_minor % 2 == 1 and gst_version_micro < 90
 
 host_system = host_machine.system()
 
@@ -58,10 +59,23 @@ if cc.has_argument('-fno-strict-aliasing')
 endif
 
 # Define G_DISABLE_DEPRECATED for development versions
-if gst_version_minor % 2 == 1 and gst_version_micro < 90
+if gst_version_is_dev
+  message('Disabling deprecated GLib API')
   add_project_arguments('-DG_DISABLE_DEPRECATED', language: 'c')
 endif
 
+cast_checks = get_option('gobject-cast-checks')
+if cast_checks.disabled() or (cast_checks.auto() and not gst_version_is_dev)
+  message('Disabling GLib cast checks')
+  add_project_arguments('-DG_DISABLE_CAST_CHECKS', language: 'c')
+endif
+
+glib_asserts = get_option('glib-asserts')
+if glib_asserts.disabled() or (glib_asserts.auto() and not gst_version_is_dev)
+  message('Disabling GLib asserts')
+  add_project_arguments('-DG_DISABLE_ASSERT', language: 'c')
+endif
+
 cdata = configuration_data()
 cdata.set_quoted('GST_API_VERSION', apiversion)
 cdata.set_quoted('GST_DATADIR', join_paths(prefix, get_option('datadir')))