-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to build Open3D to be able to wrap the DLL for a .NET project? #7062
Comments
What errors are you having? Please post text of your errors, instead of screenshots. I've succeeded in building Open3D static and DLL libraries from source, but I'm having troubles integrating it into my C++ projects. From what I can tell, part of my issues are dependency clashes. Open3D packs some older versions of common dependencies (Eigen, fmt), and this can clash when your project relies different versions of these same libraries. I tried to integrate the static libraries instead, in an attempt to isolate dependencies and remedy this problem. However, Open3D includes several of their external dependencies in their .h files, so I'm unable to fully isolate their dependencies. With a quick
|
I managed to get it to work in a Microsoft Visual C++/CLI project. Now I can use Open3D in a native C++ class and wrap it in CLR C++ class for my C# project. I will add my project settings in case someone needs them. Maybe someone wants to add some documentation to the project?
My problem was that I couldn't use the binaries from the releases (v0.18.0 or v0.17.0) directly. Adding them to a C++/CLI project resulted in build errors in Visual Studio, although they worked just fine in a C++ console application.
So I tried to build and install them myself. Which is actually a good thing because now I can change some build options and exclude the parts I don't need. diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7b047cd0b..a9e9bd57d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -34,11 +34,11 @@ endif()
include(CMakeDependentOption)
# Open3D build options
-option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
-option(BUILD_EXAMPLES "Build Open3D examples programs" ON )
+option(BUILD_SHARED_LIBS "Build shared libraries" ON )
+option(BUILD_EXAMPLES "Build Open3D examples programs" OFF)
option(BUILD_UNIT_TESTS "Build Open3D unit tests" OFF)
option(BUILD_BENCHMARKS "Build the micro benchmarks" OFF)
-option(BUILD_PYTHON_MODULE "Build the python module" ON )
+option(BUILD_PYTHON_MODULE "Build the python module" OFF)
option(BUILD_CUDA_MODULE "Build the CUDA module" OFF)
option(BUILD_WITH_CUDA_STATIC "Build with static CUDA libraries" ON )
option(BUILD_COMMON_CUDA_ARCHS "Build for common CUDA GPUs (for release)" OFF)
@@ -53,7 +53,7 @@ else()
option(BUILD_ISPC_MODULE "Build the ISPC module" OFF)
endif()
option(BUILD_COMMON_ISPC_ISAS "Build for common ISPC ISAs (for release)" OFF)
-option(BUILD_GUI "Builds new GUI" ON )
+option(BUILD_GUI "Builds new GUI" OFF)
option(WITH_OPENMP "Use OpenMP multi-threading" ON )
option(WITH_IPP "Use Intel Integrated Performance Primitives" ON )
option(ENABLE_HEADLESS_RENDERING "Use OSMesa for headless rendering" OFF) Building with my options worked just fine. Installing however is when I ran into troubles... When running Since I was out of options I checked out So, I will use this build until a new release comes out. |
After analyzing the errors while writing the above comment I think I found the source of the error I encountered. I checked out the
|
After fixing the files from #7062 (comment) I managed to build and install |
I discovered that Now I can work with the Another thing is that I somehow need a |
Checklist
main
branch).My Question
I'm trying to compile Open3D to get a DLL which I can use in C++ project which exports methods that I can use in a .NET C# project via P/Invoke.
I have tried hints from #2889 and #5608, or whatever I could find on StackOverflow. Information is sparse.
I managed to build a DLL that I can use in a C++ console application that I created in Visual Studio but not in a project that is compiled to a DLL containing
__declspec(dllexport)
.As soon as I include Open3D.h my build fails with errors from various Open3D header files. I only have .NET/C# background so I don't know why it's even trying to build these files.
I'm only using the Windows runtime and I have tried to compile
main
and0.18.0
. The0.18.0
build fails and/or theINSTALL
target doesn't work as expected.Do you have any information on this?
The text was updated successfully, but these errors were encountered: