Single compilation units
Even before reading 1, we noticed a great speed up in compile time for all PCL libraries if instead of compiling N object files and linking them together, we compile only one, and include all the sources of the N files in this main source. If you peek at an older version of PCL, you might notice things along the lines of:
1 // Include the implementations instead of compiling them separately to speed up compile time 2 #include "extract_indices.cpp" 3 #include "passthrough.cpp" 4 #include "project_inliers.cpp" 5 #include "statistical_outlier_removal.cpp" 6 #include "voxel_grid.cpp"
and in CMakeLists.txt:
1 rosbuild_add_library (pcl_ros_filters 2 src/pcl_ros/filters/filter.cpp 3 # Compilation is much faster if we include all the following CPP files in filters.cpp 4 #src/pcl_ros/filters/passthrough.cpp 5 #src/pcl_ros/filters/project_inliers.cpp 6 #src/pcl_ros/filters/extract_indices.cpp 7 #src/pcl_ros/filters/statistical_outlier_removal.cpp 8 #src/pcl_ros/filters/voxel_grid.cpp 9 )
For more information on how/why this works, see 1.