From 22112f36c5f7da1982656e600ff1f241fbce66b2 Mon Sep 17 00:00:00 2001 From: Esteban DUGUEPEROUX Date: Thu, 6 Jul 2023 23:32:35 +0200 Subject: [PATCH] Add pcl PointCloudLibrary package Inspired from https://github.com/conan-io/conan-center-index/pull/1891 --- recipes/pcl/all/conandata.yml | 11 + recipes/pcl/all/conanfile.py | 239 ++++++++++++++++ recipes/pcl/all/patches/0001-test.patch | 270 ++++++++++++++++++ recipes/pcl/all/test_package/CMakeLists.txt | 10 + recipes/pcl/all/test_package/conanfile.py | 27 ++ recipes/pcl/all/test_package/test_package.cpp | 73 +++++ recipes/pcl/config.yml | 3 + 7 files changed, 633 insertions(+) create mode 100644 recipes/pcl/all/conandata.yml create mode 100644 recipes/pcl/all/conanfile.py create mode 100644 recipes/pcl/all/patches/0001-test.patch create mode 100644 recipes/pcl/all/test_package/CMakeLists.txt create mode 100644 recipes/pcl/all/test_package/conanfile.py create mode 100644 recipes/pcl/all/test_package/test_package.cpp create mode 100644 recipes/pcl/config.yml diff --git a/recipes/pcl/all/conandata.yml b/recipes/pcl/all/conandata.yml new file mode 100644 index 00000000000000..729e0a8216824c --- /dev/null +++ b/recipes/pcl/all/conandata.yml @@ -0,0 +1,11 @@ +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-test.patch" + patch_description: "Update pcl CMake files to work with conan" + patch_type: "conan" + + diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py new file mode 100644 index 00000000000000..b172a2cb3bbd52 --- /dev/null +++ b/recipes/pcl/all/conanfile.py @@ -0,0 +1,239 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.system.package_manager import Apt, Dnf +import os + + +required_conan_version = ">=1.53.0" + + +class PclConan(ConanFile): + name = "pcl" + description = "Point Cloud Library" + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/PointCloudLibrary/pcl" + topics = ("computer-vision", "point-cloud", "pcl", "pointcloud") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_openmp": [True, False], + "with_libusb": [True, False], + "with_png": [True, False], + "with_qhull": [True, False], + "with_vtk": [True, False], + "with_cuda": [True, False], + "with_pcap": [True, False], + "with_opengl": [True, False], + "with_tools": [True, False], + "with_apps": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_openmp": False, + "with_libusb": False, + "with_png": True, + "with_qhull": True, + "with_vtk": False, + "with_cuda": False, + "with_pcap": False, + "with_opengl": False, + "with_tools": False, + "with_apps": False, + } + + @property + def _min_cppstd(self): + return 17 + + # in case the project requires C++14/17/20/... the minimum compiler version should be listed + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + "clang": "7", + "apple-clang": "10", + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def system_requirements(self): + if self.options.with_vtk: + Apt(self).install(["libvtk-dev"]) + Dnf(self).install(["vtk-devel"]) + + def requirements(self): + self.requires("boost/1.82.0") + self.requires("eigen/3.3.9", transitive_headers=True) + self.requires("flann/1.9.1") + if self.options.with_png: + self.requires("libpng/1.6.39") + if self.options.with_qhull: + self.requires("qhull/8.0.1") + if self.options.with_apps: + self.requires("qt/6.5.0") + if self.options.with_libusb: + self.requires("libusb/1.0.26") + if self.options.with_pcap: + self.requires("libpcap/1.10.4") + + def validate(self): + # validate the minimum cpp standard supported. For C++ projects only + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + check_min_vs(self, 191) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + # in case it does not work in another configuration, it should validated here too + if is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared on Visual Studio and msvc.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["PCL_SHARED_LIBS"] = self.options.shared + tc.variables["WITH_OPENMP"] = self.options.with_openmp + tc.variables["WITH_LIBUSB"] = self.options.with_libusb + tc.variables["WITH_PNG"] = self.options.with_png + tc.variables["WITH_QHULL"] = self.options.with_qhull + tc.variables["WITH_VTK"] = self.options.with_vtk + tc.variables["WITH_CUDA"] = self.options.with_cuda + tc.variables["WITH_PCAP"] = self.options.with_pcap + tc.variables["WITH_OPENGL"] = self.options.with_opengl + tc.variables["BUILD_tools"] = self.options.with_tools + tc.variables["BUILD_apps"] = self.options.with_apps + tc.variables["BUILD_examples"] = True + tc.cache_variables["WITH_QT"] = self.options.with_apps + tc.cache_variables["WITH_VTK"] = False + tc.generate() + + tc = CMakeDeps(self) + tc.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "share")) + + @property + def _pcl_lib_components(self): + def usb(): + return ["libusb::libusb"] if self.options.with_libusb else [] + def png(): + return ["libpng::libpng"] if self.options.with_png else [] + def qhull(): + return ["qhull::qhull"] if self.options.with_qhull else [] + + return { + "common": {"requires": ["eigen::eigen3", "boost::boost"]}, + "kdtree": {"requires": ["common", "flann::flann"]}, + "octree": {"requires": ["common"]}, + "search": {"requires": ["common", "kdtree", "octree", "flann::flann"]}, + "sample_consensus": {"requires": ["common", "search"]}, + "filters": {"requires": ["common", "sample_consensus", "search", "kdtree", "octree"]}, + "2d": {"requires": ["common", "filters"], "header_only": True}, + "geometry": {"requires": ["common"], "header_only": True}, + "io": {"requires": ["common", "octree"] + png() + usb(), "extra_libs": ["io_ply"]}, + "features": {"requires": ["common", "search", "kdtree", "octree", "filters", "2d"]}, + "ml": {"requires": ["common"]}, + "segmentation": {"requires": ["common", "geometry", "search", "sample_consensus", "kdtree", "octree", "features", "filters", "ml"]}, + "surface": {"requires": ["common", "search", "kdtree", "octree"] + qhull()}, + "registration": {"requires": ["common", "octree", "kdtree", "search", "sample_consensus", "features", "filters"]}, + "keypoints": {"requires": ["common", "search", "kdtree", "octree", "features", "filters"]}, + "tracking": {"requires": ["common", "search", "kdtree", "filters", "octree"]}, + "recognition": {"requires": ["common", "io", "search", "kdtree", "octree", "features", "filters", "registration", "sample_consensus", "ml"]}, + "stereo": {"requires": ["common", "io"]} + } + + @property + def _version_suffix(self): + semver = Version(self.version) + return "{}.{}".format(semver.major, semver.minor) + + def _lib_name(self, lib): + if self.settings.compiler == "msvc" and self.settings.build_type == "Debug": + return "pcl_{}d".format(lib) + return "pcl_{}".format(lib) + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "PCL" + self.cpp_info.names["cmake_find_package_multi"] = "PCL" + + self.cpp_info.set_property("cmake_file_name", "PCL") + self.cpp_info.set_property("cmake_module_file_name", "PCL") + self.cpp_info.set_property("cmake_target_name", "PCL::PCL") + + def _update_components(components): + for comp, values in components.items(): + self.cpp_info.components[comp].names["cmake_find_package"] = comp + self.cpp_info.components[comp].names["cmake_find_package_multi"] = comp + self.cpp_info.components[comp].set_property("cmake_file_name", comp) + self.cpp_info.components[comp].set_property("cmake_module_file_name", comp) + self.cpp_info.components[comp].set_property("cmake_target_name", f"PCL::{comp}") + + self.cpp_info.components[comp].names["pkg_config"] = "pcl_{}-{}".format(comp, self._version_suffix) + self.cpp_info.components[comp].set_property("pkg_config_name", "pcl_{}-{}".format(comp, self._version_suffix)) + + self.cpp_info.components[comp].includedirs = [os.path.join("include", "pcl-{}".format(self._version_suffix))] + if not values.get("header_only", False): + libs = [comp] + values.get("extra_libs", []) + self.cpp_info.components[comp].libs = [self._lib_name(lib) for lib in libs] + self.cpp_info.components[comp].requires = values["requires"] + + _update_components(self._pcl_lib_components) + + if not self.options.shared: + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["common"].system_libs.append("pthread") + if self.options.with_openmp: + if self.settings.os == "Linux": + if self.settings.compiler == "gcc": + self.cpp_info.components["common"].sharedlinkflags.append("-fopenmp") + self.cpp_info.components["common"].exelinkflags.append("-fopenmp") + elif self.settings.os == "Windows": + if self.settings.compiler == "msvc": + self.cpp_info.components["common"].system_libs.append("delayimp") + elif self.settings.compiler == "gcc": + self.cpp_info.components["common"].system_libs.append("gomp") + + if self.options.with_apps: + self.cpp_info.components["apps"].libs = [] + self.cpp_info.components["apps"].requires = ["qt::qt"] + diff --git a/recipes/pcl/all/patches/0001-test.patch b/recipes/pcl/all/patches/0001-test.patch new file mode 100644 index 00000000000000..f570d7f0ccc756 --- /dev/null +++ b/recipes/pcl/all/patches/0001-test.patch @@ -0,0 +1,270 @@ +--- + CMakeLists.txt | 8 +- + PCLConfig.cmake.in | 4 +- + apps/3d_rec_framework/CMakeLists.txt | 2 +- + apps/CMakeLists.txt | 8 +- + cmake/Modules/FindEigen.cmake | 41 ---- + cmake/Modules/FindFLANN.cmake | 223 ------------------ + cmake/Modules/FindPcap.cmake | 109 --------- + cmake/Modules/FindQhull.cmake | 182 -------------- + cmake/Modules/Findlibusb.cmake | 76 ------ + cmake/pcl_targets.cmake | 3 +- + common/CMakeLists.txt | 2 +- + .../sources/vfh_recognition/CMakeLists.txt | 4 +- + io/CMakeLists.txt | 2 +- + kdtree/CMakeLists.txt | 2 +- + search/CMakeLists.txt | 2 +- + surface/CMakeLists.txt | 6 +- + test/features/CMakeLists.txt | 2 +- + test/surface/CMakeLists.txt | 2 +- + tools/CMakeLists.txt | 2 +- + 19 files changed, 26 insertions(+), 654 deletions(-) + delete mode 100644 cmake/Modules/FindEigen.cmake + delete mode 100644 cmake/Modules/FindFLANN.cmake + delete mode 100644 cmake/Modules/FindPcap.cmake + delete mode 100755 cmake/Modules/FindQhull.cmake + delete mode 100644 cmake/Modules/Findlibusb.cmake + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 51879ed12..6115e9426 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -31,7 +31,7 @@ if(MSVC AND ("${MSVC_VERSION}" LESS 1910)) + endif() + + ### ---[ Find universal dependencies +-set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/" ${CMAKE_MODULE_PATH}) ++# set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/" ${CMAKE_MODULE_PATH}) + + # ---[ Include pkgconfig + include(FindPkgConfig) +@@ -319,11 +319,13 @@ endif() + find_package(Threads REQUIRED) + + # Eigen (required) +-find_package(Eigen 3.3 REQUIRED) ++find_package(Eigen3 REQUIRED) ++string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPER_CMAKE_BUILD_TYPE) ++set(EIGEN_INCLUDE_DIRS ${eigen_INCLUDE_DIRS_${UPPER_CMAKE_BUILD_TYPE}}) + include_directories(SYSTEM ${EIGEN_INCLUDE_DIRS}) + + # FLANN (required) +-find_package(FLANN 1.9.1 REQUIRED) ++find_package(flann 1.9.1 REQUIRED) + 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() +diff --git a/PCLConfig.cmake.in b/PCLConfig.cmake.in +index d3fa589a6..010e4edcc 100644 +--- a/PCLConfig.cmake.in ++++ b/PCLConfig.cmake.in +@@ -670,8 +670,8 @@ pcl_remove_duplicate_libraries(PCL_COMPONENTS PCL_LIBRARIES) + + # Add 3rd party libraries, as user code might include our .HPP implementations + list(APPEND PCL_LIBRARIES ${PCL_BOOST_LIBRARIES} ${PCL_OPENNI_LIBRARIES} ${PCL_OPENNI2_LIBRARIES} ${PCL_ENSENSO_LIBRARIES} ${PCL_davidSDK_LIBRARIES} ${PCL_DSSDK_LIBRARIES} ${PCL_RSSDK_LIBRARIES} ${PCL_RSSDK2_LIBRARIES} ${PCL_VTK_LIBRARIES}) +-if (TARGET FLANN::FLANN) +- list(APPEND PCL_LIBRARIES FLANN::FLANN) ++if (TARGET flann::flann) ++ list(APPEND PCL_LIBRARIES flann::flann) + endif() + + if(TARGET QHULL::QHULL) +diff --git a/apps/3d_rec_framework/CMakeLists.txt b/apps/3d_rec_framework/CMakeLists.txt +index 56e4ee7a6..85648fdb1 100644 +--- a/apps/3d_rec_framework/CMakeLists.txt ++++ b/apps/3d_rec_framework/CMakeLists.txt +@@ -98,7 +98,7 @@ endif() + + PCL_MAKE_PKGCONFIG(${LIB_NAME} COMPONENT ${SUBSUBSYS_NAME} DESC ${SUBSUBSYS_DESC}) + +-if(QHULL_FOUND) ++if(Qhull_FOUND) + add_executable(pcl_global_classification src/tools/global_classification.cpp) + target_link_libraries(pcl_global_classification pcl_apps pcl_3d_rec_framework pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_surface) + endif() +diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt +index 4c88a7ab1..e45a54f46 100644 +--- a/apps/CMakeLists.txt ++++ b/apps/CMakeLists.txt +@@ -61,7 +61,7 @@ if(VTK_FOUND) + PCL_ADD_EXECUTABLE(pcl_pcd_organized_multi_plane_segmentation COMPONENT ${SUBSYS_NAME} SOURCES src/pcd_organized_multi_plane_segmentation.cpp) + target_link_libraries(pcl_pcd_organized_multi_plane_segmentation pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_features) + +- if(QHULL_FOUND) ++ if(Qhull_FOUND) + PCL_ADD_EXECUTABLE(pcl_pcd_select_object_plane COMPONENT ${SUBSYS_NAME} SOURCES src/pcd_select_object_plane.cpp) + target_link_libraries(pcl_pcd_select_object_plane pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_features pcl_surface) + endif() +@@ -185,7 +185,7 @@ if(VTK_FOUND) + + endif() + +- if(QHULL_FOUND) ++ if(Qhull_FOUND) + PCL_ADD_EXECUTABLE(pcl_openni_3d_convex_hull COMPONENT ${SUBSYS_NAME} SOURCES src/openni_3d_convex_hull.cpp BUNDLE) + target_link_libraries(pcl_openni_3d_convex_hull pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_features pcl_surface) + +@@ -200,7 +200,7 @@ if(VTK_FOUND) + + PCL_ADD_EXECUTABLE(pcl_ni_linemod COMPONENT ${SUBSYS_NAME} SOURCES src/ni_linemod.cpp BUNDLE) + target_link_libraries(pcl_ni_linemod pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_features pcl_surface pcl_search) +- endif() # QHULL_FOUND ++ endif() # Qhull_FOUND + + PCL_ADD_EXECUTABLE(pcl_ni_agast COMPONENT ${SUBSYS_NAME} SOURCES src/ni_agast.cpp BUNDLE) + target_link_libraries(pcl_ni_agast pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_features pcl_keypoints pcl_surface pcl_search) +@@ -241,7 +241,7 @@ foreach(subdir ${PCL_APPS_MODULES_DIRS}) + add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/${subdir}") + endforeach() + +-if(QHULL_FOUND) ++if(Qhull_FOUND) + set(incs + "include/pcl/${SUBSYS_NAME}/dominant_plane_segmentation.h" + "include/pcl/${SUBSYS_NAME}/timer.h" +diff --git a/cmake/pcl_targets.cmake b/cmake/pcl_targets.cmake +index 2da076c23..77e205734 100644 +--- a/cmake/pcl_targets.cmake ++++ b/cmake/pcl_targets.cmake +@@ -126,7 +126,8 @@ macro(PCL_SUBSYS_DEPEND _var) + endif() + if(ARGS_EXT_DEPS) + foreach(_dep ${ARGS_EXT_DEPS}) +- string(TOUPPER "${_dep}_found" EXT_DEP_FOUND) ++ set(EXT_DEP_FOUND "${_dep}_FOUND") ++ message(STATUS "EXT_DEP_FOUND: ${EXT_DEP_FOUND}") + #Variable EXT_DEP_FOUND expands to ie. QHULL_FOUND which in turn is then used to see if the EXT_DEPS is found. + if(NOT ${EXT_DEP_FOUND}) + set(${_var} FALSE) +diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt +index 12d69ed5c..48e1a202e 100644 +--- a/common/CMakeLists.txt ++++ b/common/CMakeLists.txt +@@ -4,7 +4,7 @@ set(SUBSYS_DEPS) + + set(build TRUE) + PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ON) +-PCL_SUBSYS_DEPEND(build NAME ${SUBSYS_NAME} DEPS ${SUBSYS_DEPS} EXT_DEPS eigen boost) ++PCL_SUBSYS_DEPEND(build NAME ${SUBSYS_NAME} DEPS ${SUBSYS_DEPS} EXT_DEPS Eigen3 Boost) + + PCL_ADD_DOC("${SUBSYS_NAME}") + +diff --git a/doc/tutorials/content/sources/vfh_recognition/CMakeLists.txt b/doc/tutorials/content/sources/vfh_recognition/CMakeLists.txt +index 7c4a9f1f3..8261356a9 100644 +--- a/doc/tutorials/content/sources/vfh_recognition/CMakeLists.txt ++++ b/doc/tutorials/content/sources/vfh_recognition/CMakeLists.txt +@@ -16,7 +16,7 @@ include_directories(SYSTEM + + add_executable(build_tree build_tree.cpp) + target_link_libraries(build_tree ${PCL_LIBRARIES} ${Boost_LIBRARIES} +- FLANN::FLANN ${HDF5_LIBRARIES}) ++ flann::flann ${HDF5_LIBRARIES}) + + add_executable(nearest_neighbors nearest_neighbors.cpp) +-target_link_libraries(nearest_neighbors ${PCL_LIBRARIES} ${Boost_LIBRARIES} FLANN::FLANN ${HDF5_LIBRARIES}) ++target_link_libraries(nearest_neighbors ${PCL_LIBRARIES} ${Boost_LIBRARIES} flann::flann ${HDF5_LIBRARIES}) +diff --git a/io/CMakeLists.txt b/io/CMakeLists.txt +index dcba29803..2e36dcfa2 100644 +--- a/io/CMakeLists.txt ++++ b/io/CMakeLists.txt +@@ -1,7 +1,7 @@ + set(SUBSYS_NAME io) + set(SUBSYS_DESC "Point cloud IO library") + set(SUBSYS_DEPS common octree) +-set(SUBSYS_EXT_DEPS boost eigen) ++set(SUBSYS_EXT_DEPS Boost Eigen3) + + set(build TRUE) + PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ON) +diff --git a/kdtree/CMakeLists.txt b/kdtree/CMakeLists.txt +index d9c94bbe4..f96abcb67 100644 +--- a/kdtree/CMakeLists.txt ++++ b/kdtree/CMakeLists.txt +@@ -30,7 +30,7 @@ set(impl_incs + set(LIB_NAME "pcl_${SUBSYS_NAME}") + include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include") + PCL_ADD_LIBRARY(${LIB_NAME} COMPONENT ${SUBSYS_NAME} SOURCES ${srcs} ${incs} ${impl_incs}) +-target_link_libraries("${LIB_NAME}" pcl_common FLANN::FLANN) ++target_link_libraries("${LIB_NAME}" pcl_common flann::flann) + set(EXT_DEPS flann) + PCL_MAKE_PKGCONFIG(${LIB_NAME} COMPONENT ${SUBSYS_NAME} DESC ${SUBSYS_DESC} PCL_DEPS ${SUBSYS_DEPS} EXT_DEPS ${EXT_DEPS}) + +diff --git a/search/CMakeLists.txt b/search/CMakeLists.txt +index 0b93e5255..53b823809 100644 +--- a/search/CMakeLists.txt ++++ b/search/CMakeLists.txt +@@ -41,7 +41,7 @@ set(impl_incs + set(LIB_NAME "pcl_${SUBSYS_NAME}") + include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include") + PCL_ADD_LIBRARY(${LIB_NAME} COMPONENT ${SUBSYS_NAME} SOURCES ${srcs} ${incs} ${impl_incs}) +-target_link_libraries("${LIB_NAME}" pcl_common FLANN::FLANN pcl_octree pcl_kdtree) ++target_link_libraries("${LIB_NAME}" pcl_common flann::flann pcl_octree pcl_kdtree) + list(APPEND EXT_DEPS flann) + PCL_MAKE_PKGCONFIG(${LIB_NAME} COMPONENT ${SUBSYS_NAME} DESC ${SUBSYS_DESC} PCL_DEPS ${SUBSYS_DEPS}) + +diff --git a/surface/CMakeLists.txt b/surface/CMakeLists.txt +index c29105e6a..7caf26100 100644 +--- a/surface/CMakeLists.txt ++++ b/surface/CMakeLists.txt +@@ -12,7 +12,7 @@ if(NOT build) + return() + endif() + +-if(QHULL_FOUND) ++if(Qhull_FOUND) + set(HULL_INCLUDES + "include/pcl/${SUBSYS_NAME}/concave_hull.h" + "include/pcl/${SUBSYS_NAME}/convex_hull.h" +@@ -192,8 +192,8 @@ if(VTK_FOUND) + endif() + endif() + +-if(QHULL_FOUND) +- target_link_libraries("${LIB_NAME}" QHULL::QHULL) ++if(Qhull_FOUND) ++ target_link_libraries("${LIB_NAME}" Qhull::qhullstatic_r) + endif() + + PCL_MAKE_PKGCONFIG(${LIB_NAME} COMPONENT ${SUBSYS_NAME} DESC ${SUBSYS_DESC} PCL_DEPS ${SUBSYS_DEPS}) +diff --git a/test/features/CMakeLists.txt b/test/features/CMakeLists.txt +index 4dbab6e8b..e5014aa80 100644 +--- a/test/features/CMakeLists.txt ++++ b/test/features/CMakeLists.txt +@@ -91,7 +91,7 @@ if(BUILD_io) + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") + PCL_ADD_TEST(features_narf test_narf + FILES test_narf.cpp +- LINK_WITH pcl_gtest pcl_features FLANN::FLANN) ++ LINK_WITH pcl_gtest pcl_features flann::flann) + PCL_ADD_TEST(a_ii_normals_test test_ii_normals + FILES test_ii_normals.cpp + LINK_WITH pcl_gtest pcl_io pcl_features +diff --git a/test/surface/CMakeLists.txt b/test/surface/CMakeLists.txt +index 3abd8c60f..de8f68494 100644 +--- a/test/surface/CMakeLists.txt ++++ b/test/surface/CMakeLists.txt +@@ -41,7 +41,7 @@ PCL_ADD_TEST(surface_poisson test_poisson + LINK_WITH pcl_gtest pcl_io pcl_kdtree pcl_surface pcl_features + ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd") + +-if(QHULL_FOUND) ++if(Qhull_FOUND) + PCL_ADD_TEST(surface_convex_hull test_convex_hull + FILES test_convex_hull.cpp + LINK_WITH pcl_gtest pcl_io pcl_kdtree pcl_surface pcl_features pcl_filters pcl_search +diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt +index a4151e9c2..0052c8f52 100644 +--- a/tools/CMakeLists.txt ++++ b/tools/CMakeLists.txt +@@ -272,7 +272,7 @@ if(TARGET pcl_surface) + PCL_ADD_EXECUTABLE(pcl_poisson_reconstruction COMPONENT ${SUBSYS_NAME} SOURCES poisson_reconstruction.cpp) + target_link_libraries(pcl_poisson_reconstruction pcl_common pcl_io pcl_surface) + +- if(QHULL_FOUND) ++ if(Qhull_FOUND) + PCL_ADD_EXECUTABLE(pcl_crop_to_hull COMPONENT ${SUBSYS_NAME} SOURCES crop_to_hull.cpp) + target_link_libraries(pcl_crop_to_hull pcl_common pcl_io pcl_filters pcl_surface) + +-- +2.41.0 + diff --git a/recipes/pcl/all/test_package/CMakeLists.txt b/recipes/pcl/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..57794a612df2a9 --- /dev/null +++ b/recipes/pcl/all/test_package/CMakeLists.txt @@ -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) diff --git a/recipes/pcl/all/test_package/conanfile.py b/recipes/pcl/all/test_package/conanfile.py new file mode 100644 index 00000000000000..02eb5ce439fb40 --- /dev/null +++ b/recipes/pcl/all/test_package/conanfile.py @@ -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") diff --git a/recipes/pcl/all/test_package/test_package.cpp b/recipes/pcl/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..cca717d08eb8f6 --- /dev/null +++ b/recipes/pcl/all/test_package/test_package.cpp @@ -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 + +#include + +int +main (int, char**) +{ + using PointType = pcl::PointXYZ; + using CloudType = pcl::PointCloud; + 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 (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 extract_indices; + extract_indices.setIndices (pcl::make_shared (indices)); + extract_indices.setInputCloud (cloud); + pcl::PointCloud::Ptr output (new pcl::PointCloud); + extract_indices.filter (*output); + + std::cout << "Output has " << output->size () << " points." << std::endl; + return (0); +} diff --git a/recipes/pcl/config.yml b/recipes/pcl/config.yml new file mode 100644 index 00000000000000..aac1819cc10c01 --- /dev/null +++ b/recipes/pcl/config.yml @@ -0,0 +1,3 @@ +versions: + "1.13.1": + folder: all