IntelRealSense / librealsense

Intel® RealSense™ SDK
https://www.intelrealsense.com/
Apache License 2.0
7.64k stars 4.83k forks source link

linking statically Win #4649

Open Armin234 opened 5 years ago

Armin234 commented 5 years ago

Hi,

where i can get a static lib librealsense2.lib do linking with my program?

Armin

MartyG-RealSense commented 5 years ago

The CMake customization flags for building Librealsense say that if the flag BUILD_SHARED_LIBS is set to False (it is True by default) then the output will be a static library instead of a dynamic link library (DLL) or a shared object (SO).

https://github.com/IntelRealSense/librealsense/wiki/Build-Configuration

Armin234 commented 5 years ago

okay, that means I have to download the entire package and try to compile it myself … :-(

dorodnic commented 5 years ago

That is true. Let us know if you encounter any problems building the package with CMake and Visual Studio. Static version is not suitable for some applications (for instance .NET P/Invoke) but I agree it would be useful to bundle the full static library in the installer, in addition to what we have right now.

Armin234 commented 5 years ago

By copying the DLL into the Windows System32 directory, my problem has been solved, even if it is the sloppiest solution. I was irrated that all precompiled programs in the SDK / Tools worked until I understood that they were linked statically and not dynamically like the project examples.

Personally, I prefer the static linking, probably for the same reasons why the tools in the SDK were linked statically.

For me, there are several approaches:

RealSenseCustomerSupport commented 4 years ago

This change request is approved. We will implement it.

MartyG-RealSense commented 2 years ago

Hi @Armin234 I would like to provide an update about the feature request in this case for static linking in Windows. The feature request created by Intel remains active but there is no progress to report at the time of writing this.