如何建立与Android NDK的第三方库 [英] How to build third party libraries with Android NDK
问题描述
如何编译与Android NDK第三方库?我编译它实现了JNI函数作为一个共享库,它依赖于其他第三方LIB(HTK)的包装。我不知道如何设置makefile文件。以下不工作:
How can I compile third party libraries with the android NDK? I am compiling a wrapper which implements the JNI functions as a shared lib, which depends on another 3rd party lib (HTK). I don't know how to setup the makefile. The following does not work:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
include HTKLib/Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := gaitfuncs
LOCAL_SRC_FILES := gaitfuncs.c
%LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
include $(BUILD_SHARED_LIBRARY)
第二的makefile应该再建该我的共享库链接到一个静态库。我怎样才能包括此子目录的makefile正常吗?这是做它的正确方法是什么?作为奖励:是否有通配符的LOCAL_SRC_FILES变量采取.C例如结尾的所有文件
The second makefile should then build a static lib which my shared lib links to. How can I include this subdir makefile properly? Is this the correct way of doing it? And as a bonus: Are there wildcards for the LOCAL_SRC_FILES variable to take all files ending in .c for example.
谢谢!
推荐答案
我找到了解决方法:
JNIPATH := $(call my-dir)
LOCAL_PATH := $(JNIPATH)
include $(call all-subdir-makefiles)
LOCAL_PATH := $(JNIPATH)
include $(CLEAR_VARS)
LOCAL_MODULE := gaitfuncs
LOCAL_SRC_FILES := gaitfuncs.c
LOCAL_STATIC_LIBRARIES := htk
include $(BUILD_SHARED_LIBRARY)
调用子目录,makefile文件功能不完全是优雅的前调用的CLEAR_VARS功能;)
Calling the CLEAR_VARS function before calling the subdir-makefiles function wasn't exactly elegant ;)
这篇关于如何建立与Android NDK的第三方库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!