问题描述
我目前正在写一个流派分类中的应用在计算机工程的最后一年的项目。我最初在C写的特征提取code(实现FFTW),现在我需要通过NDK来实现它在Android上。
I am currently writing a genre classification application as my final year project in Computer Engineering. I initially wrote the feature extraction code (implementing FFTW) in C and now I need to implement it on Android via the NDK.
这是我的第一个项目NDK,所以我仍然得到的东西挂,但我已经根据的。我没有做的最后一步,因为我不认为这是正确的我需要的东西。
This is my first NDK project so I'm still getting the hang of things but I have compiled the FFTW3 library for Android according to this guide. I didn't do the very last step because I didn't think it was right for what I need.
我的问题是我怎么,编译步骤之后,使用该库在它调用主NDK应用程序?我做的一切都在正常只是Application.mk与设置为libfftw3.a LOCAL_STATIC_LIBRARIES我刚刚编译?然后,我不需要有任何-lfftw3连接标志像我通常会吧?
My question is how do I, after the compile step, use the library in the main NDK application that calls on it? Do I everything normally in Application.mk just with LOCAL_STATIC_LIBRARIES set to the libfftw3.a that I just compiled? And then I don't need to have any -lfftw3 linker flags like I normally would right?
推荐答案
您可以使用prebuit FFTW库(不管你是怎么构建它)。
You can use prebuit FFTW library (no matter how did you build it).
或者你也可以在 Android.mk
建立FFTW的makefile与整个项目。
Or you can build FFTW in Android.mk
makefile with the whole project.
Android.mk
的内容将是:
# Prebuilt FFTW library
include $(CLEAR_VARS)
LOCAL_MODULE := fftw
include $(PREBUILT_STATIC_LIBRARY)
# or
# Build FFTW library
include $(CLEAR_VARS)
LOCAL_MODULE := fftw
# TODO put your static libs build flags
include path_to_fftw_sources/$(LOCAL_MODULE).mk
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := YourProject
# TODO put your shared lib build flags
include path_to_your_project/$(LOCAL_MODULE).mk
LOCAL_STATIC_LIBRARIES += fftw
include $(BUILD_SHARED_LIBRARY)
我已经写了 path_to_fftw_sources / $(LOCAL_MODULE).mk
建筑FFTW静态库和 path_to_your_project / $(LOCAL_MODULE).mk
构建共享库。它往往是更好地把 LOCAL_SRC_FILES
和 LOCAL_C_INCLUDES
来单独 .mk
文件。
I have written path_to_fftw_sources/$(LOCAL_MODULE).mk
for building fftw static library and path_to_your_project/$(LOCAL_MODULE).mk
for building your shared library. It is often better to put LOCAL_SRC_FILES
and LOCAL_C_INCLUDES
to the separate .mk
file.
您可以在文档/ Android的MK.html
文件在你的NDK阅读更多关于 Android.mk
文件分布。
You can read more about Android.mk
file in docs/ANDROID-MK.html
document in your NDK distribution.
这篇关于链接FFTW成一个Android NDK应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!