PointCloudLibrary / pcl

Point Cloud Library (PCL)
https://pointclouds.org/
Other
9.64k stars 4.59k forks source link

Give users more control regarding with which point types classes are … #6062

Closed mvieth closed 1 week ago

mvieth commented 2 weeks ago

…instantiated

Previously, users could only choose between all types, some types ("core types" although it is not transparent which types these are), and no types (PCL_NO_PRECOMPILE). PCL_XYZ_POINT_TYPES and PCL_NORMAL_POINT_TYPES are now configurable via CMake (these only take effect if PCL_ONLY_CORE_POINT_TYPES and PCL_NO_PRECOMPILE are OFF). This enables users on all platforms and compilers to reduce PCL compile times and library size. Additionally, for users of MSVC or MINGW, PCL_ONLY_CORE_POINT_TYPES is now ON by default and not statically added to the definitions in CMakeLists.txt. I believe this is behaviour is more transparent, and these users now have the option to set PCL_ONLY_CORE_POINT_TYPES to OFF and choose the instantiated types via PCL_XYZ_POINT_TYPES and PCL_NORMAL_POINT_TYPES instead. However one of these two ways to reduce the set of instantiations must be used on Windows to avoid the linker error fatal error LNK1189: library limit of 65535 objects exceeded when trying to link the features library.

Fixes https://github.com/PointCloudLibrary/pcl/issues/5928

mvieth commented 1 week ago

One addition: there currently seem to be some constraints regarding which point types can be removed from/need to be present in PCL_XYZ_POINT_TYPES and PCL_NORMAL_POINT_TYPES (depending on which PCL modules are built, and whether tests are built or not). Perhaps we can improve this in a future pull request. Currently, in my tests, PCL_NORMAL_POINT_TYPES=(pcl::Normal)(pcl::PointNormal) and PCL_XYZ_POINT_TYPES=(pcl::PointXYZ)(pcl::PointXYZI)(pcl::PointXYZL)(pcl::PointXYZRGB)(pcl::PointXYZRGBA)(pcl::PointXYZRGBL)(pcl::PointNormal)(pcl::PointXYZINormal)(pcl::PointXYZLNormal)(pcl::PointXYZRGBNormal)(pcl::PointWithRange) seem to work.