Skip to content

Commit 1b79e2a

Browse files
committed
Bump PCL to 1.8+, compile on Bionic
1 parent 0e48c02 commit 1b79e2a

File tree

5 files changed

+28
-14
lines changed

5 files changed

+28
-14
lines changed

CMakeLists.txt

+2-8
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,13 @@ find_package(COLOR_DEBUG REQUIRED)
4545
# Soft dependencies.
4646

4747
find_package(OpenCV QUIET)
48-
find_package(PCL 1.6 QUIET)
48+
find_package(PCL 1.8 QUIET)
4949
find_package(TensorflowCC 1.12 QUIET)
5050
find_package(GTestSources 1.6.0 QUIET)
5151
find_package(SWIG QUIET)
5252
find_package(Doxygen QUIET)
5353

54-
# Xenial + PCL 1.7 bug
55-
# https://github.com/PointCloudLibrary/pcl/issues/2406
56-
if(DEFINED PCL_LIBRARIES)
57-
list(REMOVE_ITEM PCL_LIBRARIES "vtkproj4")
58-
endif()
59-
60-
# Focal + PCL 1.10 + OpenNI workaround (idea: use CMake components to find_package(PCL)?)
54+
# Focal + PCL 1.10 + OpenNI workaround (idea: use CMake components to find_package(PCL)?).
6155
if(PCL_VERSION VERSION_EQUAL 1.10)
6256
include_directories(/usr/include/ni)
6357
link_libraries(/usr/lib/libOpenNI.so)

libraries/YarpCloudUtils/CMakeLists.txt

+9
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@ option(ENABLE_YarpCloudUtils "Enable/disable YarpCloudUtils" ON)
22

33
if(ENABLE_YarpCloudUtils)
44

