meson: add options to disable gobject cast checks and glib asserts

... and define G_DISABLE_DEPRECATED for development versions,
like we do in autotools.
This commit is contained in:
Tim-Philipp Müller 2018-08-18 21:15:23 +01:00
parent cf385f20cf
commit d24e1caf8e
2 changed files with 26 additions and 1 deletions

View file

@ -14,6 +14,7 @@ gst_version_micro = version_arr[2].to_int()
else else
gst_version_nano = 0 gst_version_nano = 0
endif endif
gst_version_is_dev = gst_version_minor % 2 == 1 and gst_version_micro < 90
have_cxx = add_languages('cpp', required : false) have_cxx = add_languages('cpp', required : false)
@ -228,6 +229,24 @@ foreach extra_arg : warning_c_flags
endif endif
endforeach endforeach
# 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
presetdir = join_paths(get_option('datadir'), 'gstreamer-' + api_version, 'presets') presetdir = join_paths(get_option('datadir'), 'gstreamer-' + api_version, 'presets')
pkgconfig = import('pkgconfig') pkgconfig = import('pkgconfig')

View file

@ -18,10 +18,16 @@ option('mpeg2dec', type : 'feature', value : 'auto', description : 'MPEG 2 video
option('sidplay', type : 'feature', value : 'auto', description : 'Commodore 64 audio decoder plugin') option('sidplay', type : 'feature', value : 'auto', description : 'Commodore 64 audio decoder plugin')
option('x264', type : 'feature', value : 'auto', description : 'H.264 video encoder plugin') option('x264', type : 'feature', value : 'auto', description : 'H.264 video encoder plugin')
# Common options # Common feature options
option('nls', type : 'feature', value : 'auto', yield: true, option('nls', type : 'feature', value : 'auto', yield: true,
description : 'Enable native language support (translations)') description : 'Enable native language support (translations)')
option('orc', type : 'feature', value : 'auto', yield : true) 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, option('package-name', type : 'string', yield : true,
description : 'package name to use in plugins') description : 'package name to use in plugins')
option('package-origin', type : 'string', value : 'Unknown package origin', yield: true, option('package-origin', type : 'string', value : 'Unknown package origin', yield: true,