webrtc: Add gobject-introspection integration

https://bugzilla.gnome.org/show_bug.cgi?id=794347
This commit is contained in:
Sebastian Dröge 2018-03-15 12:04:00 +02:00
parent 7da65ab6d5
commit b35b01ad09
2 changed files with 72 additions and 1 deletions

View file

@ -52,3 +52,57 @@ libgstwebrtc_@GST_API_VERSION@_la_LDFLAGS = \
$(GST_LT_LDFLAGS) $(GST_LT_LDFLAGS)
include $(top_srcdir)/common/gst-glib-gen.mak include $(top_srcdir)/common/gst-glib-gen.mak
if HAVE_INTROSPECTION
BUILT_GIRSOURCES = GstWebRTC-@GST_API_VERSION@.gir
gir_headers=$(patsubst %,$(srcdir)/%, $(libgstwebrtc_@GST_API_VERSION@include_HEADERS))
gir_sources=$(patsubst %,$(srcdir)/%, $(libgstwebrtc_@GST_API_VERSION@_la_SOURCES))
GstWebRTC-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstwebrtc-@GST_API_VERSION@.la
$(AM_V_GEN)GST_PLUGIN_SYSTEM_PATH_1_0="" GST_PLUGIN_PATH_1_0="" GST_REGISTRY_UPDATE=no GI_SCANNER_DISABLE_CACHE=yes \
CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" CC="$(CC)" PKG_CONFIG="$(PKG_CONFIG)" DLLTOOL="$(DLLTOOL)" \
PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" \
$(INTROSPECTION_SCANNER) -v --namespace GstWebRTC \
--nsversion=@GST_API_VERSION@ \
--warn-all \
--strip-prefix=Gst \
-I$(top_srcdir)/gst-libs \
-I$(top_builddir)/gst-libs \
--c-include "gst/webrtc/webrtc.h" \
--add-include-path=$(top_builddir)/gst-libs \
--add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-1.0` \
--add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-sdp-1.0` \
--library-path=$(top_builddir)/gst-libs \
--library=libgstwebrtc-@GST_API_VERSION@.la \
--include=Gst-@GST_API_VERSION@ \
--include=GstSdp-@GST_API_VERSION@ \
--libtool="${LIBTOOL}" \
--pkg gstreamer-@GST_API_VERSION@ \
--pkg gstreamer-sdp-@GST_API_VERSION@ \
--pkg-export gstreamer-webrtc-@GST_API_VERSION@ \
--add-init-section="$(INTROSPECTION_INIT)" \
--output $@ \
$(gir_headers) \
$(gir_sources)
# INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to
# install anything - we need to install inside our prefix.
girdir = $(datadir)/gir-1.0
gir_DATA = $(BUILT_GIRSOURCES)
typelibsdir = $(libdir)/girepository-1.0/
typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
%.typelib: %.gir $(INTROSPECTION_COMPILER)
$(AM_V_GEN)PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" \
$(INTROSPECTION_COMPILER) \
--includedir=$(srcdir)/gst-libs \
--includedir=$(builddir)/gst-libs \
--includedir=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-1.0` \
--includedir=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-sdp-1.0` \
$(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
CLEANFILES += $(BUILT_GIRSOURCES) $(typelibs_DATA)
endif

View file

@ -40,7 +40,7 @@ gstwebrtc_c = custom_target('gstwebrtcenum_c',
command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@']) command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
webrtc_gen_sources = [gstwebrtc_h] webrtc_gen_sources = [gstwebrtc_h]
gstwebrtc_dependencies = [gstbase_dep, gstpbutils_dep, gstsdp_dep] gstwebrtc_dependencies = [gstbase_dep, gstsdp_dep]
gstwebrtc = library('gstwebrtc-' + api_version, gstwebrtc = library('gstwebrtc-' + api_version,
webrtc_sources, gstwebrtc_c, gstwebrtc_h, webrtc_sources, gstwebrtc_c, gstwebrtc_h,
@ -52,8 +52,25 @@ gstwebrtc = library('gstwebrtc-' + api_version,
dependencies : gstwebrtc_dependencies, dependencies : gstwebrtc_dependencies,
) )
if build_gir
webrtc_gir = gnome.generate_gir(gstwebrtc,
sources : gstwebrtc_sources + gstwebrtc_headers,
namespace : 'GstWebRTC',
nsversion : api_version,
identifier_prefix : 'Gst',
symbol_prefix : 'gst',
export_packages : 'gstreamer-webrtc-1.0',
includes : ['Gst-1.0', 'GstSdp-1.0'],
install : true,
extra_args : gir_init_section + ['-DGST_USE_UNSTABLE_API'] + ['--c-include=gst/webrtc/webrtc.h'],
dependencies : [gstbase_dep, gstsdp_dep]
)
webrtc_gen_sources += webrtc_gir
endif
install_headers(webrtc_headers, subdir : 'gstreamer-1.0/gst/webrtc') install_headers(webrtc_headers, subdir : 'gstreamer-1.0/gst/webrtc')
gstwebrtc_dep = declare_dependency(link_with: gstwebrtc, gstwebrtc_dep = declare_dependency(link_with: gstwebrtc,
include_directories : libsinc, include_directories : libsinc,
sources: webrtc_gen_sources,
dependencies: gstwebrtc_dependencies) dependencies: gstwebrtc_dependencies)