Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pcl PointCloudLibrary package #18389

Merged
merged 43 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
d8a1d15
Add pcl PointCloudLibrary package
EstebanDugueperoux2 Jul 6, 2023
9f53056
pcl: misc recipe tweaks
valgur Aug 9, 2023
6bc2990
Merge pull request #5 from valgur/feature/AddPCL
EstebanDugueperoux2 Aug 9, 2023
a6c679a
Merge branch 'master' into feature/AddPCL
EstebanDugueperoux2 Aug 9, 2023
eeb72b3
Update recipes/pcl/all/conanfile.py
EstebanDugueperoux2 Aug 9, 2023
6378376
pcl: Further fixes to Conan targets use in CMake
valgur Aug 9, 2023
b0b0311
pcl: Fix buggy OpenNI detection if libusb missing
valgur Aug 9, 2023
5083304
pcl: Fix PCL CMake config breaking OpenGL detection
valgur Aug 9, 2023
d274368
pcl: Fix _add_component() bugs
valgur Aug 9, 2023
25d75d3
pcl: add TODOs for missing Conan packages
valgur Aug 9, 2023
6e94296
pcl: set_property("cmake_find_mode", "both")
valgur Aug 9, 2023
3fbb0e9
pcl: more accurate modelling of PCL components
valgur Aug 9, 2023
5a5e796
pcl: tidy description
valgur Aug 9, 2023
161aef4
Merge pull request #6 from valgur/feature/AddPCL
EstebanDugueperoux2 Aug 9, 2023
c4be26d
Enable opengl event if with_vtk is false
EstebanDugueperoux2 Aug 9, 2023
4a9fc5e
Revert "Enable opengl event if with_vtk is false"
EstebanDugueperoux2 Aug 10, 2023
33738d3
Enable opengl only if with_vtk==True
EstebanDugueperoux2 Aug 10, 2023
f0d4886
test is_msvc() method
EstebanDugueperoux2 Aug 10, 2023
9083c61
test is_msvc_static_runtime
EstebanDugueperoux2 Aug 10, 2023
4486fd0
pcl: make components optional, add full dependency info
valgur Aug 10, 2023
2c1f59f
pcl: fixes to the component system
valgur Aug 10, 2023
5bb2754
pcl: set OpenGL_GL_PREFERENCE=GLVND
valgur Aug 10, 2023
1cc967a
pcl: fix _extra_libs handling
valgur Aug 10, 2023
d3e5eb0
pcl: fix CUDA support
valgur Aug 10, 2023
ae24a89
pcl: add all VTK system package variants
valgur Aug 10, 2023
5ddafb9
pcl: add missing transitive_headers=True based on installed header in…
valgur Aug 10, 2023
bfb4bd0
pcl: add ws2_32 dep on Windows
valgur Aug 10, 2023
86dcd11
Merge pull request #7 from valgur/feature/AddPCL
EstebanDugueperoux2 Aug 11, 2023
8750fef
Restore is_msvc_static_runtime import
EstebanDugueperoux2 Aug 11, 2023
f1a076f
pcl: fix Conan v1 issue
valgur Aug 11, 2023
d2669e0
Merge pull request #8 from valgur/feature/AddPCL
EstebanDugueperoux2 Aug 11, 2023
9b7bf4c
pcl: new add_build_type_postfix option, fix library naming on Windows
valgur Aug 11, 2023
df90c18
Merge pull request #9 from valgur/feature/AddPCL
EstebanDugueperoux2 Aug 11, 2023
7cdb556
Take into account @maksim-petukhov remark
EstebanDugueperoux2 Aug 11, 2023
c04721f
Take into account @valgur remark
EstebanDugueperoux2 Aug 11, 2023
d3307f7
Take into account maksim-petukhov remark
EstebanDugueperoux2 Aug 11, 2023
c26c415
Set instantiate_only_core_point_types option at True
EstebanDugueperoux2 Aug 11, 2023
ec02bdd
pcl: restore zlib dependency
valgur Aug 11, 2023
fbd2246
pcl: adjust precompile_only_core_point_types name, add comment
valgur Aug 11, 2023
79c2797
Merge pull request #10 from valgur/feature/AddPCL
EstebanDugueperoux2 Aug 11, 2023
24c68d1
Merge branch 'master' into feature/AddPCL
EstebanDugueperoux2 Aug 12, 2023
2cb3b99
Merge branch 'master' into feature/AddPCL
EstebanDugueperoux2 Aug 13, 2023
2415d90
Add rm to prevent PDBs files install
EstebanDugueperoux2 Aug 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions recipes/pcl/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
sources:
"1.13.1":
url: https://github.com/PointCloudLibrary/pcl/archive/refs/tags/pcl-1.13.1.tar.gz
sha256: 8ab98a9db371d822de0859084a375a74bdc7f31c96d674147710cf4101b79621
patches:
"1.13.1":
- patch_file: "patches/0001-cmake_use_conan_targets.patch"
patch_description: "Update PCL CMake files to work with Conan"
patch_type: "conan"
- patch_file: "patches/0001-fix-FindOpenNI-bug.patch"
patch_description: "Fix a libusb detection bug in FindOpenNI.cmake"
patch_type: "bugfix"

