pcl icon indicating copy to clipboard operation
pcl copied to clipboard

Enable delayed loading of VTK libraries on Windows

Open CSBVision opened this issue 2 years ago • 2 comments
trafficstars

Currently, VTK is a relatively large but mandatory dependency of PCL. However, it is mostly (if not only) needed for visualization/debugging/etc. such that a significant amount of library functionalities are actually independent of VTK. Still, VTK libraries will always be required since they are a link-time dependency even though they might be not used at all in many applications. For this reasoning, we propose to make the VTK libraries delay loaded on Windows using the /DELAYLOAD linker option. This allows to skip the VTK modules while distributing PCL, which makes the distribution process relatively lightweight (in particular, if the other dependencies are statically linked).

The respective changes are rather small, after VTK was found only the respective linker flags are defined.

CSBVision avatar Mar 27 '23 09:03 CSBVision

You can omit using VTK entirely if you build PCL yourself. But I guess it doesn't hurt to do be able to delayload it as an option anyways.

larshg avatar Mar 27 '23 21:03 larshg

Might be true, thanks for pointing out, we did not test this at all because to our knowledge VTK is a mandatory dependency. Even though it can be omitted, it is still extremely useful during development or for debugging purposes, i.e. we don't want to exclude it from the build. Here, delay load allows to use it only where needed, but to skip it elsewhere.

CSBVision avatar Mar 28 '23 04:03 CSBVision