将 FFTW 链接到 Android NDK 应用程序

发布于 2024-12-02 03:17:36 字数 458 浏览 0 评论 0原文

我目前正在编写一个流派分类应用程序,作为我计算机工程的最后一年项目。我最初用 C 语言编写了特征提取代码(实现 FFTW),现在我需要通过 NDK 在 Android 上实现它。

这是我的第一个 NDK 项目,所以我仍在掌握窍门,但我已经根据 本指南。我没有执行最后一步,因为我认为这不适合我的需要。

我的问题是,在编译步骤之后,如何在调用它的主 NDK 应用程序中使用该库?我在 Application.mk 中的所有内容是否正常,只是将 LOCAL_STATIC_LIBRARIES 设置为我刚刚编译的 libfftw3.a ?然后我不需要像通常那样有任何 -lfftw3 链接器标志,对吗?

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.

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.

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笑梦风尘 2024-12-09 03:17:37

您可以使用预编译 FFTW 库(无论您如何构建它)。

或者您可以在 Android.mk makefile 中使用整个项目构建 FFTW。

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< /code> 用于构建您的共享库。通常最好将 LOCAL_SRC_FILESLOCAL_C_INCLUDES 放入单独的 .mk 文件中。

您可以在 NDK 发行版的 docs/ANDROID-MK.html 文档中了解有关 Android.mk 文件的更多信息。

You can use prebuit FFTW library (no matter how did you build it).

Or you can build FFTW in Android.mk makefile with the whole project.

Android.mk content will be:

# 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)

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.

You can read more about Android.mk file in docs/ANDROID-MK.html document in your NDK distribution.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文