From fffc3128937ca329431f4611da8896c5c08c21fe Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Sat, 11 Aug 2018 18:17:29 +0100 Subject: [PATCH] meson: add options to disable gobject cast checks and glib asserts And match what we do for autotools here currently. --- libs/gst/check/meson.build | 2 +- meson.build | 16 +++++++++++++++- meson_options.txt | 4 ++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/libs/gst/check/meson.build b/libs/gst/check/meson.build index 00ea454..f09908d 100644 --- a/libs/gst/check/meson.build +++ b/libs/gst/check/meson.build @@ -39,7 +39,7 @@ configure_file(input : 'libcheck/check.h.in', gst_check = shared_library('gstcheck-@0@'.format(apiversion), gst_check_sources, - c_args : gst_c_args + ['-DGST_EXPORTS'], + c_args : gst_c_args + ['-DGST_EXPORTS', '-UG_DISABLE_ASSERT'], version : libversion, soversion : soversion, install : true, diff --git a/meson.build b/meson.build index 9cd433e..3b50130 100644 --- a/meson.build +++ b/meson.build @@ -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'))) diff --git a/meson_options.txt b/meson_options.txt index d5c3873..275a1cb 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -30,6 +30,10 @@ option('tools', type : 'feature', value : 'auto', yield : true) option('gtk_doc', type : 'feature', value : 'auto', yield : true, description : 'Generate API documentation with gtk-doc') option('introspection', type : 'feature', value : 'auto', yield : true, description : 'Generate gobject-introspection bindings') option('nls', type : 'feature', value : 'auto', yield: true, description : 'Enable native language support (translations)') +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, -- 2.7.4