meson: Add support for building GIR when used as subproject

Add allow project to us it as subproject too
This commit is contained in:
Thibault Saunier 2016-08-26 20:06:22 -03:00
parent da327d8625
commit 53d69adcaf
2 changed files with 19 additions and 6 deletions

View file

@ -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')

View file

@ -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
)