Check warning on line 12 in recipes/pcl/all/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

'patch_type' should have 'patch_source' as per https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patch_type it is expected to have a source (e.g. a URL) to where it originates from to help with reviewing and consumers to evaluate patches
- patch_file: "patches/0001-Add-Eigen3-Eigen-target-in-pcl_common-target.patch"
patch_description: "Add Eigen3::Eigen target to pcl_common target"
patch_type: "conan"
- patch_file: "patches/0001-ReportFixAboutMemoryConsumptionDuringBuild.patch"
patch_description: "MovingLeastSquares: reduce the number of instantiations to reduce compile time"
patch_source: "https://github.com/PointCloudLibrary/pcl/pull/5764"
patch_type: "conan"
579 changes: 579 additions & 0 deletions recipes/pcl/all/conanfile.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From a975f68d2e399a1563fe0d66b2c048978f0282d1 Mon Sep 17 00:00:00 2001
From: Esteban DUGUEPEROUX <esteban.dugueperoux@gmail.com>
Date: Mon, 7 Aug 2023 23:50:12 +0200
Subject: [PATCH] Add Eigen3::Eigen target in pcl_common target

---
common/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
index 48e1a202e..e0ced5241 100644
--- a/common/CMakeLists.txt
+++ b/common/CMakeLists.txt
@@ -179,7 +179,7 @@ target_include_directories(${LIB_NAME} PUBLIC
$<INSTALL_INTERFACE:include>
)

-target_link_libraries(${LIB_NAME} Boost::boost)
+target_link_libraries(${LIB_NAME} Boost::boost Eigen3::Eigen)

if(MSVC AND NOT (MSVC_VERSION LESS 1915))
# MSVC resolved a byte alignment issue in compiler version 15.9
--
2.41.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From 0bc2f2cc369f7d013ee5c29075188c4e26ea6f87 Mon Sep 17 00:00:00 2001
From: Markus Vieth <mvieth@techfak.uni-bielefeld.de>
Date: Sat, 15 Jul 2023 15:49:25 +0200
Subject: [PATCH] MovingLeastSquares: reduce the number of instantiations to
reduce compile time PCL_XYZ_POINT_TYPES currently contains 18 types, so
previously, MLS was instantiated for 18*18=324 different type combinations.
However, among those were instantiations which are likely used by nobody
(like `pcl::MovingLeastSquares<pcl::PointWithRange, pcl::PointDEM>`). With
these changes, MLS is only instantiated 6*6+(18-6)=48 times. The most common
type combinations should be covered, but if someone uses an uncommon
combinations, they have to add `#define PCL_NO_PRECOMPILE` before including
`pcl/surface/mls.h` to avoid linker errors.

