From ce64f0e0e0d4e692c8d99f9744d38b9676b3d720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Sat, 18 Aug 2018 21:08:55 +0100 Subject: meson: add options to disable gobject cast checks and glib asserts ... and define G_DISABLE_DEPRECATED for development versions, like we do in autotools. --- meson.build | 19 +++++++++++++++++++ meson_options.txt | 4 ++++ 2 files changed, 23 insertions(+) diff --git a/meson.build b/meson.build index 6be8347cc..d861fdfe4 100644 --- a/meson.build +++ b/meson.build @@ -14,6 +14,7 @@ gst_version_micro = version_arr[2].to_int() else gst_version_nano = 0 endif +gst_version_is_dev = gst_version_minor % 2 == 1 and gst_version_micro < 90 # FIXME: automagic have_cxx = add_languages('cpp', required : false) @@ -61,6 +62,24 @@ if cc.has_argument('-fno-strict-aliasing') add_project_arguments('-fno-strict-aliasing', language: 'c') endif +# Define G_DISABLE_DEPRECATED for development versions +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() check_headers = [ diff --git a/meson_options.txt b/meson_options.txt index 0d7a4bb98..460a13a9a 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -86,6 +86,10 @@ option('examples', type : 'feature', value : 'auto', yield : true) option('tests', type : 'feature', value : 'auto', yield : true) option('nls', type : 'feature', value : 'auto', yield: true, description : 'Enable native language support (translations)') option('orc', type : 'feature', value : 'auto', yield : true) +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') # Common options option('package-name', type : 'string', yield : true, -- cgit v1.2.1