问题描述
您好,我是新来的Android NDK到目前为止,我与所有示例应用程序工作的Android NDK,现在我想端口fftw3库在Android中,你可以PLZ建议我这方面的任何教程。
hi i am new to android-ndk so far i worked with all sample applications in android-ndk,now i am trying to port fftw3 library in android, can you plz suggest me any tutorial for this.
感谢。
推荐答案
该FFTW3构建系统利用自动工具,让你无法与Android NDK直接使用它。
一个好的博客文章处理这个问题是<一个href=\"http://warpedtimes.word$p$pss.com/2010/02/03/building-open-source-libraries-with-android-ndk/\">here.
The FFTW3 build system makes use of Autotools, so that you can not use it directly with the Android NDK.A good blog post dealing with this issue is here.
我们的想法是生成正确的的config.h
文件离线和创造的Android的Makefile,取代通常由自动工具产生的。没有的部分。
The idea is to generate a proper config.h
file offline and to create Android Makefiles, which replace the missing ones normally generated by the Autotools.
要实现不同的本地模块的模块化布局,你可以使用,我提出以下建议:
To achieve a modular layout for the different native modules you might use, I'd recommend the following:
在您的顶级 JNI /
目录将这两个文件:
In your top jni/
directory put these two files:
Application.mk
:
APP_OPTIM := release
APP_ABI := armeabi armeabi-v7a
APP_MODULES := fftw3
Android.mk
:
TOP_DIR := $(call my-dir)
include $(TOP_DIR)/fftw3/project/jni/Android.mk
这种方式,你可以很容易地创建一个 JNI / new_module_name
目录,然后将添加一个新的模块 new_module_name
来在 APP_MODULES
列表。
This way you can easily add a new module by creating a jni/new_module_name
directory and then adding new_module_name
to the APP_MODULES
list.
然后创建一个新的 JNI / fftw3
目录,并把另一个 Application.mk
有:
Then create a new jni/fftw3
directory and put another Application.mk
there:
Application.mk
:
APP_PROJECT_PATH := $(call my-dir)/project
APP_MODULES += fftw3
APP_OPTIM := release
APP_ABI := armeabi armeabi-v7a
然后把原来的FFTW3包下 JNI / fftw3 /项目/ JNI
。
在这一点上,你需要生成一个的config.h
。您可以通过使用一个小的shell脚本如做到这一点。
At this point you need to generate a config.h
. You can do this by using a small shell script like this.
最后一步是创建所需的Android Makefile文件。在 JNI / fftw3 /项目/ JNI
把顶部 Android.mk
:
The last step is to create the needed Android Makefile. In jni/fftw3/project/jni
put a top Android.mk
:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
include $(LOCAL_PATH)/api/sources.mk
include $(LOCAL_PATH)/dft/sources.mk
include $(LOCAL_PATH)/dft/scalar/sources.mk
include $(LOCAL_PATH)/dft/scalar/codelets/sources.mk
include $(LOCAL_PATH)/kernel/sources.mk
include $(LOCAL_PATH)/rdft/sources.mk
include $(LOCAL_PATH)/rdft/scalar/sources.mk
include $(LOCAL_PATH)/rdft/scalar/r2cb/sources.mk
include $(LOCAL_PATH)/rdft/scalar/r2cf/sources.mk
include $(LOCAL_PATH)/rdft/scalar/r2r/sources.mk
include $(LOCAL_PATH)/reodft/sources.mk
LOCAL_MODULE := fftw3
LOCAL_C_INCLUDES := $(LOCAL_PATH) \
$(LOCAL_PATH)/api \
$(LOCAL_PATH)/dft \
$(LOCAL_PATH)/dft/scalar \
$(LOCAL_PATH)/dft/scalar/codelets \
$(LOCAL_PATH)/kernel \
$(LOCAL_PATH)/rdft \
$(LOCAL_PATH)/rdft/scalar \
$(LOCAL_PATH)/rdft/scalar/r2cb \
$(LOCAL_PATH)/rdft/scalar/r2cf \
$(LOCAL_PATH)/rdft/scalar/r2r \
$(LOCAL_PATH)/reodft
# Use APP_OPTIM in Application.mk
LOCAL_CFLAGS := -g
include $(BUILD_SHARED_LIBRARY)
现在你必须创建所有这些 sources.mk
文件FROW。
例如。一个典型的 sources.mk
是这样的:
Frow now on you have to create all these sources.mk
files.E.g. a typical sources.mk
looks like this:
RDFT / sources.mk
:
sources = buffered2.c \
buffered.c \
<....>
vrank-geq1.c \
vrank-geq1-rdft2.c
LOCAL_SRC_FILES += $(sources:%=rdft/%)
调用 NDK的构建
脚本在您的应用程序的顶级目录,你应该有两个现成的使用FFTW3库结束:
Call the ndk-build
script in the top directory of your app and you should end up with two ready-to-use FFTW3 libraries:
-
库/ armeabi-V7A / libfftw3.so
-
库/ armeabi / libfftw3.so
libs/armeabi-v7a/libfftw3.so
libs/armeabi/libfftw3.so
这篇关于在Android的NDK编译fftw3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!