From 4ca86913dc18361efc3b6a97d0e3f161b7672cb8 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 | 12 + recipes/pcl/all/conanfile.py | 240 ++++++++++++++++++ .../0001-KB-H020_avoid_pkgconfig_files.patch | 200 +++++++++++++++ recipes/pcl/all/patches/0001-test.patch | 217 ++++++++++++++++ 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 + 8 files changed, 782 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-KB-H020_avoid_pkgconfig_files.patch 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..4dcfd7e279178f --- /dev/null +++ b/recipes/pcl/all/conandata.yml @@ -0,0 +1,12 @@ +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" + - patch_file: "patches/0001-KB-H020_avoid_pkgconfig_files.patch" + patch_description: "Disable pkgconfig files install to follow KB-H020 rule" + patch_type: "conan" diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py new file mode 100644 index 00000000000000..39634d3fb589c3 --- /dev/null +++ b/recipes/pcl/all/conanfile.py @@ -0,0 +1,240 @@ +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", "pcd", "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"]) + if self.settings.os == "Windows": + self.output.warn("On Windows VTK must be installed manually.") + + 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-KB-H020_avoid_pkgconfig_files.patch b/recipes/pcl/all/patches/0001-KB-H020_avoid_pkgconfig_files.patch new file mode 100644 index 00000000000000..80bfc2c921e822 --- /dev/null +++ b/recipes/pcl/all/patches/0001-KB-H020_avoid_pkgconfig_files.patch @@ -0,0 +1,200 @@ +From beb14566d19b76c0ef39637aff0f73d4325b7b0e Mon Sep 17 00:00:00 2001 +From: Esteban DUGUEPEROUX +Date: Sat, 8 Jul 2023 18:06:13 +0200 +Subject: [PATCH] otto + +--- + cmake/pcl_targets.cmake | 3 - + conandata.yml | 2 + + conanfile.py | 155 ++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 157 insertions(+), 3 deletions(-) + create mode 100644 conandata.yml + create mode 100644 conanfile.py + +diff --git a/cmake/pcl_targets.cmake b/cmake/pcl_targets.cmake +index 77e205734..f98d980c7 100644 +--- a/cmake/pcl_targets.cmake ++++ b/cmake/pcl_targets.cmake +@@ -571,9 +571,6 @@ function(PCL_MAKE_PKGCONFIG _name) + else() + configure_file(${PROJECT_SOURCE_DIR}/cmake/pkgconfig.cmake.in ${_pc_file} @ONLY) + endif() +- install(FILES ${_pc_file} +- DESTINATION ${PKGCFG_INSTALL_DIR} +- COMPONENT pcl_${ARGS_COMPONENT}) + endfunction() + + ############################################################################### +diff --git a/conandata.yml b/conandata.yml +new file mode 100644 +index 000000000..ecf1b160c +--- /dev/null ++++ b/conandata.yml +@@ -0,0 +1,2 @@ ++patches: ++- patch_file: "patches/0001-buildflatbuffers-cmake.patch" +\ No newline at end of file +diff --git a/conanfile.py b/conanfile.py +new file mode 100644 +index 000000000..ca0b56d01 +--- /dev/null ++++ b/conanfile.py +@@ -0,0 +1,155 @@ ++from conan import ConanFile ++from conan.errors import ConanInvalidConfiguration ++from conan.tools.microsoft import check_min_vs, is_msvc_static_runtime, is_msvc ++from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir, replace_in_file ++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.env import VirtualBuildEnv ++import os ++ ++ ++required_conan_version = ">=1.53.0" ++ ++ ++class PclConan(ConanFile): ++ name = "pcl" ++ version = "0.0.1" ++ 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 should usually be "library" (if there is shared option) ++ package_type = "library" ++ settings = "os", "arch", "compiler", "build_type" ++ options = { ++ "shared": [True, False], ++ "fPIC": [True, False], ++ } ++ default_options = { ++ "shared": False, ++ "fPIC": True, ++ } ++ ++ @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 config_options(self): ++ if self.settings.os == "Windows": ++ del self.options.fPIC ++ ++ def export_sources(self): ++ # This LICENSE.md is a source file intended to be part of the final package ++ # it is not the license of the current recipe ++ copy(self, "*", self.recipe_folder, self.export_sources_folder) ++ ++ def configure(self): ++ if self.options.shared: ++ self.options.rm_safe("fPIC") ++ ++ def layout(self): ++ cmake_layout(self) ++ ++ def requirements(self): ++ self.requires("boost/1.82.0") ++ self.requires("eigen/3.4.0") ++ self.requires("flann/1.9.2") ++ # if self.options.with_png: ++ self.requires("libpng/1.6.39") ++ # if self.options.with_qhull: ++ self.requires("qhull/8.0.1") ++ self.requires("qt/6.5.0") ++ ++ 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 generate(self): ++ # BUILD_SHARED_LIBS and POSITION_INDEPENDENT_CODE are automatically parsed when self.options.shared or self.options.fPIC exist ++ tc = CMakeToolchain(self) ++ # Boolean values are preferred instead of "ON"/"OFF" ++ tc.variables["PCL_ENABLE_CCACHE"] = "ON" ++ # if is_msvc(self): ++ # # don't use self.settings.compiler.runtime ++ # tc.variables["USE_MSVC_RUNTIME_LIBRARY_DLL"] = not is_msvc_static_runtime(self) ++ # # deps_cpp_info, deps_env_info and deps_user_info are no longer used ++ # if self.dependencies["dependency"].options.foobar: ++ # tc.variables["DEPENDENCY_LIBPATH"] = self.dependencies["dependency"].cpp_info.libdirs ++ # # cache_variables should be used sparingly, example setting cmake policies ++ # tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" ++ tc.generate() ++ # In case there are dependencies listed on requirements, CMakeDeps should be used ++ tc = CMakeDeps(self) ++ tc.generate() ++ ++ def _patch_sources(self): ++ apply_conandata_patches(self) ++ # remove bundled xxhash ++ # rm(self, "whateer.*", os.path.join(self.source_folder, "lib")) ++ # replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "...", "") ++ ++ def build(self): ++ self._patch_sources() # It can be apply_conandata_patches(self) only in case no more patches are needed ++ 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() ++ ++ # some files extensions and folders are not allowed. Please, read the FAQs to get informed. ++ rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) ++ rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) ++ rmdir(self, os.path.join(self.package_folder, "share")) ++ rm(self, "*.la", os.path.join(self.package_folder, "lib")) ++ rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) ++ rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) ++ ++ def package_info(self): ++ self.cpp_info.libs = ["package_lib"] ++ ++ # if package has an official FindPACKAGE.cmake listed in https://cmake.org/cmake/help/latest/manual/cmake-modules.7.html#find-modules ++ # examples: bzip2, freetype, gdal, icu, libcurl, libjpeg, libpng, libtiff, openssl, sqlite3, zlib... ++ self.cpp_info.set_property("cmake_module_file_name", "PACKAGE") ++ self.cpp_info.set_property("cmake_module_target_name", "PACKAGE::PACKAGE") ++ # if package provides a CMake config file (package-config.cmake or packageConfig.cmake, with package::package target, usually installed in /lib/cmake//) ++ self.cpp_info.set_property("cmake_file_name", "package") ++ self.cpp_info.set_property("cmake_target_name", "package::package") ++ # if package provides a pkgconfig file (package.pc, usually installed in /lib/pkgconfig/) ++ self.cpp_info.set_property("pkg_config_name", "package") ++ ++ # If they are needed on Linux, m, pthread and dl are usually needed on FreeBSD too ++ if self.settings.os in ["Linux", "FreeBSD"]: ++ self.cpp_info.system_libs.append("m") ++ self.cpp_info.system_libs.append("pthread") ++ self.cpp_info.system_libs.append("dl") ++ ++ # TODO: to remove in conan v2 once cmake_find_package_* generators removed ++ self.cpp_info.filenames["cmake_find_package"] = "PACKAGE" ++ self.cpp_info.filenames["cmake_find_package_multi"] = "package" ++ self.cpp_info.names["cmake_find_package"] = "PACKAGE" ++ self.cpp_info.names["cmake_find_package_multi"] = "package" +-- +2.41.0 + diff --git a/recipes/pcl/all/patches/0001-test.patch b/recipes/pcl/all/patches/0001-test.patch new file mode 100644 index 00000000000000..230d3dd37c3aba --- /dev/null +++ b/recipes/pcl/all/patches/0001-test.patch @@ -0,0 +1,217 @@ +--- 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() +--- 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) +--- 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() +--- 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" +--- 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) +--- 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}") + +--- 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}) +--- 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) +--- 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}) + +--- 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}) + +--- 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,12 @@ if(VTK_FOUND) + endif() + endif() + +-if(QHULL_FOUND) +- target_link_libraries("${LIB_NAME}" QHULL::QHULL) ++if(Qhull_FOUND) ++ if(TARGET Qhull::qhull_r) ++ target_link_libraries("${LIB_NAME}" Qhull::qhull_r) ++ else() ++ target_link_libraries("${LIB_NAME}" Qhull::qhullstatic_r) ++ endif() + endif() + + PCL_MAKE_PKGCONFIG(${LIB_NAME} COMPONENT ${SUBSYS_NAME} DESC ${SUBSYS_DESC} PCL_DEPS ${SUBSYS_DEPS}) +--- 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 +--- 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 +--- 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) + + 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