Skip to content

Commit b0b2519

Browse files
authored
Merge pull request #6062 from mvieth/configurable_instantiations
Give users more control regarding with which point types classes are …
2 parents 976836b + 5e874e9 commit b0b2519

File tree

4 files changed

+16
-35
lines changed

4 files changed

+16
-35
lines changed

CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
144144
endif()
145145

146146
if(CMAKE_COMPILER_IS_MSVC)
147-
add_definitions("-DBOOST_ALL_NO_LIB -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -DNOMINMAX -DPCL_ONLY_CORE_POINT_TYPES ${SSE_DEFINITIONS}")
147+
add_definitions("-DBOOST_ALL_NO_LIB -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -DNOMINMAX ${SSE_DEFINITIONS}")
148148

149149
if("${CMAKE_CXX_FLAGS}" STREQUAL "${CMAKE_CXX_FLAGS_DEFAULT}")
150150
string(APPEND CMAKE_CXX_FLAGS " /fp:precise ${SSE_FLAGS} ${AVX_FLAGS}")
@@ -232,10 +232,6 @@ if(CMAKE_COMPILER_IS_CLANG)
232232
set(CLANG_LIBRARIES "stdc++")
233233
endif()
234234

235-
if(CMAKE_COMPILER_IS_MINGW)
236-
add_definitions(-DPCL_ONLY_CORE_POINT_TYPES)
237-
endif()
238-
239235
include("${PCL_SOURCE_DIR}/cmake/pcl_utils.cmake")
240236
DISSECT_VERSION()
241237
GET_OS_INFO()

cmake/pcl_options.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,18 @@ mark_as_advanced(PCL_QHULL_REQUIRED_TYPE)
4848
option(PCL_PREFER_BOOST_FILESYSTEM "Prefer boost::filesystem over std::filesystem (if compiled as C++17 or higher, std::filesystem is chosen by default)" OFF)
4949
mark_as_advanced(PCL_PREFER_BOOST_FILESYSTEM)
5050

51+
set(PCL_XYZ_POINT_TYPES "(pcl::PointXYZ)(pcl::PointXYZI)(pcl::PointXYZL)(pcl::PointXYZRGBA)(pcl::PointXYZRGB)(pcl::PointXYZRGBL)(pcl::PointXYZLAB)(pcl::PointXYZHSV)(pcl::InterestPoint)(pcl::PointNormal)(pcl::PointXYZRGBNormal)(pcl::PointXYZINormal)(pcl::PointXYZLNormal)(pcl::PointWithRange)(pcl::PointWithViewpoint)(pcl::PointWithScale)(pcl::PointSurfel)(pcl::PointDEM)" CACHE STRING "Point types with xyz information for which PCL classes will be instantiated. Alternative to PCL_ONLY_CORE_POINT_TYPES. You can remove unneeded types to reduce compile time and library size.")
52+
mark_as_advanced(PCL_XYZ_POINT_TYPES)
53+
54+
set(PCL_NORMAL_POINT_TYPES "(pcl::Normal)(pcl::PointNormal)(pcl::PointXYZRGBNormal)(pcl::PointXYZINormal)(pcl::PointXYZLNormal)(pcl::PointSurfel)" CACHE STRING "Point types with normal information for which PCL classes will be instantiated. Alternative to PCL_ONLY_CORE_POINT_TYPES. You can remove unneeded types to reduce compile time and library size.")
55+
mark_as_advanced(PCL_NORMAL_POINT_TYPES)
56+
5157
# Precompile for a minimal set of point types instead of all.
58+
if(CMAKE_COMPILER_IS_MSVC OR CMAKE_COMPILER_IS_MINGW)
59+
option(PCL_ONLY_CORE_POINT_TYPES "Compile explicitly only for a small subset of point types (e.g., pcl::PointXYZ instead of PCL_XYZ_POINT_TYPES)." ON)
60+
else()
5261
option(PCL_ONLY_CORE_POINT_TYPES "Compile explicitly only for a small subset of point types (e.g., pcl::PointXYZ instead of PCL_XYZ_POINT_TYPES)." OFF)
62+
endif()
5363
mark_as_advanced(PCL_ONLY_CORE_POINT_TYPES)
5464

5565
# Precompile for a minimal set of point types instead of all.

common/include/pcl/impl/point_types.hpp

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#pragma once
4040

4141
#include <pcl/memory.h> // for PCL_MAKE_ALIGNED_OPERATOR_NEW
42+
#include <pcl/pcl_config.h> // for PCL_XYZ_POINT_TYPES, PCL_NORMAL_POINT_TYPES
4243
#include <pcl/pcl_macros.h> // for PCL_EXPORTS
4344
#include <pcl/PCLPointField.h> // for PCLPointField
4445
#include <pcl/point_types.h> // implementee
@@ -118,42 +119,12 @@
118119
(pcl::PointXYZRGBNormal) \
119120
(pcl::PointSurfel) \
120121

121-
// Define all point types that include XYZ data
122-
#define PCL_XYZ_POINT_TYPES \
123-
(pcl::PointXYZ) \
124-
(pcl::PointXYZI) \
125-
(pcl::PointXYZL) \
126-
(pcl::PointXYZRGBA) \
127-
(pcl::PointXYZRGB) \
128-
(pcl::PointXYZRGBL) \
129-
(pcl::PointXYZLAB) \
130-
(pcl::PointXYZHSV) \
131-
(pcl::InterestPoint) \
132-
(pcl::PointNormal) \
133-
(pcl::PointXYZRGBNormal) \
134-
(pcl::PointXYZINormal) \
135-
(pcl::PointXYZLNormal) \
136-
(pcl::PointWithRange) \
137-
(pcl::PointWithViewpoint) \
138-
(pcl::PointWithScale) \
139-
(pcl::PointSurfel) \
140-
(pcl::PointDEM)
141-
142122
// Define all point types with XYZ and label
143123
#define PCL_XYZL_POINT_TYPES \
144124
(pcl::PointXYZL) \
145125
(pcl::PointXYZRGBL) \
146126
(pcl::PointXYZLNormal)
147127

148-
// Define all point types that include normal[3] data
149-
#define PCL_NORMAL_POINT_TYPES \
150-
(pcl::Normal) \
151-
(pcl::PointNormal) \
152-
(pcl::PointXYZRGBNormal) \
153-
(pcl::PointXYZINormal) \
154-
(pcl::PointXYZLNormal) \
155-
(pcl::PointSurfel)
156-
157128
// Define all point types that represent features
158129
#define PCL_FEATURE_POINT_TYPES \
159130
(pcl::PFHSignature125) \

pcl_config.h.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@
5959
/* Precompile for a minimal set of point types instead of all. */
6060
#cmakedefine PCL_ONLY_CORE_POINT_TYPES
6161

62+
#define PCL_XYZ_POINT_TYPES @PCL_XYZ_POINT_TYPES@
63+
64+
#define PCL_NORMAL_POINT_TYPES @PCL_NORMAL_POINT_TYPES@
65+
6266
/* Do not precompile for any point types at all. */
6367
#cmakedefine PCL_NO_PRECOMPILE
6468

0 commit comments

Comments
 (0)