---
surface/src/mls.cpp | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/surface/src/mls.cpp b/surface/src/mls.cpp
index ba2fd655300..c948f4d19e1 100644
--- a/surface/src/mls.cpp
+++ b/surface/src/mls.cpp
@@ -80,6 +80,15 @@ pcl::MLSResult::calculatePrincipalCurvatures (const double u, const double v) co
PCL_INSTANTIATE_PRODUCT(MovingLeastSquares, ((pcl::PointXYZ)(pcl::PointXYZI)(pcl::PointXYZRGB)(pcl::PointXYZRGBA)(pcl::PointXYZRGBNormal)(pcl::PointNormal))
((pcl::PointXYZ)(pcl::PointXYZI)(pcl::PointXYZRGB)(pcl::PointXYZRGBA)(pcl::PointXYZRGBNormal)(pcl::PointNormal)))
#else
- PCL_INSTANTIATE_PRODUCT(MovingLeastSquares, (PCL_XYZ_POINT_TYPES)(PCL_XYZ_POINT_TYPES))
+ // PCL_INSTANTIATE_PRODUCT(MovingLeastSquares, (PCL_XYZ_POINT_TYPES)(PCL_XYZ_POINT_TYPES))
+ // All instantiations that are available with PCL_ONLY_CORE_POINT_TYPES, plus instantiations for all XYZ types where PointInT and PointOutT are the same
+ #define PCL_INSTANTIATE_MovingLeastSquaresSameInAndOut(T) template class PCL_EXPORTS pcl::MovingLeastSquares<T,T>;
+ PCL_INSTANTIATE(MovingLeastSquaresSameInAndOut, PCL_XYZ_POINT_TYPES)
+ PCL_INSTANTIATE_PRODUCT(MovingLeastSquares, ((pcl::PointXYZ))((pcl::PointXYZI)(pcl::PointXYZRGB)(pcl::PointXYZRGBA)(pcl::PointXYZRGBNormal)(pcl::PointNormal)))
+ PCL_INSTANTIATE_PRODUCT(MovingLeastSquares, ((pcl::PointXYZI))((pcl::PointXYZ)(pcl::PointXYZRGB)(pcl::PointXYZRGBA)(pcl::PointXYZRGBNormal)(pcl::PointNormal)))
+ PCL_INSTANTIATE_PRODUCT(MovingLeastSquares, ((pcl::PointXYZRGB))((pcl::PointXYZ)(pcl::PointXYZI)(pcl::PointXYZRGBA)(pcl::PointXYZRGBNormal)(pcl::PointNormal)))
+ PCL_INSTANTIATE_PRODUCT(MovingLeastSquares, ((pcl::PointXYZRGBA))((pcl::PointXYZ)(pcl::PointXYZI)(pcl::PointXYZRGB)(pcl::PointXYZRGBNormal)(pcl::PointNormal)))
+ PCL_INSTANTIATE_PRODUCT(MovingLeastSquares, ((pcl::PointXYZRGBNormal))((pcl::PointXYZ)(pcl::PointXYZI)(pcl::PointXYZRGB)(pcl::PointXYZRGBA)(pcl::PointNormal)))
+ PCL_INSTANTIATE_PRODUCT(MovingLeastSquares, ((pcl::PointNormal))((pcl::PointXYZ)(pcl::PointXYZI)(pcl::PointXYZRGB)(pcl::PointXYZRGBA)(pcl::PointXYZRGBNormal)))
#endif
#endif // PCL_NO_PRECOMPILE
52 changes: 52 additions & 0 deletions recipes/pcl/all/patches/0001-cmake_use_conan_targets.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -297,7 +297,7 @@
# OpenMP (optional)
option(WITH_OPENMP "Build with parallelization using OpenMP" TRUE)
if(WITH_OPENMP)
- find_package(OpenMP COMPONENTS C CXX)
+ find_package(OpenMP REQUIRED COMPONENTS C CXX)
endif()
if(OpenMP_FOUND)
string(APPEND CMAKE_C_FLAGS " ${OpenMP_C_FLAGS}")
@@ -319,11 +319,11 @@
find_package(Threads REQUIRED)

# Eigen (required)
-find_package(Eigen 3.3 REQUIRED)
+find_package(EIGEN REQUIRED CONFIG)
include_directories(SYSTEM ${EIGEN_INCLUDE_DIRS})

# FLANN (required)
-find_package(FLANN 1.9.1 REQUIRED)
+find_package(FLANN CONFIG)
if(NOT (${FLANN_LIBRARY_TYPE} MATCHES ${PCL_FLANN_REQUIRED_TYPE}) AND NOT (${PCL_FLANN_REQUIRED_TYPE} MATCHES "DONTCARE"))
message(FATAL_ERROR "Flann was selected with ${PCL_FLANN_REQUIRED_TYPE} but found as ${FLANN_LIBRARY_TYPE}")
endif()
@@ -359,7 +359,7 @@
# LibPNG
option(WITH_PNG "PNG file support" TRUE)
if(WITH_PNG)
- find_package(PNG)
+ find_package(PNG REQUIRED CONFIG)
if(PNG_FOUND)
set(HAVE_PNG ON)
include_directories(SYSTEM "${PNG_INCLUDE_DIR}")
@@ -369,7 +369,7 @@
# Qhull
option(WITH_QHULL "Include convex-hull operations" TRUE)
if(WITH_QHULL)
- find_package(Qhull)
+ find_package(QHULL REQUIRED CONFIG)
if(NOT (${QHULL_LIBRARY_TYPE} MATCHES ${PCL_QHULL_REQUIRED_TYPE}) AND NOT (${PCL_QHULL_REQUIRED_TYPE} MATCHES "DONTCARE"))
message(FATAL_ERROR "Qhull was selected with ${PCL_QHULL_REQUIRED_TYPE} but found as ${QHULL_LIBRARY_TYPE}")
endif()
@@ -404,7 +404,7 @@
#Find PCAP
option(WITH_PCAP "pcap file capabilities in Velodyne HDL driver" TRUE)
if(WITH_PCAP)
- find_package(Pcap)
+ find_package(PCAP REQUIRED CONFIG)
endif()