5+
if(PCL_VERSION VERSION_LESS 1.9)
6+
include_directories(${PCL_INCLUDE_DIRS})
7+
link_directories(${PCL_LIBRARY_DIRS})
8+
9+
# workaround for PCL 1.8 (Ubuntu 18.04), exclude empty/blank strings as compile defs
10+
list(FILTER PCL_DEFINITIONS EXCLUDE REGEX "^ +$")
11+
add_definitions(${PCL_DEFINITIONS})
12+
endif()
13+
514
add_library(YarpCloudUtils SHARED YarpCloudUtils.hpp
615
YarpCloudUtils-ply-export.cpp
716
YarpCloudUtils-ply-import.cpp

libraries/YarpCloudUtils/YarpCloudUtils-pcl-impl.hpp

+8
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@
4242
#include <pcl/surface/grid_projection.h>
4343
#include <pcl/surface/marching_cubes_hoppe.h>
4444
#include <pcl/surface/marching_cubes_rbf.h>
45+
#if PCL_VERSION_COMPARE(>=, 1, 9, 0)
4546
#include <pcl/surface/mls.h>
47+
#endif
4648
#include <pcl/surface/organized_fast_mesh.h>
4749
#include <pcl/surface/poisson.h>
4850
#include <pcl/surface/simplification_remove_unused_vertices.h>
@@ -296,7 +298,9 @@ void doLocalMaximum(const typename pcl::PointCloud<T>::ConstPtr & in, const type
296298
template <typename T>
297299
void doMarchingCubesHoppe(const typename pcl::PointCloud<T>::ConstPtr & in, const pcl::PolygonMesh::Ptr & out, const yarp::os::Searchable & options)
298300
{
301+
#if PCL_VERSION_COMPARE(>=, 1, 9, 0)
299302
auto distanceIgnore = options.check("distanceIgnore", yarp::os::Value(-1.0f)).asFloat32();
303+
#endif
300304
auto gridResolution = options.check("gridResolution", yarp::os::Value(32)).asInt32();
301305
auto gridResolutionX = options.check("gridResolutionX", yarp::os::Value(gridResolution)).asInt32();
302306
auto gridResolutionY = options.check("gridResolutionY", yarp::os::Value(gridResolution)).asInt32();
@@ -308,7 +312,9 @@ void doMarchingCubesHoppe(const typename pcl::PointCloud<T>::ConstPtr & in, cons
308312
tree->setInputCloud(in);
309313

310314
pcl::MarchingCubesHoppe<T> hoppe;
315+
#if PCL_VERSION_COMPARE(>=, 1, 9, 0)
311316
hoppe.setDistanceIgnore(distanceIgnore);
317+
#endif
312318
hoppe.setGridResolution(gridResolutionX, gridResolutionY, gridResolutionZ);
313319
hoppe.setInputCloud(in);
314320
hoppe.setIsoLevel(isoLevel);
@@ -451,6 +457,7 @@ void doMeshSubdivisionVTK(const pcl::PolygonMesh::ConstPtr & in, const pcl::Poly
451457
checkOutput(out, "MeshSubdivisionVTK");
452458
}
453459

460+
#if PCL_VERSION_COMPARE(>=, 1, 9, 0)
454461
template <typename T1, typename T2 = T1>
455462
void doMovingLeastSquares(const typename pcl::PointCloud<T1>::ConstPtr & in, const typename pcl::PointCloud<T2>::Ptr & out, const yarp::os::Searchable & options)
456463
{
@@ -537,6 +544,7 @@ void doMovingLeastSquares(const typename pcl::PointCloud<T1>::ConstPtr & in, con
537544

538545
checkOutput<T2>(out, "MovingLeastSquares");
539546
}
547+
#endif
540548

541549
template <typename T1, typename T2>
542550
void doNormalEstimation(const typename pcl::PointCloud<T1>::ConstPtr & in, const typename pcl::PointCloud<T2>::Ptr & out, const yarp::os::Searchable & options)

libraries/YarpCloudUtils/YarpCloudUtils-pcl.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,14 @@ namespace
133133
case "MeshSubdivisionVTK"_hash:
134134
doMeshSubdivisionVTK(prev.getMesh(), curr.setMesh(), options);
135135
break;
136+
#if PCL_VERSION_COMPARE(>=, 1, 9, 0)
136137
case "MovingLeastSquares"_hash:
137138
if (options.check("computeNormals"), yarp::os::Value(false).asBool())
138139
doMovingLeastSquares<any_xyz_t, normal_t>(prev.getCloud<any_xyz_t>(), curr.setCloud<normal_t>(), options);
139140
else
140141
doMovingLeastSquares<any_xyz_t>(prev.getCloud<any_xyz_t>(), curr.setCloud<any_xyz_t>(), options);
141142
break;
143+
#endif
142144
case "NormalEstimation"_hash:
143145
pcl::copyPointCloud(*prev.getCloud<any_xyz_t>(), *curr.setCloud<normal_t>());
144146
doNormalEstimation<any_xyz_t, normal_t>(prev.getCloud<any_xyz_t>(), curr.useCloud<normal_t>(), options);

programs/pointAtObjectServer/CMakeLists.txt

+7-6
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,14 @@ cmake_dependent_option(ENABLE_pointAtObjectServer "Enable/disable pointAtObjectS
77

88
if(ENABLE_pointAtObjectServer)
99

10-
include_directories(${PCL_INCLUDE_DIRS})
10+
if(PCL_VERSION VERSION_LESS 1.9)
11+
include_directories(${PCL_INCLUDE_DIRS})
12+
link_directories(${PCL_LIBRARY_DIRS})
1113

12-
link_directories(${PCL_LIBRARY_DIRS})
14+
# workaround for PCL 1.8 (Ubuntu 18.04), exclude empty/blank strings as compile defs
15+
list(FILTER PCL_DEFINITIONS EXCLUDE REGEX "^ +$")
16+
add_definitions(${PCL_DEFINITIONS})
17+
endif()
1318

1419
add_executable(pointAtObjectServer main.cpp
1520
PointAtObjectServer.hpp
@@ -21,10 +26,6 @@ if(ENABLE_pointAtObjectServer)
2126
vtkTimerCallback.hpp
2227
vtkTimerCallback.cpp)
2328

24-
# workaround for PCL 1.8 (Ubuntu 18.04), exclude empty/blank strings as compile defs
25-
list(FILTER PCL_DEFINITIONS EXCLUDE REGEX "^ +$")
26-
target_compile_definitions(pointAtObjectServer PUBLIC ${PCL_DEFINITIONS})
27-
2829
target_link_libraries(pointAtObjectServer YARP::YARP_os
2930
YARP::YARP_init
3031
YARP::YARP_sig

0 commit comments

Comments
 (0)