Commit 90f32acd authored by Tanel Alumae's avatar Tanel Alumae
Browse files

trunk: refactored GStreamer plugin Makefile; GStreamer plugin is now linked dynamically

git-svn-id: 5e6a8d80-dfce-4ca6-a32a-6e07a63d50c8
parent 6ba50382
all: all:
EXTRA_CXXFLAGS = -fPIC -Wno-sign-compare -I /usr/include/gstreamer-1.0 \
-I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include \
-I ../../tools/portaudio/install/include
include ../ include ../
ifneq ($(KALDI_FLAVOR), dynamic)
$(error Kaldi must compiled with dynamic libraries support. Run configure with --shared flag. )
EXTRA_CXXFLAGS = -Wno-sign-compare -I ../../tools/portaudio/install/include
EXTRA_CXXFLAGS += $(shell pkg-config --cflags gstreamer-1.0)
EXTRA_CXXFLAGS += $(shell pkg-config --cflags glib-2.0)
EXTRA_LDLIBS = -pthread -lgstbase-1.0 -lgstcontroller-1.0 -lgstreamer-1.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0
#Kaldi shared libraries required by the GStreamer plugin
EXTRA_LDLIBS += -lkaldi-online -lkaldi-lat -lkaldi-decoder -lkaldi-feat -lkaldi-transform \
-lkaldi-gmm -lkaldi-hmm \
-lkaldi-tree -lkaldi-matrix -lkaldi-util -lkaldi-base
OBJFILES = gst-audio-source.o gst-online-gmm-decode-faster.o OBJFILES = gst-audio-source.o gst-online-gmm-decode-faster.o
...@@ -17,23 +26,22 @@ BINFILES= $(LIBFILE) ...@@ -17,23 +26,22 @@ BINFILES= $(LIBFILE)
all: $(LIBFILE) all: $(LIBFILE)
GST_LIBS = -pthread -lgstbase-1.0 -lgstcontroller-1.0 -lgstreamer-1.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0 EXTRA_LDLIBS += ../../tools/portaudio/install/lib/libportaudio.a
ifneq ($(wildcard ../../tools/portaudio/install/include/pa_linux_alsa.h),)
ADDLIBS=../online/kaldi-online.a ../lat/kaldi-lat.a ../decoder/kaldi-decoder.a \ EXTRA_LDLIBS += -lasound
../feat/kaldi-feat.a ../transform/kaldi-transform.a ../gmm/kaldi-gmm.a ../hmm/kaldi-hmm.a \ else
../tree/kaldi-tree.a ../matrix/kaldi-matrix.a ../util/kaldi-util.a ../base/kaldi-base.a \ EXTRA_LDLIBS += -lrt
../../tools/portaudio/install/lib/libportaudio.a endif
# MKL libs required for shared library # MKL libs required when linked via shared library
GSTKALDI_SO_LDFLAGS+=-lmkl_p4n -lmkl_def EXTRA_LDLIBS+=-lmkl_p4n -lmkl_def
endif endif
$(CXX) -shared -DPIC -o $(LIBFILE) -Wl,-soname=$(LIBFILE) $(GST_LIBS) $(GSTKALDI_SO_LDFLAGS) \ $(CXX) -shared -DPIC -o $(LIBFILE) -Wl,-soname=$(LIBFILE) \
-Wl,-whole-archive $(ADDLIBS) -Wl,-no-whole-archive $(OBJFILES) -L$(KALDILIBDIR) -Wl,-rpath=$(KALDILIBDIR) $(EXTRA_LDLIBS) $(LDLIBS) $(LDFLAGS) \
kaldimarshal.h: kaldimarshal.list kaldimarshal.h: kaldimarshal.list
glib-genmarshal --header --prefix=kaldi_marshal kaldimarshal.list > kaldimarshal.h.tmp glib-genmarshal --header --prefix=kaldi_marshal kaldimarshal.list > kaldimarshal.h.tmp
...@@ -44,7 +52,6 @@ kaldimarshal.list ...@@ -44,7 +52,6 @@ kaldimarshal.list
echo "#include \"kaldimarshal.h\"" >> kaldimarshal.c.tmp echo "#include \"kaldimarshal.h\"" >> kaldimarshal.c.tmp
glib-genmarshal --body --prefix=kaldi_marshal kaldimarshal.list >> kaldimarshal.c.tmp glib-genmarshal --body --prefix=kaldi_marshal kaldimarshal.list >> kaldimarshal.c.tmp
mv kaldimarshal.c.tmp mv kaldimarshal.c.tmp
clean: clean:
-rm -f *.o *.a $(TESTFILES) $(BINFILES) kaldimarshal.h -rm -f *.o *.a $(TESTFILES) $(BINFILES) kaldimarshal.h
...@@ -52,6 +59,6 @@ clean: ...@@ -52,6 +59,6 @@ clean:
depend: kaldimarshal.h depend: kaldimarshal.h
-$(CXX) -M $(CXXFLAGS) *.cc > -$(CXX) -M $(CXXFLAGS) *.cc >
-include -include
...@@ -8,9 +8,17 @@ decoder words are "pushed" out using a callback. ...@@ -8,9 +8,17 @@ decoder words are "pushed" out using a callback.
== Requirements == == Requirements ==
* GStreamer 1.0, including the 'good' plugins and the GStreamer tools package Following packages are needed for the GStreamer plugin:
* Development packages for Gstreamer 1.0 (libgstreamer1.0-dev on Debian Jessie)
* libgstreamer1.0-dev
* gstreamer1.0-plugins-good
* gstreamer1.0-tools
* gstreamer1.0-pulseaudio (only required for the demos in egs/voxforge/gst_demo)
On Debian Wheezy, the GStreamer 1.0 packages are available from the backports repository (
On Ubuntu, you might need to use this PPA:
== Install == == Install ==
Compile rest of the Kaldi using the 'shared' flavour. To do this, Compile rest of the Kaldi using the 'shared' flavour. To do this,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment