如何将Eigen编译成 .so 文件

huangapple go评论54阅读模式
英文:

how to compile Eigen to .so

问题

https://eigen.tuxfamily.org/dox/GettingStarted.html 中提到,不需要使用 CMake 进行安装,只需要包含头文件。但现在我想将 Eigen 编译为共享库,以便轻松地在另一个共享库中链接,有人可以告诉我该如何操作吗?

如何将 Eigen 编译为共享库和动态链接库 (DLL)?

英文:

In the https://eigen.tuxfamily.org/dox/GettingStarted.html,it said that Eigen is not necessary to use Cmake to install, and just to include the header file.But now I want to compile Eigen as a shared library to easily be linked in another shared library, someone can tell what to do?

How to compiler Eigen to a shared library&dll

答案1

得分: 2

The MPL允许您将Eigen链接到您自己的代码中。Eigen的某些部分属于LGPL,这可能会导致问题,但Eigen的COPYING.README文件告诉您如何剥离LGPL代码。

如果您希望确保所包含的Eigen代码根据MPL2和可能更宽松的许可证(如BSD)进行许可,可以使用这个预处理符号:EIGEN_MPL2_ONLY。例如,对于大多数编译器,您可以将其添加到项目的CXXFLAGS中:-DEIGEN_MPL2_ONLY。这将在您包含任何LGPL许可的代码时生成编译错误。

英文:

The MPL is completely okay with you linking Eigen into your own code.
Some bits of Eigen are LGPL, which would pose a problem, but the Eigen COPYING.README tells you how to strip LGPL code:

> If you want to guarantee that the Eigen code that you are #including
> is licensed under the MPL2 and possibly more permissive licenses (like
> BSD), #define this preprocessor symbol: EIGEN_MPL2_ONLY For example,
> with most compilers, you could add this to your project CXXFLAGS:
> -DEIGEN_MPL2_ONLY
> This will cause a compilation error to be generated if you #include any code that is LGPL licensed.

huangapple
  • 本文由 发表于 2023年4月4日 14:54:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/75926316.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定