diff --git a/recipes/pcl/all/conandata.yml b/recipes/pcl/all/conandata.yml new file mode 100644 index 00000000000000..68d7c41b647077 --- /dev/null +++ b/recipes/pcl/all/conandata.yml @@ -0,0 +1,9 @@ +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-flann-target-cmake.patch" + patch_description: "Use flann::flann instead of FLANN::FLANN target generated by CMakeDeps" + patch_type: "conan" diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py new file mode 100644 index 00000000000000..79246a5d778f29 --- /dev/null +++ b/recipes/pcl/all/conanfile.py @@ -0,0 +1,224 @@ +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" + 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_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_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 requirements(self): + self.requires("boost/1.82.0") + self.requires("eigen/3.3.9") + 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") + if self.options.with_apps: + self.requires("qt/6.5.0") + if self.options.with_libusb: + self.requires("libusb/1.0.26") + + 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_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.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() + + @property + def _pcl_lib_components(self): + 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(), "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-flann-target-cmake.patch b/recipes/pcl/all/patches/0001-flann-target-cmake.patch new file mode 100644 index 00000000000000..f30f46451f98fa --- /dev/null +++ b/recipes/pcl/all/patches/0001-flann-target-cmake.patch @@ -0,0 +1,298 @@ +--- 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/cmake/Modules/FindFLANN.cmake b/cmake/Modules/FindFLANN.cmake +deleted file mode 100644 +index 16ee72fbe..000000000 +--- a/cmake/Modules/FindFLANN.cmake ++++ /dev/null +@@ -1,223 +0,0 @@ +-#.rst: +-# FindFLANN +-# -------- +-# +-# Try to find FLANN library and headers. This module supports both old released versions +-# of FLANN ≤ 1.9.1 and newer development versions that ship with a modern config file. +-# +-# IMPORTED Targets +-# ^^^^^^^^^^^^^^^^ +-# +-# This module defines the :prop_tgt:`IMPORTED` targets: +-# +-# ``FLANN::FLANN`` +-# Defined if the system has FLANN. +-# +-# Result Variables +-# ^^^^^^^^^^^^^^^^ +-# +-# This module sets the following variables: +-# +-# :: +-# +-# FLANN_FOUND True in case FLANN is found, otherwise false +-# FLANN_ROOT Path to the root of found FLANN installation +-# +-# Example usage +-# ^^^^^^^^^^^^^ +-# +-# :: +-# +-# find_package(FLANN REQUIRED) +-# +-# add_executable(foo foo.cc) +-# target_link_libraries(foo FLANN::FLANN) +-# +- +-# Early return if FLANN target is already defined. This makes it safe to run +-# this script multiple times. +-if(TARGET FLANN::FLANN) +- set(FLANN_FOUND ON) +- return() +-endif() +- +-# First try to locate FLANN using modern config +-find_package(flann NO_MODULE ${FLANN_FIND_VERSION} QUIET) +- +-if(flann_FOUND) +- unset(flann_FOUND) +- set(FLANN_FOUND ON) +- +- # Create interface library that effectively becomes an alias for the appropriate (static/dynamic) imported FLANN target +- add_library(FLANN::FLANN INTERFACE IMPORTED) +- +- if(TARGET flann::flann_cpp_s AND TARGET flann::flann_cpp) +- if(PCL_FLANN_REQUIRED_TYPE MATCHES "SHARED") +- set_property(TARGET FLANN::FLANN APPEND PROPERTY INTERFACE_LINK_LIBRARIES flann::flann_cpp) +- set(FLANN_LIBRARY_TYPE SHARED) +- elseif(PCL_FLANN_REQUIRED_TYPE MATCHES "STATIC") +- set_property(TARGET FLANN::FLANN APPEND PROPERTY INTERFACE_LINK_LIBRARIES flann::flann_cpp_s) +- set(FLANN_LIBRARY_TYPE STATIC) +- else() +- if(PCL_SHARED_LIBS) +- set_property(TARGET FLANN::FLANN APPEND PROPERTY INTERFACE_LINK_LIBRARIES flann::flann_cpp) +- set(FLANN_LIBRARY_TYPE SHARED) +- else() +- set_property(TARGET FLANN::FLANN APPEND PROPERTY INTERFACE_LINK_LIBRARIES flann::flann_cpp_s) +- set(FLANN_LIBRARY_TYPE STATIC) +- endif() +- endif() +- elseif(TARGET flann::flann_cpp_s) +- set_property(TARGET FLANN::FLANN APPEND PROPERTY INTERFACE_LINK_LIBRARIES flann::flann_cpp_s) +- set(FLANN_LIBRARY_TYPE STATIC) +- else() +- set_property(TARGET FLANN::FLANN APPEND PROPERTY INTERFACE_LINK_LIBRARIES flann::flann_cpp) +- set(FLANN_LIBRARY_TYPE SHARED) +- endif() +- +- # Determine FLANN installation root based on the path to the processed Config file +- get_filename_component(_config_dir "${flann_CONFIG}" DIRECTORY) +- get_filename_component(FLANN_ROOT "${_config_dir}/../../.." ABSOLUTE) +- unset(_config_dir) +- message(STATUS "Found flann version ${flann_VERSION}") +- return() +-endif() +- +-# Second try to locate FLANN using pkgconfig +-find_package(PkgConfig QUIET) +-if(FLANN_FIND_VERSION) +- pkg_check_modules(PC_FLANN flann>=${FLANN_FIND_VERSION}) +-else() +- pkg_check_modules(PC_FLANN flann) +-endif() +- +-find_path(FLANN_INCLUDE_DIR +- NAMES +- flann/flann.hpp +- HINTS +- ${PC_FLANN_INCLUDE_DIRS} +- ${FLANN_ROOT} +- $ENV{FLANN_ROOT} +- PATHS +- $ENV{PROGRAMFILES}/Flann +- $ENV{PROGRAMW6432}/Flann +- PATH_SUFFIXES +- include +-) +- +-find_library(FLANN_LIBRARY_SHARED +- NAMES +- flann_cpp +- HINTS +- ${PC_FLANN_LIBRARY_DIRS} +- ${FLANN_ROOT} +- $ENV{FLANN_ROOT} +- PATHS +- $ENV{PROGRAMFILES}/Flann +- $ENV{PROGRAMW6432}/Flann +- PATH_SUFFIXES +- lib +-) +- +-find_library(FLANN_LIBRARY_DEBUG_SHARED +- NAMES +- flann_cpp-gd flann_cppd +- HINTS +- ${PC_FLANN_LIBRARY_DIRS} +- ${FLANN_ROOT} +- $ENV{FLANN_ROOT} +- PATHS +- $ENV{PROGRAMFILES}/Flann +- $ENV{PROGRAMW6432}/Flann +- PATH_SUFFIXES +- lib +-) +- +-find_library(FLANN_LIBRARY_STATIC +- NAMES +- flann_cpp_s +- HINTS +- ${PC_FLANN_LIBRARY_DIRS} +- ${FLANN_ROOT} +- $ENV{FLANN_ROOT} +- PATHS +- $ENV{PROGRAMFILES}/Flann +- $ENV{PROGRAMW6432}/Flann +- PATH_SUFFIXES +- lib +-) +- +-find_library(FLANN_LIBRARY_DEBUG_STATIC +- NAMES +- flann_cpp_s-gd flann_cpp_sd +- HINTS +- ${PC_FLANN_LIBRARY_DIRS} +- ${FLANN_ROOT} +- $ENV{FLANN_ROOT} +- PATHS +- $ENV{PROGRAMFILES}/Flann +- $ENV{PROGRAMW6432}/Flann +- PATH_SUFFIXES +- lib +-) +- +-if(FLANN_LIBRARY_SHARED AND FLANN_LIBRARY_STATIC) +- if(PCL_FLANN_REQUIRED_TYPE MATCHES "SHARED") +- set(FLANN_LIBRARY_TYPE SHARED) +- set(FLANN_LIBRARY ${FLANN_LIBRARY_SHARED}) +- elseif(PCL_FLANN_REQUIRED_TYPE MATCHES "STATIC") +- set(FLANN_LIBRARY_TYPE STATIC) +- set(FLANN_LIBRARY ${FLANN_LIBRARY_STATIC}) +- else() +- if(PCL_SHARED_LIBS) +- set(FLANN_LIBRARY_TYPE SHARED) +- set(FLANN_LIBRARY ${FLANN_LIBRARY_SHARED}) +- else() +- set(FLANN_LIBRARY_TYPE STATIC) +- set(FLANN_LIBRARY ${FLANN_LIBRARY_STATIC}) +- endif() +- endif() +-elseif(FLANN_LIBRARY_STATIC) +- set(FLANN_LIBRARY_TYPE STATIC) +- set(FLANN_LIBRARY ${FLANN_LIBRARY_STATIC}) +-elseif(FLANN_LIBRARY_SHARED) +- set(FLANN_LIBRARY_TYPE SHARED) +- set(FLANN_LIBRARY ${FLANN_LIBRARY_SHARED}) +-endif() +- +-include(FindPackageHandleStandardArgs) +-find_package_handle_standard_args( +- FLANN DEFAULT_MSG +- FLANN_LIBRARY FLANN_INCLUDE_DIR +-) +- +-if(FLANN_FOUND) +- add_library(FLANN::FLANN ${FLANN_LIBRARY_TYPE} IMPORTED) +- set_target_properties(FLANN::FLANN PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FLANN_INCLUDE_DIR}") +- set_target_properties(FLANN::FLANN PROPERTIES INTERFACE_COMPILE_DEFINITIONS "${PC_FLANN_CFLAGS_OTHER}") +- set_property(TARGET FLANN::FLANN APPEND PROPERTY IMPORTED_CONFIGURATIONS "RELEASE") +- set_target_properties(FLANN::FLANN PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX") +- if(WIN32 AND (NOT FLANN_LIBRARY_TYPE MATCHES "STATIC")) +- set_target_properties(FLANN::FLANN PROPERTIES IMPORTED_IMPLIB_RELEASE "${FLANN_LIBRARY}") +- else() +- set_target_properties(FLANN::FLANN PROPERTIES IMPORTED_LOCATION_RELEASE "${FLANN_LIBRARY}") +- endif() +- if(FLANN_LIBRARY_DEBUG) +- set_property(TARGET FLANN::FLANN APPEND PROPERTY IMPORTED_CONFIGURATIONS "DEBUG") +- set_target_properties(FLANN::FLANN PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX") +- if(WIN32 AND (NOT FLANN_LIBRARY_TYPE MATCHES "STATIC")) +- set_target_properties(FLANN::FLANN PROPERTIES IMPORTED_IMPLIB_DEBUG "${FLANN_LIBRARY_DEBUG}") +- else() +- set_target_properties(FLANN::FLANN PROPERTIES IMPORTED_LOCATION_DEBUG "${FLANN_LIBRARY_DEBUG}") +- endif() +- endif() +- # Pkgconfig may specify additional link libraries besides from FLANN itself +- # in PC_FLANN_LIBRARIES, add them to the target link interface. +- foreach(_library ${PC_FLANN_LIBRARIES}) +- if(NOT _library MATCHES "flann") +- set_property(TARGET FLANN::FLANN APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${_library}") +- endif() +- endforeach() +- get_filename_component(FLANN_ROOT "${FLANN_INCLUDE_DIR}" PATH) +- message(STATUS "FLANN found (include: ${FLANN_INCLUDE_DIR}, lib: ${FLANN_LIBRARY})") +-endif() +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/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/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 +-- +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..49b6e98449609c --- /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::surface) +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..2ee1a089f9de2f --- /dev/null +++ b/recipes/pcl/all/test_package/test_package.cpp @@ -0,0 +1,27 @@ +#include +#include +#include + +#include + +using PointCloud = pcl::PointCloud; + +int main() { + + auto cloud = PointCloud::Ptr(new PointCloud); + cloud->emplace_back(-1, -1, 0); + cloud->emplace_back(1, -1, 0); + cloud->emplace_back(0, 1, 0); + cloud->emplace_back(0, 0, 1); + + std::cout << "Calculating convex hull\n"; + + PointCloud hull_geometry; + + pcl::ConvexHull hull; + hull.setInputCloud(cloud); + hull.setComputeAreaVolume(true); + hull.reconstruct(hull_geometry); + + std::cout << "Convex Hull Volume: " << hull.getTotalVolume() << std::endl; +} \ No newline at end of file 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