From d8a1d1535f884785f8b759ea8bb03bacbb1d44e2 Mon Sep 17 00:00:00 2001 From: Esteban DUGUEPEROUX Date: Thu, 6 Jul 2023 23:32:35 +0200 Subject: [PATCH 01/34] Add pcl PointCloudLibrary package Inspired from https://github.com/conan-io/conan-center-index/pull/1891 --- recipes/pcl/all/conandata.yml | 18 ++ recipes/pcl/all/conanfile.py | 246 ++++++++++++++++++ ...n3-Eigen-target-in-pcl_common-target.patch | 25 ++ .../0001-KB-H020_avoid_pkgconfig_files.patch | 12 + ...FixAboutMemoryConsumptionDuringBuild.patch | 19 ++ ...use_requirements_name_from_cmakedeps.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 + 10 files changed, 650 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-Add-Eigen3-Eigen-target-in-pcl_common-target.patch create mode 100644 recipes/pcl/all/patches/0001-KB-H020_avoid_pkgconfig_files.patch create mode 100644 recipes/pcl/all/patches/0001-ReportFixAboutMemoryConsumptionDuringBuild.patch create mode 100644 recipes/pcl/all/patches/0001-cmake_use_requirements_name_from_cmakedeps.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 0000000000000..a7bc897797452 --- /dev/null +++ b/recipes/pcl/all/conandata.yml @@ -0,0 +1,18 @@ +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_requirements_name_from_cmakedeps.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" + - patch_file: "patches/0001-ReportFixAboutMemoryConsumptionDuringBuild.patch" + patch_description: "Report fix from https://github.com/PointCloudLibrary/pcl/pull/5764" + patch_type: "conan" + - 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" diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py new file mode 100644 index 0000000000000..8bad1d9f8297d --- /dev/null +++ b/recipes/pcl/all/conanfile.py @@ -0,0 +1,246 @@ +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 import package_manager +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", "pointcloud", "3d", "pcd", "ply", "stl", "ifs", "vtk") + 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, + } + + short_paths = 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 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: + package_manager.Apt(self).install(["libvtk-dev"]) + package_manager.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("zlib/1.2.13") + # Transitive headers on boost because pcl/point_struct_traits.h:40:10: references boost/mpl/assert.hpp + self.requires("boost/1.82.0", transitive_headers=True) + self.requires("eigen/3.4.0", transitive_headers=True) + self.requires("flann/1.9.2") + if self.options.with_png: + self.requires("libpng/1.6.40") + if self.options.with_qhull: + self.requires("qhull/8.0.1") + if self.options.with_apps: + self.requires("qt/6.5.1") + if self.options.with_libusb: + self.requires("libusb/1.0.26") + if self.options.with_pcap: + self.requires("libpcap/1.10.4") + if self.options.with_opengl: + self.requires("opengl/system") + + 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." + ) + + 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.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(variables={"PCL_ONLY_CORE_POINT_TYPES": "ON"}) + cmake.build() + + def package(self): + copy(self, pattern="LICENSE.txt", 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, "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + # For the legal reasons, and in order to reduce the size of packages, it's not allowed to package Microsoft Visual Studio runtime libraries, such as msvcr80.dll, msvcp80.dll, vcruntime140.dll and so on. + # See https://github.com/conan-io/conan-center-index/blob/master/docs/error_knowledge_base.md#kb-h021-ms-runtime-files + rmdir(self, os.path.join(self.package_folder, "bin")) + + @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", "zlib::zlib"] + 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-Add-Eigen3-Eigen-target-in-pcl_common-target.patch b/recipes/pcl/all/patches/0001-Add-Eigen3-Eigen-target-in-pcl_common-target.patch new file mode 100644 index 0000000000000..5dfeedf59e5f4 --- /dev/null +++ b/recipes/pcl/all/patches/0001-Add-Eigen3-Eigen-target-in-pcl_common-target.patch @@ -0,0 +1,25 @@ +From a975f68d2e399a1563fe0d66b2c048978f0282d1 Mon Sep 17 00:00:00 2001 +From: Esteban DUGUEPEROUX +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 + $ + ) + +-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 + 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 0000000000000..4397cd3de043a --- /dev/null +++ b/recipes/pcl/all/patches/0001-KB-H020_avoid_pkgconfig_files.patch @@ -0,0 +1,12 @@ +--- 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/recipes/pcl/all/patches/0001-ReportFixAboutMemoryConsumptionDuringBuild.patch b/recipes/pcl/all/patches/0001-ReportFixAboutMemoryConsumptionDuringBuild.patch new file mode 100644 index 0000000000000..fe10ff7c3f6c4 --- /dev/null +++ b/recipes/pcl/all/patches/0001-ReportFixAboutMemoryConsumptionDuringBuild.patch @@ -0,0 +1,19 @@ +--- 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; ++ 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 diff --git a/recipes/pcl/all/patches/0001-cmake_use_requirements_name_from_cmakedeps.patch b/recipes/pcl/all/patches/0001-cmake_use_requirements_name_from_cmakedeps.patch new file mode 100644 index 0000000000000..230d3dd37c3ab --- /dev/null +++ b/recipes/pcl/all/patches/0001-cmake_use_requirements_name_from_cmakedeps.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 0000000000000..57794a612df2a --- /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 0000000000000..02eb5ce439fb4 --- /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 0000000000000..cca717d08eb8f --- /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 0000000000000..aac1819cc10c0 --- /dev/null +++ b/recipes/pcl/config.yml @@ -0,0 +1,3 @@ +versions: + "1.13.1": + folder: all From 9f530563ca5ae59f3d8d1776579aa3e07b2e7ccc Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 9 Aug 2023 10:13:19 +0300 Subject: [PATCH 02/34] pcl: misc recipe tweaks --- recipes/pcl/all/conandata.yml | 14 +- recipes/pcl/all/conanfile.py | 182 ++++++++------- .../0001-KB-H020_avoid_pkgconfig_files.patch | 12 - ...FixAboutMemoryConsumptionDuringBuild.patch | 19 ++ .../0001-cmake_use_conan_targets.patch | 32 +++ ...use_requirements_name_from_cmakedeps.patch | 217 ------------------ 6 files changed, 151 insertions(+), 325 deletions(-) delete mode 100644 recipes/pcl/all/patches/0001-KB-H020_avoid_pkgconfig_files.patch create mode 100644 recipes/pcl/all/patches/0001-cmake_use_conan_targets.patch delete mode 100644 recipes/pcl/all/patches/0001-cmake_use_requirements_name_from_cmakedeps.patch diff --git a/recipes/pcl/all/conandata.yml b/recipes/pcl/all/conandata.yml index a7bc897797452..406f258e13d39 100644 --- a/recipes/pcl/all/conandata.yml +++ b/recipes/pcl/all/conandata.yml @@ -4,15 +4,13 @@ sources: sha256: 8ab98a9db371d822de0859084a375a74bdc7f31c96d674147710cf4101b79621 patches: "1.13.1": - - patch_file: "patches/0001-cmake_use_requirements_name_from_cmakedeps.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" - - patch_file: "patches/0001-ReportFixAboutMemoryConsumptionDuringBuild.patch" - patch_description: "Report fix from https://github.com/PointCloudLibrary/pcl/pull/5764" + - 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-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" diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 8bad1d9f8297d..efe778913c316 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -1,20 +1,18 @@ 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.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, rm +from conan.tools.scm import Version from conan.tools.system import package_manager import os - required_conan_version = ">=1.53.0" class PclConan(ConanFile): name = "pcl" - description = "Point Cloud Library" + description = "The Point Cloud Library (PCL) is a standalone, large-scale, open project for 2D/3D image and point cloud processing." license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/PointCloudLibrary/pcl" @@ -45,7 +43,7 @@ class PclConan(ConanFile): "with_vtk": False, "with_cuda": False, "with_pcap": False, - "with_opengl": False, + "with_opengl": True, "with_tools": False, "with_apps": False, } @@ -56,13 +54,14 @@ class PclConan(ConanFile): 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", + "msvc": "191", + "Visual Studio": "15", } def export_sources(self): @@ -81,14 +80,16 @@ def layout(self): def system_requirements(self): if self.options.with_vtk: + # TODO: add vtk/system package? package_manager.Apt(self).install(["libvtk-dev"]) package_manager.Dnf(self).install(["vtk-devel"]) if self.settings.os == "Windows": - self.output.warn("On Windows VTK must be installed manually.") + self.output.warn("VTK must be installed manually on Windows.") def requirements(self): self.requires("zlib/1.2.13") - # Transitive headers on boost because pcl/point_struct_traits.h:40:10: references boost/mpl/assert.hpp + # Boost is used in public PCL headers here: + # https://github.com/PointCloudLibrary/pcl/blob/pcl-1.13.1/common/include/pcl/point_struct_traits.h#L40-L46 self.requires("boost/1.82.0", transitive_headers=True) self.requires("eigen/3.4.0", transitive_headers=True) self.requires("flann/1.9.2") @@ -104,102 +105,83 @@ def requirements(self): self.requires("libpcap/1.10.4") if self.options.with_opengl: self.requires("opengl/system") + self.requires("glew/2.2.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." - ) + 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." + ) 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["PCL_SHARED_LIBS"] = self.options.shared + tc.cache_variables["WITH_OPENMP"] = self.options.with_openmp + tc.cache_variables["WITH_LIBUSB"] = self.options.with_libusb + tc.cache_variables["WITH_PNG"] = self.options.with_png + tc.cache_variables["WITH_QHULL"] = self.options.with_qhull + tc.cache_variables["WITH_VTK"] = self.options.with_vtk + tc.cache_variables["WITH_CUDA"] = self.options.with_cuda + tc.cache_variables["WITH_PCAP"] = self.options.with_pcap + tc.cache_variables["WITH_OPENGL"] = self.options.with_opengl + tc.cache_variables["BUILD_tools"] = self.options.with_tools + tc.cache_variables["BUILD_apps"] = self.options.with_apps + tc.cache_variables["BUILD_examples"] = False tc.cache_variables["WITH_QT"] = self.options.with_apps + tc.cache_variables["PCL_ONLY_CORE_POINT_TYPES"] = True tc.generate() tc = CMakeDeps(self) + tc.set_property("eigen", "cmake_file_name", "EIGEN") + tc.set_property("flann", "cmake_file_name", "FLANN") + tc.set_property("flann", "cmake_target_name", "FLANN::FLANN") + tc.set_property("glew", "cmake_file_name", "GLEW") + if self.options.with_qhull: + tc.set_property("qhull", "cmake_file_name", "QHULL") tc.generate() def _patch_sources(self): apply_conandata_patches(self) + for mod in ["Eigen", "FLANN", "GLEW", "PCap", "Qhull", "libusb"]: + os.remove(os.path.join(self.source_folder, "cmake", "Modules", f"Find{mod}.cmake")) def build(self): self._patch_sources() cmake = CMake(self) - cmake.configure(variables={"PCL_ONLY_CORE_POINT_TYPES": "ON"}) + cmake.configure() cmake.build() def package(self): - copy(self, pattern="LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "LICENSE.txt", + 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, "cmake")) rmdir(self, os.path.join(self.package_folder, "share")) - # For the legal reasons, and in order to reduce the size of packages, it's not allowed to package Microsoft Visual Studio runtime libraries, such as msvcr80.dll, msvcp80.dll, vcruntime140.dll and so on. - # See https://github.com/conan-io/conan-center-index/blob/master/docs/error_knowledge_base.md#kb-h021-ms-runtime-files - rmdir(self, os.path.join(self.package_folder, "bin")) - - @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", "zlib::zlib"] + 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"]} - } + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + # Remove MSVC runtime libraries + for dll_pattern_to_remove in ["concrt*.dll", "msvcp*.dll", "vcruntime*.dll"]: + rm(self, dll_pattern_to_remove, os.path.join(self.package_folder, "bin")) @property def _version_suffix(self): semver = Version(self.version) - return "{}.{}".format(semver.major, semver.minor) + return f"{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) - + return f"pcl_{lib}d" + return f"pcl_{lib}" + def package_info(self): self.cpp_info.names["cmake_find_package"] = "PCL" self.cpp_info.names["cmake_find_package_multi"] = "PCL" @@ -208,38 +190,62 @@ def package_info(self): 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}") + def _add_component(comp, requires, *, extra_libs=(), header_only=False): + 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].set_property("pkg_config_name", f"pcl_{comp}-{self._version_suffix}") + self.cpp_info.components[comp].includedirs = [os.path.join("include", f"pcl-{self._version_suffix}")] + if not header_only: + libs = [comp] + extra_libs + if comp != "common": + libs.append("common") + self.cpp_info.components[comp].libs = [self._lib_name(lib) for lib in libs] + self.cpp_info.components[comp].requires = requires - 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)) + 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 [] - 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"] + _add_component("common", ["eigen::eigen3", "boost::boost"]) + _add_component("kdtree", ["flann::flann"]) + _add_component("octree", []) + _add_component("search", ["kdtree", "octree", "flann::flann"]) + _add_component("sample_consensus", ["search"]) + _add_component("filters", ["sample_consensus", "search", "kdtree", "octree"]) + _add_component("2d", ["filters"], header_only=True) + _add_component("geometry", [], header_only=True) + _add_component("io", ["octree", "zlib::zlib"] + png() + usb(), extra_libs=["io_ply"]) + _add_component("features", ["search", "kdtree", "octree", "filters", "2d"]) + _add_component("ml", []) + _add_component("segmentation", ["geometry", "search", "sample_consensus", "kdtree", "octree", "features", "filters", "ml"]) + _add_component("surface", ["search", "kdtree", "octree"] + qhull()) + _add_component("registration", ["octree", "kdtree", "search", "sample_consensus", "features", "filters"]) + _add_component("keypoints", ["search", "kdtree", "octree", "features", "filters"]) + _add_component("tracking", ["search", "kdtree", "filters", "octree"]) + _add_component("recognition", ["io", "search", "kdtree", "octree", "features", "filters", "registration", "sample_consensus", "ml"]) + _add_component("stereo", ["io"]) - _update_components(self._pcl_lib_components) if not self.options.shared: + common = self.cpp_info.components["common"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["common"].system_libs.append("pthread") + 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") + common.sharedlinkflags.append("-fopenmp") + common.exelinkflags.append("-fopenmp") elif self.settings.os == "Windows": if self.settings.compiler == "msvc": - self.cpp_info.components["common"].system_libs.append("delayimp") + common.system_libs.append("delayimp") elif self.settings.compiler == "gcc": - self.cpp_info.components["common"].system_libs.append("gomp") + common.system_libs.append("gomp") if self.options.with_apps: self.cpp_info.components["apps"].libs = [] 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 deleted file mode 100644 index 4397cd3de043a..0000000000000 --- a/recipes/pcl/all/patches/0001-KB-H020_avoid_pkgconfig_files.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- 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/recipes/pcl/all/patches/0001-ReportFixAboutMemoryConsumptionDuringBuild.patch b/recipes/pcl/all/patches/0001-ReportFixAboutMemoryConsumptionDuringBuild.patch index fe10ff7c3f6c4..35fba73e8b067 100644 --- a/recipes/pcl/all/patches/0001-ReportFixAboutMemoryConsumptionDuringBuild.patch +++ b/recipes/pcl/all/patches/0001-ReportFixAboutMemoryConsumptionDuringBuild.patch @@ -1,3 +1,22 @@ +From 0bc2f2cc369f7d013ee5c29075188c4e26ea6f87 Mon Sep 17 00:00:00 2001 +From: Markus Vieth +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`). 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 diff --git a/recipes/pcl/all/patches/0001-cmake_use_conan_targets.patch b/recipes/pcl/all/patches/0001-cmake_use_conan_targets.patch new file mode 100644 index 0000000000000..f26acb9f5dce4 --- /dev/null +++ b/recipes/pcl/all/patches/0001-cmake_use_conan_targets.patch @@ -0,0 +1,32 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -319,6 +319,6 @@ endif() + find_package(Threads REQUIRED) + + # Eigen (required) +-find_package(Eigen 3.3 REQUIRED) ++find_package(EIGEN REQUIRED) + include_directories(SYSTEM ${EIGEN_INCLUDE_DIRS}) + +--- 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 EIGEN Boost) + + PCL_ADD_DOC("${SUBSYS_NAME}") + +--- 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 EIGEN) + + set(build TRUE) + PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ON) diff --git a/recipes/pcl/all/patches/0001-cmake_use_requirements_name_from_cmakedeps.patch b/recipes/pcl/all/patches/0001-cmake_use_requirements_name_from_cmakedeps.patch deleted file mode 100644 index 230d3dd37c3ab..0000000000000 --- a/recipes/pcl/all/patches/0001-cmake_use_requirements_name_from_cmakedeps.patch +++ /dev/null @@ -1,217 +0,0 @@ ---- 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) - - From eeb72b328ee395a0af2613c8e5b88464ee4d6ad0 Mon Sep 17 00:00:00 2001 From: Esteban Dugueperoux <43169544+EstebanDugueperoux2@users.noreply.github.com> Date: Wed, 9 Aug 2023 14:16:24 +0200 Subject: [PATCH 03/34] Update recipes/pcl/all/conanfile.py Co-authored-by: Martin Valgur --- recipes/pcl/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index efe778913c316..ac8076d4d4fa2 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -148,7 +148,7 @@ def generate(self): def _patch_sources(self): apply_conandata_patches(self) - for mod in ["Eigen", "FLANN", "GLEW", "PCap", "Qhull", "libusb"]: + for mod in ["Eigen", "FLANN", "GLEW", "Pcap", "Qhull", "libusb"]: os.remove(os.path.join(self.source_folder, "cmake", "Modules", f"Find{mod}.cmake")) def build(self): From 637837644232f9dd8c3c6bd60256214358eb4b76 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 9 Aug 2023 17:54:56 +0300 Subject: [PATCH 04/34] pcl: Further fixes to Conan targets use in CMake --- recipes/pcl/all/conanfile.py | 31 +++++---- .../0001-cmake_use_conan_targets.patch | 66 ++++++++++++------- 2 files changed, 61 insertions(+), 36 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index ac8076d4d4fa2..6a45d7e30afae 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -3,6 +3,7 @@ from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, rm +from conan.tools.gnu import PkgConfigDeps from conan.tools.scm import Version from conan.tools.system import package_manager import os @@ -122,29 +123,33 @@ def source(self): def generate(self): tc = CMakeToolchain(self) tc.cache_variables["PCL_SHARED_LIBS"] = self.options.shared - tc.cache_variables["WITH_OPENMP"] = self.options.with_openmp + tc.cache_variables["WITH_CUDA"] = self.options.with_cuda tc.cache_variables["WITH_LIBUSB"] = self.options.with_libusb + tc.cache_variables["WITH_OPENGL"] = self.options.with_opengl + tc.cache_variables["WITH_OPENMP"] = self.options.with_openmp + tc.cache_variables["WITH_PCAP"] = self.options.with_pcap tc.cache_variables["WITH_PNG"] = self.options.with_png tc.cache_variables["WITH_QHULL"] = self.options.with_qhull + tc.cache_variables["WITH_QT"] = self.options.with_apps tc.cache_variables["WITH_VTK"] = self.options.with_vtk - tc.cache_variables["WITH_CUDA"] = self.options.with_cuda - tc.cache_variables["WITH_PCAP"] = self.options.with_pcap - tc.cache_variables["WITH_OPENGL"] = self.options.with_opengl + tc.cache_variables["WITH_SYSTEM_ZLIB"] = True tc.cache_variables["BUILD_tools"] = self.options.with_tools tc.cache_variables["BUILD_apps"] = self.options.with_apps tc.cache_variables["BUILD_examples"] = False - tc.cache_variables["WITH_QT"] = self.options.with_apps tc.cache_variables["PCL_ONLY_CORE_POINT_TYPES"] = True tc.generate() - tc = CMakeDeps(self) - tc.set_property("eigen", "cmake_file_name", "EIGEN") - tc.set_property("flann", "cmake_file_name", "FLANN") - tc.set_property("flann", "cmake_target_name", "FLANN::FLANN") - tc.set_property("glew", "cmake_file_name", "GLEW") - if self.options.with_qhull: - tc.set_property("qhull", "cmake_file_name", "QHULL") - tc.generate() + deps = CMakeDeps(self) + deps.set_property("eigen", "cmake_file_name", "EIGEN") + deps.set_property("flann", "cmake_file_name", "FLANN") + deps.set_property("flann", "cmake_target_name", "FLANN::FLANN") + deps.set_property("pcap", "cmake_file_name", "PCAP") + deps.set_property("qhull", "cmake_file_name", "QHULL") + deps.set_property("qhull", "cmake_target_name", "QHULL::QHULL") + deps.generate() + + deps = PkgConfigDeps(self) + deps.generate() def _patch_sources(self): apply_conandata_patches(self) diff --git a/recipes/pcl/all/patches/0001-cmake_use_conan_targets.patch b/recipes/pcl/all/patches/0001-cmake_use_conan_targets.patch index f26acb9f5dce4..0c1a2e8f3b163 100644 --- a/recipes/pcl/all/patches/0001-cmake_use_conan_targets.patch +++ b/recipes/pcl/all/patches/0001-cmake_use_conan_targets.patch @@ -1,32 +1,52 @@ --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -319,6 +319,6 @@ endif() +@@ -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) ++find_package(EIGEN REQUIRED CONFIG) include_directories(SYSTEM ${EIGEN_INCLUDE_DIRS}) ---- a/common/CMakeLists.txt -+++ b/common/CMakeLists.txt -@@ -4,7 +4,7 @@ set(SUBSYS_DEPS) + # FLANN (required) +-find_package(FLANN 1.9.1 REQUIRED) ++find_package(FLANN REQUIRED 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() - 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 EIGEN Boost) - - PCL_ADD_DOC("${SUBSYS_NAME}") - ---- 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 EIGEN) - - set(build TRUE) - PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ON) + # OpenGL and GLUT From b0b031159196f7cd9a1a99a782d39faef7b0149b Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 9 Aug 2023 17:55:53 +0300 Subject: [PATCH 05/34] pcl: Fix buggy OpenNI detection if libusb missing --- recipes/pcl/all/conandata.yml | 3 ++ .../all/patches/0001-fix-FindOpenNI-bug.patch | 32 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 recipes/pcl/all/patches/0001-fix-FindOpenNI-bug.patch diff --git a/recipes/pcl/all/conandata.yml b/recipes/pcl/all/conandata.yml index 406f258e13d39..6eea92ef4a761 100644 --- a/recipes/pcl/all/conandata.yml +++ b/recipes/pcl/all/conandata.yml @@ -7,6 +7,9 @@ patches: - 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" - 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" diff --git a/recipes/pcl/all/patches/0001-fix-FindOpenNI-bug.patch b/recipes/pcl/all/patches/0001-fix-FindOpenNI-bug.patch new file mode 100644 index 0000000000000..34cf4a671e285 --- /dev/null +++ b/recipes/pcl/all/patches/0001-fix-FindOpenNI-bug.patch @@ -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}) From 5083304e56d4f2b97b86e93ef9c568229d22f9a5 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 9 Aug 2023 17:58:25 +0300 Subject: [PATCH 06/34] pcl: Fix PCL CMake config breaking OpenGL detection --- recipes/pcl/all/conanfile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 6a45d7e30afae..330a6a6e579de 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -106,6 +106,7 @@ def requirements(self): self.requires("libpcap/1.10.4") if self.options.with_opengl: self.requires("opengl/system") + self.requires("freeglut/3.4.0") self.requires("glew/2.2.0") def validate(self): @@ -137,6 +138,8 @@ def generate(self): tc.cache_variables["BUILD_apps"] = self.options.with_apps tc.cache_variables["BUILD_examples"] = False tc.cache_variables["PCL_ONLY_CORE_POINT_TYPES"] = True + # The default False setting breaks OpenGL detection in CMake + tc.cache_variables["PCL_ALLOW_BOTH_SHARED_AND_STATIC_DEPENDENCIES"] = True tc.generate() deps = CMakeDeps(self) From d274368141f3fb9350bfe5f535da95c73839f44e Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 9 Aug 2023 17:59:29 +0300 Subject: [PATCH 07/34] pcl: Fix _add_component() bugs --- recipes/pcl/all/conanfile.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 330a6a6e579de..09f9074aa315b 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -198,7 +198,7 @@ def package_info(self): self.cpp_info.set_property("cmake_module_file_name", "PCL") self.cpp_info.set_property("cmake_target_name", "PCL::PCL") - def _add_component(comp, requires, *, extra_libs=(), header_only=False): + def _add_component(comp, requires, *, extra_libs=None, header_only=False): 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) @@ -207,11 +207,11 @@ def _add_component(comp, requires, *, extra_libs=(), header_only=False): self.cpp_info.components[comp].set_property("pkg_config_name", f"pcl_{comp}-{self._version_suffix}") self.cpp_info.components[comp].includedirs = [os.path.join("include", f"pcl-{self._version_suffix}")] if not header_only: - libs = [comp] + extra_libs - if comp != "common": - libs.append("common") + libs = [comp] + if extra_libs: + libs += extra_libs self.cpp_info.components[comp].libs = [self._lib_name(lib) for lib in libs] - self.cpp_info.components[comp].requires = requires + self.cpp_info.components[comp].requires = ["common"] + requires def usb(): return ["libusb::libusb"] if self.options.with_libusb else [] From 25d75d3633fa5eef338cef9d8244f5b6efb67a0d Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 9 Aug 2023 18:14:29 +0300 Subject: [PATCH 08/34] pcl: add TODOs for missing Conan packages --- recipes/pcl/all/conanfile.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 09f9074aa315b..4421989bbb099 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -108,6 +108,14 @@ def requirements(self): self.requires("opengl/system") self.requires("freeglut/3.4.0") self.requires("glew/2.2.0") + # TODO: + # self.requires("vtk/9.x.x") + # self.requires("openni/x.x.x") + # self.requires("openni2/x.x.x") + # self.requires("ensenso/x.x.x") + # self.requires("davidsdk/x.x.x") + # self.requires("dssdk/x.x.x") + # self.requires("rssdk/x.x.x") def validate(self): if self.settings.compiler.cppstd: From 6e9429624207a13a1bb5181640f6ab1105663ffc Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 9 Aug 2023 18:14:58 +0300 Subject: [PATCH 09/34] pcl: set_property("cmake_find_mode", "both") --- recipes/pcl/all/conanfile.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 4421989bbb099..5fc00259f4a2d 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -199,12 +199,9 @@ def _lib_name(self, lib): return f"pcl_{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") + self.cpp_info.set_property("cmake_find_mode", "both") def _add_component(comp, requires, *, extra_libs=None, header_only=False): self.cpp_info.components[comp].names["cmake_find_package"] = comp @@ -266,3 +263,7 @@ def qhull(): if self.options.with_apps: self.cpp_info.components["apps"].libs = [] self.cpp_info.components["apps"].requires = ["qt::qt"] + + # TODO: Legacy, to be removed on Conan 2.0 + self.cpp_info.names["cmake_find_package"] = "PCL" + self.cpp_info.names["cmake_find_package_multi"] = "PCL" From 3fbb0e99a89a013667145493c6987f29af526352 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 9 Aug 2023 19:08:15 +0300 Subject: [PATCH 10/34] pcl: more accurate modelling of PCL components --- recipes/pcl/all/conanfile.py | 99 +++++++++++++++++++++++++----------- 1 file changed, 70 insertions(+), 29 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 5fc00259f4a2d..3a0c7e5b4e1d7 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -104,7 +104,8 @@ def requirements(self): self.requires("libusb/1.0.26") if self.options.with_pcap: self.requires("libpcap/1.10.4") - if self.options.with_opengl: + if self.options.with_opengl and self.options.with_vtk: + # OpenGL is only used if VTK is available self.requires("opengl/system") self.requires("freeglut/3.4.0") self.requires("glew/2.2.0") @@ -117,6 +118,11 @@ def requirements(self): # self.requires("dssdk/x.x.x") # self.requires("rssdk/x.x.x") + def package_id(self): + if self.info.options.with_vtk: + # with_opengl has no effect if VTK is not available + self.info.options.with_opengl = False + def validate(self): if self.settings.compiler.cppstd: check_min_cppstd(self, self._min_cppstd) @@ -203,20 +209,23 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "PCL::PCL") self.cpp_info.set_property("cmake_find_mode", "both") - def _add_component(comp, requires, *, extra_libs=None, header_only=False): - 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].set_property("pkg_config_name", f"pcl_{comp}-{self._version_suffix}") - self.cpp_info.components[comp].includedirs = [os.path.join("include", f"pcl-{self._version_suffix}")] + def _add_component(name, requires, *, extra_libs=None, header_only=False): + component = self.cpp_info.components[name] + component.names["cmake_find_package"] = name + component.names["cmake_find_package_multi"] = name + component.set_property("cmake_file_name", name) + component.set_property("cmake_module_file_name", name) + component.set_property("cmake_target_name", f"PCL::{name}") + component.set_property("pkg_config_name", f"pcl_{name}-{self._version_suffix}") + component.includedirs = [os.path.join("include", f"pcl-{self._version_suffix}")] if not header_only: - libs = [comp] + libs = [name] if extra_libs: libs += extra_libs - self.cpp_info.components[comp].libs = [self._lib_name(lib) for lib in libs] - self.cpp_info.components[comp].requires = ["common"] + requires + component.libs = [self._lib_name(lib) for lib in libs] + if name != "common": + component.requires = ["common"] + component.requires += requires def usb(): return ["libusb::libusb"] if self.options.with_libusb else [] @@ -224,26 +233,62 @@ def png(): return ["libpng::libpng"] if self.options.with_png else [] def qhull(): return ["qhull::qhull"] if self.options.with_qhull else [] - + def vtk(): + # TODO: add vtk package to CCI + return [] + def opengl(): + if self.options.with_opengl: + return ["opengl::opengl", "freeglut::freeglut", "glew::glew"] + return [] + + # FIXME: grep for PCL_MAKE_PKGCONFIG and add any missing sub-components + # TODO: make the set of enabled components configurable via options + # TODO: maybe extract the component configuration automatically from each CMakelists.txt _add_component("common", ["eigen::eigen3", "boost::boost"]) - _add_component("kdtree", ["flann::flann"]) - _add_component("octree", []) - _add_component("search", ["kdtree", "octree", "flann::flann"]) - _add_component("sample_consensus", ["search"]) + _add_component("2d", ["filters"] + vtk(), header_only=True) + if self.options.with_cuda: + # FIXME: add individual sub-components + _add_component("cuda", []) + _add_component("features", ["search", "kdtree", "octree", "filters", "2d"]) _add_component("filters", ["sample_consensus", "search", "kdtree", "octree"]) - _add_component("2d", ["filters"], header_only=True) _add_component("geometry", [], header_only=True) - _add_component("io", ["octree", "zlib::zlib"] + png() + usb(), extra_libs=["io_ply"]) - _add_component("features", ["search", "kdtree", "octree", "filters", "2d"]) - _add_component("ml", []) - _add_component("segmentation", ["geometry", "search", "sample_consensus", "kdtree", "octree", "features", "filters", "ml"]) - _add_component("surface", ["search", "kdtree", "octree"] + qhull()) - _add_component("registration", ["octree", "kdtree", "search", "sample_consensus", "features", "filters"]) + if self.options.with_cuda: + # FIXME: add individual sub-components + _add_component("gpu", []) + _add_component("io", ["octree", "zlib::zlib"] + png() + usb() + vtk(), extra_libs=["io_ply"]) + _add_component("kdtree", ["flann::flann"]) _add_component("keypoints", ["search", "kdtree", "octree", "features", "filters"]) - _add_component("tracking", ["search", "kdtree", "filters", "octree"]) + _add_component("ml", []) + _add_component("octree", []) + if self.options.with_vtk: + # FIXME: add individual sub-components + _add_component("outofcore", ["io", "filters", "octree", "visualization"] + vtk()) + if self.options.with_vtk: + _add_component("people", ["kdtree", "search", "sample_consensus", "filters", "io", "visualization", "geometry", "segmentation", "octree"] + vtk()) _add_component("recognition", ["io", "search", "kdtree", "octree", "features", "filters", "registration", "sample_consensus", "ml"]) + _add_component("registration", ["octree", "kdtree", "search", "sample_consensus", "features", "filters"]) + _add_component("sample_consensus", ["search"]) + _add_component("search", ["kdtree", "octree", "flann::flann"]) + _add_component("segmentation", ["geometry", "search", "sample_consensus", "kdtree", "octree", "features", "filters", "ml"]) + # simulation is disabled by default + # _add_component("simulation", ["io", "surface", "kdtree", "features", "search", "octree", "visualization", "filters", "geometry"] + opengl() + vtk()) _add_component("stereo", ["io"]) + _add_component("surface", ["search", "kdtree", "octree"] + qhull() + vtk()) + _add_component("tracking", ["search", "kdtree", "filters", "octree"]) + if self.options.with_vtk: + _add_component("visualization", ["io", "kdtree", "geometry", "search", "octree"] + opengl() + vtk()) + + if self.options.with_tools: + self.cpp_info.components["tools"].libs = [] + self.cpp_info.components["apps"].requires = [ + "filters", "sample_consensus", "segmentation", "search", "kdtree", "features", "surface", + "octree", "registration", "recognition", "geometry", "keypoints", "ml", "visualization" + ] + vtk() + qhull() + if self.options.with_apps: + # FIXME: add each app as individual sub-component + self.cpp_info.components["apps"].libs = [] + self.cpp_info.components["apps"].requires = ["qt::qt"] + opengl() + vtk() if not self.options.shared: common = self.cpp_info.components["common"] @@ -260,10 +305,6 @@ def qhull(): elif self.settings.compiler == "gcc": common.system_libs.append("gomp") - if self.options.with_apps: - self.cpp_info.components["apps"].libs = [] - self.cpp_info.components["apps"].requires = ["qt::qt"] - # TODO: Legacy, to be removed on Conan 2.0 self.cpp_info.names["cmake_find_package"] = "PCL" self.cpp_info.names["cmake_find_package_multi"] = "PCL" From 5a5e796965e8d883bd173a7b170c126080e6ff5f Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 9 Aug 2023 19:08:50 +0300 Subject: [PATCH 11/34] pcl: tidy description --- recipes/pcl/all/conanfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 3a0c7e5b4e1d7..40d8c966e242f 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -13,7 +13,8 @@ class PclConan(ConanFile): name = "pcl" - description = "The Point Cloud Library (PCL) is a standalone, large-scale, open project for 2D/3D image and point cloud processing." + description = ("The Point Cloud Library (PCL) is a standalone, large-scale, " + "open project for 2D/3D image and point cloud processing.") license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/PointCloudLibrary/pcl" From c4be26d44c9f2fd6ed4bd323714ff6bf2e67ed0d Mon Sep 17 00:00:00 2001 From: Esteban DUGUEPEROUX Date: Wed, 9 Aug 2023 22:28:58 +0200 Subject: [PATCH 12/34] Enable opengl event if with_vtk is false - Enable opengl event if with_vtk is false as done in PCL CMakeLists.txt --- recipes/pcl/all/conanfile.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 40d8c966e242f..88182978f1779 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -105,8 +105,7 @@ def requirements(self): self.requires("libusb/1.0.26") if self.options.with_pcap: self.requires("libpcap/1.10.4") - if self.options.with_opengl and self.options.with_vtk: - # OpenGL is only used if VTK is available + if self.options.with_opengl: self.requires("opengl/system") self.requires("freeglut/3.4.0") self.requires("glew/2.2.0") @@ -119,11 +118,6 @@ def requirements(self): # self.requires("dssdk/x.x.x") # self.requires("rssdk/x.x.x") - def package_id(self): - if self.info.options.with_vtk: - # with_opengl has no effect if VTK is not available - self.info.options.with_opengl = False - def validate(self): if self.settings.compiler.cppstd: check_min_cppstd(self, self._min_cppstd) From 4a9fc5e451fb8c436dbb2107db2393468e386ed3 Mon Sep 17 00:00:00 2001 From: Esteban DUGUEPEROUX Date: Thu, 10 Aug 2023 04:03:02 +0200 Subject: [PATCH 13/34] Revert "Enable opengl event if with_vtk is false" This reverts commit c4be26d44c9f2fd6ed4bd323714ff6bf2e67ed0d. --- recipes/pcl/all/conanfile.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 88182978f1779..40d8c966e242f 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -105,7 +105,8 @@ def requirements(self): self.requires("libusb/1.0.26") if self.options.with_pcap: self.requires("libpcap/1.10.4") - if self.options.with_opengl: + if self.options.with_opengl and self.options.with_vtk: + # OpenGL is only used if VTK is available self.requires("opengl/system") self.requires("freeglut/3.4.0") self.requires("glew/2.2.0") @@ -118,6 +119,11 @@ def requirements(self): # self.requires("dssdk/x.x.x") # self.requires("rssdk/x.x.x") + def package_id(self): + if self.info.options.with_vtk: + # with_opengl has no effect if VTK is not available + self.info.options.with_opengl = False + def validate(self): if self.settings.compiler.cppstd: check_min_cppstd(self, self._min_cppstd) From 33738d3e4ed61fdb24af093d56ff14e17049dda4 Mon Sep 17 00:00:00 2001 From: Esteban DUGUEPEROUX Date: Thu, 10 Aug 2023 04:09:21 +0200 Subject: [PATCH 14/34] Enable opengl only if with_vtk==True --- recipes/pcl/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 40d8c966e242f..7f6112c558c96 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -141,7 +141,7 @@ def generate(self): tc.cache_variables["PCL_SHARED_LIBS"] = self.options.shared tc.cache_variables["WITH_CUDA"] = self.options.with_cuda tc.cache_variables["WITH_LIBUSB"] = self.options.with_libusb - tc.cache_variables["WITH_OPENGL"] = self.options.with_opengl + tc.cache_variables["WITH_OPENGL"] = self.options.with_opengl and self.options.with_vtk tc.cache_variables["WITH_OPENMP"] = self.options.with_openmp tc.cache_variables["WITH_PCAP"] = self.options.with_pcap tc.cache_variables["WITH_PNG"] = self.options.with_png From f0d488649b1c670d59147c2418a4345f69fb39d9 Mon Sep 17 00:00:00 2001 From: Esteban DUGUEPEROUX Date: Thu, 10 Aug 2023 10:23:03 +0200 Subject: [PATCH 15/34] test is_msvc() method --- recipes/pcl/all/conanfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 7f6112c558c96..064db47fe64ee 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -4,6 +4,7 @@ from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, rm from conan.tools.gnu import PkgConfigDeps +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime from conan.tools.scm import Version from conan.tools.system import package_manager import os @@ -201,7 +202,7 @@ def _version_suffix(self): return f"{semver.major}.{semver.minor}" def _lib_name(self, lib): - if self.settings.compiler == "msvc" and self.settings.build_type == "Debug": + if is_msvc(self) and self.settings.build_type == "Debug": return f"pcl_{lib}d" return f"pcl_{lib}" From 9083c61755136e514f806fbcda8662b35ca1a4f4 Mon Sep 17 00:00:00 2001 From: Esteban DUGUEPEROUX Date: Thu, 10 Aug 2023 10:50:37 +0200 Subject: [PATCH 16/34] test is_msvc_static_runtime --- recipes/pcl/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 064db47fe64ee..1eeaf3c41835d 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -202,7 +202,7 @@ def _version_suffix(self): return f"{semver.major}.{semver.minor}" def _lib_name(self, lib): - if is_msvc(self) and self.settings.build_type == "Debug": + if (is_msvc(self) or is_msvc_static_runtime(self)) and self.settings.build_type == "Debug": return f"pcl_{lib}d" return f"pcl_{lib}" From 4486fd07498c8ac876e32df87d484d827c0f0705 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 10 Aug 2023 18:35:03 +0300 Subject: [PATCH 17/34] pcl: make components optional, add full dependency info --- recipes/pcl/all/conanfile.py | 437 +++++++++++++++++++++++++++-------- 1 file changed, 339 insertions(+), 98 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 064db47fe64ee..7316f7cade149 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -4,14 +4,13 @@ from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, rm from conan.tools.gnu import PkgConfigDeps -from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.microsoft import is_msvc from conan.tools.scm import Version from conan.tools.system import package_manager import os required_conan_version = ">=1.53.0" - class PclConan(ConanFile): name = "pcl" description = ("The Point Cloud Library (PCL) is a standalone, large-scale, " @@ -25,34 +24,250 @@ class PclConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], - "with_openmp": [True, False], + # Enable/disable individual components + "2d": [True, False], + "features": [True, False], + "filters": [True, False], + "geometry": [True, False], + "io": [True, False], + "kdtree": [True, False], + "keypoints": [True, False], + "ml": [True, False], + "octree": [True, False], + "outofcore": [True, False], + "people": [True, False], + "recognition": [True, False], + "registration": [True, False], + "sample_consensus": [True, False], + "search": [True, False], + "segmentation": [True, False], + "simulation": [True, False], + "stereo": [True, False], + "surface": [True, False], + "tracking": [True, False], + "visualization": [True, False], + "cuda_common": [True, False], + "cuda_features": [True, False], + "cuda_io": [True, False], + "cuda_sample_consensus": [True, False], + "cuda_segmentation": [True, False], + "gpu_containers": [True, False], + "gpu_features": [True, False], + "gpu_kinfu": [True, False], + "gpu_kinfu_large_scale": [True, False], + "gpu_octree": [True, False], + "gpu_people": [True, False], + "gpu_segmentation": [True, False], + "gpu_surface": [True, False], + "gpu_tracking": [True, False], + "gpu_utils": [True, False], + "apps": [True, False], + "tools": [True, False], + # Optional external dependencies. + # Only used if the corresponding component is enabled. + "with_cuda": [True, False], + "with_flann": [True, False], "with_libusb": [True, False], + "with_opencv": [True, False], + "with_opengl": [True, False], + "with_openmp": [True, False], + "with_pcap": [True, False], "with_png": [True, False], "with_qhull": [True, False], + "with_qt": [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], + # TODO: + # "with_davidsdk": [True, False], + # "with_dssdk": [True, False], + # "with_ensenso": [True, False], + # "with_fzapi": [True, False], + # "with_metslib": [True, False], + # "with_openni": [True, False], + # "with_openni2": [True, False], + # "with_rssdk": [True, False], + # "with_rssdk2": [True, False], + # "with_qvtk": [True, False], } default_options = { "shared": False, "fPIC": True, + # Enable/disable individual components + "2d": True, + "features": True, + "filters": True, + "geometry": True, + "io": True, + "kdtree": True, + "keypoints": True, + "ml": True, + "octree": True, + "outofcore": False, + "people": False, + "recognition": True, + "registration": True, + "sample_consensus": True, + "search": True, + "segmentation": True, + "simulation": False, + "stereo": True, + "surface": True, + "tracking": True, + # Visualization is currently disabled by default due to missing VTK package + "visualization": False, + # GPU components are disabled by default + "cuda_common": False, + "cuda_features": False, + "cuda_io": False, + "cuda_sample_consensus": False, + "cuda_segmentation": False, + "gpu_containers": False, + "gpu_features": False, + "gpu_kinfu": False, + "gpu_kinfu_large_scale": False, + "gpu_octree": False, + "gpu_people": False, + "gpu_segmentation": False, + "gpu_surface": False, + "gpu_tracking": False, + "gpu_utils": False, + "apps": False, + "tools": False, + # Optional external dependencies + "with_cuda": False, + "with_flann": True, + "with_libusb": True, + "with_opencv": True, + "with_opengl": True, "with_openmp": False, - "with_libusb": False, + "with_pcap": True, "with_png": True, "with_qhull": True, + "with_qt": True, "with_vtk": False, - "with_cuda": False, - "with_pcap": False, - "with_opengl": True, - "with_tools": False, - "with_apps": False, } short_paths = True + # The component details have been extracted from their CMakeLists.txt files using + # https://gist.github.com/valgur/e54e39b6a8931b58cc1776515104c828 + @property + def _external_deps(self): + return { + "common": ["boost", "eigen"], + "cuda_common": ["cuda"], + "cuda_features": ["cuda"], + "cuda_io": ["cuda", "openni"], + "cuda_sample_consensus": ["cuda"], + "cuda_segmentation": ["cuda"], + "gpu_containers": ["cuda"], + "gpu_features": ["cuda"], + "gpu_kinfu": ["cuda"], + "gpu_kinfu_large_scale": ["cuda"], + "gpu_octree": ["cuda"], + "gpu_people": ["cuda"], + "gpu_segmentation": ["cuda"], + "gpu_surface": ["cuda"], + "gpu_tracking": ["cuda"], + "gpu_utils": ["cuda"], + "people": ["vtk"], + "visualization": ["vtk"], + } + + @property + def _external_optional_deps(self): + return { + "2d": ["vtk"], + "common": ["boost", "eigen"], + "io": ["davidsdk", "dssdk", "ensenso", "fzapi", "libusb", "openni", "openni2", "pcap", "png", "rssdk", "rssdk2", "vtk"], + "kdtree": ["flann"], + "people": ["openni"], + "recognition": ["metslib"], + "search": ["flann"], + "simulation": ["opengl"], + "surface": ["qhull", "vtk"], + "visualization": ["davidsdk", "dssdk", "ensenso", "opengl", "openni", "openni2", "qvtk", "rssdk"], + "apps": ["cuda", "libusb", "opengl", "openni", "png", "qhull", "qt", "qvtk", "vtk"], + "tools": ["cuda", "davidsdk", "dssdk", "ensenso", "opencv", "opengl", "openni", "openni2", "qhull", "rssdk", "vtk"], + } + + @property + def _internal_deps(self): + return { + "2d": ["common", "filters"], + "common": [], + "cuda_features": ["common", "cuda_common", "io"], + "cuda_io": ["common", "cuda_common", "io"], + "cuda_sample_consensus": ["common", "cuda_common", "io"], + "cuda_segmentation": ["common", "cuda_common", "io"], + "features": ["2d", "common", "filters", "kdtree", "octree", "search"], + "filters": ["common", "kdtree", "octree", "sample_consensus", "search"], + "geometry": ["common"], + "gpu_containers": ["common"], + "gpu_features": ["common", "geometry", "gpu_containers", "gpu_octree", "gpu_utils"], + "gpu_kinfu": ["common", "geometry", "gpu_containers", "io", "search"], + "gpu_kinfu_large_scale": ["common", "features", "filters", "geometry", "gpu_containers", + "gpu_utils", "io", "kdtree", "octree", "search", "surface"], + "gpu_octree": ["common", "gpu_containers", "gpu_utils"], + "gpu_people": ["common", "features", "filters", "geometry", "gpu_containers", + "gpu_utils", "io", "kdtree", "octree", "search", "segmentation", + "surface", "visualization"], + "gpu_segmentation": ["common", "gpu_containers", "gpu_octree", "gpu_utils"], + "gpu_surface": ["common", "geometry", "gpu_containers", "gpu_utils"], + "gpu_tracking": ["common", "filters", "gpu_containers", "gpu_octree", + "gpu_utils", "kdtree", "octree", "search", "tracking"], + "gpu_utils": ["common", "gpu_containers"], + "io": ["common", "octree"], + "kdtree": ["common"], + "keypoints": ["common", "features", "filters", "kdtree", "octree", "search"], + "ml": ["common"], + "octree": ["common"], + "outofcore": ["common", "filters", "io", "octree", "visualization"], + "people": ["common", "filters", "geometry", "io", "kdtree", "octree", + "sample_consensus", "search", "segmentation", "visualization"], + "recognition": ["common", "features", "filters", "io", "kdtree", "ml", + "octree", "registration", "sample_consensus", "search"], + "registration": ["common", "features", "filters", "kdtree", "octree", + "sample_consensus", "search"], + "sample_consensus": ["common", "search"], + "search": ["common", "kdtree", "octree"], + "segmentation": ["common", "features", "filters", "geometry", "kdtree", + "ml", "octree", "sample_consensus", "search"], + "simulation": ["common", "features", "filters", "geometry", "io", + "kdtree", "octree", "search", "surface", "visualization"], + "stereo": ["common", "io"], + "surface": ["common", "kdtree", "octree", "search"], + "tracking": ["common", "filters", "kdtree", "octree", "search"], + "visualization": ["common", "geometry", "io", "kdtree", "octree", "search"], + } + + @property + def _internal_optional_deps(self): + return { + "apps": ["2d", "common", "cuda_common", "cuda_features", "cuda_io", + "cuda_sample_consensus", "cuda_segmentation", "features", "filters", + "geometry", "io", "kdtree", "keypoints", "ml", "octree", "recognition", + "registration", "sample_consensus", "search", "segmentation", "stereo", + "surface", "tracking", "visualization"], + "tools": ["features", "filters", "geometry", "gpu_kinfu", "gpu_kinfu_large_scale", + "io", "kdtree", "keypoints", "ml", "octree", "recognition", "registration", + "sample_consensus", "search", "segmentation", "surface", "visualization"], + } + + def _is_header_only(self, component): + return component in {"2d", "cuda_common", "geometry"} + + @property + def _extra_libs(self): + return {"io": ["pcl_io_ply"]} + + @property + def _enabled_components(self): + return {c for c in self._internal_deps if self.options.get_safe(c) or c == "common"} + + @property + def _disabled_components(self): + return {c for c in self._internal_deps if not self.options.get_safe(c)} + @property def _min_cppstd(self): return 17 @@ -81,8 +296,25 @@ def configure(self): def layout(self): cmake_layout(self, src_folder="src") + def _all_required_deps(self, opts): + all_deps = set() + for component, deps in self._external_deps.items(): + if opts.get_safe(component): + all_deps.update(deps) + return all_deps + + def _all_optional_deps(self, opts): + all_deps = set() + for component, deps in self._external_optional_deps.items(): + if opts.get_safe(component): + all_deps.update(deps) + return all_deps + + def _all_deps(self, opts): + return self._all_required_deps(opts) | self._all_optional_deps(opts) + def system_requirements(self): - if self.options.with_vtk: + if self.options.with_vtk and "vtk" in self._all_deps(self.options): # TODO: add vtk/system package? package_manager.Apt(self).install(["libvtk-dev"]) package_manager.Dnf(self).install(["vtk-devel"]) @@ -90,27 +322,31 @@ def system_requirements(self): self.output.warn("VTK must be installed manually on Windows.") def requirements(self): - self.requires("zlib/1.2.13") # Boost is used in public PCL headers here: # https://github.com/PointCloudLibrary/pcl/blob/pcl-1.13.1/common/include/pcl/point_struct_traits.h#L40-L46 self.requires("boost/1.82.0", transitive_headers=True) self.requires("eigen/3.4.0", transitive_headers=True) - self.requires("flann/1.9.2") - if self.options.with_png: + used_deps = self._all_deps(self.options) + if self.options.with_flann and "flann" in used_deps: + self.requires("flann/1.9.2") + if self.options.with_png and "png" in used_deps: self.requires("libpng/1.6.40") - if self.options.with_qhull: + if self.options.with_qhull and "qhull" in used_deps: self.requires("qhull/8.0.1") - if self.options.with_apps: + if self.options.with_qt and "qt" in used_deps: self.requires("qt/6.5.1") - if self.options.with_libusb: + if self.options.with_libusb and "libusb" in used_deps: self.requires("libusb/1.0.26") - if self.options.with_pcap: + if self.options.with_pcap and "pcap" in used_deps: self.requires("libpcap/1.10.4") - if self.options.with_opengl and self.options.with_vtk: + if self.options.with_opengl and "opengl" in used_deps: # OpenGL is only used if VTK is available self.requires("opengl/system") self.requires("freeglut/3.4.0") self.requires("glew/2.2.0") + self.requires("glu/system") + if self.options.with_opencv and "opencv" in used_deps: + self.requires("opencv/4.5.5") # TODO: # self.requires("vtk/9.x.x") # self.requires("openni/x.x.x") @@ -121,11 +357,29 @@ def requirements(self): # self.requires("rssdk/x.x.x") def package_id(self): - if self.info.options.with_vtk: - # with_opengl has no effect if VTK is not available - self.info.options.with_opengl = False + used_deps = self._all_deps(self.info.options) + # Disable options that have no effect + all_opts = list(self.info.options.possible_values) + for opt in all_opts: + if opt.startswith("with_") and opt.split("_", 1)[1] not in used_deps: + setattr(self.info.options, opt, False) def validate(self): + for component, deps in self._external_deps.items(): + if self.options.get_safe(component): + for dep in deps: + if not self.options.get_safe(f"with_{dep}"): + raise ConanInvalidConfiguration( + f"'with_{dep}=True' is required when '{component}' is enabled." + ) + for component, deps in self._internal_deps.items(): + if self.options.get_safe(component): + for dep in deps: + if not self.options.get_safe(dep) and dep != "common": + raise ConanInvalidConfiguration( + f"'{dep}=True' is required when '{component}' is enabled." + ) + if self.settings.compiler.cppstd: check_min_cppstd(self, self._min_cppstd) minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) @@ -142,20 +396,24 @@ def generate(self): tc.cache_variables["PCL_SHARED_LIBS"] = self.options.shared tc.cache_variables["WITH_CUDA"] = self.options.with_cuda tc.cache_variables["WITH_LIBUSB"] = self.options.with_libusb - tc.cache_variables["WITH_OPENGL"] = self.options.with_opengl and self.options.with_vtk + tc.cache_variables["WITH_OPENGL"] = self.options.with_opengl tc.cache_variables["WITH_OPENMP"] = self.options.with_openmp tc.cache_variables["WITH_PCAP"] = self.options.with_pcap tc.cache_variables["WITH_PNG"] = self.options.with_png tc.cache_variables["WITH_QHULL"] = self.options.with_qhull - tc.cache_variables["WITH_QT"] = self.options.with_apps + tc.cache_variables["WITH_QT"] = self.options.with_qt tc.cache_variables["WITH_VTK"] = self.options.with_vtk tc.cache_variables["WITH_SYSTEM_ZLIB"] = True - tc.cache_variables["BUILD_tools"] = self.options.with_tools - tc.cache_variables["BUILD_apps"] = self.options.with_apps - tc.cache_variables["BUILD_examples"] = False tc.cache_variables["PCL_ONLY_CORE_POINT_TYPES"] = True # The default False setting breaks OpenGL detection in CMake tc.cache_variables["PCL_ALLOW_BOTH_SHARED_AND_STATIC_DEPENDENCIES"] = True + tc.cache_variables["BUILD_tools"] = self.options.tools + tc.cache_variables["BUILD_apps"] = self.options.apps + tc.cache_variables["BUILD_examples"] = False + for comp in sorted(self._enabled_components): + tc.cache_variables[f"BUILD_{comp}"] = True + for comp in sorted(self._disabled_components): + tc.cache_variables[f"BUILD_{comp}"] = False tc.generate() deps = CMakeDeps(self) @@ -206,12 +464,40 @@ def _lib_name(self, lib): return f"pcl_{lib}d" return f"pcl_{lib}" + def _ext_dep_to_conan_target(self, dep): + if not self.options.get_safe(f"with_{dep}"): + return [] + return { + "boost": ["boost::boost"], + "cuda": [], + "davidsdk": [], + "dssdk": [], + "eigen": ["eigen::eigen"], + "ensenso": [], + "flann": ["flann::flann"], + "fzapi": [], + "libusb": ["libusb::libusb"], + "metslib": [], + "opencv": ["opencv::opencv"], + "opengl": ["opengl::opengl", "freeglut::freeglut", "glew::glew", "glu::glu"], + "openni": [], + "openni2": [], + "pcap": ["libpcap::libpcap"], + "png": ["libpng::libpng"], + "qhull": ["qhull::qhull"], + "qt": ["qt::qt"], + "qvtk": [], + "rssdk": [], + "rssdk2": [], + "vtk": [], + }[dep] + def package_info(self): self.cpp_info.set_property("cmake_file_name", "PCL") self.cpp_info.set_property("cmake_target_name", "PCL::PCL") self.cpp_info.set_property("cmake_find_mode", "both") - def _add_component(name, requires, *, extra_libs=None, header_only=False): + for name in self._enabled_components: component = self.cpp_info.components[name] component.names["cmake_find_package"] = name component.names["cmake_find_package_multi"] = name @@ -220,77 +506,32 @@ def _add_component(name, requires, *, extra_libs=None, header_only=False): component.set_property("cmake_target_name", f"PCL::{name}") component.set_property("pkg_config_name", f"pcl_{name}-{self._version_suffix}") component.includedirs = [os.path.join("include", f"pcl-{self._version_suffix}")] - if not header_only: + if not self._is_header_only(name): libs = [name] - if extra_libs: - libs += extra_libs + libs += self._extra_libs.get(name, []) component.libs = [self._lib_name(lib) for lib in libs] - if name != "common": - component.requires = ["common"] - component.requires += requires - - 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 [] - def vtk(): - # TODO: add vtk package to CCI - return [] - def opengl(): - if self.options.with_opengl: - return ["opengl::opengl", "freeglut::freeglut", "glew::glew"] - return [] + component.requires += self._internal_deps[name] + for opt_dep in self._internal_optional_deps.get(name, []): + if self.options.get_safe(opt_dep): + component.requires.append(opt_dep) + for dep in self._external_deps.get(name, []) + self._external_optional_deps.get(name, []): + component.requires += self._ext_dep_to_conan_target(dep) - # FIXME: grep for PCL_MAKE_PKGCONFIG and add any missing sub-components - # TODO: make the set of enabled components configurable via options - # TODO: maybe extract the component configuration automatically from each CMakelists.txt - _add_component("common", ["eigen::eigen3", "boost::boost"]) - _add_component("2d", ["filters"] + vtk(), header_only=True) - if self.options.with_cuda: - # FIXME: add individual sub-components - _add_component("cuda", []) - _add_component("features", ["search", "kdtree", "octree", "filters", "2d"]) - _add_component("filters", ["sample_consensus", "search", "kdtree", "octree"]) - _add_component("geometry", [], header_only=True) - if self.options.with_cuda: - # FIXME: add individual sub-components - _add_component("gpu", []) - _add_component("io", ["octree", "zlib::zlib"] + png() + usb() + vtk(), extra_libs=["io_ply"]) - _add_component("kdtree", ["flann::flann"]) - _add_component("keypoints", ["search", "kdtree", "octree", "features", "filters"]) - _add_component("ml", []) - _add_component("octree", []) - if self.options.with_vtk: - # FIXME: add individual sub-components - _add_component("outofcore", ["io", "filters", "octree", "visualization"] + vtk()) - if self.options.with_vtk: - _add_component("people", ["kdtree", "search", "sample_consensus", "filters", "io", "visualization", "geometry", "segmentation", "octree"] + vtk()) - _add_component("recognition", ["io", "search", "kdtree", "octree", "features", "filters", "registration", "sample_consensus", "ml"]) - _add_component("registration", ["octree", "kdtree", "search", "sample_consensus", "features", "filters"]) - _add_component("sample_consensus", ["search"]) - _add_component("search", ["kdtree", "octree", "flann::flann"]) - _add_component("segmentation", ["geometry", "search", "sample_consensus", "kdtree", "octree", "features", "filters", "ml"]) - # simulation is disabled by default - # _add_component("simulation", ["io", "surface", "kdtree", "features", "search", "octree", "visualization", "filters", "geometry"] + opengl() + vtk()) - _add_component("stereo", ["io"]) - _add_component("surface", ["search", "kdtree", "octree"] + qhull() + vtk()) - _add_component("tracking", ["search", "kdtree", "filters", "octree"]) - if self.options.with_vtk: - _add_component("visualization", ["io", "kdtree", "geometry", "search", "octree"] + opengl() + vtk()) + if self.options.with_apps: + component = self.cpp_info.components["apps"] + component.libs = [] + component.includedirs = [] + component.requires = self._internal_optional_deps["apps"] + for dep in self._external_optional_deps["apps"]: + component.requires += self._ext_dep_to_conan_target(dep) if self.options.with_tools: - self.cpp_info.components["tools"].libs = [] - self.cpp_info.components["apps"].requires = [ - "filters", "sample_consensus", "segmentation", "search", "kdtree", "features", "surface", - "octree", "registration", "recognition", "geometry", "keypoints", "ml", "visualization" - ] + vtk() + qhull() - - if self.options.with_apps: - # FIXME: add each app as individual sub-component - self.cpp_info.components["apps"].libs = [] - self.cpp_info.components["apps"].requires = ["qt::qt"] + opengl() + vtk() + component = self.cpp_info.components["tools"] + component.libs = [] + component.includedirs = [] + component.requires = self._internal_optional_deps["tools"] + for dep in self._external_optional_deps["tools"]: + component.requires += self._ext_dep_to_conan_target(dep) if not self.options.shared: common = self.cpp_info.components["common"] From 2c1f59f4307fb79ae793a34c1beb207d79c1c723 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 10 Aug 2023 20:07:35 +0300 Subject: [PATCH 18/34] pcl: fixes to the component system --- recipes/pcl/all/conanfile.py | 182 +++++++++--------- .../0001-cmake_use_conan_targets.patch | 2 +- 2 files changed, 90 insertions(+), 94 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 7316f7cade149..d7ab0d0f37724 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -177,7 +177,6 @@ def _external_deps(self): def _external_optional_deps(self): return { "2d": ["vtk"], - "common": ["boost", "eigen"], "io": ["davidsdk", "dssdk", "ensenso", "fzapi", "libusb", "openni", "openni2", "pcap", "png", "rssdk", "rssdk2", "vtk"], "kdtree": ["flann"], "people": ["openni"], @@ -190,11 +189,40 @@ def _external_optional_deps(self): "tools": ["cuda", "davidsdk", "dssdk", "ensenso", "opencv", "opengl", "openni", "openni2", "qhull", "rssdk", "vtk"], } + def _ext_dep_to_conan_target(self, dep): + if not self._is_enabled(dep): + return [] + return { + "boost": ["boost::boost"], + "cuda": [], + "davidsdk": [], + "dssdk": [], + "eigen": ["eigen::eigen"], + "ensenso": [], + "flann": ["flann::flann"], + "fzapi": [], + "libusb": ["libusb::libusb"], + "metslib": [], + "opencv": ["opencv::opencv"], + "opengl": ["opengl::opengl", "freeglut::freeglut", "glew::glew", "glu::glu"], + "openni": [], + "openni2": [], + "pcap": ["libpcap::libpcap"], + "png": ["libpng::libpng"], + "qhull": ["qhull::qhull"], + "qt": ["qt::qt"], + "qvtk": [], + "rssdk": [], + "rssdk2": [], + "vtk": [], + }[dep] + @property def _internal_deps(self): return { "2d": ["common", "filters"], "common": [], + "cuda_common": [], "cuda_features": ["common", "cuda_common", "io"], "cuda_io": ["common", "cuda_common", "io"], "cuda_sample_consensus": ["common", "cuda_common", "io"], @@ -260,13 +288,20 @@ def _is_header_only(self, component): def _extra_libs(self): return {"io": ["pcl_io_ply"]} - @property - def _enabled_components(self): - return {c for c in self._internal_deps if self.options.get_safe(c) or c == "common"} + def _enabled_components(self, opts=None): + opts = opts or self.options + return {c for c in self._internal_deps if opts.get_safe(c)} | {"common"} - @property - def _disabled_components(self): - return {c for c in self._internal_deps if not self.options.get_safe(c)} + def _disabled_components(self, opts=None): + opts = opts or self.options + return {c for c in self._internal_deps if not opts.get_safe(c)} - {"common"} + + def _all_ext_deps(self, opts): + all_deps = set() + for component in self._enabled_components(opts): + all_deps.update(self._external_deps.get(component, [])) + all_deps.update(self._external_optional_deps.get(component, [])) + return all_deps @property def _min_cppstd(self): @@ -296,56 +331,43 @@ def configure(self): def layout(self): cmake_layout(self, src_folder="src") - def _all_required_deps(self, opts): - all_deps = set() - for component, deps in self._external_deps.items(): - if opts.get_safe(component): - all_deps.update(deps) - return all_deps - - def _all_optional_deps(self, opts): - all_deps = set() - for component, deps in self._external_optional_deps.items(): - if opts.get_safe(component): - all_deps.update(deps) - return all_deps - - def _all_deps(self, opts): - return self._all_required_deps(opts) | self._all_optional_deps(opts) - def system_requirements(self): - if self.options.with_vtk and "vtk" in self._all_deps(self.options): + if self._is_enabled("vtk"): # TODO: add vtk/system package? package_manager.Apt(self).install(["libvtk-dev"]) package_manager.Dnf(self).install(["vtk-devel"]) if self.settings.os == "Windows": self.output.warn("VTK must be installed manually on Windows.") + def _is_enabled(self, dep): + if dep in ["boost", "eigen"]: + return True + return self.options.get_safe(f"with_{dep}") and dep in self._all_ext_deps(self.options) + def requirements(self): # Boost is used in public PCL headers here: # https://github.com/PointCloudLibrary/pcl/blob/pcl-1.13.1/common/include/pcl/point_struct_traits.h#L40-L46 self.requires("boost/1.82.0", transitive_headers=True) self.requires("eigen/3.4.0", transitive_headers=True) - used_deps = self._all_deps(self.options) - if self.options.with_flann and "flann" in used_deps: + if self._is_enabled("flann"): self.requires("flann/1.9.2") - if self.options.with_png and "png" in used_deps: + if self._is_enabled("png"): self.requires("libpng/1.6.40") - if self.options.with_qhull and "qhull" in used_deps: + if self._is_enabled("qhull"): self.requires("qhull/8.0.1") - if self.options.with_qt and "qt" in used_deps: + if self._is_enabled("qt"): self.requires("qt/6.5.1") - if self.options.with_libusb and "libusb" in used_deps: + if self._is_enabled("libusb"): self.requires("libusb/1.0.26") - if self.options.with_pcap and "pcap" in used_deps: + if self._is_enabled("pcap"): self.requires("libpcap/1.10.4") - if self.options.with_opengl and "opengl" in used_deps: + if self._is_enabled("opengl"): # OpenGL is only used if VTK is available self.requires("opengl/system") self.requires("freeglut/3.4.0") self.requires("glew/2.2.0") self.requires("glu/system") - if self.options.with_opencv and "opencv" in used_deps: + if self._is_enabled("opencv"): self.requires("opencv/4.5.5") # TODO: # self.requires("vtk/9.x.x") @@ -357,7 +379,7 @@ def requirements(self): # self.requires("rssdk/x.x.x") def package_id(self): - used_deps = self._all_deps(self.info.options) + used_deps = self._all_ext_deps(self.info.options) # Disable options that have no effect all_opts = list(self.info.options.possible_values) for opt in all_opts: @@ -365,20 +387,18 @@ def package_id(self): setattr(self.info.options, opt, False) def validate(self): - for component, deps in self._external_deps.items(): - if self.options.get_safe(component): - for dep in deps: - if not self.options.get_safe(f"with_{dep}"): - raise ConanInvalidConfiguration( - f"'with_{dep}=True' is required when '{component}' is enabled." - ) - for component, deps in self._internal_deps.items(): - if self.options.get_safe(component): - for dep in deps: - if not self.options.get_safe(dep) and dep != "common": - raise ConanInvalidConfiguration( - f"'{dep}=True' is required when '{component}' is enabled." - ) + enabled_components = self._enabled_components() + for component in sorted(enabled_components): + for dep in self._external_deps.get(component, []): + if not self._is_enabled(dep): + raise ConanInvalidConfiguration( + f"'with_{dep}=True' is required when '{component}' is enabled." + ) + for dep in self._internal_deps[component]: + if dep not in enabled_components: + raise ConanInvalidConfiguration( + f"'{dep}=True' is required when '{component}' is enabled." + ) if self.settings.compiler.cppstd: check_min_cppstd(self, self._min_cppstd) @@ -394,15 +414,15 @@ def source(self): def generate(self): tc = CMakeToolchain(self) tc.cache_variables["PCL_SHARED_LIBS"] = self.options.shared - tc.cache_variables["WITH_CUDA"] = self.options.with_cuda - tc.cache_variables["WITH_LIBUSB"] = self.options.with_libusb - tc.cache_variables["WITH_OPENGL"] = self.options.with_opengl - tc.cache_variables["WITH_OPENMP"] = self.options.with_openmp - tc.cache_variables["WITH_PCAP"] = self.options.with_pcap - tc.cache_variables["WITH_PNG"] = self.options.with_png - tc.cache_variables["WITH_QHULL"] = self.options.with_qhull - tc.cache_variables["WITH_QT"] = self.options.with_qt - tc.cache_variables["WITH_VTK"] = self.options.with_vtk + tc.cache_variables["WITH_CUDA"] = self._is_enabled("cuda") + tc.cache_variables["WITH_LIBUSB"] = self._is_enabled("libusb") + tc.cache_variables["WITH_OPENGL"] = self._is_enabled("opengl") + tc.cache_variables["WITH_OPENMP"] = self._is_enabled("openmp") + tc.cache_variables["WITH_PCAP"] = self._is_enabled("pcap") + tc.cache_variables["WITH_PNG"] = self._is_enabled("png") + tc.cache_variables["WITH_QHULL"] = self._is_enabled("qhull") + tc.cache_variables["WITH_QT"] = self._is_enabled("qt") + tc.cache_variables["WITH_VTK"] = self._is_enabled("vtk") tc.cache_variables["WITH_SYSTEM_ZLIB"] = True tc.cache_variables["PCL_ONLY_CORE_POINT_TYPES"] = True # The default False setting breaks OpenGL detection in CMake @@ -410,9 +430,13 @@ def generate(self): tc.cache_variables["BUILD_tools"] = self.options.tools tc.cache_variables["BUILD_apps"] = self.options.apps tc.cache_variables["BUILD_examples"] = False - for comp in sorted(self._enabled_components): + enabled = sorted(self._enabled_components()) + disabled = sorted(self._disabled_components()) + self.output.info("Enabled components: " + ", ".join(enabled)) + self.output.info("Disabled components: " + ", ".join(disabled)) + for comp in enabled: tc.cache_variables[f"BUILD_{comp}"] = True - for comp in sorted(self._disabled_components): + for comp in disabled: tc.cache_variables[f"BUILD_{comp}"] = False tc.generate() @@ -420,7 +444,7 @@ def generate(self): deps.set_property("eigen", "cmake_file_name", "EIGEN") deps.set_property("flann", "cmake_file_name", "FLANN") deps.set_property("flann", "cmake_target_name", "FLANN::FLANN") - deps.set_property("pcap", "cmake_file_name", "PCAP") + deps.set_property("libpcap", "cmake_file_name", "PCAP") deps.set_property("qhull", "cmake_file_name", "QHULL") deps.set_property("qhull", "cmake_target_name", "QHULL::QHULL") deps.generate() @@ -463,41 +487,12 @@ def _lib_name(self, lib): if is_msvc(self) and self.settings.build_type == "Debug": return f"pcl_{lib}d" return f"pcl_{lib}" - - def _ext_dep_to_conan_target(self, dep): - if not self.options.get_safe(f"with_{dep}"): - return [] - return { - "boost": ["boost::boost"], - "cuda": [], - "davidsdk": [], - "dssdk": [], - "eigen": ["eigen::eigen"], - "ensenso": [], - "flann": ["flann::flann"], - "fzapi": [], - "libusb": ["libusb::libusb"], - "metslib": [], - "opencv": ["opencv::opencv"], - "opengl": ["opengl::opengl", "freeglut::freeglut", "glew::glew", "glu::glu"], - "openni": [], - "openni2": [], - "pcap": ["libpcap::libpcap"], - "png": ["libpng::libpng"], - "qhull": ["qhull::qhull"], - "qt": ["qt::qt"], - "qvtk": [], - "rssdk": [], - "rssdk2": [], - "vtk": [], - }[dep] - def package_info(self): self.cpp_info.set_property("cmake_file_name", "PCL") self.cpp_info.set_property("cmake_target_name", "PCL::PCL") self.cpp_info.set_property("cmake_find_mode", "both") - for name in self._enabled_components: + for name in sorted(self._enabled_components()): component = self.cpp_info.components[name] component.names["cmake_find_package"] = name component.names["cmake_find_package_multi"] = name @@ -516,8 +511,9 @@ def package_info(self): component.requires.append(opt_dep) for dep in self._external_deps.get(name, []) + self._external_optional_deps.get(name, []): component.requires += self._ext_dep_to_conan_target(dep) + self.output.info(f"Component {name} requires: {component.requires}") - if self.options.with_apps: + if self.options.apps: component = self.cpp_info.components["apps"] component.libs = [] component.includedirs = [] @@ -525,7 +521,7 @@ def package_info(self): for dep in self._external_optional_deps["apps"]: component.requires += self._ext_dep_to_conan_target(dep) - if self.options.with_tools: + if self.options.tools: component = self.cpp_info.components["tools"] component.libs = [] component.includedirs = [] diff --git a/recipes/pcl/all/patches/0001-cmake_use_conan_targets.patch b/recipes/pcl/all/patches/0001-cmake_use_conan_targets.patch index 0c1a2e8f3b163..5461a0bfed49e 100644 --- a/recipes/pcl/all/patches/0001-cmake_use_conan_targets.patch +++ b/recipes/pcl/all/patches/0001-cmake_use_conan_targets.patch @@ -19,7 +19,7 @@ # FLANN (required) -find_package(FLANN 1.9.1 REQUIRED) -+find_package(FLANN REQUIRED CONFIG) ++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() From 5bb2754d57e8de39cc3807bd8009df8402d8d97f Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 10 Aug 2023 21:34:07 +0300 Subject: [PATCH 19/34] pcl: set OpenGL_GL_PREFERENCE=GLVND --- recipes/pcl/all/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index d7ab0d0f37724..59bbe4d0b53a3 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -427,6 +427,7 @@ def generate(self): tc.cache_variables["PCL_ONLY_CORE_POINT_TYPES"] = True # The default False setting breaks OpenGL detection in CMake tc.cache_variables["PCL_ALLOW_BOTH_SHARED_AND_STATIC_DEPENDENCIES"] = True + tc.variables["OpenGL_GL_PREFERENCE"] = "GLVND" tc.cache_variables["BUILD_tools"] = self.options.tools tc.cache_variables["BUILD_apps"] = self.options.apps tc.cache_variables["BUILD_examples"] = False From 1cc967a0ce0d31c34c70981cdbf638226a82796a Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 10 Aug 2023 21:52:30 +0300 Subject: [PATCH 20/34] pcl: fix _extra_libs handling --- recipes/pcl/all/conanfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 59bbe4d0b53a3..463c6f9681159 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -286,7 +286,7 @@ def _is_header_only(self, component): @property def _extra_libs(self): - return {"io": ["pcl_io_ply"]} + return {"io": ["io_ply"]} def _enabled_components(self, opts=None): opts = opts or self.options @@ -488,6 +488,7 @@ def _lib_name(self, lib): if is_msvc(self) and self.settings.build_type == "Debug": return f"pcl_{lib}d" return f"pcl_{lib}" + def package_info(self): self.cpp_info.set_property("cmake_file_name", "PCL") self.cpp_info.set_property("cmake_target_name", "PCL::PCL") From d3e5eb07fe9c47751f34fb1a74868289bd59736c Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 10 Aug 2023 22:46:26 +0300 Subject: [PATCH 21/34] pcl: fix CUDA support --- recipes/pcl/all/conanfile.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 463c6f9681159..7904959a6770c 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -414,7 +414,6 @@ def source(self): def generate(self): tc = CMakeToolchain(self) tc.cache_variables["PCL_SHARED_LIBS"] = self.options.shared - tc.cache_variables["WITH_CUDA"] = self._is_enabled("cuda") tc.cache_variables["WITH_LIBUSB"] = self._is_enabled("libusb") tc.cache_variables["WITH_OPENGL"] = self._is_enabled("opengl") tc.cache_variables["WITH_OPENMP"] = self._is_enabled("openmp") @@ -423,6 +422,9 @@ def generate(self): tc.cache_variables["WITH_QHULL"] = self._is_enabled("qhull") tc.cache_variables["WITH_QT"] = self._is_enabled("qt") tc.cache_variables["WITH_VTK"] = self._is_enabled("vtk") + tc.cache_variables["WITH_CUDA"] = self._is_enabled("cuda") + tc.cache_variables["BUILD_CUDA"] = self._is_enabled("cuda") + tc.cache_variables["BUILD_GPU"] = self._is_enabled("cuda") tc.cache_variables["WITH_SYSTEM_ZLIB"] = True tc.cache_variables["PCL_ONLY_CORE_POINT_TYPES"] = True # The default False setting breaks OpenGL detection in CMake From ae24a89941418c7c25184f2ebfd9bf5a5a469bc1 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 10 Aug 2023 23:03:46 +0300 Subject: [PATCH 22/34] pcl: add all VTK system package variants --- recipes/pcl/all/conanfile.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 7904959a6770c..ecbd0f0271637 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -334,10 +334,16 @@ def layout(self): def system_requirements(self): if self._is_enabled("vtk"): # TODO: add vtk/system package? - package_manager.Apt(self).install(["libvtk-dev"]) - package_manager.Dnf(self).install(["vtk-devel"]) + # https://repology.org/project/vtk/versions + package_manager.Apt(self).install(["libvtk9-dev"], update=True, check=True) + package_manager.Dnf(self).install(["vtk-devel"], update=True, check=True) + package_manager.Yum(self).install(["vtk-devel"], update=True, check=True) + package_manager.PacMan(self).install(["vtk"], update=True, check=True) + package_manager.Zypper(self).install(["vtk"], update=True, check=True) + package_manager.Pkg(self).install(["vtk9"], update=True, check=True) + package_manager.Brew(self).install(["vtk"], update=True, check=True) if self.settings.os == "Windows": - self.output.warn("VTK must be installed manually on Windows.") + self.output.warning("VTK must be installed manually on Windows.") def _is_enabled(self, dep): if dep in ["boost", "eigen"]: From 5ddafb9ddd5ff747b5c5bd0584f7300cf704dbeb Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Fri, 11 Aug 2023 01:25:55 +0300 Subject: [PATCH 23/34] pcl: add missing transitive_headers=True based on installed header includes --- recipes/pcl/all/conanfile.py | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index ecbd0f0271637..0438430bff8f3 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -351,38 +351,40 @@ def _is_enabled(self, dep): return self.options.get_safe(f"with_{dep}") and dep in self._all_ext_deps(self.options) def requirements(self): - # Boost is used in public PCL headers here: - # https://github.com/PointCloudLibrary/pcl/blob/pcl-1.13.1/common/include/pcl/point_struct_traits.h#L40-L46 self.requires("boost/1.82.0", transitive_headers=True) self.requires("eigen/3.4.0", transitive_headers=True) if self._is_enabled("flann"): - self.requires("flann/1.9.2") + self.requires("flann/1.9.2", transitive_headers=True) if self._is_enabled("png"): self.requires("libpng/1.6.40") if self._is_enabled("qhull"): - self.requires("qhull/8.0.1") + self.requires("qhull/8.0.1", transitive_headers=True) if self._is_enabled("qt"): self.requires("qt/6.5.1") if self._is_enabled("libusb"): - self.requires("libusb/1.0.26") + self.requires("libusb/1.0.26", transitive_headers=True) if self._is_enabled("pcap"): self.requires("libpcap/1.10.4") if self._is_enabled("opengl"): # OpenGL is only used if VTK is available - self.requires("opengl/system") - self.requires("freeglut/3.4.0") - self.requires("glew/2.2.0") - self.requires("glu/system") + self.requires("opengl/system", transitive_headers=True) + self.requires("freeglut/3.4.0", transitive_headers=True) + self.requires("glew/2.2.0", transitive_headers=True) + self.requires("glu/system", transitive_headers=True) if self._is_enabled("opencv"): - self.requires("opencv/4.5.5") + self.requires("opencv/4.5.5", transitive_headers=True) # TODO: - # self.requires("vtk/9.x.x") - # self.requires("openni/x.x.x") - # self.requires("openni2/x.x.x") - # self.requires("ensenso/x.x.x") - # self.requires("davidsdk/x.x.x") - # self.requires("dssdk/x.x.x") - # self.requires("rssdk/x.x.x") + # self.requires("vtk/9.x.x", transitive_headers=True) + # self.requires("openni/x.x.x", transitive_headers=True) + # self.requires("openni2/x.x.x", transitive_headers=True) + # self.requires("ensenso/x.x.x", transitive_headers=True) + # self.requires("davidsdk/x.x.x", transitive_headers=True) + # self.requires("dssdk/x.x.x", transitive_headers=True) + # self.requires("rssdk/x.x.x", transitive_headers=True) + # self.requires("metslib/x.x.x", transitive_headers=True) + # self.requires("openmp/system", transitive_headers=True) + # self.requires("opennurbs/x.x.x", transitive_headers=True) + # self.requires("poisson4/x.x.x", transitive_headers=True) def package_id(self): used_deps = self._all_ext_deps(self.info.options) From bfb4bd00c2a2b9a6ee34779ca90482b4a42bfd5c Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Fri, 11 Aug 2023 01:26:59 +0300 Subject: [PATCH 24/34] pcl: add ws2_32 dep on Windows --- recipes/pcl/all/conanfile.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 0438430bff8f3..4f5d2ac8f4d5d 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -541,8 +541,8 @@ def package_info(self): for dep in self._external_optional_deps["tools"]: component.requires += self._ext_dep_to_conan_target(dep) + common = self.cpp_info.components["common"] if not self.options.shared: - common = self.cpp_info.components["common"] if self.settings.os in ["Linux", "FreeBSD"]: common.system_libs.append("pthread") if self.options.with_openmp: @@ -555,6 +555,8 @@ def package_info(self): common.system_libs.append("delayimp") elif self.settings.compiler == "gcc": common.system_libs.append("gomp") + if self.settings.os == "Windows": + common.system_libs.append("ws2_32") # TODO: Legacy, to be removed on Conan 2.0 self.cpp_info.names["cmake_find_package"] = "PCL" From 8750fef7be46b74fb68f6dfbb3ee6c9fbda6f44c Mon Sep 17 00:00:00 2001 From: Esteban DUGUEPEROUX Date: Fri, 11 Aug 2023 08:39:31 +0200 Subject: [PATCH 25/34] Restore is_msvc_static_runtime import --- recipes/pcl/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 44136dd60249d..22bb9ac210eb6 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -4,7 +4,7 @@ from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, rm from conan.tools.gnu import PkgConfigDeps -from conan.tools.microsoft import is_msvc +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime from conan.tools.scm import Version from conan.tools.system import package_manager import os From f1a076f6e3568c5fea423f2338525bb0f7f08fb1 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Fri, 11 Aug 2023 10:23:38 +0300 Subject: [PATCH 26/34] pcl: fix Conan v1 issue --- recipes/pcl/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 4f5d2ac8f4d5d..5c9457757a547 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -389,7 +389,7 @@ def requirements(self): def package_id(self): used_deps = self._all_ext_deps(self.info.options) # Disable options that have no effect - all_opts = list(self.info.options.possible_values) + all_opts = [opt for opt, value in self.info.options.items()] for opt in all_opts: if opt.startswith("with_") and opt.split("_", 1)[1] not in used_deps: setattr(self.info.options, opt, False) From 9b7bf4c95ae0e14311b2beddfcdd69c84e0682dc Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Fri, 11 Aug 2023 11:44:58 +0300 Subject: [PATCH 27/34] pcl: new add_build_type_postfix option, fix library naming on Windows --- recipes/pcl/all/conanfile.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 004d425d4cb33..c198d6731834e 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -4,7 +4,6 @@ from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, rm from conan.tools.gnu import PkgConfigDeps -from conan.tools.microsoft import is_msvc, is_msvc_static_runtime from conan.tools.scm import Version from conan.tools.system import package_manager import os @@ -87,6 +86,8 @@ class PclConan(ConanFile): # "with_rssdk": [True, False], # "with_rssdk2": [True, False], # "with_qvtk": [True, False], + # Whether to append a ''/d/rd/s postfix to executables on Windows depending on the build type + "add_build_type_postfix": [True, False], } default_options = { "shared": False, @@ -144,6 +145,7 @@ class PclConan(ConanFile): "with_qhull": True, "with_qt": True, "with_vtk": False, + "add_build_type_postfix": False, } short_paths = True @@ -286,7 +288,7 @@ def _is_header_only(self, component): @property def _extra_libs(self): - return {"io": ["io_ply"]} + return {"io": ["pcl_io_ply"]} def _enabled_components(self, opts=None): opts = opts or self.options @@ -438,6 +440,13 @@ def generate(self): # The default False setting breaks OpenGL detection in CMake tc.cache_variables["PCL_ALLOW_BOTH_SHARED_AND_STATIC_DEPENDENCIES"] = True tc.variables["OpenGL_GL_PREFERENCE"] = "GLVND" + + if not self.options.add_build_type_postfix: + tc.cache_variables["CMAKE_DEBUG_POSTFIX"] = "" + tc.cache_variables["CMAKE_RELEASE_POSTFIX"] = "" + tc.cache_variables["CMAKE_RELWITHDEBINFO_POSTFIX"] = "" + tc.cache_variables["CMAKE_MINSIZEREL_POSTFIX"] = "" + tc.cache_variables["BUILD_tools"] = self.options.tools tc.cache_variables["BUILD_apps"] = self.options.apps tc.cache_variables["BUILD_examples"] = False @@ -449,6 +458,7 @@ def generate(self): tc.cache_variables[f"BUILD_{comp}"] = True for comp in disabled: tc.cache_variables[f"BUILD_{comp}"] = False + tc.generate() deps = CMakeDeps(self) @@ -494,11 +504,6 @@ def _version_suffix(self): semver = Version(self.version) return f"{semver.major}.{semver.minor}" - def _lib_name(self, lib): - if (is_msvc(self) or is_msvc_static_runtime(self)) and self.settings.build_type == "Debug": - return f"pcl_{lib}d" - return f"pcl_{lib}" - def package_info(self): self.cpp_info.set_property("cmake_file_name", "PCL") self.cpp_info.set_property("cmake_target_name", "PCL::PCL") @@ -514,9 +519,8 @@ def package_info(self): component.set_property("pkg_config_name", f"pcl_{name}-{self._version_suffix}") component.includedirs = [os.path.join("include", f"pcl-{self._version_suffix}")] if not self._is_header_only(name): - libs = [name] - libs += self._extra_libs.get(name, []) - component.libs = [self._lib_name(lib) for lib in libs] + component.libs = [f"pcl_{name}"] + component.libs += self._extra_libs.get(name, []) component.requires += self._internal_deps[name] for opt_dep in self._internal_optional_deps.get(name, []): if self.options.get_safe(opt_dep): From 7cdb5568a997493ce00d429a64c64c35587ce428 Mon Sep 17 00:00:00 2001 From: Esteban DUGUEPEROUX Date: Fri, 11 Aug 2023 12:39:59 +0200 Subject: [PATCH 28/34] Take into account @maksim-petukhov remark --- recipes/pcl/all/conanfile.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index c198d6731834e..52f14a2fca88f 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -86,6 +86,8 @@ class PclConan(ConanFile): # "with_rssdk": [True, False], # "with_rssdk2": [True, False], # "with_qvtk": [True, False], + # If to enable https://github.com/PointCloudLibrary/pcl/pull/5764 + "with_compilation_optimisation": [True, False], # Whether to append a ''/d/rd/s postfix to executables on Windows depending on the build type "add_build_type_postfix": [True, False], } @@ -145,6 +147,7 @@ class PclConan(ConanFile): "with_qhull": True, "with_qt": True, "with_vtk": False, + "with_compilation_optimisation": True, "add_build_type_postfix": False, } @@ -436,7 +439,7 @@ def generate(self): tc.cache_variables["BUILD_CUDA"] = self._is_enabled("cuda") tc.cache_variables["BUILD_GPU"] = self._is_enabled("cuda") tc.cache_variables["WITH_SYSTEM_ZLIB"] = True - tc.cache_variables["PCL_ONLY_CORE_POINT_TYPES"] = True + tc.cache_variables["PCL_ONLY_CORE_POINT_TYPES"] = self.options.with_compilation_optimisation # The default False setting breaks OpenGL detection in CMake tc.cache_variables["PCL_ALLOW_BOTH_SHARED_AND_STATIC_DEPENDENCIES"] = True tc.variables["OpenGL_GL_PREFERENCE"] = "GLVND" From c04721f2e2ae091aab87bff99e0236fe7b713169 Mon Sep 17 00:00:00 2001 From: Esteban DUGUEPEROUX Date: Fri, 11 Aug 2023 13:44:50 +0200 Subject: [PATCH 29/34] Take into account @valgur remark --- recipes/pcl/all/conanfile.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 52f14a2fca88f..283a3e181923d 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -87,7 +87,7 @@ class PclConan(ConanFile): # "with_rssdk2": [True, False], # "with_qvtk": [True, False], # If to enable https://github.com/PointCloudLibrary/pcl/pull/5764 - "with_compilation_optimisation": [True, False], + "instantiate_only_core_point_types": [True, False], # Whether to append a ''/d/rd/s postfix to executables on Windows depending on the build type "add_build_type_postfix": [True, False], } @@ -147,7 +147,7 @@ class PclConan(ConanFile): "with_qhull": True, "with_qt": True, "with_vtk": False, - "with_compilation_optimisation": True, + "instantiate_only_core_point_types": True, "add_build_type_postfix": False, } @@ -439,7 +439,7 @@ def generate(self): tc.cache_variables["BUILD_CUDA"] = self._is_enabled("cuda") tc.cache_variables["BUILD_GPU"] = self._is_enabled("cuda") tc.cache_variables["WITH_SYSTEM_ZLIB"] = True - tc.cache_variables["PCL_ONLY_CORE_POINT_TYPES"] = self.options.with_compilation_optimisation + tc.cache_variables["PCL_ONLY_CORE_POINT_TYPES"] = self.options.instantiate_only_core_point_types # The default False setting breaks OpenGL detection in CMake tc.cache_variables["PCL_ALLOW_BOTH_SHARED_AND_STATIC_DEPENDENCIES"] = True tc.variables["OpenGL_GL_PREFERENCE"] = "GLVND" From d3307f7c224cf9b6b588ee2b08efc56c3ee4e915 Mon Sep 17 00:00:00 2001 From: Esteban DUGUEPEROUX Date: Fri, 11 Aug 2023 16:05:47 +0200 Subject: [PATCH 30/34] Take into account maksim-petukhov remark --- recipes/pcl/all/conanfile.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 283a3e181923d..d1c41e00f3d25 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -86,7 +86,6 @@ class PclConan(ConanFile): # "with_rssdk": [True, False], # "with_rssdk2": [True, False], # "with_qvtk": [True, False], - # If to enable https://github.com/PointCloudLibrary/pcl/pull/5764 "instantiate_only_core_point_types": [True, False], # Whether to append a ''/d/rd/s postfix to executables on Windows depending on the build type "add_build_type_postfix": [True, False], @@ -147,7 +146,7 @@ class PclConan(ConanFile): "with_qhull": True, "with_qt": True, "with_vtk": False, - "instantiate_only_core_point_types": True, + "instantiate_only_core_point_types": False, "add_build_type_postfix": False, } From c26c4155be01150d30413a9c4431e55fd3a2f2a4 Mon Sep 17 00:00:00 2001 From: Esteban DUGUEPEROUX Date: Fri, 11 Aug 2023 19:19:37 +0200 Subject: [PATCH 31/34] Set instantiate_only_core_point_types option at True --- recipes/pcl/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index d1c41e00f3d25..2d8a80aa8b2b9 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -146,7 +146,7 @@ class PclConan(ConanFile): "with_qhull": True, "with_qt": True, "with_vtk": False, - "instantiate_only_core_point_types": False, + "instantiate_only_core_point_types": True, "add_build_type_postfix": False, } From ec02bdd11930da84fb77a55d8971089a6b602cf6 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Fri, 11 Aug 2023 21:02:07 +0300 Subject: [PATCH 32/34] pcl: restore zlib dependency --- recipes/pcl/all/conanfile.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 2d8a80aa8b2b9..0aec0a2fc0763 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -173,7 +173,9 @@ def _external_deps(self): "gpu_surface": ["cuda"], "gpu_tracking": ["cuda"], "gpu_utils": ["cuda"], + "io": ["zlib"], "people": ["vtk"], + "surface": ["zlib"], "visualization": ["vtk"], } @@ -219,6 +221,7 @@ def _ext_dep_to_conan_target(self, dep): "rssdk": [], "rssdk2": [], "vtk": [], + "zlib": ["zlib::zlib"], }[dep] @property @@ -300,7 +303,7 @@ def _disabled_components(self, opts=None): opts = opts or self.options return {c for c in self._internal_deps if not opts.get_safe(c)} - {"common"} - def _all_ext_deps(self, opts): + def _used_ext_deps(self, opts): all_deps = set() for component in self._enabled_components(opts): all_deps.update(self._external_deps.get(component, [])) @@ -350,9 +353,10 @@ def system_requirements(self): self.output.warning("VTK must be installed manually on Windows.") def _is_enabled(self, dep): - if dep in ["boost", "eigen"]: - return True - return self.options.get_safe(f"with_{dep}") and dep in self._all_ext_deps(self.options) + always_available = ["boost", "eigen", "zlib"] + is_available = self.options.get_safe(f"with_{dep}") or dep in always_available + is_used = dep in self._used_ext_deps(self.options) + return is_available and is_used def requirements(self): self.requires("boost/1.82.0", transitive_headers=True) @@ -377,6 +381,8 @@ def requirements(self): self.requires("glu/system", transitive_headers=True) if self._is_enabled("opencv"): self.requires("opencv/4.5.5", transitive_headers=True) + if self._is_enabled("zlib"): + self.requires("zlib/1.2.13") # TODO: # self.requires("vtk/9.x.x", transitive_headers=True) # self.requires("openni/x.x.x", transitive_headers=True) @@ -391,7 +397,7 @@ def requirements(self): # self.requires("poisson4/x.x.x", transitive_headers=True) def package_id(self): - used_deps = self._all_ext_deps(self.info.options) + used_deps = self._used_ext_deps(self.info.options) # Disable options that have no effect all_opts = [opt for opt, value in self.info.options.items()] for opt in all_opts: From fbd2246f744157c8f9f5f6766a35e8b97d91ee67 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Fri, 11 Aug 2023 21:17:53 +0300 Subject: [PATCH 33/34] pcl: adjust precompile_only_core_point_types name, add comment Based on https://github.com/PointCloudLibrary/pcl/blob/3ed96c246e5c873713ec670b895469d09149a552/cmake/pcl_options.cmake#L49 --- recipes/pcl/all/conanfile.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 0aec0a2fc0763..8722087175102 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -86,7 +86,8 @@ class PclConan(ConanFile): # "with_rssdk": [True, False], # "with_rssdk2": [True, False], # "with_qvtk": [True, False], - "instantiate_only_core_point_types": [True, False], + # Precompile for a minimal set of point types only instead of all (e.g., pcl::PointXYZ instead of PCL_XYZ_POINT_TYPES) + "precompile_only_core_point_types": [True, False], # Whether to append a ''/d/rd/s postfix to executables on Windows depending on the build type "add_build_type_postfix": [True, False], } @@ -146,7 +147,8 @@ class PclConan(ConanFile): "with_qhull": True, "with_qt": True, "with_vtk": False, - "instantiate_only_core_point_types": True, + # Enabled to avoid excessive memory usage during compilation in CCI + "precompile_only_core_point_types": True, "add_build_type_postfix": False, } @@ -444,7 +446,7 @@ def generate(self): tc.cache_variables["BUILD_CUDA"] = self._is_enabled("cuda") tc.cache_variables["BUILD_GPU"] = self._is_enabled("cuda") tc.cache_variables["WITH_SYSTEM_ZLIB"] = True - tc.cache_variables["PCL_ONLY_CORE_POINT_TYPES"] = self.options.instantiate_only_core_point_types + tc.cache_variables["PCL_ONLY_CORE_POINT_TYPES"] = self.options.precompile_only_core_point_types # The default False setting breaks OpenGL detection in CMake tc.cache_variables["PCL_ALLOW_BOTH_SHARED_AND_STATIC_DEPENDENCIES"] = True tc.variables["OpenGL_GL_PREFERENCE"] = "GLVND" From 2415d909a32ea238d8d1785e8cf7c34292fcad37 Mon Sep 17 00:00:00 2001 From: Esteban DUGUEPEROUX Date: Thu, 17 Aug 2023 20:00:04 +0200 Subject: [PATCH 34/34] Add rm to prevent PDBs files install --- recipes/pcl/all/conanfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 8722087175102..c957981fea188 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -505,6 +505,8 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "cmake")) rmdir(self, os.path.join(self.package_folder, "share")) rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) # Remove MSVC runtime libraries for dll_pattern_to_remove in ["concrt*.dll", "msvcp*.dll", "vcruntime*.dll"]: rm(self, dll_pattern_to_remove, os.path.join(self.package_folder, "bin"))