Skip to content

Commit

Permalink
meson: add options to disable gobject cast checks and glib asserts
Browse files Browse the repository at this point in the history
and define G_DISABLE_DEPRECATED for development versions,
like we do in autotools.
  • Loading branch information
tp-m committed Aug 11, 2018
1 parent 8178688 commit c9f975e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
19 changes: 19 additions & 0 deletions meson.build
Expand Up @@ -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

have_cxx = add_languages('cpp', required : false)
have_objc = add_languages('objc', required : false)
Expand Down Expand Up @@ -66,6 +67,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

core_conf = configuration_data()
check_headers = [
['HAVE_DLFCN_H', 'dlfcn.h'],
Expand Down
4 changes: 4 additions & 0 deletions meson_options.txt
Expand Up @@ -58,6 +58,10 @@ option('gtk_doc', type : 'feature', value : 'auto', yield : true, description :
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('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,
Expand Down

0 comments on commit c9f975e

Please sign in to comment.