Easy3D
Easy3D copied to clipboard
Compiling Easy3D as dynamic library
Enabling the use of Easy3D in a dynamic library project.
Thank you for your efforts in this pull request! It works perfectly on Mac and Linux, but it seems not possible to make it work on Windows without modifying the source code. As far I know, we'll have to make the following changes for Windows:
- define a macro, e.g.,
EASY3D_API
as#ifdef EASY3D_DYNAMIC_LIBRARY #define EASY3D_API __declspec(dllexport) #else #define EASY3D_API __declspec(dllimport) #endif
- add
EASY3D_API
to the declarations of ALL the classes and functions that will be exported to the dynamic libraries. The involves modifying almost every file in Easy3D.
Do you know if there is an easier way that these can be done?
Besides, it will be better to introduce a CMake option, e.g., EASY3D_BUILD_DYNAMIC_LIBRARY
in the main CMakeList file, so users can choose between static and dynamic.
Thank you for replying. I did not consider Windows, and unfortunately, I don't know an easier way to do it for Windows. I think it will be good to introduce the CMake option for Easy3D as dynamic library for Linux and Mac users for now.
I will have this issue on hold until an elegant solution is found. Maybe http://gcc.gnu.org/wiki/Visibility ...
Some scenarios also need to use static libraries. You can make a switch later, and you can freely switch the compilation configuration of static libraries and dynamic libraries. That's even better!
Hi,
Just to let you know that Easy3D now can be built as shared libraries.
The latest code is in the dev
branch: https://github.com/LiangliangNan/Easy3D/tree/dev
I will merge it into the main
branch after more tests.
In case you use it and find issues, do please let me know.
I will close this pull request. Good luck with your research!