ekho在codelite环境下的编译运行

来源:互联网 发布:西伯利亚联邦大学 知乎 编辑:程序博客网 时间:2024/05/09 00:15

今天朋友在弄ekho遇到点小小的问题,帮着弄下,顺便相当于学习学习ekho,同时熟悉下codelite这个IDE环境。

ekho 语音,开源的TTS项目。各位亲自行百度之。

安装时的问题:

1.无知的跑去sourceforge下载了最新版本(5.4)的ekho,发现他缺少soundtouch这个头文件文件夹,不知道为什么,也许他想改变目录结构吧,果断放弃之,在下面看到linux应该使用的源码(注:如果只是需要这个软件来玩,下载deb安装文件就行了)是5.0.7.下载之。

2.安装的时候又很无脑的

./configure --enable-speechd --enable-festival --enable-soundtouch
错误报出一大堆。

查看changlog文件

 4.2: sonic is used as the default library for changing speed instead of SoundTouch.

所以配置文件不需要--enable-soundtouch

./configure --enable-speechd --enable-festivalmakesudo make install
安装codelite.

sudo apt-fast install codelite
其余的主要参考 http://blog.csdn.net/zouxy09/article/details/7909154  这个博客,我就不在此处多啰嗦了。

接下来正题,codelite开发ekho。例子程序还是用前面那个

#include "config.h"#include "ekho.h"using namespace ekho;int main(int argc, char **argv){Ekho wong("Mandarin");Ekho yue("Cantonese");wong.blockSpeak("你好,欢迎");yue.blockSpeak("你好,欢迎");return 0;}

接下来先看看我们的Makefile文件,首先说明这个Makefile还不完善,他仅仅只能与源文件和include、lib在相同文件夹下时有效。
  1 CC=g++  2 CFLAGS=-L/myhome/work/test/ekhotest -Iinclude -Iinclude/sonic -Iinclude/speech_tools -Iinclude/soundtouch -Iinclude/festival -Iinclude/utf8 `pkg-config --cflags libpulse-simple`  3 LIBS=-lpthread -lvorbisenc -lvorbis -lm -logg -lmp3lame -lsndfile -lncurses `pkg-config --libs libpulse-simple`  4 SLIBS=lib/libekho.a lib/libSoundTouch.a lib/libFestival.a lib/libestools.a lib/libeststring.a lib/libestbase.a  5 OBJECTS=ekhotest.o  6 TARGETS=testekho  7   8   9  10 $(TARGETS):$(OBJECTS) 11         $(CC) $^ $(SLIBS) $(LIBS) -o $@ 12 .cpp.o: 13         $(CC) -c $< $(CFLAGS) -o $@ 14 .c.o: 15         $(CC) -c $< $(CFLAGS) -o $@ 16 clean: 17         rm -rf $(TARGETS) $(OBJECTS)

我们要对照着这个Makefile来设置codelite的相关选项。首先在ekho的安装目录旁边建立一个文件夹ekhoneeds,在其下建立两个文件夹include与lib.├── include└── lib拷贝ekho-4.12源码目录下的libekho.a和lib/*到新建的lib下,再将源码目录下的config.h和include/*,还有sonic/*.h、utfcpp/source/*拷贝到新建的include目录下。这个ekhoneeds就是以后开发ekho所需的所有了,其他的都不需要了。第三步 设置codelite1.设置头文件路径在Settings菜单中打开Build Settings...在弹出的对话框中,左边的树视图,展开gnu g++--->Advanced右边的Include path:后面的编辑框中填入上面的头文件路径/myhome/tools/ekhoneeds/include。然后点OK关闭对话框。这个是总路径。其余次级目录点击工程右键-->Settings-->Compiler-->Additional Search Path依次输入/myhome/tools/ekhoneeds/include/festival
/
myhome/tools/ekhoneeds/include/sonic
/myhome/tools/ekhoneeds/include/soundtouch/myhome/tools/ekhoneeds/include/speech_tools/myhome/tools/ekhoneeds/include/utf82.设置CFLAGSMakefile中写了那么多实际上只有一个才是真正的有意义的`pkg-config --cflags libpulse-simple`,其他的都是在设置头文件路径,我们第一步已经做了。还是工程右键-->Settings-->Compiler-->Compiler Options 添加`pkg-config --cflags libpulse-simple`3.设置库路径工程右键-->Settings-->Linker-->Library Path/myhome/tools/ekhoneeds/lib4.设置将要使用的库工程右键-->Settings-->Linker-->Options加入-lekho -lSoundTouch -lFestival -lestools -leststring -lestbase -lpthread -lvorbisenc -lvorbis -lm -logg -lmp3lame -lsndfile -lncurses `pkg-config --libs libpulse-simple`注意 这里原本的静态库也使用-l的形式来引入,就是去掉他的lib前缀与.a后缀OK 编译运行 可以了