# OpenGL and GLUT
32 changes: 32 additions & 0 deletions recipes/pcl/all/patches/0001-fix-FindOpenNI-bug.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
--- cmake/Modules/FindOpenNI.cmake
+++ cmake/Modules/FindOpenNI.cmake
@@ -52,7 +52,12 @@

# Libraries
if(NOT WIN32)
- find_package(libusb REQUIRED)
+ find_package(libusb QUIET)
+ if (NOT libusb_FOUND)
+ message(WARNING "Found OpenNI library, but required libusb is not available")
+ set(OPENNI_FOUND FALSE)
+ return()
+ endif()
set(OPENNI_LIBRARIES ${OPENNI_LIBRARY} libusb::libusb)
else()
set(OPENNI_LIBRARIES ${OPENNI_LIBRARY})
--- cmake/Modules/FindOpenNI2.cmake
+++ cmake/Modules/FindOpenNI2.cmake
@@ -42,7 +42,12 @@

# Libraries
if(NOT WIN32)
- find_package(libusb REQUIRED)
+ find_package(libusb QUIET)
+ if (NOT libusb_FOUND)
+ message(WARNING "Found OpenNI2 library, but required libusb is not available")
+ set(OPENNI2_FOUND FALSE)
+ return()
+ endif()
set(OPENNI2_LIBRARIES ${OPENNI2_LIBRARY} libusb::libusb)
else()
set(OPENNI2_LIBRARIES ${OPENNI2_LIBRARY})
10 changes: 10 additions & 0 deletions recipes/pcl/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 3.15)

project(test_package CXX)

find_package(PCL REQUIRED surface CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)

target_link_libraries(${PROJECT_NAME} PRIVATE PCL::filters)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
27 changes: 27 additions & 0 deletions recipes/pcl/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import cmake_layout, CMake
import os


# It will become the standard on Conan 2.x
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
test_type = "explicit"

def requirements(self):
self.requires(self.tested_reference_str)

def layout(self):
cmake_layout(self)

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
if can_run(self):
bin_path = os.path.join(self.cpp.build.bindir, "test_package")
self.run(bin_path, env="conanrun")
73 changes: 73 additions & 0 deletions recipes/pcl/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// Copied from https://github.com/PointCloudLibrary/pcl/blob/pcl-1.13.1/examples/filters/example_extract_indices.cpp
/*
* Software License Agreement (BSD License)
*
* Point Cloud Library (PCL) - www.pointclouds.org
* Copyright (c) 2009-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.
*
* $Id: example_ExtractIndices.cpp 4117 2012-01-31 17:56:02Z aichim $
*
*/

#include <iostream>

#include <pcl/filters/extract_indices.h>

int
main (int, char**)
{
using PointType = pcl::PointXYZ;
using CloudType = pcl::PointCloud<PointType>;
CloudType::Ptr cloud (new CloudType);
cloud->is_dense = false;
PointType p;
for (unsigned int i = 0; i < 5; ++i)
{
p.x = p.y = p.z = static_cast<float> (i);
cloud->push_back (p);
}

std::cout << "Cloud has " << cloud->size () << " points." << std::endl;

pcl::PointIndices indices;
indices.indices.push_back (0);
indices.indices.push_back (2);

pcl::ExtractIndices<PointType> extract_indices;
extract_indices.setIndices (pcl::make_shared<const pcl::PointIndices> (indices));
extract_indices.setInputCloud (cloud);
pcl::PointCloud<pcl::PointXYZ>::Ptr output (new pcl::PointCloud<pcl::PointXYZ>);
extract_indices.filter (*output);

std::cout << "Output has " << output->size () << " points." << std::endl;
return (0);
}
3 changes: 3 additions & 0 deletions recipes/pcl/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"1.13.1":
folder: all