From 53d69adcafd2eca83790bdb18437ed36e0fbd970 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Fri, 26 Aug 2016 20:06:22 -0300 Subject: [PATCH] meson: Add support for building GIR when used as subproject Add allow project to us it as subproject too --- meson.build | 1 + validate/gst/validate/meson.build | 24 ++++++++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index 251c4ed..a3bd25a 100644 --- a/meson.build +++ b/meson.build @@ -44,6 +44,7 @@ mathlib = cc.find_library('m', required : false) gst_c_args = ['-DHAVE_CONFIG_H', '-DGST_USE_UNSTABLE_API'] +gir_init_section = [ '--add-init-section=extern void gst_init(gint*,gchar**); gst_init(NULL,NULL);' ] gir = find_program('g-ir-scanner', required : false) build_gir = gir.found() and not meson.is_cross_build() and not get_option('disable-introspection') gnome = import('gnome') diff --git a/validate/gst/validate/meson.build b/validate/gst/validate/meson.build index d729986..c617d25 100644 --- a/validate/gst/validate/meson.build +++ b/validate/gst/validate/meson.build @@ -48,15 +48,24 @@ gstvalidate = shared_library('gstvalidate', dependencies : [gst_dep, glib_dep, gio_dep, gmodule_dep, gst_pbutils_dep, mathlib]) +validate_gen_sources = [] if build_gir - gnome.generate_gir(gstvalidate, - include_directories : include_directories('..'), + gst_validate_gir_extra_args = gir_init_section + [ '--c-include=gst/validate/validate.h' ] + if meson.is_subproject() + # FIXME: There must be a better way to do this + # Need to pass the include path to find gst/gst.h and gst/gstenumtypes.h (built) + gst_validate_gir_extra_args += ['--cflags-begin', + '-I' + meson.current_source_dir() + '/../../', + '-I' + meson.current_build_dir() + '/../../', + '--cflags-end'] + endif + validate_gen_sources = [gnome.generate_gir(gstvalidate, sources : gstvalidate_sources, nsversion : '1.0', namespace : 'GstValidate', symbol_prefix : 'gst_', identifier_prefix : 'Gst', - export_packages : 'gstvalidate-' + apiversion, + export_packages : 'gst-validate-' + apiversion, includes : ['GObject-2.0', 'GLib-2.0', 'Gio-2.0', @@ -64,11 +73,14 @@ if build_gir 'GstVideo-' + apiversion, 'Gst-' + apiversion, 'GstPbutils-' + apiversion], - install : true - ) + install : true, + dependencies : [gst_dep, glib_dep, gio_dep, gst_pbutils_dep], + )] endif validate_dep = declare_dependency(link_with : gstvalidate, include_directories : [inc_dirs], dependencies : [gst_dep, glib_dep, gio_dep, gmodule_dep, - gst_pbutils_dep, mathlib]) + gst_pbutils_dep, mathlib], + sources : validate_gen_sources +) -- 2.7.4