From 85d93abb22d63827192214a93e1d546c687d3e2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BCttner?= Date: Mon, 20 Jun 2016 13:12:50 +0200 Subject: [PATCH 1/3] Fix linking error when using Octree with custom leaf container The octree module didn't respect the PCL_NO_PRECOMPILE mechanism. This commit fixes that by implementing it for percompiled classes and fixing includes for non-precompiled classes. --- .../pcl/octree/impl/octree2buf_base.hpp | 2 + .../include/pcl/octree/impl/octree_search.hpp | 2 + octree/include/pcl/octree/octree2buf_base.h | 4 +- octree/include/pcl/octree/octree_base.h | 4 +- octree/include/pcl/octree/octree_iterator.h | 5 ++ .../pcl/octree/octree_pointcloud_adjacency.h | 3 +- .../octree/octree_pointcloud_voxelcentroid.h | 1 + octree/include/pcl/octree/octree_search.h | 4 +- octree/src/octree_impl.cpp | 80 ------------------- octree/src/octree_inst.cpp | 5 +- 10 files changed, 22 insertions(+), 88 deletions(-) delete mode 100644 octree/src/octree_impl.cpp diff --git a/octree/include/pcl/octree/impl/octree2buf_base.hpp b/octree/include/pcl/octree/impl/octree2buf_base.hpp index 522ddfe42af..915093c5ad7 100644 --- a/octree/include/pcl/octree/impl/octree2buf_base.hpp +++ b/octree/include/pcl/octree/impl/octree2buf_base.hpp @@ -39,6 +39,8 @@ #ifndef PCL_OCTREE_2BUF_BASE_HPP #define PCL_OCTREE_2BUF_BASE_HPP +#include + namespace pcl { namespace octree diff --git a/octree/include/pcl/octree/impl/octree_search.hpp b/octree/include/pcl/octree/impl/octree_search.hpp index 51d28f8af8e..0535f855a15 100644 --- a/octree/include/pcl/octree/impl/octree_search.hpp +++ b/octree/include/pcl/octree/impl/octree_search.hpp @@ -864,4 +864,6 @@ pcl::octree::OctreePointCloudSearch::g return (voxel_count); } +#define PCL_INSTANTIATE_OctreePointCloudSearch(T) template class PCL_EXPORTS pcl::octree::OctreePointCloudSearch; + #endif // PCL_OCTREE_SEARCH_IMPL_H_ diff --git a/octree/include/pcl/octree/octree2buf_base.h b/octree/include/pcl/octree/octree2buf_base.h index 2d6b21aee66..c1691ead37f 100644 --- a/octree/include/pcl/octree/octree2buf_base.h +++ b/octree/include/pcl/octree/octree2buf_base.h @@ -920,7 +920,9 @@ namespace pcl } } -//#include "impl/octree2buf_base.hpp" +#ifdef PCL_NO_PRECOMPILE +#include +#endif #endif diff --git a/octree/include/pcl/octree/octree_base.h b/octree/include/pcl/octree/octree_base.h index 21c3d163d2f..d04be1ac2b3 100644 --- a/octree/include/pcl/octree/octree_base.h +++ b/octree/include/pcl/octree/octree_base.h @@ -594,7 +594,9 @@ namespace pcl } } -//#include "impl/octree_base.hpp" +#ifdef PCL_NO_PRECOMPILE +#include +#endif #endif diff --git a/octree/include/pcl/octree/octree_iterator.h b/octree/include/pcl/octree/octree_iterator.h index 8069fed8e2b..ef10a737d2c 100644 --- a/octree/include/pcl/octree/octree_iterator.h +++ b/octree/include/pcl/octree/octree_iterator.h @@ -619,5 +619,10 @@ namespace pcl } } +/* + * Note: Since octree iterators depend on octrees, don't precompile them. + */ +#include + #endif diff --git a/octree/include/pcl/octree/octree_pointcloud_adjacency.h b/octree/include/pcl/octree/octree_pointcloud_adjacency.h index 0385da97421..27d7cf3841b 100644 --- a/octree/include/pcl/octree/octree_pointcloud_adjacency.h +++ b/octree/include/pcl/octree/octree_pointcloud_adjacency.h @@ -247,9 +247,8 @@ namespace pcl } -//#ifdef PCL_NO_PRECOMPILE +// Note: Do not precompile this octree type because it is typically used with custom leaf containers. #include -//#endif #endif // PCL_OCTREE_POINTCLOUD_ADJACENCY_H_ diff --git a/octree/include/pcl/octree/octree_pointcloud_voxelcentroid.h b/octree/include/pcl/octree/octree_pointcloud_voxelcentroid.h index 10cddadcb90..5101c8f9442 100644 --- a/octree/include/pcl/octree/octree_pointcloud_voxelcentroid.h +++ b/octree/include/pcl/octree/octree_pointcloud_voxelcentroid.h @@ -232,6 +232,7 @@ namespace pcl } } +// Note: Don't precompile this octree type to speed up compilation. It's probably rarely used. #include #endif diff --git a/octree/include/pcl/octree/octree_search.h b/octree/include/pcl/octree/octree_search.h index 231a3865249..564a493a07a 100644 --- a/octree/include/pcl/octree/octree_search.h +++ b/octree/include/pcl/octree/octree_search.h @@ -602,8 +602,6 @@ namespace pcl #ifdef PCL_NO_PRECOMPILE #include -#else -#define PCL_INSTANTIATE_OctreePointCloudSearch(T) template class PCL_EXPORTS pcl::octree::OctreePointCloudSearch; -#endif // PCL_NO_PRECOMPILE +#endif #endif // PCL_OCTREE_SEARCH_H_ diff --git a/octree/src/octree_impl.cpp b/octree/src/octree_impl.cpp deleted file mode 100644 index 87ce28c0b44..00000000000 --- a/octree/src/octree_impl.cpp +++ /dev/null @@ -1,80 +0,0 @@ - -/* - * Software License Agreement (BSD License) - * - * Copyright (c) 2011, Willow Garage, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of Willow Garage, Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * Author: Julius Kammerl (julius@kammerl.de) - */ - -#include -#include -#include - -#include -#include - -// Instantiations of specific point types - -template class PCL_EXPORTS pcl::octree::OctreeBase; -template class PCL_EXPORTS pcl::octree::Octree2BufBase; - -template class PCL_EXPORTS pcl::octree::OctreeBase, - pcl::octree::OctreeContainerEmpty >; - -template class PCL_EXPORTS pcl::octree::Octree2BufBase, - pcl::octree::OctreeContainerEmpty >; - -PCL_INSTANTIATE(OctreePointCloudSingleBufferWithLeafDataTVector, - PCL_XYZ_POINT_TYPES) -PCL_INSTANTIATE(OctreePointCloudDoubleBufferWithLeafDataTVector, - PCL_XYZ_POINT_TYPES) - -PCL_INSTANTIATE(OctreePointCloudSearch, PCL_XYZ_POINT_TYPES) - - -// PCL_INSTANTIATE(OctreePointCloudSingleBufferWithLeafDataT, PCL_XYZ_POINT_TYPES) - -// PCL_INSTANTIATE(OctreePointCloudSingleBufferWithEmptyLeaf, PCL_XYZ_POINT_TYPES) - -// PCL_INSTANTIATE(OctreePointCloudDensity, PCL_XYZ_POINT_TYPES) -// PCL_INSTANTIATE(OctreePointCloudSingleBufferWithDensityLeaf, PCL_XYZ_POINT_TYPES) -// PCL_INSTANTIATE(OctreePointCloudDoubleBufferWithDensityLeaf, PCL_XYZ_POINT_TYPES) - -// PCL_INSTANTIATE(OctreePointCloudOccupancy, PCL_XYZ_POINT_TYPES) -// PCL_INSTANTIATE(OctreePointCloudSinglePoint, PCL_XYZ_POINT_TYPES) -// PCL_INSTANTIATE(OctreePointCloudPointVector, PCL_XYZ_POINT_TYPES) -PCL_INSTANTIATE(OctreePointCloudChangeDetector, PCL_XYZ_POINT_TYPES) -// PCL_INSTANTIATE(OctreePointCloudVoxelCentroid, PCL_XYZ_POINT_TYPES) - - diff --git a/octree/src/octree_inst.cpp b/octree/src/octree_inst.cpp index 1ca86ea7b19..a243b8cb933 100644 --- a/octree/src/octree_inst.cpp +++ b/octree/src/octree_inst.cpp @@ -1,4 +1,3 @@ - /* * Software License Agreement (BSD License) * @@ -70,6 +69,10 @@ PCL_INSTANTIATE(OctreePointCloudSearch, PCL_XYZ_POINT_TYPES) // PCL_INSTANTIATE(OctreePointCloudSingleBufferWithLeafDataT, PCL_XYZ_POINT_TYPES) PCL_INSTANTIATE(OctreePointCloudSingleBufferWithEmptyLeaf, PCL_XYZ_POINT_TYPES) +/* + * Note: Disable apriori instantiation of these octree types to speed up compilation. + * They are probably rarely used. + */ // PCL_INSTANTIATE(OctreePointCloudDensity, PCL_XYZ_POINT_TYPES) // PCL_INSTANTIATE(OctreePointCloudSingleBufferWithDensityLeaf, PCL_XYZ_POINT_TYPES) // PCL_INSTANTIATE(OctreePointCloudDoubleBufferWithDensityLeaf, PCL_XYZ_POINT_TYPES) From 09c42e56de393d404170c9de1dc3ae566bd4bef7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BCttner?= Date: Mon, 20 Jun 2016 23:51:06 +0200 Subject: [PATCH 2/3] Cleanup octree includes * Remove unnecessary includes and fix compilation error in OctreePointcloudAdjacency. * Add OctreePointCloudAdjacency to octree.h and add comment for instantiation. * Replace general octree.h includes by specific ones. Only include what is necessary to minimize dependencies and reduce build times. * Remove leftover string comment --- apps/src/openni_change_viewer.cpp | 2 +- .../octree_change_detection.cpp | 2 +- .../content/sources/octree_search/octree_search.cpp | 2 +- features/include/pcl/features/impl/gfpfh.hpp | 1 - .../include/pcl/filters/impl/morphological_filter.hpp | 2 +- .../include/pcl/gpu/kinfu_large_scale/world_model.h | 2 -- gpu/octree/test/test_approx_nearest.cpp | 4 ++-- gpu/octree/test/test_bfrs_gpu.cpp | 1 - gpu/octree/test/test_host_radius_search.cpp | 2 +- gpu/octree/test/test_knn_search.cpp | 4 ++-- gpu/octree/test/test_radius_search.cpp | 1 - .../impl/octree_pointcloud_compression.hpp | 3 --- octree/include/pcl/octree/impl/octree2buf_base.hpp | 2 -- octree/include/pcl/octree/impl/octree_base.hpp | 2 -- octree/include/pcl/octree/impl/octree_iterator.hpp | 5 ----- octree/include/pcl/octree/impl/octree_pointcloud.hpp | 3 +-- .../pcl/octree/impl/octree_pointcloud_adjacency.hpp | 11 ++++++++++- .../octree/impl/octree_pointcloud_voxelcentroid.hpp | 9 ++++++++- octree/include/pcl/octree/impl/octree_search.hpp | 5 ----- octree/include/pcl/octree/octree.h | 1 + octree/include/pcl/octree/octree2buf_base.h | 10 ++++------ octree/include/pcl/octree/octree_base.h | 9 ++++----- octree/include/pcl/octree/octree_container.h | 1 - octree/include/pcl/octree/octree_iterator.h | 7 ++----- octree/include/pcl/octree/octree_key.h | 2 -- octree/include/pcl/octree/octree_nodes.h | 3 --- octree/include/pcl/octree/octree_pointcloud.h | 6 +----- .../include/pcl/octree/octree_pointcloud_adjacency.h | 4 +--- .../pcl/octree/octree_pointcloud_changedetector.h | 3 ++- octree/include/pcl/octree/octree_pointcloud_density.h | 2 +- .../include/pcl/octree/octree_pointcloud_occupancy.h | 2 +- .../pcl/octree/octree_pointcloud_pointvector.h | 2 +- .../pcl/octree/octree_pointcloud_singlepoint.h | 2 +- .../pcl/octree/octree_pointcloud_voxelcentroid.h | 6 +----- octree/include/pcl/octree/octree_search.h | 3 +-- octree/src/octree_inst.cpp | 1 + .../pcl/segmentation/impl/lccp_segmentation.hpp | 1 + .../include/pcl/segmentation/supervoxel_clustering.h | 2 +- segmentation/src/supervoxel_clustering.cpp | 2 +- tools/octree_viewer.cpp | 3 +-- tracking/include/pcl/tracking/particle_filter.h | 3 +-- 41 files changed, 55 insertions(+), 83 deletions(-) diff --git a/apps/src/openni_change_viewer.cpp b/apps/src/openni_change_viewer.cpp index 4fda64ba2c4..95b69d652fb 100644 --- a/apps/src/openni_change_viewer.cpp +++ b/apps/src/openni_change_viewer.cpp @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include diff --git a/doc/tutorials/content/sources/octree_change_detection/octree_change_detection.cpp b/doc/tutorials/content/sources/octree_change_detection/octree_change_detection.cpp index 93dba4a2d16..a15f3d92600 100644 --- a/doc/tutorials/content/sources/octree_change_detection/octree_change_detection.cpp +++ b/doc/tutorials/content/sources/octree_change_detection/octree_change_detection.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include diff --git a/doc/tutorials/content/sources/octree_search/octree_search.cpp b/doc/tutorials/content/sources/octree_search/octree_search.cpp index 85c5db2ef1b..f8b139c26de 100644 --- a/doc/tutorials/content/sources/octree_search/octree_search.cpp +++ b/doc/tutorials/content/sources/octree_search/octree_search.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include diff --git a/features/include/pcl/features/impl/gfpfh.hpp b/features/include/pcl/features/impl/gfpfh.hpp index 6d05f669fc9..4566a475246 100644 --- a/features/include/pcl/features/impl/gfpfh.hpp +++ b/features/include/pcl/features/impl/gfpfh.hpp @@ -42,7 +42,6 @@ #define PCL_FEATURES_IMPL_GFPFH_H_ #include -#include #include #include diff --git a/filters/include/pcl/filters/impl/morphological_filter.hpp b/filters/include/pcl/filters/impl/morphological_filter.hpp index 59a0a965f8e..8c12fc48871 100644 --- a/filters/include/pcl/filters/impl/morphological_filter.hpp +++ b/filters/include/pcl/filters/impl/morphological_filter.hpp @@ -50,7 +50,7 @@ #include #include #include -#include +#include /////////////////////////////////////////////////////////////////////////////////////////// template void diff --git a/gpu/kinfu_large_scale/include/pcl/gpu/kinfu_large_scale/world_model.h b/gpu/kinfu_large_scale/include/pcl/gpu/kinfu_large_scale/world_model.h index 9f3f396623c..4ccd1b77529 100644 --- a/gpu/kinfu_large_scale/include/pcl/gpu/kinfu_large_scale/world_model.h +++ b/gpu/kinfu_large_scale/include/pcl/gpu/kinfu_large_scale/world_model.h @@ -40,8 +40,6 @@ #define PCL_WORLD_MODEL_H_ #include -#include -#include #include #include #include diff --git a/gpu/octree/test/test_approx_nearest.cpp b/gpu/octree/test/test_approx_nearest.cpp index bd4e1245e25..cfab9d4a413 100644 --- a/gpu/octree/test/test_approx_nearest.cpp +++ b/gpu/octree/test/test_approx_nearest.cpp @@ -48,7 +48,7 @@ #pragma warning (disable: 4521) #endif #include -#include +#include #if defined _MSC_VER #pragma warning (default: 4521) #endif @@ -146,4 +146,4 @@ TEST(PCL_OctreeGPU, approxNearesSearch) cout << "count_pcl_better: " << count_pcl_better << endl; cout << "avg_diff_pcl_better: " << diff_pcl_better << endl; -} \ No newline at end of file +} diff --git a/gpu/octree/test/test_bfrs_gpu.cpp b/gpu/octree/test/test_bfrs_gpu.cpp index f366807f8d8..991281fa9ba 100644 --- a/gpu/octree/test/test_bfrs_gpu.cpp +++ b/gpu/octree/test/test_bfrs_gpu.cpp @@ -44,7 +44,6 @@ #endif #include -#include #if defined _MSC_VER #pragma warning (default: 4521) diff --git a/gpu/octree/test/test_host_radius_search.cpp b/gpu/octree/test/test_host_radius_search.cpp index 63451094bac..f38ee275a04 100644 --- a/gpu/octree/test/test_host_radius_search.cpp +++ b/gpu/octree/test/test_host_radius_search.cpp @@ -46,7 +46,7 @@ #include #include -#include +#include #if defined _MSC_VER #pragma warning (default: 4521) diff --git a/gpu/octree/test/test_knn_search.cpp b/gpu/octree/test/test_knn_search.cpp index 6eee6b6b59b..4bef613d199 100644 --- a/gpu/octree/test/test_knn_search.cpp +++ b/gpu/octree/test/test_knn_search.cpp @@ -48,7 +48,7 @@ #pragma warning (disable: 4521) #endif #include -#include +#include #if defined _MSC_VER #pragma warning (default: 4521) #endif @@ -182,4 +182,4 @@ TEST(PCL_OctreeGPU, exactNeighbourSearch) pairs_gpu.pop_back(); } } -} \ No newline at end of file +} diff --git a/gpu/octree/test/test_radius_search.cpp b/gpu/octree/test/test_radius_search.cpp index 491ac6d2cd9..cdd0296ff72 100644 --- a/gpu/octree/test/test_radius_search.cpp +++ b/gpu/octree/test/test_radius_search.cpp @@ -45,7 +45,6 @@ #endif #include -#include #if defined _MSC_VER #pragma warning (default: 4521) diff --git a/io/include/pcl/compression/impl/octree_pointcloud_compression.hpp b/io/include/pcl/compression/impl/octree_pointcloud_compression.hpp index c86f3a15f9c..291f2406336 100644 --- a/io/include/pcl/compression/impl/octree_pointcloud_compression.hpp +++ b/io/include/pcl/compression/impl/octree_pointcloud_compression.hpp @@ -38,7 +38,6 @@ #ifndef OCTREE_COMPRESSION_HPP #define OCTREE_COMPRESSION_HPP -#include #include #include @@ -48,8 +47,6 @@ #include #include -using namespace pcl::octree; - namespace pcl { namespace io diff --git a/octree/include/pcl/octree/impl/octree2buf_base.hpp b/octree/include/pcl/octree/impl/octree2buf_base.hpp index 915093c5ad7..522ddfe42af 100644 --- a/octree/include/pcl/octree/impl/octree2buf_base.hpp +++ b/octree/include/pcl/octree/impl/octree2buf_base.hpp @@ -39,8 +39,6 @@ #ifndef PCL_OCTREE_2BUF_BASE_HPP #define PCL_OCTREE_2BUF_BASE_HPP -#include - namespace pcl { namespace octree diff --git a/octree/include/pcl/octree/impl/octree_base.hpp b/octree/include/pcl/octree/impl/octree_base.hpp index c49de275234..777128536e7 100644 --- a/octree/include/pcl/octree/impl/octree_base.hpp +++ b/octree/include/pcl/octree/impl/octree_base.hpp @@ -42,8 +42,6 @@ #include #include -#include -#include namespace pcl { diff --git a/octree/include/pcl/octree/impl/octree_iterator.hpp b/octree/include/pcl/octree/impl/octree_iterator.hpp index 5d95a028d3a..6811ad4a6d1 100644 --- a/octree/include/pcl/octree/impl/octree_iterator.hpp +++ b/octree/include/pcl/octree/impl/octree_iterator.hpp @@ -39,11 +39,6 @@ #ifndef PCL_OCTREE_ITERATOR_HPP_ #define PCL_OCTREE_ITERATOR_HPP_ -#include -#include - -#include - namespace pcl { namespace octree diff --git a/octree/include/pcl/octree/impl/octree_pointcloud.hpp b/octree/include/pcl/octree/impl/octree_pointcloud.hpp index 3191a20e6c7..74fb02a7688 100644 --- a/octree/include/pcl/octree/impl/octree_pointcloud.hpp +++ b/octree/include/pcl/octree/impl/octree_pointcloud.hpp @@ -39,11 +39,10 @@ #ifndef PCL_OCTREE_POINTCLOUD_HPP_ #define PCL_OCTREE_POINTCLOUD_HPP_ -#include #include #include - +#include ////////////////////////////////////////////////////////////////////////////////////////////// template diff --git a/octree/include/pcl/octree/impl/octree_pointcloud_adjacency.hpp b/octree/include/pcl/octree/impl/octree_pointcloud_adjacency.hpp index 96288904175..a3c5365ab7e 100644 --- a/octree/include/pcl/octree/impl/octree_pointcloud_adjacency.hpp +++ b/octree/include/pcl/octree/impl/octree_pointcloud_adjacency.hpp @@ -38,7 +38,16 @@ #ifndef PCL_OCTREE_POINTCLOUD_ADJACENCY_HPP_ #define PCL_OCTREE_POINTCLOUD_ADJACENCY_HPP_ -#include +#include +#include +/* + * OctreePointCloudAdjacency is not precompiled, since it's used in other + * parts of PCL with custom LeafContainers. So if PCL_NO_PRECOMPILE is NOT + * used, octree_pointcloud_adjacency.h includes this file but octree_pointcloud.h + * would not include the implementation because it's precompiled. So we need to + * include it here "manually". + */ +#include ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// template diff --git a/octree/include/pcl/octree/impl/octree_pointcloud_voxelcentroid.hpp b/octree/include/pcl/octree/impl/octree_pointcloud_voxelcentroid.hpp index 67480c54ad1..e958f6404bf 100644 --- a/octree/include/pcl/octree/impl/octree_pointcloud_voxelcentroid.hpp +++ b/octree/include/pcl/octree/impl/octree_pointcloud_voxelcentroid.hpp @@ -40,7 +40,14 @@ #ifndef PCL_OCTREE_VOXELCENTROID_HPP #define PCL_OCTREE_VOXELCENTROID_HPP -#include +/* + * OctreePointCloudVoxelcontroid is not precompiled, since it's used in other + * parts of PCL with custom LeafContainers. So if PCL_NO_PRECOMPILE is NOT + * used, octree_pointcloud_voxelcentroid.h includes this file but octree_pointcloud.h + * would not include the implementation because it's precompiled. So we need to + * include it here "manually". + */ +#include ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// template bool diff --git a/octree/include/pcl/octree/impl/octree_search.hpp b/octree/include/pcl/octree/impl/octree_search.hpp index 0535f855a15..9dc682e5b91 100644 --- a/octree/include/pcl/octree/impl/octree_search.hpp +++ b/octree/include/pcl/octree/impl/octree_search.hpp @@ -39,13 +39,8 @@ #ifndef PCL_OCTREE_SEARCH_IMPL_H_ #define PCL_OCTREE_SEARCH_IMPL_H_ -#include -#include - -#include #include - ////////////////////////////////////////////////////////////////////////////////////////////// template bool pcl::octree::OctreePointCloudSearch::voxelSearch (const PointT& point, diff --git a/octree/include/pcl/octree/octree.h b/octree/include/pcl/octree/octree.h index 15309d80a1c..e66298900da 100644 --- a/octree/include/pcl/octree/octree.h +++ b/octree/include/pcl/octree/octree.h @@ -51,6 +51,7 @@ #include #include #include +#include #include diff --git a/octree/include/pcl/octree/octree2buf_base.h b/octree/include/pcl/octree/octree2buf_base.h index c1691ead37f..d9a2dcd8a9d 100644 --- a/octree/include/pcl/octree/octree2buf_base.h +++ b/octree/include/pcl/octree/octree2buf_base.h @@ -41,13 +41,11 @@ #include -#include "octree_nodes.h" -#include "octree_container.h" -#include "octree_key.h" -#include "octree_iterator.h" +#include +#include +#include +#include -#include -#include namespace pcl { diff --git a/octree/include/pcl/octree/octree_base.h b/octree/include/pcl/octree/octree_base.h index d04be1ac2b3..e004b67a6d0 100644 --- a/octree/include/pcl/octree/octree_base.h +++ b/octree/include/pcl/octree/octree_base.h @@ -39,13 +39,12 @@ #ifndef PCL_OCTREE_TREE_BASE_H #define PCL_OCTREE_TREE_BASE_H -#include #include -#include "octree_nodes.h" -#include "octree_container.h" -#include "octree_key.h" -#include "octree_iterator.h" +#include +#include +#include +#include namespace pcl { diff --git a/octree/include/pcl/octree/octree_container.h b/octree/include/pcl/octree/octree_container.h index 3b06f72b496..be62dd80c0f 100644 --- a/octree/include/pcl/octree/octree_container.h +++ b/octree/include/pcl/octree/octree_container.h @@ -39,7 +39,6 @@ #ifndef PCL_OCTREE_CONTAINER_H #define PCL_OCTREE_CONTAINER_H -#include #include #include diff --git a/octree/include/pcl/octree/octree_iterator.h b/octree/include/pcl/octree/octree_iterator.h index ef10a737d2c..edcbed5c97a 100644 --- a/octree/include/pcl/octree/octree_iterator.h +++ b/octree/include/pcl/octree/octree_iterator.h @@ -43,11 +43,8 @@ #include #include -#include "octree_nodes.h" -#include "octree_key.h" - -#include -#include +#include +#include #include diff --git a/octree/include/pcl/octree/octree_key.h b/octree/include/pcl/octree/octree_key.h index 704323c3581..4442cef4322 100644 --- a/octree/include/pcl/octree/octree_key.h +++ b/octree/include/pcl/octree/octree_key.h @@ -38,8 +38,6 @@ #ifndef PCL_OCTREE_KEY_H #define PCL_OCTREE_KEY_H -#include - namespace pcl { namespace octree diff --git a/octree/include/pcl/octree/octree_nodes.h b/octree/include/pcl/octree/octree_nodes.h index d9b26897ef4..07ce67d66e5 100644 --- a/octree/include/pcl/octree/octree_nodes.h +++ b/octree/include/pcl/octree/octree_nodes.h @@ -42,9 +42,6 @@ #include #include -#include - -#include #include diff --git a/octree/include/pcl/octree/octree_pointcloud.h b/octree/include/pcl/octree/octree_pointcloud.h index 9f39799ab2b..73cf607c56e 100644 --- a/octree/include/pcl/octree/octree_pointcloud.h +++ b/octree/include/pcl/octree/octree_pointcloud.h @@ -39,16 +39,12 @@ #ifndef PCL_OCTREE_POINTCLOUD_H #define PCL_OCTREE_POINTCLOUD_H -#include "octree_base.h" -//#include "octree2buf_base.h" +#include #include #include -#include #include -#include -#include namespace pcl { diff --git a/octree/include/pcl/octree/octree_pointcloud_adjacency.h b/octree/include/pcl/octree/octree_pointcloud_adjacency.h index 27d7cf3841b..d213a8c3694 100644 --- a/octree/include/pcl/octree/octree_pointcloud_adjacency.h +++ b/octree/include/pcl/octree/octree_pointcloud_adjacency.h @@ -40,10 +40,8 @@ #ifndef PCL_OCTREE_POINTCLOUD_ADJACENCY_H_ #define PCL_OCTREE_POINTCLOUD_ADJACENCY_H_ -#include -#include #include -#include +#include #include #include diff --git a/octree/include/pcl/octree/octree_pointcloud_changedetector.h b/octree/include/pcl/octree/octree_pointcloud_changedetector.h index cdacc07466b..3de95ad9766 100644 --- a/octree/include/pcl/octree/octree_pointcloud_changedetector.h +++ b/octree/include/pcl/octree/octree_pointcloud_changedetector.h @@ -39,7 +39,8 @@ #ifndef PCL_OCTREE_CHANGEDETECTOR_H #define PCL_OCTREE_CHANGEDETECTOR_H -#include "octree_pointcloud.h" +#include +#include namespace pcl { diff --git a/octree/include/pcl/octree/octree_pointcloud_density.h b/octree/include/pcl/octree/octree_pointcloud_density.h index 667011eb880..9137a39bd8c 100644 --- a/octree/include/pcl/octree/octree_pointcloud_density.h +++ b/octree/include/pcl/octree/octree_pointcloud_density.h @@ -39,7 +39,7 @@ #ifndef PCL_OCTREE_DENSITY_H #define PCL_OCTREE_DENSITY_H -#include "octree_pointcloud.h" +#include namespace pcl { diff --git a/octree/include/pcl/octree/octree_pointcloud_occupancy.h b/octree/include/pcl/octree/octree_pointcloud_occupancy.h index e61f7e63649..7510257d13c 100644 --- a/octree/include/pcl/octree/octree_pointcloud_occupancy.h +++ b/octree/include/pcl/octree/octree_pointcloud_occupancy.h @@ -39,7 +39,7 @@ #ifndef PCL_OCTREE_OCCUPANCY_H #define PCL_OCTREE_OCCUPANCY_H -#include "octree_pointcloud.h" +#include namespace pcl { diff --git a/octree/include/pcl/octree/octree_pointcloud_pointvector.h b/octree/include/pcl/octree/octree_pointcloud_pointvector.h index 41038dea9e5..d5b6a140a80 100644 --- a/octree/include/pcl/octree/octree_pointcloud_pointvector.h +++ b/octree/include/pcl/octree/octree_pointcloud_pointvector.h @@ -39,7 +39,7 @@ #ifndef PCL_OCTREE_POINT_VECTOR_H #define PCL_OCTREE_POINT_VECTOR_H -#include "octree_pointcloud.h" +#include namespace pcl { diff --git a/octree/include/pcl/octree/octree_pointcloud_singlepoint.h b/octree/include/pcl/octree/octree_pointcloud_singlepoint.h index 917be167831..7300ac030bb 100644 --- a/octree/include/pcl/octree/octree_pointcloud_singlepoint.h +++ b/octree/include/pcl/octree/octree_pointcloud_singlepoint.h @@ -39,7 +39,7 @@ #ifndef PCL_OCTREE_SINGLE_POINT_H #define PCL_OCTREE_SINGLE_POINT_H -#include "octree_pointcloud.h" +#include namespace pcl { diff --git a/octree/include/pcl/octree/octree_pointcloud_voxelcentroid.h b/octree/include/pcl/octree/octree_pointcloud_voxelcentroid.h index 5101c8f9442..68840f9400c 100644 --- a/octree/include/pcl/octree/octree_pointcloud_voxelcentroid.h +++ b/octree/include/pcl/octree/octree_pointcloud_voxelcentroid.h @@ -40,11 +40,7 @@ #ifndef PCL_OCTREE_VOXELCENTROID_H #define PCL_OCTREE_VOXELCENTROID_H -#include "octree_pointcloud.h" - -#include -#include -#include +#include namespace pcl { diff --git a/octree/include/pcl/octree/octree_search.h b/octree/include/pcl/octree/octree_search.h index 564a493a07a..08e99793d62 100644 --- a/octree/include/pcl/octree/octree_search.h +++ b/octree/include/pcl/octree/octree_search.h @@ -40,9 +40,8 @@ #define PCL_OCTREE_SEARCH_H_ #include -#include -#include "octree_pointcloud.h" +#include namespace pcl { diff --git a/octree/src/octree_inst.cpp b/octree/src/octree_inst.cpp index a243b8cb933..90a6a84c865 100644 --- a/octree/src/octree_inst.cpp +++ b/octree/src/octree_inst.cpp @@ -82,6 +82,7 @@ PCL_INSTANTIATE(OctreePointCloudSingleBufferWithEmptyLeaf, PCL_XYZ_POINT_TYPES) // PCL_INSTANTIATE(OctreePointCloudPointVector, PCL_XYZ_POINT_TYPES) // PCL_INSTANTIATE(OctreePointCloudChangeDetector, PCL_XYZ_POINT_TYPES) // PCL_INSTANTIATE(OctreePointCloudVoxelCentroid, PCL_XYZ_POINT_TYPES) +// PCL_INSTANTIATE(OctreePointCloudAdjacency, PCL_XYZ_POINT_TYPES) #endif // PCL_NO_PRECOMPILE diff --git a/segmentation/include/pcl/segmentation/impl/lccp_segmentation.hpp b/segmentation/include/pcl/segmentation/impl/lccp_segmentation.hpp index c9748c668cc..34f55b5b671 100644 --- a/segmentation/include/pcl/segmentation/impl/lccp_segmentation.hpp +++ b/segmentation/include/pcl/segmentation/impl/lccp_segmentation.hpp @@ -39,6 +39,7 @@ #define PCL_SEGMENTATION_IMPL_LCCP_SEGMENTATION_HPP_ #include +#include ////////////////////////////////////////////////////////// diff --git a/segmentation/include/pcl/segmentation/supervoxel_clustering.h b/segmentation/include/pcl/segmentation/supervoxel_clustering.h index d34737f1d02..1048fe590e7 100644 --- a/segmentation/include/pcl/segmentation/supervoxel_clustering.h +++ b/segmentation/include/pcl/segmentation/supervoxel_clustering.h @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/segmentation/src/supervoxel_clustering.cpp b/segmentation/src/supervoxel_clustering.cpp index f4685758fb4..c2d5a109a3e 100644 --- a/segmentation/src/supervoxel_clustering.cpp +++ b/segmentation/src/supervoxel_clustering.cpp @@ -171,4 +171,4 @@ template class pcl::octree::OctreePointCloudAdjacencyContainer; template class pcl::octree::OctreePointCloudAdjacency; -template class pcl::octree::OctreePointCloudAdjacency; \ No newline at end of file +template class pcl::octree::OctreePointCloudAdjacency; diff --git a/tools/octree_viewer.cpp b/tools/octree_viewer.cpp index 37d2e98ccf3..f5ae26be84d 100644 --- a/tools/octree_viewer.cpp +++ b/tools/octree_viewer.cpp @@ -41,8 +41,7 @@ #include #include -#include -#include +#include #include #include "boost.h" diff --git a/tracking/include/pcl/tracking/particle_filter.h b/tracking/include/pcl/tracking/particle_filter.h index 7221caa31f8..8a9d3382959 100644 --- a/tracking/include/pcl/tracking/particle_filter.h +++ b/tracking/include/pcl/tracking/particle_filter.h @@ -5,13 +5,12 @@ #include #include #include -#include +#include #include namespace pcl { - namespace tracking { /** \brief @b ParticleFilterTracker tracks the PointCloud which is given by From 633343bb66e4523f582719d4bd6ec219401adf57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BCttner?= Date: Wed, 19 Oct 2016 22:16:15 +0200 Subject: [PATCH 3/3] Use PCL_NO_PRECOMPILE in modules which need custom octree leaf containers. Using PCL_NO_PRECOMPILE in cpp files makes sense, since code has to be generated anyway. The scope of the preprocessor definition is the cpp file itself, so it doesn't pollute something. And since all classes are instantiated with other template parameter values, there is no duplicate code. --- io/src/compression.cpp | 5 +---- segmentation/src/supervoxel_clustering.cpp | 25 ++++++++++++++-------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/io/src/compression.cpp b/io/src/compression.cpp index 8720c8b305d..393506b9ef7 100644 --- a/io/src/compression.cpp +++ b/io/src/compression.cpp @@ -35,13 +35,10 @@ * * Author: Julius Kammerl (julius@kammerl.de) */ - +#define PCL_NO_PRECOMPILE #include #include -#include -#include - #include #include diff --git a/segmentation/src/supervoxel_clustering.cpp b/segmentation/src/supervoxel_clustering.cpp index c2d5a109a3e..58452fb0f3e 100644 --- a/segmentation/src/supervoxel_clustering.cpp +++ b/segmentation/src/supervoxel_clustering.cpp @@ -37,6 +37,13 @@ * */ +/* + * Do not use pre-compiled versions in this compilation unit (cpp-file), + * especially for the octree classes. This way the OctreePointCloudAdjacency + * class is instantiated with the custom leaf container SupervoxelClustering. + */ +#define PCL_NO_PRECOMPILE + #include #include #include @@ -161,14 +168,14 @@ typedef pcl::octree::OctreePointCloudAdjacencyContainer AdjacencyContainerRGBT; typedef pcl::octree::OctreePointCloudAdjacencyContainer AdjacencyContainerRGBAT; -template class pcl::SupervoxelClustering; -template class pcl::SupervoxelClustering; -template class pcl::SupervoxelClustering; +template class PCL_EXPORTS pcl::SupervoxelClustering; +template class PCL_EXPORTS pcl::SupervoxelClustering; +template class PCL_EXPORTS pcl::SupervoxelClustering; -template class pcl::octree::OctreePointCloudAdjacencyContainer; -template class pcl::octree::OctreePointCloudAdjacencyContainer; -template class pcl::octree::OctreePointCloudAdjacencyContainer; +template class PCL_EXPORTS pcl::octree::OctreePointCloudAdjacencyContainer; +template class PCL_EXPORTS pcl::octree::OctreePointCloudAdjacencyContainer; +template class PCL_EXPORTS pcl::octree::OctreePointCloudAdjacencyContainer; -template class pcl::octree::OctreePointCloudAdjacency; -template class pcl::octree::OctreePointCloudAdjacency; -template class pcl::octree::OctreePointCloudAdjacency; +template class PCL_EXPORTS pcl::octree::OctreePointCloudAdjacency; +template class PCL_EXPORTS pcl::octree::OctreePointCloudAdjacency; +template class PCL_EXPORTS pcl::octree::OctreePointCloudAdjacency;