将 eigen 与 android ndk 一起使用

发布于 2024-12-20 20:26:03 字数 414 浏览 4 评论 0原文

有人使用 ndk 成功导入 eigen 库吗?我正在考虑使用它来为我正在开发的应用程序执行所有数学矩阵运算。我发现一些人在一些论坛中提到了它,但除了我不知道他们是否成功地让它工作这一事实之外,我读过的大多数论坛都开始提到一些与霓虹灯代码相关的错误......我还没有搞乱之前。

真正有用的是,如果有人可以向我指出如何使用 ndk 编译现有库(如 eigen)的教程。这样我以后就可以自己做。我刚刚发现这个: http://code.google.com/p/android-cmake/ 并想尝试自己实现它,但不知道从哪里开始。显然,我前面有一些半密集的阅读,所以我会开始阅读,但同时如果有人可以介入并帮助编译与 ndk 一起使用的本机库,我将非常感激。

Has anybody successfully imported the eigen library using the ndk? I was thinking about using it to do all the math matrix operations for an app Im working on. I found a few people mentioning it in some forums but aside from the fact that I dont know if they successfully got it working most of the forums I read start off mentioning some error related to neon code.....which I havent messed with before either.

What would be really helpful is if some one can point me towards a tutorial on how to compile an existing library like eigen using the ndk. That way I can just do it for myself later on. I just now found this: http://code.google.com/p/android-cmake/ and would like to try to implement it myself but not sure where to start. Obviously I have some semi-intense reading ahead of me so Ill start that but mean time if some one could jump in and help with the compiling of native libraries for use with the ndk I would much appreciate it.

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

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

发布评论

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

评论(2

秋风の叶未落 2024-12-27 20:26:03

我以前从未使用过 Android NDK,我使用 Eigen 进行物理数值计算。

Eigen 只是标题,因此您可以将其放在您喜欢的任何位置。您只需设置该文件夹的包含路径(可能在您的 Android.mk 中)。如果您不需要 Eigen 中不支持的库,那么您只需要“Eigen”文件夹。其余的仅用于文档和测试。
简单浏览一下文档后,我认为您可以在

LOCAL_C_INCLUDES := path/to/eigen

Android.mk 内部

实现这一目标。一个快速而肮脏的解决方案是将 Eigen 放入“jni”文件夹中。但这只有在所有使用 Eigen 的源都存在的情况下才有效。这样您就不必编辑 Android.mk。

I've never used the Android NDK before, I'm using Eigen for numeric calculations in physics.

Eigen is header only, so you can put it every where you like. You just have to set the include path to that folder( probably inside your Android.mk ). If you don't need the unsupported libraries in Eigen, then you only need the "Eigen" folder. The rest is only for documentation, and tests.
After a short look at the documentation i think you can achieve that with

LOCAL_C_INCLUDES := path/to/eigen

inside your Android.mk

A quick and dirty solution would be to throw Eigen inside the 'jni' folder. But this only works if all the source using Eigen is there as well. This way you don't have to edit your Android.mk.

゛时过境迁 2024-12-27 20:26:03

我更喜欢将 Eigen 标头放在 Eclipse 工作区之外,就像 stl 等一样。为此,请解压缩 Eigen 下载并将文件夹“Eigen”复制到您选择的目录中:

/Users/foo/libraries/eigen/Eigen

然后,在项目的 Android.mk 文件中,告诉 ndk-build Eigen 包含文件的位置:

LOCAL_C_INCLUDES += /Users/foo/libraries/eigen

不要在此处引用实际的“Eigen”文件夹,而是引用其上方的文件夹,否则包含将不起作用。最后,告诉 Eclipse 索引器有关包含的信息:

右键单击您的项目 ->属性-> C/C++ 通用 ->路径和符号 ->包括-> GNU C++ ->添加...->文件系统...->再次将其指向 /Users/foo/libraries/eigen

完成。

I prefer to have the Eigen headers outside the Eclipse workspace, just like stl etc. To do this, unzip your Eigen download and copy the folder "Eigen" into a directory of your choice:

/Users/foo/libraries/eigen/Eigen

Then, in your project's Android.mk file, tell ndk-build where the Eigen include files are:

LOCAL_C_INCLUDES += /Users/foo/libraries/eigen

Don't reference the actual "Eigen" folder here, reference the folder above it, otherwise the includes won't work. Finally, tell the eclipse indexer about the includes:

Right-click your project -> Properties -> C/C++ General -> Paths and Symbols -> Includes -> GNU C++ -> Add... -> File System... -> again point it to /Users/foo/libraries/eigen

Done.

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