Skip to content

Commit

Permalink
Merge pull request #6062 from mvieth/configurable_instantiations
Browse files Browse the repository at this point in the history
Give users more control regarding with which point types classes are …
  • Loading branch information
mvieth authored Jun 18, 2024
2 parents 976836b + 5e874e9 commit b0b2519
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 35 deletions.
6 changes: 1 addition & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
endif()

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

if("${CMAKE_CXX_FLAGS}" STREQUAL "${CMAKE_CXX_FLAGS_DEFAULT}")
string(APPEND CMAKE_CXX_FLAGS " /fp:precise ${SSE_FLAGS} ${AVX_FLAGS}")
Expand Down Expand Up @@ -232,10 +232,6 @@ if(CMAKE_COMPILER_IS_CLANG)
set(CLANG_LIBRARIES "stdc++")
endif()

if(CMAKE_COMPILER_IS_MINGW)
add_definitions(-DPCL_ONLY_CORE_POINT_TYPES)
endif()

include("${PCL_SOURCE_DIR}/cmake/pcl_utils.cmake")
DISSECT_VERSION()
GET_OS_INFO()
Expand Down
10 changes: 10 additions & 0 deletions cmake/pcl_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,18 @@ mark_as_advanced(PCL_QHULL_REQUIRED_TYPE)
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)
mark_as_advanced(PCL_PREFER_BOOST_FILESYSTEM)

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.")
mark_as_advanced(PCL_XYZ_POINT_TYPES)

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.")
mark_as_advanced(PCL_NORMAL_POINT_TYPES)

# Precompile for a minimal set of point types instead of all.
if(CMAKE_COMPILER_IS_MSVC OR CMAKE_COMPILER_IS_MINGW)
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)
else()
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)
endif()
mark_as_advanced(PCL_ONLY_CORE_POINT_TYPES)

# Precompile for a minimal set of point types instead of all.
Expand Down
31 changes: 1 addition & 30 deletions common/include/pcl/impl/point_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#pragma once

#include <pcl/memory.h> // for PCL_MAKE_ALIGNED_OPERATOR_NEW
#include <pcl/pcl_config.h> // for PCL_XYZ_POINT_TYPES, PCL_NORMAL_POINT_TYPES
#include <pcl/pcl_macros.h> // for PCL_EXPORTS
#include <pcl/PCLPointField.h> // for PCLPointField
#include <pcl/point_types.h> // implementee
Expand Down Expand Up @@ -118,42 +119,12 @@
(pcl::PointXYZRGBNormal) \
(pcl::PointSurfel) \

// Define all point types that include XYZ data
#define 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)

// Define all point types with XYZ and label
#define PCL_XYZL_POINT_TYPES \
(pcl::PointXYZL) \
(pcl::PointXYZRGBL) \
(pcl::PointXYZLNormal)

// Define all point types that include normal[3] data
#define PCL_NORMAL_POINT_TYPES \
(pcl::Normal) \
(pcl::PointNormal) \
(pcl::PointXYZRGBNormal) \
(pcl::PointXYZINormal) \
(pcl::PointXYZLNormal) \
(pcl::PointSurfel)

// Define all point types that represent features
#define PCL_FEATURE_POINT_TYPES \
(pcl::PFHSignature125) \
Expand Down
4 changes: 4 additions & 0 deletions pcl_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
/* Precompile for a minimal set of point types instead of all. */
#cmakedefine PCL_ONLY_CORE_POINT_TYPES

#define PCL_XYZ_POINT_TYPES @PCL_XYZ_POINT_TYPES@

#define PCL_NORMAL_POINT_TYPES @PCL_NORMAL_POINT_TYPES@

/* Do not precompile for any point types at all. */
#cmakedefine PCL_NO_PRECOMPILE

Expand Down

0 comments on commit b0b2519

Please sign in to comment.