From 78029bdce6b02c86f3751769dbdc1ea19a4d3f0f Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sat, 13 Jun 2020 11:49:35 +0100 Subject: [PATCH 01/53] Add PCL package --- recipes/pcl/all/CMakeLists.txt | 3 + recipes/pcl/all/conandata.yml | 7 + recipes/pcl/all/conanfile.py | 198 ++++++++++++++++++++ recipes/pcl/all/test_package/CMakeLists.txt | 9 + recipes/pcl/all/test_package/conanfile.py | 21 +++ recipes/pcl/all/test_package/example.cpp | 12 ++ recipes/pcl/config.yml | 5 + 7 files changed, 255 insertions(+) create mode 100644 recipes/pcl/all/CMakeLists.txt create mode 100644 recipes/pcl/all/conandata.yml create mode 100644 recipes/pcl/all/conanfile.py 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/example.cpp create mode 100644 recipes/pcl/config.yml diff --git a/recipes/pcl/all/CMakeLists.txt b/recipes/pcl/all/CMakeLists.txt new file mode 100644 index 0000000000000..81eb52aa45f97 --- /dev/null +++ b/recipes/pcl/all/CMakeLists.txt @@ -0,0 +1,3 @@ +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() +add_subdirectory(pcl) diff --git a/recipes/pcl/all/conandata.yml b/recipes/pcl/all/conandata.yml new file mode 100644 index 0000000000000..28e986fbae69e --- /dev/null +++ b/recipes/pcl/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "1.10.1": + url: "https://github.com/PointCloudLibrary/pcl/archive/pcl-1.10.1.tar.gz" + sha256: "61ec734ec7c786c628491844b46f9624958c360012c173bbc993c5ff88b4900e" + "1.11.0": + url: "https://github.com/PointCloudLibrary/pcl/archive/pcl-1.11.0.tar.gz" + sha256: "4255c3d3572e9774b5a1dccc235711b7a723197b79430ef539c2044e9ce65954" diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py new file mode 100644 index 0000000000000..6d3ce401fbd62 --- /dev/null +++ b/recipes/pcl/all/conanfile.py @@ -0,0 +1,198 @@ +import shutil +import os.path + +from conans import ConanFile, CMake, tools + + +class ConanRecipe(ConanFile): + name = "pcl" + description = "Point Cloud Library" + license = "BSD-3-Clause" + homepage = "https://pointclouds.org/" + settings = "os", "compiler", "build_type", "arch" + options = { + "shared": [True, False], + "fPIC": [True, False], + "tools": [True, False], + "usb": [True, False], + "png": [True, False], + "qhull": [True, False], + "cuda": [True, False], + "vtk": [True, False], + "pcap": [True, False], + "opengl": [True, False], + "openni": [True, False], + "openni2": [True, False], + "ensenso": [True, False], + "davidsdk": [True, False], + "dssdk": [True, False], + "rssdk": [True, False], + "kdtree": [True, False], + "octree": [True, False], + "search": [True, False], + "sample_consensus": [True, False], + "filters": [True, False], + "twod": [True, False], + "geometry": [True, False], + "io": [True, False], + "features": [True, False], + "ml": [True, False], + "segmentation": [True, False], + "surface": [True, False], + "registration": [True, False], + "keypoints": [True, False], + "tracking": [True, False], + "recognition": [True, False], + "stereo": [True, False] + } + default_options = { + "shared": True, + "fPIC": True, + "tools": False, + "boost:shared": True, + "usb": False, + "png": True, + "qhull": True, + "cuda": False, + "vtk": False, + "pcap": False, + "opengl": True, + "openni": False, + "openni2": False, + "ensenso": False, + "davidsdk": False, + "dssdk": False, + "rssdk": False, + "kdtree": True, + "octree": True, + "search": False, + "sample_consensus": False, + "filters": False, + "twod": False, + "geometry": True, + "io": True, + "features": False, + "ml": True, + "segmentation": True, + "surface": True, + "registration": True, + "keypoints": False, + "tracking": False, + "recognition": False, + "stereo": False + } + requires = ("boost/[>1.69.0]", + "eigen/[>3.3.5]", + "flann/[>1.9.0]") + generators = "cmake" + exports = ["CMakeLists.txt"] + + @property + def _major_minor_version(self): + major, minor, patch = self.version.split(".") + return ".".join([major, minor]) + + @property + def _source_subfolder(self): + return f"pcl-pcl-{self.version}" + + def source(self): + tools.get(**self.conan_data["sources"][self.version]) + tools.replace_in_file("CMakeLists.txt", "add_subdirectory(pcl)", f"add_subdirectory({self._source_subfolder})") + + def requirements(self): + if self.options.png: + self.requires("libpng/[>1.6.36]") + if self.options.qhull: + self.requires("qhull/[>7.3.0]") + self.options["qhull"].shared=False + + def configure(self): + if self.options.registration: + self.options.octree = True + self.options.filters = True + self.options.features = True + if self.options.io: + self.options.octree = True + if self.options.filters: + self.options.kdtree = True + self.options.search = True + self.options.sample_consensus = True + if self.options.segmentation: + self.options.ml = True + if self.options.features: + self.options.twod = True + + + def _configure_cmake(self): + cmake_definitions = { + "PCL_BUILD_WITH_BOOST_DYNAMIC_LINKING_WIN32": self.options["boost"].shared, + } + + pcl_config = { + "EIGEN_ROOT": self.deps_cpp_info["eigen"].rootpath, + "FLANN_ROOT": self.deps_cpp_info["flann"].rootpath, + "BOOST_ROOT": self.deps_cpp_info["boost"].rootpath, + "BUILD_tools": self.options.tools, + "WITH_LIBUSB": self.options.usb, + "WITH_PNG": self.options.png, + "WITH_QHULL": self.options.qhull, + "WITH_CUDA": self.options.cuda, + "WITH_VTK": self.options.vtk, + "WITH_PCAP": self.options.pcap, + "WITH_OPENGL": self.options.opengl, + "WITH_OPENNI": self.options.openni2, + "WITH_OPENNI2": self.options.openni2, + "WITH_ENSENSO": self.options.ensenso, + "WITH_DAVIDSDK": self.options.davidsdk, + "WITH_DSSDK": self.options.dssdk, + "WITH_RSSDK": self.options.rssdk, + "PCL_SHARED_LIBS": self.options.shared + } + pcl_features = { + "BUILD_kdtree": self.options.kdtree, + "BUILD_octree": self.options.octree, + "BUILD_search": self.options.search, + "BUILD_sample_consensus": self.options.sample_consensus, + "BUILD_filters": self.options.filters, + "BUILD_2d": self.options.twod, + "BUILD_geometry": self.options.geometry, + "BUILD_io": self.options.io, + "BUILD_features": self.options.features, + "BUILD_ml": self.options.ml, + "BUILD_segmentation": self.options.segmentation, + "BUILD_surface": self.options.surface, + "BUILD_registration": self.options.registration, + "BUILD_keypoints": self.options.keypoints, + "BUILD_tracking": self.options.tracking, + "BUILD_recognition": self.options.recognition, + "BUILD_stereo": self.options.stereo + } + + if self.options.png: + pcl_config["LIBPNG_ROOT"] = self.deps_cpp_info["libpng"].rootpath + if self.options.qhull: + pcl_config["QHULL_ROOT"] = self.deps_cpp_info["qhull"].rootpath + pcl_config["QHULL_USE_STATIC"] = True + + cmake = CMake(self) + cmake.definitions.update(cmake_definitions) + cmake.definitions.update(pcl_config) + cmake.definitions.update(pcl_features) + cmake.configure() + return cmake + + def build(self): + cmake = self._configure_cmake() + cmake.build() + + def package(self): + cmake = self._configure_cmake() + cmake.install() + self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) + shutil.rmtree(os.path.join(self.package_folder, "share")) + shutil.rmtree(os.path.join(self.package_folder, "lib", "pkgconfig")) + + def package_info(self): + self.cpp_info.includedirs = [f"include/pcl-{self._major_minor_version}"] + self.cpp_info.libs = tools.collect_libs(self) diff --git a/recipes/pcl/all/test_package/CMakeLists.txt b/recipes/pcl/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..ccf513ca0bde9 --- /dev/null +++ b/recipes/pcl/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.10) +project(PclTestPackage) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_executable(pcl_test_package example.cpp) +target_compile_features(pcl_test_package PUBLIC cxx_std_14) +target_link_libraries(pcl_test_package PRIVATE ${CONAN_TARGETS}) diff --git a/recipes/pcl/all/test_package/conanfile.py b/recipes/pcl/all/test_package/conanfile.py new file mode 100644 index 0000000000000..568eac9e8c4c2 --- /dev/null +++ b/recipes/pcl/all/test_package/conanfile.py @@ -0,0 +1,21 @@ +from conans import ConanFile, CMake +import os + + +class PclTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake" + short_paths = True + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def imports(self): + self.copy("*.dll", "bin", "bin") + + def test(self): + os.chdir('bin') + self.run('.{}pcl_test_package'.format(os.sep)) + diff --git a/recipes/pcl/all/test_package/example.cpp b/recipes/pcl/all/test_package/example.cpp new file mode 100644 index 0000000000000..557740c8e9b15 --- /dev/null +++ b/recipes/pcl/all/test_package/example.cpp @@ -0,0 +1,12 @@ +#include + +#include + +int main() { + pcl::PointXYZ p; + p.x = -1.0f; + p.y = 3.14f; + p.z = 42.0f; + + std::cout << "PointXYZ: " << p << std::endl; +} diff --git a/recipes/pcl/config.yml b/recipes/pcl/config.yml new file mode 100644 index 0000000000000..3f6e63566ea77 --- /dev/null +++ b/recipes/pcl/config.yml @@ -0,0 +1,5 @@ +versions: + "1.10.1": + folder: all + "1.11.0": + folder: all From 07d0522782df4f20cc6d327d4d8f68e870e4a84f Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sat, 13 Jun 2020 12:30:26 +0100 Subject: [PATCH 02/53] Fix hook errors --- recipes/pcl/all/CMakeLists.txt | 1 + recipes/pcl/all/conanfile.py | 1 + recipes/pcl/all/test_package/conanfile.py | 4 ---- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/recipes/pcl/all/CMakeLists.txt b/recipes/pcl/all/CMakeLists.txt index 81eb52aa45f97..436653d253bae 100644 --- a/recipes/pcl/all/CMakeLists.txt +++ b/recipes/pcl/all/CMakeLists.txt @@ -1,3 +1,4 @@ +cmake_minimum_required(VERSION 3.10) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() add_subdirectory(pcl) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 6d3ce401fbd62..b01402046dd43 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -9,6 +9,7 @@ class ConanRecipe(ConanFile): description = "Point Cloud Library" license = "BSD-3-Clause" homepage = "https://pointclouds.org/" + url = "https://github.com/conan-io/conan-center-index" settings = "os", "compiler", "build_type", "arch" options = { "shared": [True, False], diff --git a/recipes/pcl/all/test_package/conanfile.py b/recipes/pcl/all/test_package/conanfile.py index 568eac9e8c4c2..cd8d45a2b1857 100644 --- a/recipes/pcl/all/test_package/conanfile.py +++ b/recipes/pcl/all/test_package/conanfile.py @@ -12,10 +12,6 @@ def build(self): cmake.configure() cmake.build() - def imports(self): - self.copy("*.dll", "bin", "bin") - def test(self): os.chdir('bin') self.run('.{}pcl_test_package'.format(os.sep)) - From fd43a92f92e9e82c19a7a26fac240d2337d2cdb9 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sat, 13 Jun 2020 14:55:02 +0100 Subject: [PATCH 03/53] select correct version of flann library --- 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 b01402046dd43..80220fdbae916 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -148,7 +148,8 @@ def _configure_cmake(self): "WITH_DAVIDSDK": self.options.davidsdk, "WITH_DSSDK": self.options.dssdk, "WITH_RSSDK": self.options.rssdk, - "PCL_SHARED_LIBS": self.options.shared + "PCL_SHARED_LIBS": self.options.shared, + "FLANN_USE_STATIC": not self.options["flann"].shared } pcl_features = { "BUILD_kdtree": self.options.kdtree, From 8774793d9a7f3791f0090de6aac4dbf3c80c6f9b Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sat, 13 Jun 2020 14:55:24 +0100 Subject: [PATCH 04/53] rename class --- 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 80220fdbae916..85ca5969769ad 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -4,7 +4,7 @@ from conans import ConanFile, CMake, tools -class ConanRecipe(ConanFile): +class PclConanRecipe(ConanFile): name = "pcl" description = "Point Cloud Library" license = "BSD-3-Clause" From 32fef4ef2f1b00e9dca7089c3d6612ba8a73b8e4 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sat, 13 Jun 2020 15:28:28 +0100 Subject: [PATCH 05/53] rename module options --- recipes/pcl/all/conanfile.py | 133 ++++++++++++++++++----------------- 1 file changed, 67 insertions(+), 66 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 85ca5969769ad..e0911aee1420a 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -9,7 +9,7 @@ class PclConanRecipe(ConanFile): description = "Point Cloud Library" license = "BSD-3-Clause" homepage = "https://pointclouds.org/" - url = "https://github.com/conan-io/conan-center-index" + url = "https://github.com/conan-module_io/conan-center-index" settings = "os", "compiler", "build_type", "arch" options = { "shared": [True, False], @@ -28,23 +28,23 @@ class PclConanRecipe(ConanFile): "davidsdk": [True, False], "dssdk": [True, False], "rssdk": [True, False], - "kdtree": [True, False], - "octree": [True, False], - "search": [True, False], - "sample_consensus": [True, False], - "filters": [True, False], - "twod": [True, False], - "geometry": [True, False], - "io": [True, False], - "features": [True, False], - "ml": [True, False], - "segmentation": [True, False], - "surface": [True, False], - "registration": [True, False], - "keypoints": [True, False], - "tracking": [True, False], - "recognition": [True, False], - "stereo": [True, False] + "module_2d": [True, False], + "module_features": [True, False], + "module_filters": [True, False], + "module_geometry": [True, False], + "module_io": [True, False], + "module_kdtree": [True, False], + "module_keypoints": [True, False], + "module_ml": [True, False], + "module_octree": [True, False], + "module_registration": [True, False], + "module_sample_consensus": [True, False], + "module_search": [True, False], + "module_segmentation": [True, False], + "module_stereo": [True, False], + "module_surface": [True, False], + "module_tracking": [True, False], + "module_recognition": [True, False] } default_options = { "shared": True, @@ -64,23 +64,23 @@ class PclConanRecipe(ConanFile): "davidsdk": False, "dssdk": False, "rssdk": False, - "kdtree": True, - "octree": True, - "search": False, - "sample_consensus": False, - "filters": False, - "twod": False, - "geometry": True, - "io": True, - "features": False, - "ml": True, - "segmentation": True, - "surface": True, - "registration": True, - "keypoints": False, - "tracking": False, - "recognition": False, - "stereo": False + "module_2d": False, + "module_features": False, + "module_filters": False, + "module_geometry": True, + "module_io": True, + "module_kdtree": True, + "module_keypoints": False, + "module_ml": True, + "module_octree": True, + "module_recognition": False, + "module_registration": True, + "module_sample_consensus": False, + "module_search": False, + "module_segmentation": True, + "module_stereo": False, + "module_surface": True, + "module_tracking": False } requires = ("boost/[>1.69.0]", "eigen/[>3.3.5]", @@ -109,20 +109,21 @@ def requirements(self): self.options["qhull"].shared=False def configure(self): - if self.options.registration: - self.options.octree = True - self.options.filters = True - self.options.features = True - if self.options.io: - self.options.octree = True - if self.options.filters: - self.options.kdtree = True - self.options.search = True - self.options.sample_consensus = True - if self.options.segmentation: - self.options.ml = True - if self.options.features: - self.options.twod = True + if self.options.module_registration: + self.options.module_octree = True + self.options.module_filters = True + self.options.module_features = True + self.options.module_2d = True + if self.options.module_io: + self.options.module_octree = True + if self.options.module_filters: + self.options.module_kdtree = True + self.options.module_search = True + self.options.module_sample_consensus = True + if self.options.module_segmentation: + self.options.module_ml = True + if self.options.module_features: + self.options.module_2d = True def _configure_cmake(self): @@ -152,23 +153,23 @@ def _configure_cmake(self): "FLANN_USE_STATIC": not self.options["flann"].shared } pcl_features = { - "BUILD_kdtree": self.options.kdtree, - "BUILD_octree": self.options.octree, - "BUILD_search": self.options.search, - "BUILD_sample_consensus": self.options.sample_consensus, - "BUILD_filters": self.options.filters, - "BUILD_2d": self.options.twod, - "BUILD_geometry": self.options.geometry, - "BUILD_io": self.options.io, - "BUILD_features": self.options.features, - "BUILD_ml": self.options.ml, - "BUILD_segmentation": self.options.segmentation, - "BUILD_surface": self.options.surface, - "BUILD_registration": self.options.registration, - "BUILD_keypoints": self.options.keypoints, - "BUILD_tracking": self.options.tracking, - "BUILD_recognition": self.options.recognition, - "BUILD_stereo": self.options.stereo + "BUILD_kdtree": self.options.module_kdtree, + "BUILD_octree": self.options.module_octree, + "BUILD_search": self.options.module_search, + "BUILD_sample_consensus": self.options.module_sample_consensus, + "BUILD_filters": self.options.module_filters, + "BUILD_2d": self.options.module_2d, + "BUILD_geometry": self.options.module_geometry, + "BUILD_io": self.options.module_io, + "BUILD_features": self.options.module_features, + "BUILD_ml": self.options.module_ml, + "BUILD_segmentation": self.options.module_segmentation, + "BUILD_surface": self.options.module_surface, + "BUILD_module_registration": self.options.module_registration, + "BUILD_module_keypoints": self.options.module_keypoints, + "BUILD_module_tracking": self.options.module_tracking, + "BUILD_recognition": self.options.module_recognition, + "BUILD_stereo": self.options.module_stereo } if self.options.png: From 8b74bdecf9b379b8e61e8837e404e20273f13b3b Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sat, 13 Jun 2020 15:36:53 +0100 Subject: [PATCH 06/53] rename options and add opengl requirement --- recipes/pcl/all/conanfile.py | 101 ++++++++++++++++++----------------- 1 file changed, 51 insertions(+), 50 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index e0911aee1420a..52e09a052b93a 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -9,25 +9,25 @@ class PclConanRecipe(ConanFile): description = "Point Cloud Library" license = "BSD-3-Clause" homepage = "https://pointclouds.org/" - url = "https://github.com/conan-module_io/conan-center-index" + url = "https://github.com/conan-io/conan-center-index" settings = "os", "compiler", "build_type", "arch" options = { "shared": [True, False], "fPIC": [True, False], - "tools": [True, False], - "usb": [True, False], - "png": [True, False], - "qhull": [True, False], - "cuda": [True, False], - "vtk": [True, False], - "pcap": [True, False], - "opengl": [True, False], - "openni": [True, False], - "openni2": [True, False], - "ensenso": [True, False], - "davidsdk": [True, False], - "dssdk": [True, False], - "rssdk": [True, False], + "with_cuda": [True, False], + "with_davidsdk": [True, False], + "with_dssdk": [True, False], + "with_ensenso": [True, False], + "with_opengl": [True, False], + "with_openni": [True, False], + "with_openni2": [True, False], + "with_pcap": [True, False], + "with_png": [True, False], + "with_qhull": [True, False], + "with_rssdk": [True, False], + "with_tools": [True, False], + "with_usb": [True, False], + "with_vtk": [True, False], "module_2d": [True, False], "module_features": [True, False], "module_filters": [True, False], @@ -49,21 +49,21 @@ class PclConanRecipe(ConanFile): default_options = { "shared": True, "fPIC": True, - "tools": False, "boost:shared": True, - "usb": False, - "png": True, - "qhull": True, - "cuda": False, - "vtk": False, - "pcap": False, - "opengl": True, - "openni": False, - "openni2": False, - "ensenso": False, - "davidsdk": False, - "dssdk": False, - "rssdk": False, + "with_cuda": False, + "with_davidsdk": False, + "with_dssdk": False, + "with_ensenso": False, + "with_opengl": True, + "with_openni": False, + "with_openni2": False, + "with_qhull": True, + "with_pcap": False, + "with_png": True, + "with_rssdk": False, + "with_tools": False, + "with_usb": False, + "with_vtk": False, "module_2d": False, "module_features": False, "module_filters": False, @@ -102,11 +102,13 @@ def source(self): tools.replace_in_file("CMakeLists.txt", "add_subdirectory(pcl)", f"add_subdirectory({self._source_subfolder})") def requirements(self): - if self.options.png: + if self.options.with_png: self.requires("libpng/[>1.6.36]") - if self.options.qhull: + if self.options.with_qhull: self.requires("qhull/[>7.3.0]") - self.options["qhull"].shared=False + self.options["qhull"].shared = False + if self.options.with_opengl: + self.requires("opengl/system") def configure(self): if self.options.module_registration: @@ -125,30 +127,29 @@ def configure(self): if self.options.module_features: self.options.module_2d = True - def _configure_cmake(self): cmake_definitions = { - "PCL_BUILD_WITH_BOOST_DYNAMIC_LINKING_WIN32": self.options["boost"].shared, + "PCL_BUILD_WITH_BOOST_DYNAMIC_LINKING_WIN32": self.options["boost"].shared } pcl_config = { "EIGEN_ROOT": self.deps_cpp_info["eigen"].rootpath, "FLANN_ROOT": self.deps_cpp_info["flann"].rootpath, "BOOST_ROOT": self.deps_cpp_info["boost"].rootpath, - "BUILD_tools": self.options.tools, - "WITH_LIBUSB": self.options.usb, - "WITH_PNG": self.options.png, - "WITH_QHULL": self.options.qhull, - "WITH_CUDA": self.options.cuda, - "WITH_VTK": self.options.vtk, - "WITH_PCAP": self.options.pcap, - "WITH_OPENGL": self.options.opengl, - "WITH_OPENNI": self.options.openni2, - "WITH_OPENNI2": self.options.openni2, - "WITH_ENSENSO": self.options.ensenso, - "WITH_DAVIDSDK": self.options.davidsdk, - "WITH_DSSDK": self.options.dssdk, - "WITH_RSSDK": self.options.rssdk, + "BUILD_tools": self.options.with_tools, + "WITH_LIBUSB": self.options.with_usb, + "WITH_PNG": self.options.with_png, + "WITH_QHULL": self.options.with_qhull, + "WITH_CUDA": self.options.with_cuda, + "WITH_VTK": self.options.with_vtk, + "WITH_PCAP": self.options.with_pcap, + "WITH_OPENGL": self.options.with_opengl, + "WITH_OPENNI": self.options.with_openni, + "WITH_OPENNI2": self.options.with_openni2, + "WITH_ENSENSO": self.options.with_ensenso, + "WITH_DAVIDSDK": self.options.with_davidsdk, + "WITH_DSSDK": self.options.with_dssdk, + "WITH_RSSDK": self.options.with_rssdk, "PCL_SHARED_LIBS": self.options.shared, "FLANN_USE_STATIC": not self.options["flann"].shared } @@ -172,9 +173,9 @@ def _configure_cmake(self): "BUILD_stereo": self.options.module_stereo } - if self.options.png: + if self.options.with_png: pcl_config["LIBPNG_ROOT"] = self.deps_cpp_info["libpng"].rootpath - if self.options.qhull: + if self.options.with_qhull: pcl_config["QHULL_ROOT"] = self.deps_cpp_info["qhull"].rootpath pcl_config["QHULL_USE_STATIC"] = True From 2c755e91b0021039232303aa31e735ad4612380f Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sun, 28 Jun 2020 12:57:17 +0100 Subject: [PATCH 07/53] Remove most package options and just use sensible defaults --- recipes/pcl/all/conanfile.py | 165 +++++++++-------------------------- 1 file changed, 41 insertions(+), 124 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 52e09a052b93a..655fbacd545e8 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -15,76 +15,21 @@ class PclConanRecipe(ConanFile): "shared": [True, False], "fPIC": [True, False], "with_cuda": [True, False], - "with_davidsdk": [True, False], - "with_dssdk": [True, False], - "with_ensenso": [True, False], - "with_opengl": [True, False], - "with_openni": [True, False], - "with_openni2": [True, False], - "with_pcap": [True, False], - "with_png": [True, False], - "with_qhull": [True, False], - "with_rssdk": [True, False], - "with_tools": [True, False], - "with_usb": [True, False], - "with_vtk": [True, False], - "module_2d": [True, False], - "module_features": [True, False], - "module_filters": [True, False], - "module_geometry": [True, False], - "module_io": [True, False], - "module_kdtree": [True, False], - "module_keypoints": [True, False], - "module_ml": [True, False], - "module_octree": [True, False], - "module_registration": [True, False], - "module_sample_consensus": [True, False], - "module_search": [True, False], - "module_segmentation": [True, False], - "module_stereo": [True, False], - "module_surface": [True, False], - "module_tracking": [True, False], - "module_recognition": [True, False] + "with_tools": [True, False] } default_options = { "shared": True, "fPIC": True, - "boost:shared": True, "with_cuda": False, - "with_davidsdk": False, - "with_dssdk": False, - "with_ensenso": False, - "with_opengl": True, - "with_openni": False, - "with_openni2": False, - "with_qhull": True, - "with_pcap": False, - "with_png": True, - "with_rssdk": False, - "with_tools": False, - "with_usb": False, - "with_vtk": False, - "module_2d": False, - "module_features": False, - "module_filters": False, - "module_geometry": True, - "module_io": True, - "module_kdtree": True, - "module_keypoints": False, - "module_ml": True, - "module_octree": True, - "module_recognition": False, - "module_registration": True, - "module_sample_consensus": False, - "module_search": False, - "module_segmentation": True, - "module_stereo": False, - "module_surface": True, - "module_tracking": False + "with_tools": False } - requires = ("boost/[>1.69.0]", - "eigen/[>3.3.5]", - "flann/[>1.9.0]") + requires = ("boost/1.70.0]", + "eigen/3.3.7", + "flann/1.9.1", + "libpng/1.6.37", + "qhull/[>7.3.0]" + + ) generators = "cmake" exports = ["CMakeLists.txt"] @@ -101,32 +46,6 @@ def source(self): tools.get(**self.conan_data["sources"][self.version]) tools.replace_in_file("CMakeLists.txt", "add_subdirectory(pcl)", f"add_subdirectory({self._source_subfolder})") - def requirements(self): - if self.options.with_png: - self.requires("libpng/[>1.6.36]") - if self.options.with_qhull: - self.requires("qhull/[>7.3.0]") - self.options["qhull"].shared = False - if self.options.with_opengl: - self.requires("opengl/system") - - def configure(self): - if self.options.module_registration: - self.options.module_octree = True - self.options.module_filters = True - self.options.module_features = True - self.options.module_2d = True - if self.options.module_io: - self.options.module_octree = True - if self.options.module_filters: - self.options.module_kdtree = True - self.options.module_search = True - self.options.module_sample_consensus = True - if self.options.module_segmentation: - self.options.module_ml = True - if self.options.module_features: - self.options.module_2d = True - def _configure_cmake(self): cmake_definitions = { "PCL_BUILD_WITH_BOOST_DYNAMIC_LINKING_WIN32": self.options["boost"].shared @@ -137,47 +56,45 @@ def _configure_cmake(self): "FLANN_ROOT": self.deps_cpp_info["flann"].rootpath, "BOOST_ROOT": self.deps_cpp_info["boost"].rootpath, "BUILD_tools": self.options.with_tools, - "WITH_LIBUSB": self.options.with_usb, - "WITH_PNG": self.options.with_png, - "WITH_QHULL": self.options.with_qhull, + "WITH_LIBUSB": False, + "WITH_PNG": True, + "WITH_QHULL": True, "WITH_CUDA": self.options.with_cuda, - "WITH_VTK": self.options.with_vtk, - "WITH_PCAP": self.options.with_pcap, - "WITH_OPENGL": self.options.with_opengl, - "WITH_OPENNI": self.options.with_openni, - "WITH_OPENNI2": self.options.with_openni2, - "WITH_ENSENSO": self.options.with_ensenso, - "WITH_DAVIDSDK": self.options.with_davidsdk, - "WITH_DSSDK": self.options.with_dssdk, - "WITH_RSSDK": self.options.with_rssdk, + "WITH_VTK": False, + "WITH_PCAP": False, + "WITH_OPENGL": True, + "WITH_OPENNI": False, + "WITH_OPENNI2": False, + "WITH_ENSENSO": False, + "WITH_DAVIDSDK": False, + "WITH_DSSDK": False, + "WITH_RSSDK": False, "PCL_SHARED_LIBS": self.options.shared, "FLANN_USE_STATIC": not self.options["flann"].shared } pcl_features = { - "BUILD_kdtree": self.options.module_kdtree, - "BUILD_octree": self.options.module_octree, - "BUILD_search": self.options.module_search, - "BUILD_sample_consensus": self.options.module_sample_consensus, - "BUILD_filters": self.options.module_filters, - "BUILD_2d": self.options.module_2d, - "BUILD_geometry": self.options.module_geometry, - "BUILD_io": self.options.module_io, - "BUILD_features": self.options.module_features, - "BUILD_ml": self.options.module_ml, - "BUILD_segmentation": self.options.module_segmentation, - "BUILD_surface": self.options.module_surface, - "BUILD_module_registration": self.options.module_registration, - "BUILD_module_keypoints": self.options.module_keypoints, - "BUILD_module_tracking": self.options.module_tracking, - "BUILD_recognition": self.options.module_recognition, - "BUILD_stereo": self.options.module_stereo + "BUILD_kdtree": True, + "BUILD_octree": True, + "BUILD_search": True, + "BUILD_sample_consensus": True, + "BUILD_filters": True, + "BUILD_2d": True, + "BUILD_geometry": True, + "BUILD_io": True, + "BUILD_features": True, + "BUILD_ml": True, + "BUILD_segmentation": True, + "BUILD_surface": True, + "BUILD_module_registration": True, + "BUILD_module_keypoints": True, + "BUILD_module_tracking": True, + "BUILD_recognition": True, + "BUILD_stereo": True, } - if self.options.with_png: - pcl_config["LIBPNG_ROOT"] = self.deps_cpp_info["libpng"].rootpath - if self.options.with_qhull: - pcl_config["QHULL_ROOT"] = self.deps_cpp_info["qhull"].rootpath - pcl_config["QHULL_USE_STATIC"] = True + pcl_config["LIBPNG_ROOT"] = self.deps_cpp_info["libpng"].rootpath + pcl_config["QHULL_ROOT"] = self.deps_cpp_info["qhull"].rootpath + pcl_config["QHULL_USE_STATIC"] = True cmake = CMake(self) cmake.definitions.update(cmake_definitions) From 843cf5516915118a7b70778e30b98bfd2da07d00 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sun, 28 Jun 2020 13:08:10 +0100 Subject: [PATCH 08/53] use cmake to specify subfolder name --- recipes/pcl/all/CMakeLists.txt | 2 +- recipes/pcl/all/conanfile.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/recipes/pcl/all/CMakeLists.txt b/recipes/pcl/all/CMakeLists.txt index 436653d253bae..2eabcd9b98af9 100644 --- a/recipes/pcl/all/CMakeLists.txt +++ b/recipes/pcl/all/CMakeLists.txt @@ -1,4 +1,4 @@ cmake_minimum_required(VERSION 3.10) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() -add_subdirectory(pcl) +add_subdirectory(pcl-pcl-${CONAN_PCL_VERSION}) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 655fbacd545e8..6f8e28a146bdc 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -23,11 +23,11 @@ class PclConanRecipe(ConanFile): "with_cuda": False, "with_tools": False } - requires = ("boost/1.70.0]", + requires = ("boost/1.70.0", "eigen/3.3.7", "flann/1.9.1", "libpng/1.6.37", - "qhull/[>7.3.0]" + "qhull/7.3.2" ) generators = "cmake" @@ -44,10 +44,10 @@ def _source_subfolder(self): def source(self): tools.get(**self.conan_data["sources"][self.version]) - tools.replace_in_file("CMakeLists.txt", "add_subdirectory(pcl)", f"add_subdirectory({self._source_subfolder})") def _configure_cmake(self): cmake_definitions = { + "CONAN_PCL_VERSION": self.version, "PCL_BUILD_WITH_BOOST_DYNAMIC_LINKING_WIN32": self.options["boost"].shared } From 9050c8d88de5ddbb1737bdad17c7f69650c070ed Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sun, 28 Jun 2020 13:25:06 +0100 Subject: [PATCH 09/53] Address PR comments --- recipes/pcl/all/CMakeLists.txt | 2 +- recipes/pcl/all/conanfile.py | 23 ++++++++++++--------- recipes/pcl/all/test_package/CMakeLists.txt | 2 +- recipes/pcl/all/test_package/conanfile.py | 7 ++++--- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/recipes/pcl/all/CMakeLists.txt b/recipes/pcl/all/CMakeLists.txt index 2eabcd9b98af9..4fe85e0dbe85f 100644 --- a/recipes/pcl/all/CMakeLists.txt +++ b/recipes/pcl/all/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.1.3) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() add_subdirectory(pcl-pcl-${CONAN_PCL_VERSION}) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 6f8e28a146bdc..5fb0ad4017747 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -2,6 +2,7 @@ import os.path from conans import ConanFile, CMake, tools +from conans.errors import ConanInvalidConfiguration class PclConanRecipe(ConanFile): @@ -21,7 +22,8 @@ class PclConanRecipe(ConanFile): "shared": True, "fPIC": True, "with_cuda": False, - "with_tools": False + "with_tools": False, + "qhull:shared": False } requires = ("boost/1.70.0", "eigen/3.3.7", @@ -33,18 +35,18 @@ class PclConanRecipe(ConanFile): generators = "cmake" exports = ["CMakeLists.txt"] - @property - def _major_minor_version(self): - major, minor, patch = self.version.split(".") - return ".".join([major, minor]) - @property def _source_subfolder(self): - return f"pcl-pcl-{self.version}" + return "pcl-pcl-{}".format(self.version) def source(self): tools.get(**self.conan_data["sources"][self.version]) + def configure(self): + tools.check_min_cppstd(self, "14") + if self.options["qhull"].shared: + raise ConanInvalidConfiguration("PCL Requires a static build of QHull") + def _configure_cmake(self): cmake_definitions = { "CONAN_PCL_VERSION": self.version, @@ -111,9 +113,10 @@ def package(self): cmake = self._configure_cmake() cmake.install() self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) - shutil.rmtree(os.path.join(self.package_folder, "share")) - shutil.rmtree(os.path.join(self.package_folder, "lib", "pkgconfig")) + tools.rmdir(os.path.join(self.package_folder, "share")) + tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): - self.cpp_info.includedirs = [f"include/pcl-{self._major_minor_version}"] + semver = tools.Version(self.version) + self.cpp_info.includedirs = ["include/pcl-{}-{}".format(semver.major, semver.minor)] self.cpp_info.libs = tools.collect_libs(self) diff --git a/recipes/pcl/all/test_package/CMakeLists.txt b/recipes/pcl/all/test_package/CMakeLists.txt index ccf513ca0bde9..9c92252e88d4d 100644 --- a/recipes/pcl/all/test_package/CMakeLists.txt +++ b/recipes/pcl/all/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.1.3) project(PclTestPackage) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) diff --git a/recipes/pcl/all/test_package/conanfile.py b/recipes/pcl/all/test_package/conanfile.py index cd8d45a2b1857..7662da90d57cf 100644 --- a/recipes/pcl/all/test_package/conanfile.py +++ b/recipes/pcl/all/test_package/conanfile.py @@ -1,4 +1,4 @@ -from conans import ConanFile, CMake +from conans import ConanFile, CMake, tools import os @@ -13,5 +13,6 @@ def build(self): cmake.build() def test(self): - os.chdir('bin') - self.run('.{}pcl_test_package'.format(os.sep)) + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "pcl_test_package") + self.run(bin_path, run_environment=True) From 6b6ddb57339f364f33bb11b10d163d9645de799e Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sun, 28 Jun 2020 19:19:45 +0100 Subject: [PATCH 10/53] Use cmake find package generator --- recipes/pcl/all/conanfile.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 5fb0ad4017747..b2395ec90b78f 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -1,4 +1,3 @@ -import shutil import os.path from conans import ConanFile, CMake, tools @@ -29,10 +28,8 @@ class PclConanRecipe(ConanFile): "eigen/3.3.7", "flann/1.9.1", "libpng/1.6.37", - "qhull/7.3.2" - - ) - generators = "cmake" + "qhull/7.3.2") + generators = ["cmake", "cmake_find_package"] exports = ["CMakeLists.txt"] @property @@ -54,9 +51,6 @@ def _configure_cmake(self): } pcl_config = { - "EIGEN_ROOT": self.deps_cpp_info["eigen"].rootpath, - "FLANN_ROOT": self.deps_cpp_info["flann"].rootpath, - "BOOST_ROOT": self.deps_cpp_info["boost"].rootpath, "BUILD_tools": self.options.with_tools, "WITH_LIBUSB": False, "WITH_PNG": True, @@ -94,8 +88,6 @@ def _configure_cmake(self): "BUILD_stereo": True, } - pcl_config["LIBPNG_ROOT"] = self.deps_cpp_info["libpng"].rootpath - pcl_config["QHULL_ROOT"] = self.deps_cpp_info["qhull"].rootpath pcl_config["QHULL_USE_STATIC"] = True cmake = CMake(self) @@ -118,5 +110,5 @@ def package(self): def package_info(self): semver = tools.Version(self.version) - self.cpp_info.includedirs = ["include/pcl-{}-{}".format(semver.major, semver.minor)] + self.cpp_info.includedirs = ["include/pcl-{}.{}".format(semver.major, semver.minor)] self.cpp_info.libs = tools.collect_libs(self) From 3cc5c64aeef1f70810a31884012d0a0f51b73182 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sun, 28 Jun 2020 19:21:00 +0100 Subject: [PATCH 11/53] call convex hull operation in test package --- recipes/pcl/all/test_package/conanfile.py | 1 - recipes/pcl/all/test_package/example.cpp | 23 ++++++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/recipes/pcl/all/test_package/conanfile.py b/recipes/pcl/all/test_package/conanfile.py index 7662da90d57cf..2a4e17a7bc1d3 100644 --- a/recipes/pcl/all/test_package/conanfile.py +++ b/recipes/pcl/all/test_package/conanfile.py @@ -1,7 +1,6 @@ from conans import ConanFile, CMake, tools import os - class PclTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" generators = "cmake" diff --git a/recipes/pcl/all/test_package/example.cpp b/recipes/pcl/all/test_package/example.cpp index 557740c8e9b15..6e3882cca8e47 100644 --- a/recipes/pcl/all/test_package/example.cpp +++ b/recipes/pcl/all/test_package/example.cpp @@ -1,12 +1,25 @@ #include +#include +#include #include int main() { - pcl::PointXYZ p; - p.x = -1.0f; - p.y = 3.14f; - p.z = 42.0f; - std::cout << "PointXYZ: " << p << std::endl; + auto cloud = std::make_shared>(); + cloud->emplace_back(-1, -1, 0); + cloud->emplace_back(1, -1, 0); + cloud->emplace_back(0, 1, 0); + cloud->emplace_back(0, 0, 1); + + std::cout << "Calculating convex hull\n"; + + pcl::PointCloud hull_geometry; + + pcl::ConvexHull hull; + hull.setInputCloud(cloud); + hull.setComputeAreaVolume(true); + hull.reconstruct(hull_geometry); + + std::cout << "Convex Hull Volume: " << hull.getTotalVolume() << std::endl; } From 3c21176a9066256a95ccb57ab7d6fc90d59c1104 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sun, 28 Jun 2020 19:23:53 +0100 Subject: [PATCH 12/53] remove requirement for qhull to be static --- recipes/pcl/all/conanfile.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index b2395ec90b78f..10d4aff64fe04 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -1,7 +1,6 @@ import os.path from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration class PclConanRecipe(ConanFile): @@ -41,8 +40,6 @@ def source(self): def configure(self): tools.check_min_cppstd(self, "14") - if self.options["qhull"].shared: - raise ConanInvalidConfiguration("PCL Requires a static build of QHull") def _configure_cmake(self): cmake_definitions = { @@ -66,7 +63,8 @@ def _configure_cmake(self): "WITH_DSSDK": False, "WITH_RSSDK": False, "PCL_SHARED_LIBS": self.options.shared, - "FLANN_USE_STATIC": not self.options["flann"].shared + "FLANN_USE_STATIC": not self.options["flann"].shared, + "QHULL_USE_STATIC": not self.options["qhull"].shared } pcl_features = { "BUILD_kdtree": True, @@ -88,8 +86,6 @@ def _configure_cmake(self): "BUILD_stereo": True, } - pcl_config["QHULL_USE_STATIC"] = True - cmake = CMake(self) cmake.definitions.update(cmake_definitions) cmake.definitions.update(pcl_config) From 13125af333cdd895b4ebc76e37210708336a8916 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sun, 28 Jun 2020 20:20:20 +0100 Subject: [PATCH 13/53] remove fpic for windows --- recipes/pcl/all/conanfile.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 10d4aff64fe04..6d9c493385f18 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -38,6 +38,10 @@ def _source_subfolder(self): def source(self): tools.get(**self.conan_data["sources"][self.version]) + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + def configure(self): tools.check_min_cppstd(self, "14") From 2347012991210cbac61eaf15c749e9c67e61c1d2 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sun, 28 Jun 2020 22:09:30 +0100 Subject: [PATCH 14/53] VS 2015 not supported --- recipes/pcl/all/conanfile.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 6d9c493385f18..c037817093c72 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -1,6 +1,7 @@ import os.path from conans import ConanFile, CMake, tools +from conans.errors import ConanInvalidConfiguration class PclConanRecipe(ConanFile): @@ -43,6 +44,9 @@ def config_options(self): del self.options.fPIC def configure(self): + if self.settings.compiler == "Visual Studio": + if self.settings.compiler.version == 14 or self.settings.compiler.toolset == "v140": + raise ConanInvalidConfiguration("Unsupported Visual Studio Compiler or Toolset") tools.check_min_cppstd(self, "14") def _configure_cmake(self): From 2f0a1ec415e01c64ba125bfac2a9e7d70c98ccd9 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Mon, 29 Jun 2020 08:33:49 +0100 Subject: [PATCH 15/53] restore opengl requirement (accidentally deleted) --- 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 c037817093c72..fa41064644e7f 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -28,6 +28,7 @@ class PclConanRecipe(ConanFile): "eigen/3.3.7", "flann/1.9.1", "libpng/1.6.37", + "opengl/system", "qhull/7.3.2") generators = ["cmake", "cmake_find_package"] exports = ["CMakeLists.txt"] From 2145466e9267c52521e0619b2527bf6d2f091cc7 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Mon, 29 Jun 2020 09:07:05 +0100 Subject: [PATCH 16/53] remove vs runtime files --- recipes/pcl/all/conanfile.py | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index fa41064644e7f..1d25ee5fb5a9c 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -1,4 +1,7 @@ -import os.path +import os +from os.path import join +from glob import glob +from itertools import chain from conans import ConanFile, CMake, tools from conans.errors import ConanInvalidConfiguration @@ -45,9 +48,8 @@ def config_options(self): del self.options.fPIC def configure(self): - if self.settings.compiler == "Visual Studio": - if self.settings.compiler.version == 14 or self.settings.compiler.toolset == "v140": - raise ConanInvalidConfiguration("Unsupported Visual Studio Compiler or Toolset") + if tools.msvs_toolset(self) == "v140": + raise ConanInvalidConfiguration("Unsupported Visual Studio Compiler or Toolset") tools.check_min_cppstd(self, "14") def _configure_cmake(self): @@ -106,12 +108,25 @@ def build(self): cmake = self._configure_cmake() cmake.build() + def _remove_vs_runtime_files(self): + patterns = [join(self.package_folder, pattern) for pattern in ["msvcp*.dll", "vcruntime*.dll", "concrt*.dll"]] + runtime_files = chain.from_iterable(glob(pattern) for pattern in patterns) + for runtime_file in runtime_files: + try: + os.remove(runtime_file) + except Exception as ex: + self.output.warn("Could not remove vs runtime file {}, {}".format(runtime_file, ex)) + def package(self): cmake = self._configure_cmake() cmake.install() self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + if self.settings.os == "Windows": + self._remove_vs_runtime_files() + + tools.rmdir(join(self.package_folder, "cmake")) + tools.rmdir(join(self.package_folder, "share")) + tools.rmdir(join(self.package_folder, "lib", "pkgconfig")) def package_info(self): semver = tools.Version(self.version) From d63624018385347e96d4f6084c37a15c6813dad2 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Mon, 29 Jun 2020 09:09:02 +0100 Subject: [PATCH 17/53] fix vs runtime file path --- 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 1d25ee5fb5a9c..1bdebbec4899b 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -109,7 +109,7 @@ def build(self): cmake.build() def _remove_vs_runtime_files(self): - patterns = [join(self.package_folder, pattern) for pattern in ["msvcp*.dll", "vcruntime*.dll", "concrt*.dll"]] + patterns = [join(self.package_folder, "bin", pattern) for pattern in ["msvcp*.dll", "vcruntime*.dll", "concrt*.dll"]] runtime_files = chain.from_iterable(glob(pattern) for pattern in patterns) for runtime_file in runtime_files: try: From 2741a6ea9f367280d52b06b297056d9b7b17f767 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Mon, 29 Jun 2020 09:10:46 +0100 Subject: [PATCH 18/53] remove qhull default option --- 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 1bdebbec4899b..ed2619e1afbf5 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -24,8 +24,7 @@ class PclConanRecipe(ConanFile): "shared": True, "fPIC": True, "with_cuda": False, - "with_tools": False, - "qhull:shared": False + "with_tools": False } requires = ("boost/1.70.0", "eigen/3.3.7", From c2728203a78640118925684d51b52d9dbb71ed02 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Mon, 29 Jun 2020 10:59:41 +0100 Subject: [PATCH 19/53] support pcl 1.10 in test package --- recipes/pcl/all/test_package/example.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/recipes/pcl/all/test_package/example.cpp b/recipes/pcl/all/test_package/example.cpp index 6e3882cca8e47..5d36dd5b6858f 100644 --- a/recipes/pcl/all/test_package/example.cpp +++ b/recipes/pcl/all/test_package/example.cpp @@ -3,10 +3,12 @@ #include #include + +using PointCloud = pcl::PointCloud; int main() { - auto cloud = std::make_shared>(); + auto cloud = PointCloud::Ptr(new PointCloud); cloud->emplace_back(-1, -1, 0); cloud->emplace_back(1, -1, 0); cloud->emplace_back(0, 1, 0); @@ -14,7 +16,7 @@ int main() { std::cout << "Calculating convex hull\n"; - pcl::PointCloud hull_geometry; + PointCloud hull_geometry; pcl::ConvexHull hull; hull.setInputCloud(cloud); From 53da8bb83f9e2675c35a9d3bf4df0c72c9ec3b95 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Mon, 29 Jun 2020 22:57:31 +0100 Subject: [PATCH 20/53] Update recipes/pcl/all/conanfile.py Co-authored-by: Uilian Ries --- 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 ed2619e1afbf5..d4fdc3b866bf5 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -41,6 +41,7 @@ def _source_subfolder(self): def source(self): tools.get(**self.conan_data["sources"][self.version]) + os.rename("pcl-pcl-{}".format(self.version), self._source_subfolder) def config_options(self): if self.settings.os == "Windows": From 8fd2f6489d5372739868b2104404da78f97a14b7 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Mon, 29 Jun 2020 22:57:44 +0100 Subject: [PATCH 21/53] Update recipes/pcl/all/CMakeLists.txt Co-authored-by: Uilian Ries --- recipes/pcl/all/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/pcl/all/CMakeLists.txt b/recipes/pcl/all/CMakeLists.txt index 4fe85e0dbe85f..081f4df0ad7ac 100644 --- a/recipes/pcl/all/CMakeLists.txt +++ b/recipes/pcl/all/CMakeLists.txt @@ -1,4 +1,4 @@ cmake_minimum_required(VERSION 3.1.3) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() -add_subdirectory(pcl-pcl-${CONAN_PCL_VERSION}) +add_subdirectory(source_subfolder) From 56461611e21f9dbf348feae8e4b48335ca36150d Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Mon, 29 Jun 2020 22:58:02 +0100 Subject: [PATCH 22/53] Update recipes/pcl/all/conanfile.py Co-authored-by: Uilian Ries --- 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 d4fdc3b866bf5..5d1efdd3d074c 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -37,7 +37,7 @@ class PclConanRecipe(ConanFile): @property def _source_subfolder(self): - return "pcl-pcl-{}".format(self.version) + return "source_subfolder" def source(self): tools.get(**self.conan_data["sources"][self.version]) From d03b3701e89d7bc923cc5c0a26f39b920f58e9a6 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Mon, 29 Jun 2020 22:58:16 +0100 Subject: [PATCH 23/53] Update recipes/pcl/all/CMakeLists.txt Co-authored-by: Uilian Ries --- recipes/pcl/all/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/pcl/all/CMakeLists.txt b/recipes/pcl/all/CMakeLists.txt index 081f4df0ad7ac..96329cfc629d4 100644 --- a/recipes/pcl/all/CMakeLists.txt +++ b/recipes/pcl/all/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1.3) +cmake_minimum_required(VERSION 2.8.12) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() add_subdirectory(source_subfolder) From db4eb9a9b169d3f366efb2c5c07e83659289fa44 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Mon, 29 Jun 2020 22:58:39 +0100 Subject: [PATCH 24/53] Update recipes/pcl/all/conanfile.py Co-authored-by: Uilian Ries --- recipes/pcl/all/conanfile.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 5d1efdd3d074c..b2b6413af2786 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -50,7 +50,26 @@ def config_options(self): def configure(self): if tools.msvs_toolset(self) == "v140": raise ConanInvalidConfiguration("Unsupported Visual Studio Compiler or Toolset") - tools.check_min_cppstd(self, "14") + minimal_cpp_standard = "14" + if self.settings.compiler.cppstd: + tools.check_min_cppstd(self, minimal_cpp_standard) + minimal_version = { + "gcc": "5", + "clang": "3.4", + "apple-clang": "10", + "Visual Studio": "14" + } + compiler = str(self.settings.compiler) + if compiler not in minimal_version: + self.output.warn( + "%s recipe lacks information about the %s compiler standard version support" % (self.name, compiler)) + self.output.warn( + "%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) + return + version = tools.Version(self.settings.compiler.version) + if version < minimal_version[compiler]: + raise ConanInvalidConfiguration("%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) + def _configure_cmake(self): cmake_definitions = { From 9129ede525db78ae78d2d8eee89d8a310cab57fd Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Mon, 29 Jun 2020 22:59:03 +0100 Subject: [PATCH 25/53] Update recipes/pcl/all/test_package/conanfile.py Co-authored-by: Uilian Ries --- recipes/pcl/all/test_package/conanfile.py | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes/pcl/all/test_package/conanfile.py b/recipes/pcl/all/test_package/conanfile.py index 2a4e17a7bc1d3..0a0b4246a66a3 100644 --- a/recipes/pcl/all/test_package/conanfile.py +++ b/recipes/pcl/all/test_package/conanfile.py @@ -4,7 +4,6 @@ class PclTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" generators = "cmake" - short_paths = True def build(self): cmake = CMake(self) From 388be41256333e09a897fa6f1c9ae6be3c1ec56f Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Mon, 29 Jun 2020 23:08:24 +0100 Subject: [PATCH 26/53] use cmake member variable --- recipes/pcl/all/conanfile.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index b2b6413af2786..4723ca2bdadee 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -70,8 +70,10 @@ def configure(self): if version < minimal_version[compiler]: raise ConanInvalidConfiguration("%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) - def _configure_cmake(self): + if self._cmake: + return self._cmake + cmake_definitions = { "CONAN_PCL_VERSION": self.version, "PCL_BUILD_WITH_BOOST_DYNAMIC_LINKING_WIN32": self.options["boost"].shared @@ -116,12 +118,12 @@ def _configure_cmake(self): "BUILD_stereo": True, } - cmake = CMake(self) - cmake.definitions.update(cmake_definitions) - cmake.definitions.update(pcl_config) - cmake.definitions.update(pcl_features) - cmake.configure() - return cmake + self._cmake = CMake(self) + self._cmake.definitions.update(cmake_definitions) + self._cmake.definitions.update(pcl_config) + self._cmake.definitions.update(pcl_features) + self._cmake.configure() + return self._cmake def build(self): cmake = self._configure_cmake() From 5143ee92a6277059c1ae670c3b1cb912fbe0e835 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Mon, 29 Jun 2020 23:26:32 +0100 Subject: [PATCH 27/53] fix cmake member variable --- 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 4723ca2bdadee..7682ec8068c01 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -34,6 +34,7 @@ class PclConanRecipe(ConanFile): "qhull/7.3.2") generators = ["cmake", "cmake_find_package"] exports = ["CMakeLists.txt"] + _cmake = None @property def _source_subfolder(self): From 605c4652884cf63dc1924744d2d5081e592a6e72 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Tue, 30 Jun 2020 16:56:44 +0100 Subject: [PATCH 28/53] Add topics and VS compatibility check --- recipes/pcl/all/conanfile.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 7682ec8068c01..98953ef5dbd92 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -1,5 +1,4 @@ import os -from os.path import join from glob import glob from itertools import chain @@ -13,6 +12,7 @@ class PclConanRecipe(ConanFile): license = "BSD-3-Clause" homepage = "https://pointclouds.org/" url = "https://github.com/conan-io/conan-center-index" + topics = ("pointcloud", "computer-vision", "point-cloud") settings = "os", "compiler", "build_type", "arch" options = { "shared": [True, False], @@ -49,7 +49,8 @@ def config_options(self): del self.options.fPIC def configure(self): - if tools.msvs_toolset(self) == "v140": + if (tools.msvs_toolset(self) == "v140" or + self.settings.compiler == "Visual Studio" and self.settings.compiler.version < "15"): raise ConanInvalidConfiguration("Unsupported Visual Studio Compiler or Toolset") minimal_cpp_standard = "14" if self.settings.compiler.cppstd: @@ -131,7 +132,7 @@ def build(self): cmake.build() def _remove_vs_runtime_files(self): - patterns = [join(self.package_folder, "bin", pattern) for pattern in ["msvcp*.dll", "vcruntime*.dll", "concrt*.dll"]] + patterns = [os.path.join(self.package_folder, "bin", pattern) for pattern in ["msvcp*.dll", "vcruntime*.dll", "concrt*.dll"]] runtime_files = chain.from_iterable(glob(pattern) for pattern in patterns) for runtime_file in runtime_files: try: @@ -146,9 +147,9 @@ def package(self): if self.settings.os == "Windows": self._remove_vs_runtime_files() - tools.rmdir(join(self.package_folder, "cmake")) - tools.rmdir(join(self.package_folder, "share")) - tools.rmdir(join(self.package_folder, "lib", "pkgconfig")) + tools.rmdir(os.path.join(self.package_folder, "cmake")) + tools.rmdir(os.path.join(self.package_folder, "share")) + tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): semver = tools.Version(self.version) From 1652b160b171b264ec1be4528c0c685b1644d278 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Tue, 30 Jun 2020 17:10:18 +0100 Subject: [PATCH 29/53] Fix compiler version check --- 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 98953ef5dbd92..5ac9bbc652279 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -50,7 +50,7 @@ def config_options(self): def configure(self): if (tools.msvs_toolset(self) == "v140" or - self.settings.compiler == "Visual Studio" and self.settings.compiler.version < "15"): + self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) < "15"): raise ConanInvalidConfiguration("Unsupported Visual Studio Compiler or Toolset") minimal_cpp_standard = "14" if self.settings.compiler.cppstd: From 9a399379d64e4fd7e89d82fc5a10995014226951 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sat, 29 Aug 2020 13:49:16 +0100 Subject: [PATCH 30/53] Add pcl subsystems as components --- recipes/pcl/all/conanfile.py | 56 +++++++++++++++++++-- recipes/pcl/all/test_package/CMakeLists.txt | 6 ++- recipes/pcl/all/test_package/conanfile.py | 2 +- 3 files changed, 58 insertions(+), 6 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 5ac9bbc652279..3d75bb2cbebfc 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -40,6 +40,11 @@ class PclConanRecipe(ConanFile): def _source_subfolder(self): return "source_subfolder" + @property + def _version_suffix(self): + semver = tools.Version(self.version) + return "{}.{}".format(semver.major, semver.minor) + def source(self): tools.get(**self.conan_data["sources"][self.version]) os.rename("pcl-pcl-{}".format(self.version), self._source_subfolder) @@ -151,7 +156,52 @@ def package(self): tools.rmdir(os.path.join(self.package_folder, "share")) tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + def _update_components(self, name, dependencies, header_only=False, extra_libs=None): + if not extra_libs: + extra_libs = [] + if not header_only: + self.cpp_info.components[name].libs = ["pcl_{}".format(lib) for lib in [name] + extra_libs] + self.cpp_info.components[name].includedirs = ["include/pcl-{}".format(self._version_suffix)] + self.cpp_info.components[name].name = "PCL_{}_LIBRARIES".format(name.upper()) + self.cpp_info.components[name].names["pkg_config"] = "pcl_{}-{}".format(name, self._version_suffix) + self.cpp_info.components[name].requires = dependencies + def package_info(self): - semver = tools.Version(self.version) - self.cpp_info.includedirs = ["include/pcl-{}.{}".format(semver.major, semver.minor)] - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.name = "PCL" + pcl_common = "common" + pcl_kdtree = "kdtree" + pcl_octree = "octree" + pcl_search = "search" + pcl_sample_consensus = "sample_consensus" + pcl_filters = "filters" + pcl_2d = "2d" + pcl_geometry = "geometry" + pcl_io = "io" + pcl_features = "features" + pcl_ml = "ml" + pcl_segmentation = "segmentation" + pcl_surface = "surface" + pcl_registration = "registration" + pcl_keypoints = "keypoints" + pcl_tracking = "tracking" + pcl_recognition = "recognition" + pcl_stereo = "stereo" + + self._update_components(pcl_common, ["eigen::eigen", "boost::boost", "opengl::opengl"]) + self._update_components(pcl_kdtree, [pcl_common, "flann::flann"]) + self._update_components(pcl_octree, [pcl_common]) + self._update_components(pcl_search, [pcl_common, pcl_kdtree, pcl_octree, "flann::flann"]) + self._update_components(pcl_sample_consensus, [pcl_common, pcl_search]) + self._update_components(pcl_filters, [pcl_common, pcl_sample_consensus, pcl_search, pcl_kdtree, pcl_octree]) + self._update_components(pcl_2d, [pcl_common, pcl_filters], header_only=True) + self._update_components(pcl_geometry, [pcl_common], header_only=True) + self._update_components(pcl_io, [pcl_common, pcl_octree, "libpng::libpng"], extra_libs=["io_ply"]) + self._update_components(pcl_features, [pcl_common,pcl_search, pcl_kdtree, pcl_octree, pcl_filters, pcl_2d]) + self._update_components(pcl_ml, [pcl_common]) + self._update_components(pcl_segmentation, [pcl_common, pcl_geometry, pcl_search, pcl_sample_consensus, pcl_kdtree, pcl_octree, pcl_features, pcl_filters, pcl_ml]) + self._update_components(pcl_surface, [pcl_common, pcl_search, pcl_kdtree, pcl_octree, "qhull::qhull"]) + self._update_components(pcl_registration, [pcl_common, pcl_octree, pcl_kdtree, pcl_search, pcl_sample_consensus, pcl_features, pcl_filters]) + self._update_components(pcl_keypoints, [pcl_common, pcl_search, pcl_kdtree, pcl_octree, pcl_features, pcl_filters]) + self._update_components(pcl_tracking, [pcl_common, pcl_search, pcl_kdtree, pcl_filters, pcl_octree]) + self._update_components(pcl_recognition, [pcl_common, pcl_io, pcl_search, pcl_kdtree, pcl_octree, pcl_features, pcl_filters, pcl_registration, pcl_sample_consensus, pcl_ml]) + self._update_components(pcl_stereo, [pcl_common, pcl_io]) diff --git a/recipes/pcl/all/test_package/CMakeLists.txt b/recipes/pcl/all/test_package/CMakeLists.txt index 9c92252e88d4d..d3d7eebfc9f72 100644 --- a/recipes/pcl/all/test_package/CMakeLists.txt +++ b/recipes/pcl/all/test_package/CMakeLists.txt @@ -2,8 +2,10 @@ cmake_minimum_required(VERSION 3.1.3) project(PclTestPackage) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +conan_basic_setup() + +find_package(PCL) add_executable(pcl_test_package example.cpp) target_compile_features(pcl_test_package PUBLIC cxx_std_14) -target_link_libraries(pcl_test_package PRIVATE ${CONAN_TARGETS}) +target_link_libraries(pcl_test_package PRIVATE PCL::PCL_SURFACE_LIBRARIES) diff --git a/recipes/pcl/all/test_package/conanfile.py b/recipes/pcl/all/test_package/conanfile.py index 0a0b4246a66a3..e01df55cf1184 100644 --- a/recipes/pcl/all/test_package/conanfile.py +++ b/recipes/pcl/all/test_package/conanfile.py @@ -3,7 +3,7 @@ class PclTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + generators = "cmake", "cmake_find_package" def build(self): cmake = CMake(self) From 6aa6ef9cee0d4c6f4c620f7769342859e027f42b Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sat, 29 Aug 2020 14:18:05 +0100 Subject: [PATCH 31/53] fix package naming for generators --- 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 3d75bb2cbebfc..5dbed6958a84f 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -167,7 +167,6 @@ def _update_components(self, name, dependencies, header_only=False, extra_libs=N self.cpp_info.components[name].requires = dependencies def package_info(self): - self.cpp_info.name = "PCL" pcl_common = "common" pcl_kdtree = "kdtree" pcl_octree = "octree" @@ -187,6 +186,9 @@ def package_info(self): pcl_recognition = "recognition" pcl_stereo = "stereo" + self.cpp_info.names["cmake_find_package"] = "PCL" + self.cpp_info.names["pkg_config"] = "PCL" + self._update_components(pcl_common, ["eigen::eigen", "boost::boost", "opengl::opengl"]) self._update_components(pcl_kdtree, [pcl_common, "flann::flann"]) self._update_components(pcl_octree, [pcl_common]) From 0bf19361326ca1635e053f38efd6c45433d4a3c0 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sat, 29 Aug 2020 16:13:14 +0100 Subject: [PATCH 32/53] Make shared false by default --- 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 5dbed6958a84f..5bd774f40befa 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -21,7 +21,7 @@ class PclConanRecipe(ConanFile): "with_tools": [True, False] } default_options = { - "shared": True, + "shared": False, "fPIC": True, "with_cuda": False, "with_tools": False From dae7be34f706c69ca12ef4e1470cffb1f6c15c7c Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Fri, 4 Sep 2020 00:46:58 +0100 Subject: [PATCH 33/53] Remove v1.10 and update to v1.11.1 --- recipes/pcl/all/conandata.yml | 9 +++------ recipes/pcl/config.yml | 4 +--- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/recipes/pcl/all/conandata.yml b/recipes/pcl/all/conandata.yml index 28e986fbae69e..d321860d1f717 100644 --- a/recipes/pcl/all/conandata.yml +++ b/recipes/pcl/all/conandata.yml @@ -1,7 +1,4 @@ sources: - "1.10.1": - url: "https://github.com/PointCloudLibrary/pcl/archive/pcl-1.10.1.tar.gz" - sha256: "61ec734ec7c786c628491844b46f9624958c360012c173bbc993c5ff88b4900e" - "1.11.0": - url: "https://github.com/PointCloudLibrary/pcl/archive/pcl-1.11.0.tar.gz" - sha256: "4255c3d3572e9774b5a1dccc235711b7a723197b79430ef539c2044e9ce65954" + "1.11.1": + url: "https://github.com/PointCloudLibrary/pcl/archive/pcl-1.11.1.tar.gz" + sha256: "a61558e53abafbc909e0996f91cfd2d7a400fcadf6b8cfb0ea3172b78422c74e" diff --git a/recipes/pcl/config.yml b/recipes/pcl/config.yml index 3f6e63566ea77..2e6b30b92c133 100644 --- a/recipes/pcl/config.yml +++ b/recipes/pcl/config.yml @@ -1,5 +1,3 @@ versions: - "1.10.1": - folder: all - "1.11.0": + "1.11.1": folder: all From 33499eb1a3240c926a6721b3563d47808636e9a0 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Fri, 4 Sep 2020 00:52:42 +0100 Subject: [PATCH 34/53] Remove opengl requirement (not required) --- recipes/pcl/all/conanfile.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 5bd774f40befa..3619b97aa6fb0 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -30,7 +30,6 @@ class PclConanRecipe(ConanFile): "eigen/3.3.7", "flann/1.9.1", "libpng/1.6.37", - "opengl/system", "qhull/7.3.2") generators = ["cmake", "cmake_find_package"] exports = ["CMakeLists.txt"] @@ -94,7 +93,7 @@ def _configure_cmake(self): "WITH_CUDA": self.options.with_cuda, "WITH_VTK": False, "WITH_PCAP": False, - "WITH_OPENGL": True, + "WITH_OPENGL": False, "WITH_OPENNI": False, "WITH_OPENNI2": False, "WITH_ENSENSO": False, @@ -189,7 +188,7 @@ def package_info(self): self.cpp_info.names["cmake_find_package"] = "PCL" self.cpp_info.names["pkg_config"] = "PCL" - self._update_components(pcl_common, ["eigen::eigen", "boost::boost", "opengl::opengl"]) + self._update_components(pcl_common, ["eigen::eigen", "boost::boost"]) self._update_components(pcl_kdtree, [pcl_common, "flann::flann"]) self._update_components(pcl_octree, [pcl_common]) self._update_components(pcl_search, [pcl_common, pcl_kdtree, pcl_octree, "flann::flann"]) From 00a4b9e46a2bb27f94cb32c058416e0e407d8717 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Mon, 28 Sep 2020 23:42:05 +0100 Subject: [PATCH 35/53] link qhull with non-reentrant lib by default --- recipes/pcl/all/conanfile.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 3619b97aa6fb0..b064d95291fe1 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -24,7 +24,8 @@ class PclConanRecipe(ConanFile): "shared": False, "fPIC": True, "with_cuda": False, - "with_tools": False + "with_tools": False, + "qhull:reentrant": False } requires = ("boost/1.70.0", "eigen/3.3.7", @@ -75,6 +76,10 @@ def configure(self): version = tools.Version(self.settings.compiler.version) if version < minimal_version[compiler]: raise ConanInvalidConfiguration("%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) + if self.options["qhull"].reentrant: + self.output.warn( + "Qhull is set to link the reentrant library. If you experience linking errors, try setting " + "qhull:reentrant=False") def _configure_cmake(self): if self._cmake: From 41911a9f746336fa71a46b24ea0094402f35fd4c Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Tue, 13 Oct 2020 19:20:20 +0100 Subject: [PATCH 36/53] ensure conan generated find modules are preferred --- recipes/pcl/all/conanfile.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index b064d95291fe1..9ed90eb1dd537 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -48,6 +48,11 @@ def _version_suffix(self): def source(self): tools.get(**self.conan_data["sources"][self.version]) os.rename("pcl-pcl-{}".format(self.version), self._source_subfolder) + tools.replace_in_file( + os.path.join(self._source_subfolder, "CMakeLists.txt"), + """set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/" ${CMAKE_MODULE_PATH})""", + """list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")""" + ) def config_options(self): if self.settings.os == "Windows": From eba3a0235d457b63ac0cface9beac2f7ef65e854 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Tue, 13 Oct 2020 19:21:05 +0100 Subject: [PATCH 37/53] Add flann target alias --- recipes/pcl/all/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/pcl/all/CMakeLists.txt b/recipes/pcl/all/CMakeLists.txt index 96329cfc629d4..f77ebf1f50297 100644 --- a/recipes/pcl/all/CMakeLists.txt +++ b/recipes/pcl/all/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 2.8.12) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() +add_library(FLANN::FLANN ALIAS Flann::Flann) add_subdirectory(source_subfolder) From 17306068c39940e972187c8574085165ff466962 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Tue, 13 Oct 2020 23:23:04 +0100 Subject: [PATCH 38/53] mimic custom PCL QHull detection --- recipes/pcl/all/CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/recipes/pcl/all/CMakeLists.txt b/recipes/pcl/all/CMakeLists.txt index f77ebf1f50297..222893ebd7cca 100644 --- a/recipes/pcl/all/CMakeLists.txt +++ b/recipes/pcl/all/CMakeLists.txt @@ -1,5 +1,15 @@ cmake_minimum_required(VERSION 2.8.12) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() + +find_package(Flann REQUIRED) add_library(FLANN::FLANN ALIAS Flann::Flann) + +find_package(Qhull REQUIRED) +set(QHULL_INCLUDE_DIRS ${Qhull_INCLUDE_DIRS}) +set(QHULL_LIBRARIES ${Qhull_LIBRARIES}) +set(HAVE_QHULL ON) +set(HAVE_QHULL_2011 TRUE) +set(QHULL_FOUND TRUE) + add_subdirectory(source_subfolder) From 414e203a6bf032e37af8c4ba33e7abf2c9e25c3f Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Wed, 14 Oct 2020 00:23:19 +0100 Subject: [PATCH 39/53] Remove unnecessary Flann workaround --- recipes/pcl/all/CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/recipes/pcl/all/CMakeLists.txt b/recipes/pcl/all/CMakeLists.txt index 222893ebd7cca..dbf13a19824b9 100644 --- a/recipes/pcl/all/CMakeLists.txt +++ b/recipes/pcl/all/CMakeLists.txt @@ -2,9 +2,6 @@ cmake_minimum_required(VERSION 2.8.12) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() -find_package(Flann REQUIRED) -add_library(FLANN::FLANN ALIAS Flann::Flann) - find_package(Qhull REQUIRED) set(QHULL_INCLUDE_DIRS ${Qhull_INCLUDE_DIRS}) set(QHULL_LIBRARIES ${Qhull_LIBRARIES}) From 19cb75d0436ccdc0798fadc98c6737cc3f57274d Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Wed, 14 Oct 2020 19:49:05 +0100 Subject: [PATCH 40/53] re-introduce flann naming workaround --- recipes/pcl/all/conanfile.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 9ed90eb1dd537..53b936191788c 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -48,11 +48,22 @@ def _version_suffix(self): def source(self): tools.get(**self.conan_data["sources"][self.version]) os.rename("pcl-pcl-{}".format(self.version), self._source_subfolder) + cmake_lists = os.path.join(self._source_subfolder, "CMakeLists.txt"), tools.replace_in_file( - os.path.join(self._source_subfolder, "CMakeLists.txt"), + cmake_lists, """set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/" ${CMAKE_MODULE_PATH})""", """list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")""" ) + tools.replace_in_file( + cmake_lists, + "find_package(FLANN 1.7.0 REQUIRED)", + "find_package(Flann REQUIRED)" + ) + for folder in ["search", "kdtree"]: + tools.replace_in_file( + os.path.join(self._source_subfolder, folder, "CMakeLists.txt"), + "FLANN::FLANN", "Flann::Flann" + ) def config_options(self): if self.settings.os == "Windows": From a71774fef7fabb6e49ea30bbafab6fa75e232a9b Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Wed, 14 Oct 2020 21:09:19 +0100 Subject: [PATCH 41/53] Add suffix for MSVC debug builds --- recipes/pcl/all/conanfile.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 53b936191788c..ca048065c67af 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -48,7 +48,7 @@ def _version_suffix(self): def source(self): tools.get(**self.conan_data["sources"][self.version]) os.rename("pcl-pcl-{}".format(self.version), self._source_subfolder) - cmake_lists = os.path.join(self._source_subfolder, "CMakeLists.txt"), + cmake_lists = os.path.join(self._source_subfolder, "CMakeLists.txt") tools.replace_in_file( cmake_lists, """set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/" ${CMAKE_MODULE_PATH})""", @@ -176,11 +176,16 @@ def package(self): tools.rmdir(os.path.join(self.package_folder, "share")) tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + def _lib_name(self, lib): + if self.settings.compiler == "Visual Studio" and self.settings.build_type == "Debug": + return "pcl_{}d".format(lib) + return "pcl_{}".format(lib) + def _update_components(self, name, dependencies, header_only=False, extra_libs=None): if not extra_libs: extra_libs = [] if not header_only: - self.cpp_info.components[name].libs = ["pcl_{}".format(lib) for lib in [name] + extra_libs] + self.cpp_info.components[name].libs = [self._lib_name(lib) for lib in [name] + extra_libs] self.cpp_info.components[name].includedirs = ["include/pcl-{}".format(self._version_suffix)] self.cpp_info.components[name].name = "PCL_{}_LIBRARIES".format(name.upper()) self.cpp_info.components[name].names["pkg_config"] = "pcl_{}-{}".format(name, self._version_suffix) From 2235aaae05d1dededfcf64b64d5f708b2264863c Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Wed, 2 Dec 2020 10:29:21 +0000 Subject: [PATCH 42/53] update boost and eigen packages --- recipes/pcl/all/conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index ca048065c67af..3c28457b3a455 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -27,8 +27,8 @@ class PclConanRecipe(ConanFile): "with_tools": False, "qhull:reentrant": False } - requires = ("boost/1.70.0", - "eigen/3.3.7", + requires = ("boost/1.74.0", + "eigen/3.3.8", "flann/1.9.1", "libpng/1.6.37", "qhull/7.3.2") From 634a2f8841346c2bfe979e62f090028e2dd6628b Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Wed, 2 Dec 2020 10:55:15 +0000 Subject: [PATCH 43/53] ensure minimum clang and libc++ --- recipes/pcl/all/conanfile.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 3c28457b3a455..5c3c0e2ed5f11 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -68,11 +68,13 @@ def source(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - - def configure(self): + + def _check_msvc(self): if (tools.msvs_toolset(self) == "v140" or self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) < "15"): raise ConanInvalidConfiguration("Unsupported Visual Studio Compiler or Toolset") + + def _check_cxx_standard(self): minimal_cpp_standard = "14" if self.settings.compiler.cppstd: tools.check_min_cppstd(self, minimal_cpp_standard) @@ -92,6 +94,19 @@ def configure(self): version = tools.Version(self.settings.compiler.version) if version < minimal_version[compiler]: raise ConanInvalidConfiguration("%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) + + def _check_libcxx_compatibility(self): + if self.settings.compiler == "clang" and self.settings.compiler.libcxx == "libc++": + version = tools.Version(self.settings.compiler.version) + minimum_version = 6 + if version < minimum_version: + raise ConanInvalidConfiguration("Clang with libc++ is version %s but must be at least version %s" % + (version, minimum_version)) + + def configure(self): + self._check_msvc() + self._check_cxx_standard() + self._check_libcxx_compatibility() if self.options["qhull"].reentrant: self.output.warn( "Qhull is set to link the reentrant library. If you experience linking errors, try setting " From e0d7968bd7635a326aa99545f5fd418db0d724c3 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Mon, 14 Dec 2020 13:32:53 +0000 Subject: [PATCH 44/53] fix failure due to missing boost mpi package --- 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 5c3c0e2ed5f11..b6750a28b70be 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -59,6 +59,12 @@ def source(self): "find_package(FLANN 1.7.0 REQUIRED)", "find_package(Flann REQUIRED)" ) + # Temporary hack for https://github.com/conan-io/conan/issues/8206 + tools.replace_in_file( + os.path.join(self._source_subfolder, "cmake", "pcl_find_boost.cmake"), + "find_package(Boost 1.55.0 QUIET COMPONENTS serialization mpi)", + "find_package(Boost 1.55.0 QUIET OPTIONAL_COMPONENTS serialization)" + ) for folder in ["search", "kdtree"]: tools.replace_in_file( os.path.join(self._source_subfolder, folder, "CMakeLists.txt"), @@ -68,7 +74,7 @@ def source(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - + def _check_msvc(self): if (tools.msvs_toolset(self) == "v140" or self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) < "15"): @@ -98,19 +104,19 @@ def _check_cxx_standard(self): def _check_libcxx_compatibility(self): if self.settings.compiler == "clang" and self.settings.compiler.libcxx == "libc++": version = tools.Version(self.settings.compiler.version) - minimum_version = 6 + minimum_version = 6 if version < minimum_version: raise ConanInvalidConfiguration("Clang with libc++ is version %s but must be at least version %s" % (version, minimum_version)) - + def configure(self): self._check_msvc() self._check_cxx_standard() self._check_libcxx_compatibility() if self.options["qhull"].reentrant: self.output.warn( - "Qhull is set to link the reentrant library. If you experience linking errors, try setting " - "qhull:reentrant=False") + "Qhull is set to link the reentrant library. If you experience linking errors, try setting " + "qhull:reentrant=False") def _configure_cmake(self): if self._cmake: From 9382f893ec75ff4e6e7658c8715fde58e12cfe83 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Fri, 19 Mar 2021 23:12:11 +0100 Subject: [PATCH 45/53] fix several things - add with_openmp, with_png and with_qhull options - openmp required specific linker flags for consumers - provide official targets - be sure to not use system libs - bumps dependencies - delete fPIC if shared - patch in build() instead of source() - force & check qhull reentrant options --- recipes/pcl/all/CMakeLists.txt | 23 +- recipes/pcl/all/conanfile.py | 281 ++++++++++++-------- recipes/pcl/all/test_package/CMakeLists.txt | 6 +- recipes/pcl/all/test_package/conanfile.py | 2 +- 4 files changed, 188 insertions(+), 124 deletions(-) diff --git a/recipes/pcl/all/CMakeLists.txt b/recipes/pcl/all/CMakeLists.txt index dbf13a19824b9..e6313ca8a91c1 100644 --- a/recipes/pcl/all/CMakeLists.txt +++ b/recipes/pcl/all/CMakeLists.txt @@ -1,12 +1,21 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.1) +project(cmake_wrapper) + include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() -find_package(Qhull REQUIRED) -set(QHULL_INCLUDE_DIRS ${Qhull_INCLUDE_DIRS}) -set(QHULL_LIBRARIES ${Qhull_LIBRARIES}) -set(HAVE_QHULL ON) -set(HAVE_QHULL_2011 TRUE) -set(QHULL_FOUND TRUE) +# PCL expects FLANN::FLANN target +find_package(flann REQUIRED CONFIG) +add_library(FLANN::FLANN INTERFACE IMPORTED) +set_property(TARGET FLANN::FLANN PROPERTY INTERFACE_LINK_LIBRARIES flann::flann) + +if(WITH_QHULL) + find_package(Qhull REQUIRED CONFIG) + set(QHULL_INCLUDE_DIRS ${Qhull_INCLUDE_DIRS}) + set(QHULL_LIBRARIES Qhull::Qhull) + set(HAVE_QHULL ON) + set(HAVE_QHULL_2011 TRUE) + set(QHULL_FOUND TRUE) +endif() add_subdirectory(source_subfolder) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index b6750a28b70be..63ef66909d1e4 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -1,76 +1,47 @@ -import os -from glob import glob -from itertools import chain - from conans import ConanFile, CMake, tools from conans.errors import ConanInvalidConfiguration +import os +import textwrap +required_conan_version = ">=1.33.0" -class PclConanRecipe(ConanFile): + +class PclConan(ConanFile): name = "pcl" description = "Point Cloud Library" license = "BSD-3-Clause" homepage = "https://pointclouds.org/" url = "https://github.com/conan-io/conan-center-index" topics = ("pointcloud", "computer-vision", "point-cloud") - settings = "os", "compiler", "build_type", "arch" + + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], + "with_openmp": [True, False], + "with_png": [True, False], + "with_qhull": [True, False], "with_cuda": [True, False], "with_tools": [True, False] } default_options = { "shared": False, "fPIC": True, + "with_openmp": False, + "with_png": True, + "with_qhull": True, "with_cuda": False, "with_tools": False, - "qhull:reentrant": False } - requires = ("boost/1.74.0", - "eigen/3.3.8", - "flann/1.9.1", - "libpng/1.6.37", - "qhull/7.3.2") - generators = ["cmake", "cmake_find_package"] + exports = ["CMakeLists.txt"] + generators = ["cmake", "cmake_find_package", "cmake_find_package_multi"] _cmake = None @property def _source_subfolder(self): return "source_subfolder" - @property - def _version_suffix(self): - semver = tools.Version(self.version) - return "{}.{}".format(semver.major, semver.minor) - - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("pcl-pcl-{}".format(self.version), self._source_subfolder) - cmake_lists = os.path.join(self._source_subfolder, "CMakeLists.txt") - tools.replace_in_file( - cmake_lists, - """set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/" ${CMAKE_MODULE_PATH})""", - """list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")""" - ) - tools.replace_in_file( - cmake_lists, - "find_package(FLANN 1.7.0 REQUIRED)", - "find_package(Flann REQUIRED)" - ) - # Temporary hack for https://github.com/conan-io/conan/issues/8206 - tools.replace_in_file( - os.path.join(self._source_subfolder, "cmake", "pcl_find_boost.cmake"), - "find_package(Boost 1.55.0 QUIET COMPONENTS serialization mpi)", - "find_package(Boost 1.55.0 QUIET OPTIONAL_COMPONENTS serialization)" - ) - for folder in ["search", "kdtree"]: - tools.replace_in_file( - os.path.join(self._source_subfolder, folder, "CMakeLists.txt"), - "FLANN::FLANN", "Flann::Flann" - ) - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -110,28 +81,60 @@ def _check_libcxx_compatibility(self): (version, minimum_version)) def configure(self): + if self.options.shared: + del self.options.fPIC self._check_msvc() self._check_cxx_standard() self._check_libcxx_compatibility() - if self.options["qhull"].reentrant: - self.output.warn( - "Qhull is set to link the reentrant library. If you experience linking errors, try setting " - "qhull:reentrant=False") + if self.options.with_qhull: + self.options["qhull"].reentrant = False + + def requirements(self): + self.requires("boost/1.75.0") + self.requires("eigen/3.3.9") + self.requires("flann/1.9.1") + if self.options.with_png: + self.requires("libpng/1.6.37") + if self.options.with_qhull: + self.requires("qhull/8.0.1") + + def validate(self): + if self.options.with_qhull and self.options["qhull"].reentrant: + raise ConanInvalidConfiguration("pcl requires non-reentrant qhull, you must set qhull:reentrant=False") + + def source(self): + tools.get(**self.conan_data["sources"][self.version]) + os.rename("pcl-pcl-{}".format(self.version), self._source_subfolder) + + def _patch_sources(self): + cmake_lists = os.path.join(self._source_subfolder, "CMakeLists.txt") + # Eigen already included by conan_basic_setup(), we don't want that PCL custom FindEigen injects a system installed eigen + tools.replace_in_file(cmake_lists, "find_package(Eigen 3.1 REQUIRED)", "") + # Flann already handled in CMake wrapper + tools.replace_in_file(cmake_lists, "find_package(FLANN 1.7.0 REQUIRED)", "") + # Qhull already handled in CMake wrapper + tools.replace_in_file(cmake_lists, "find_package(Qhull)", "") + # Temporary hack for https://github.com/conan-io/conan/issues/8206 + tools.replace_in_file( + os.path.join(self._source_subfolder, "cmake", "pcl_find_boost.cmake"), + "find_package(Boost 1.55.0 QUIET COMPONENTS serialization mpi)", + "find_package(Boost 1.55.0 QUIET OPTIONAL_COMPONENTS serialization)" + ) def _configure_cmake(self): if self._cmake: return self._cmake cmake_definitions = { - "CONAN_PCL_VERSION": self.version, "PCL_BUILD_WITH_BOOST_DYNAMIC_LINKING_WIN32": self.options["boost"].shared } pcl_config = { "BUILD_tools": self.options.with_tools, + "WITH_OPENMP": self.options.with_openmp, "WITH_LIBUSB": False, - "WITH_PNG": True, - "WITH_QHULL": True, + "WITH_PNG": self.options.with_png, + "WITH_QHULL": self.options.with_qhull, "WITH_CUDA": self.options.with_cuda, "WITH_VTK": False, "WITH_PCAP": False, @@ -143,8 +146,6 @@ def _configure_cmake(self): "WITH_DSSDK": False, "WITH_RSSDK": False, "PCL_SHARED_LIBS": self.options.shared, - "FLANN_USE_STATIC": not self.options["flann"].shared, - "QHULL_USE_STATIC": not self.options["qhull"].shared } pcl_features = { "BUILD_kdtree": True, @@ -174,82 +175,136 @@ def _configure_cmake(self): return self._cmake def build(self): + self._patch_sources() cmake = self._configure_cmake() cmake.build() - def _remove_vs_runtime_files(self): - patterns = [os.path.join(self.package_folder, "bin", pattern) for pattern in ["msvcp*.dll", "vcruntime*.dll", "concrt*.dll"]] - runtime_files = chain.from_iterable(glob(pattern) for pattern in patterns) - for runtime_file in runtime_files: - try: - os.remove(runtime_file) - except Exception as ex: - self.output.warn("Could not remove vs runtime file {}, {}".format(runtime_file, ex)) - def package(self): cmake = self._configure_cmake() cmake.install() self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) - if self.settings.os == "Windows": - self._remove_vs_runtime_files() tools.rmdir(os.path.join(self.package_folder, "cmake")) tools.rmdir(os.path.join(self.package_folder, "share")) tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + if self.settings.os == "Windows": + for pattern in ["msvcp*.dll", "vcruntime*.dll", "concrt*.dll"]: + tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), pattern) + + self._create_cmake_module_alias_targets( + os.path.join(self.package_folder, self._module_file_rel_path), + {self._target_from_name(component):"PCL::{}".format(self._target_from_name(component)) for component in self._pcl_components.keys()} + ) + + @staticmethod + def _create_cmake_module_alias_targets(module_file, targets): + content = "" + for alias, aliased in targets.items(): + content += textwrap.dedent("""\ + if(TARGET {aliased} AND NOT TARGET {alias}) + add_library({alias} INTERFACE IMPORTED) + set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) + endif() + """.format(alias=alias, aliased=aliased)) + tools.save(module_file, content) + + @property + def _module_file_rel_path(self): + return os.path.join(self._module_subfolder, + "conan-official-{}-targets.cmake".format(self.name)) + + @property + def _module_subfolder(self): + return os.path.join("lib", "cmake") + + @staticmethod + def _target_from_name(name): + return "PCL_{}_LIBRARIES".format(name.upper()) + + @property + def _pcl_components(self): + def png(): + return ["libpng::libpng"] if self.options.with_png else [] + + def qhull(): + return ["qhull::qhull"] if self.options.with_qhull else [] + + return { + "common": {"requires": ["eigen::eigen", "boost::boost"]}, + "kdtree": {"requires": ["common", "flann::flann"]}, + "octree": {"requires": ["common"]}, + "search": {"requires": ["common", "kdtree", "octree", "flann::flann"]}, + "sample_consensus": {"requires": ["common", "search"]}, + "filters": {"requires": ["common", "sample_consensus", "search", "kdtree", "octree"]}, + "2d": {"requires": ["common", "filters"], "header_only": True}, + "geometry": {"requires": ["common"], "header_only": True}, + "io": {"requires": ["common", "octree"] + png(), "extra_libs": ["io_ply"]}, + "features": {"requires": ["common", "search", "kdtree", "octree", "filters", "2d"]}, + "ml": {"requires": ["common"]}, + "segmentation": {"requires": ["common", "geometry", "search", "sample_consensus", "kdtree", "octree", "features", "filters", "ml"]}, + "surface": {"requires": ["common", "search", "kdtree", "octree"] + qhull()}, + "registration": {"requires": ["common", "octree", "kdtree", "search", "sample_consensus", "features", "filters"]}, + "keypoints": {"requires": ["common", "search", "kdtree", "octree", "features", "filters"]}, + "tracking": {"requires": ["common", "search", "kdtree", "filters", "octree"]}, + "recognition": {"requires": ["common", "io", "search", "kdtree", "octree", "features", "filters", "registration", "sample_consensus", "ml"]}, + "stereo": {"requires": ["common", "io"]} + } + + @property + def _version_suffix(self): + semver = tools.Version(self.version) + return "{}.{}".format(semver.major, semver.minor) def _lib_name(self, lib): if self.settings.compiler == "Visual Studio" and self.settings.build_type == "Debug": return "pcl_{}d".format(lib) return "pcl_{}".format(lib) - def _update_components(self, name, dependencies, header_only=False, extra_libs=None): - if not extra_libs: - extra_libs = [] - if not header_only: - self.cpp_info.components[name].libs = [self._lib_name(lib) for lib in [name] + extra_libs] - self.cpp_info.components[name].includedirs = ["include/pcl-{}".format(self._version_suffix)] - self.cpp_info.components[name].name = "PCL_{}_LIBRARIES".format(name.upper()) - self.cpp_info.components[name].names["pkg_config"] = "pcl_{}-{}".format(name, self._version_suffix) - self.cpp_info.components[name].requires = dependencies - def package_info(self): - pcl_common = "common" - pcl_kdtree = "kdtree" - pcl_octree = "octree" - pcl_search = "search" - pcl_sample_consensus = "sample_consensus" - pcl_filters = "filters" - pcl_2d = "2d" - pcl_geometry = "geometry" - pcl_io = "io" - pcl_features = "features" - pcl_ml = "ml" - pcl_segmentation = "segmentation" - pcl_surface = "surface" - pcl_registration = "registration" - pcl_keypoints = "keypoints" - pcl_tracking = "tracking" - pcl_recognition = "recognition" - pcl_stereo = "stereo" - self.cpp_info.names["cmake_find_package"] = "PCL" - self.cpp_info.names["pkg_config"] = "PCL" - - self._update_components(pcl_common, ["eigen::eigen", "boost::boost"]) - self._update_components(pcl_kdtree, [pcl_common, "flann::flann"]) - self._update_components(pcl_octree, [pcl_common]) - self._update_components(pcl_search, [pcl_common, pcl_kdtree, pcl_octree, "flann::flann"]) - self._update_components(pcl_sample_consensus, [pcl_common, pcl_search]) - self._update_components(pcl_filters, [pcl_common, pcl_sample_consensus, pcl_search, pcl_kdtree, pcl_octree]) - self._update_components(pcl_2d, [pcl_common, pcl_filters], header_only=True) - self._update_components(pcl_geometry, [pcl_common], header_only=True) - self._update_components(pcl_io, [pcl_common, pcl_octree, "libpng::libpng"], extra_libs=["io_ply"]) - self._update_components(pcl_features, [pcl_common,pcl_search, pcl_kdtree, pcl_octree, pcl_filters, pcl_2d]) - self._update_components(pcl_ml, [pcl_common]) - self._update_components(pcl_segmentation, [pcl_common, pcl_geometry, pcl_search, pcl_sample_consensus, pcl_kdtree, pcl_octree, pcl_features, pcl_filters, pcl_ml]) - self._update_components(pcl_surface, [pcl_common, pcl_search, pcl_kdtree, pcl_octree, "qhull::qhull"]) - self._update_components(pcl_registration, [pcl_common, pcl_octree, pcl_kdtree, pcl_search, pcl_sample_consensus, pcl_features, pcl_filters]) - self._update_components(pcl_keypoints, [pcl_common, pcl_search, pcl_kdtree, pcl_octree, pcl_features, pcl_filters]) - self._update_components(pcl_tracking, [pcl_common, pcl_search, pcl_kdtree, pcl_filters, pcl_octree]) - self._update_components(pcl_recognition, [pcl_common, pcl_io, pcl_search, pcl_kdtree, pcl_octree, pcl_features, pcl_filters, pcl_registration, pcl_sample_consensus, pcl_ml]) - self._update_components(pcl_stereo, [pcl_common, pcl_io]) + self.cpp_info.names["cmake_find_package_multi"] = "PCL" + + def _update_components(components): + for comp, values in components.items(): + target = self._target_from_name(comp) + self.cpp_info.components[comp].names["cmake_find_package"] = target + self.cpp_info.components[comp].names["cmake_find_package_multi"] = target + self.cpp_info.components[comp].builddirs.append(self._module_subfolder) + self.cpp_info.components[comp].build_modules["cmake_find_package"] = [self._module_file_rel_path] + self.cpp_info.components[comp].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] + self.cpp_info.components[comp].names["pkg_config"] = "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"] + + # also provide alias components to allow find_package(PCL COMPONENTS common kdtree) for example + alias_component = "pcl_{}_alias".format(comp) + self.cpp_info.components[alias_component].names["cmake_find_package"] = comp + self.cpp_info.components[alias_component].names["cmake_find_package_multi"] = comp + self.cpp_info.components[alias_component].requires = [comp] + self.cpp_info.components[alias_component].includedirs = [] + self.cpp_info.components[alias_component].libdirs = [] + self.cpp_info.components[alias_component].bindirs = [] + + _update_components(self._pcl_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 == "Visual Studio": + 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_tools: + bin_path = os.path.join(self.package_folder, "bin") + self.output.info("Appending PATH environment variable: {}".format(bin_path)) + self.env_info.PATH.append(bin_path) diff --git a/recipes/pcl/all/test_package/CMakeLists.txt b/recipes/pcl/all/test_package/CMakeLists.txt index d3d7eebfc9f72..c84ae583d2309 100644 --- a/recipes/pcl/all/test_package/CMakeLists.txt +++ b/recipes/pcl/all/test_package/CMakeLists.txt @@ -2,10 +2,10 @@ cmake_minimum_required(VERSION 3.1.3) project(PclTestPackage) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +conan_basic_setup(TARGETS) -find_package(PCL) +find_package(PCL REQUIRED surface CONFIG) add_executable(pcl_test_package example.cpp) target_compile_features(pcl_test_package PUBLIC cxx_std_14) -target_link_libraries(pcl_test_package PRIVATE PCL::PCL_SURFACE_LIBRARIES) +target_link_libraries(pcl_test_package PRIVATE PCL_SURFACE_LIBRARIES) diff --git a/recipes/pcl/all/test_package/conanfile.py b/recipes/pcl/all/test_package/conanfile.py index e01df55cf1184..797d180eb9620 100644 --- a/recipes/pcl/all/test_package/conanfile.py +++ b/recipes/pcl/all/test_package/conanfile.py @@ -3,7 +3,7 @@ class PclTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + generators = "cmake", "cmake_find_package_multi" def build(self): cmake = CMake(self) From c6fef55ab69da9f97a7a238a312a1ce1419a8315 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Sat, 20 Mar 2021 02:46:49 +0100 Subject: [PATCH 46/53] less boilerplate --- recipes/pcl/all/conanfile.py | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 63ef66909d1e4..b1691648a8986 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -193,7 +193,7 @@ def package(self): self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), - {self._target_from_name(component):"PCL::{}".format(self._target_from_name(component)) for component in self._pcl_components.keys()} + {"PCL_{}_LIBRARIES".format(comp.upper()): "PCL::{}".format(comp) for comp in self._pcl_components.keys()} ) @staticmethod @@ -217,10 +217,6 @@ def _module_file_rel_path(self): def _module_subfolder(self): return os.path.join("lib", "cmake") - @staticmethod - def _target_from_name(name): - return "PCL_{}_LIBRARIES".format(name.upper()) - @property def _pcl_components(self): def png(): @@ -266,9 +262,8 @@ def package_info(self): def _update_components(components): for comp, values in components.items(): - target = self._target_from_name(comp) - self.cpp_info.components[comp].names["cmake_find_package"] = target - self.cpp_info.components[comp].names["cmake_find_package_multi"] = target + 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].builddirs.append(self._module_subfolder) self.cpp_info.components[comp].build_modules["cmake_find_package"] = [self._module_file_rel_path] self.cpp_info.components[comp].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] @@ -279,15 +274,6 @@ def _update_components(components): self.cpp_info.components[comp].libs = [self._lib_name(lib) for lib in libs] self.cpp_info.components[comp].requires = values["requires"] - # also provide alias components to allow find_package(PCL COMPONENTS common kdtree) for example - alias_component = "pcl_{}_alias".format(comp) - self.cpp_info.components[alias_component].names["cmake_find_package"] = comp - self.cpp_info.components[alias_component].names["cmake_find_package_multi"] = comp - self.cpp_info.components[alias_component].requires = [comp] - self.cpp_info.components[alias_component].includedirs = [] - self.cpp_info.components[alias_component].libdirs = [] - self.cpp_info.components[alias_component].bindirs = [] - _update_components(self._pcl_components) if not self.options.shared: From 8c9555e4f95a47bcdd14c1cf84e2b7b7a1d49cfc Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Sat, 20 Mar 2021 10:28:31 +0100 Subject: [PATCH 47/53] add a comment about reentrant qhull --- 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 b1691648a8986..8a9497c576a3e 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -87,6 +87,8 @@ def configure(self): self._check_cxx_standard() self._check_libcxx_compatibility() if self.options.with_qhull: + # TODO: pcl might switch to reentrant qhull in the next release: + # don't forget to check https://github.com/PointCloudLibrary/pcl/pull/4540 when you bump pcl version self.options["qhull"].reentrant = False def requirements(self): From de87a8631445d65463ee0ca4afe686d0c6d5a91e Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sun, 17 Apr 2022 10:38:33 +0100 Subject: [PATCH 48/53] [pcl] bump to 1.12.1 --- recipes/pcl/all/CMakeLists.txt | 8 ++++---- recipes/pcl/all/conandata.yml | 6 +++--- recipes/pcl/all/conanfile.py | 10 ++++------ recipes/pcl/all/test_package/example.cpp | 2 +- recipes/pcl/config.yml | 2 +- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/recipes/pcl/all/CMakeLists.txt b/recipes/pcl/all/CMakeLists.txt index e6313ca8a91c1..9cea51ef00ab3 100644 --- a/recipes/pcl/all/CMakeLists.txt +++ b/recipes/pcl/all/CMakeLists.txt @@ -8,14 +8,14 @@ conan_basic_setup() find_package(flann REQUIRED CONFIG) add_library(FLANN::FLANN INTERFACE IMPORTED) set_property(TARGET FLANN::FLANN PROPERTY INTERFACE_LINK_LIBRARIES flann::flann) +set(FLANN_FOUND TRUE) if(WITH_QHULL) find_package(Qhull REQUIRED CONFIG) - set(QHULL_INCLUDE_DIRS ${Qhull_INCLUDE_DIRS}) - set(QHULL_LIBRARIES Qhull::Qhull) - set(HAVE_QHULL ON) - set(HAVE_QHULL_2011 TRUE) + add_library(QHULL::QHULL INTERFACE IMPORTED) + set_property(TARGET QHULL::QHULL PROPERTY INTERFACE_LINK_LIBRARIES Qhull::Qhull) set(QHULL_FOUND TRUE) + set(HAVE_QHULL TRUE) endif() add_subdirectory(source_subfolder) diff --git a/recipes/pcl/all/conandata.yml b/recipes/pcl/all/conandata.yml index d321860d1f717..eab0039624c63 100644 --- a/recipes/pcl/all/conandata.yml +++ b/recipes/pcl/all/conandata.yml @@ -1,4 +1,4 @@ sources: - "1.11.1": - url: "https://github.com/PointCloudLibrary/pcl/archive/pcl-1.11.1.tar.gz" - sha256: "a61558e53abafbc909e0996f91cfd2d7a400fcadf6b8cfb0ea3172b78422c74e" + "1.12.1": + url: "https://github.com/PointCloudLibrary/pcl/archive/pcl-1.12.1.tar.gz" + sha256: "dc0ac26f094eafa7b26c3653838494cc0a012bd1bdc1f1b0dc79b16c2de0125a" diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 8a9497c576a3e..305da75d6fad2 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -110,17 +110,15 @@ def source(self): def _patch_sources(self): cmake_lists = os.path.join(self._source_subfolder, "CMakeLists.txt") - # Eigen already included by conan_basic_setup(), we don't want that PCL custom FindEigen injects a system installed eigen - tools.replace_in_file(cmake_lists, "find_package(Eigen 3.1 REQUIRED)", "") - # Flann already handled in CMake wrapper - tools.replace_in_file(cmake_lists, "find_package(FLANN 1.7.0 REQUIRED)", "") + # Use conan supplied Eigen + tools.replace_in_file(cmake_lists, "include_directories(SYSTEM ${EIGEN_INCLUDE_DIRS})", "") # Qhull already handled in CMake wrapper tools.replace_in_file(cmake_lists, "find_package(Qhull)", "") # Temporary hack for https://github.com/conan-io/conan/issues/8206 tools.replace_in_file( os.path.join(self._source_subfolder, "cmake", "pcl_find_boost.cmake"), - "find_package(Boost 1.55.0 QUIET COMPONENTS serialization mpi)", - "find_package(Boost 1.55.0 QUIET OPTIONAL_COMPONENTS serialization)" + "find_package(Boost 1.65.0 QUIET COMPONENTS serialization mpi)", + "find_package(Boost 1.65.0 QUIET OPTIONAL_COMPONENTS serialization)" ) def _configure_cmake(self): diff --git a/recipes/pcl/all/test_package/example.cpp b/recipes/pcl/all/test_package/example.cpp index 5d36dd5b6858f..4094b5ff7b31a 100644 --- a/recipes/pcl/all/test_package/example.cpp +++ b/recipes/pcl/all/test_package/example.cpp @@ -3,7 +3,7 @@ #include #include - + using PointCloud = pcl::PointCloud; int main() { diff --git a/recipes/pcl/config.yml b/recipes/pcl/config.yml index 2e6b30b92c133..daa3a213a56fa 100644 --- a/recipes/pcl/config.yml +++ b/recipes/pcl/config.yml @@ -1,3 +1,3 @@ versions: - "1.11.1": + "1.12.1": folder: all From ec5056ef7f8c049fe07c5410d6adbd1ea43fde9f Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sun, 17 Apr 2022 10:39:05 +0100 Subject: [PATCH 49/53] [pcl] reentrant qhull --- recipes/pcl/all/conanfile.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 305da75d6fad2..7579e9b110671 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -86,10 +86,6 @@ def configure(self): self._check_msvc() self._check_cxx_standard() self._check_libcxx_compatibility() - if self.options.with_qhull: - # TODO: pcl might switch to reentrant qhull in the next release: - # don't forget to check https://github.com/PointCloudLibrary/pcl/pull/4540 when you bump pcl version - self.options["qhull"].reentrant = False def requirements(self): self.requires("boost/1.75.0") @@ -100,10 +96,6 @@ def requirements(self): if self.options.with_qhull: self.requires("qhull/8.0.1") - def validate(self): - if self.options.with_qhull and self.options["qhull"].reentrant: - raise ConanInvalidConfiguration("pcl requires non-reentrant qhull, you must set qhull:reentrant=False") - def source(self): tools.get(**self.conan_data["sources"][self.version]) os.rename("pcl-pcl-{}".format(self.version), self._source_subfolder) From d7cc56532cba771e153b778d20fc81e827ac225a Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sun, 17 Apr 2022 11:01:13 +0100 Subject: [PATCH 50/53] [pcl] modernize --- recipes/pcl/all/CMakeLists.txt | 4 ++++ recipes/pcl/all/conanfile.py | 16 ++++++++++++-- recipes/pcl/all/test_package/CMakeLists.txt | 3 --- recipes/pcl/all/test_package/conanfile.py | 23 +++++++++++++++++---- 4 files changed, 37 insertions(+), 9 deletions(-) diff --git a/recipes/pcl/all/CMakeLists.txt b/recipes/pcl/all/CMakeLists.txt index 9cea51ef00ab3..63a5f3c58943d 100644 --- a/recipes/pcl/all/CMakeLists.txt +++ b/recipes/pcl/all/CMakeLists.txt @@ -4,6 +4,10 @@ project(cmake_wrapper) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() +find_package(Eigen3 REQUIRED) +set(EIGEN_INCLUDE_DIRS ${Eigen3_INCLUDE_DIRS}) +set(EIGEN_FOUND TRUE) + # PCL expects FLANN::FLANN target find_package(flann REQUIRED CONFIG) add_library(FLANN::FLANN INTERFACE IMPORTED) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 7579e9b110671..50c3da1ebd763 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -102,8 +102,8 @@ def source(self): def _patch_sources(self): cmake_lists = os.path.join(self._source_subfolder, "CMakeLists.txt") - # Use conan supplied Eigen - tools.replace_in_file(cmake_lists, "include_directories(SYSTEM ${EIGEN_INCLUDE_DIRS})", "") + # Eigen already handled in CMake wrapper, we don't want that PCL custom FindEigen injects a system installed eigen + tools.replace_in_file(cmake_lists, "find_package(Eigen 3.1 REQUIRED)", "") # Qhull already handled in CMake wrapper tools.replace_in_file(cmake_lists, "find_package(Qhull)", "") # Temporary hack for https://github.com/conan-io/conan/issues/8206 @@ -252,14 +252,26 @@ 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") + 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].builddirs.append(self._module_subfolder) + self.cpp_info.components[comp].build_modules["cmake_find_package"] = [self._module_file_rel_path] self.cpp_info.components[comp].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] + self.cpp_info.components[comp].set_property("cmake_build_modules", [self._module_file_rel_path]) + 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", []) diff --git a/recipes/pcl/all/test_package/CMakeLists.txt b/recipes/pcl/all/test_package/CMakeLists.txt index c84ae583d2309..3e7e55787644f 100644 --- a/recipes/pcl/all/test_package/CMakeLists.txt +++ b/recipes/pcl/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.1.3) project(PclTestPackage) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(PCL REQUIRED surface CONFIG) add_executable(pcl_test_package example.cpp) diff --git a/recipes/pcl/all/test_package/conanfile.py b/recipes/pcl/all/test_package/conanfile.py index 797d180eb9620..6c9d412aca0fa 100644 --- a/recipes/pcl/all/test_package/conanfile.py +++ b/recipes/pcl/all/test_package/conanfile.py @@ -1,9 +1,24 @@ -from conans import ConanFile, CMake, tools import os +from conan import ConanFile +from conan.tools.cmake import ( + CMakeToolchain, + CMakeDeps, + CMake +) +from conan.tools.build import cross_building + + class PclTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_VERBOSE_MAKEFILE"] = True + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): cmake = CMake(self) @@ -11,6 +26,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "pcl_test_package") + if not cross_building(self): + bin_path = os.path.join(".", "pcl_test_package") self.run(bin_path, run_environment=True) From a52af5578156a314204151030c977533378399f3 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sun, 17 Apr 2022 21:22:04 +0100 Subject: [PATCH 51/53] [pcl] revert test package modernization --- recipes/pcl/all/test_package/CMakeLists.txt | 3 +++ recipes/pcl/all/test_package/conanfile.py | 23 ++++----------------- recipes/pcl/all/test_package/example.cpp | 2 +- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/recipes/pcl/all/test_package/CMakeLists.txt b/recipes/pcl/all/test_package/CMakeLists.txt index 3e7e55787644f..c84ae583d2309 100644 --- a/recipes/pcl/all/test_package/CMakeLists.txt +++ b/recipes/pcl/all/test_package/CMakeLists.txt @@ -1,6 +1,9 @@ cmake_minimum_required(VERSION 3.1.3) project(PclTestPackage) +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + find_package(PCL REQUIRED surface CONFIG) add_executable(pcl_test_package example.cpp) diff --git a/recipes/pcl/all/test_package/conanfile.py b/recipes/pcl/all/test_package/conanfile.py index 6c9d412aca0fa..797d180eb9620 100644 --- a/recipes/pcl/all/test_package/conanfile.py +++ b/recipes/pcl/all/test_package/conanfile.py @@ -1,24 +1,9 @@ +from conans import ConanFile, CMake, tools import os -from conan import ConanFile -from conan.tools.cmake import ( - CMakeToolchain, - CMakeDeps, - CMake -) -from conan.tools.build import cross_building - - class PclTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - - def generate(self): - tc = CMakeToolchain(self) - tc.variables["CMAKE_VERBOSE_MAKEFILE"] = True - tc.generate() - - deps = CMakeDeps(self) - deps.generate() + generators = "cmake", "cmake_find_package_multi" def build(self): cmake = CMake(self) @@ -26,6 +11,6 @@ def build(self): cmake.build() def test(self): - if not cross_building(self): - bin_path = os.path.join(".", "pcl_test_package") + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "pcl_test_package") self.run(bin_path, run_environment=True) diff --git a/recipes/pcl/all/test_package/example.cpp b/recipes/pcl/all/test_package/example.cpp index 4094b5ff7b31a..5d36dd5b6858f 100644 --- a/recipes/pcl/all/test_package/example.cpp +++ b/recipes/pcl/all/test_package/example.cpp @@ -3,7 +3,7 @@ #include #include - + using PointCloud = pcl::PointCloud; int main() { From 74580bc6ca081f29b0ea15eaf7a0b3205180458c Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Mon, 18 Apr 2022 00:30:26 +0100 Subject: [PATCH 52/53] [pcl] try workaround for clang OOM --- recipes/pcl/all/conanfile.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 50c3da1ebd763..60dadcb43d744 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -1,7 +1,9 @@ from conans import ConanFile, CMake, tools from conans.errors import ConanInvalidConfiguration + import os import textwrap +import math required_conan_version = ">=1.33.0" @@ -169,7 +171,13 @@ def _configure_cmake(self): def build(self): self._patch_sources() cmake = self._configure_cmake() - cmake.build() + if self.settings.compiler == "clang": + # Workaround for OOM when building with clang. + # See https://github.com/conan-io/conan-center-index/pull/1891 for discussion + compile_jobs = os.getenv("CONAN_CPU_COUNT", int(math.ceil(tools.cpu_count() / 2))) + self.run(f"cmake --build {cmake.build_folder} {cmake.build_config} -- -j{compile_jobs}") + else: + cmake.build() def package(self): cmake = self._configure_cmake() From 8476322ec7059843ef03b79763db40ba9a10773a Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Mon, 18 Apr 2022 08:20:44 +0100 Subject: [PATCH 53/53] [pcl] another clang OOM workaround --- recipes/pcl/all/conanfile.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/recipes/pcl/all/conanfile.py b/recipes/pcl/all/conanfile.py index 60dadcb43d744..69db7e7e1b739 100644 --- a/recipes/pcl/all/conanfile.py +++ b/recipes/pcl/all/conanfile.py @@ -3,7 +3,6 @@ import os import textwrap -import math required_conan_version = ">=1.33.0" @@ -172,12 +171,23 @@ def build(self): self._patch_sources() cmake = self._configure_cmake() if self.settings.compiler == "clang": - # Workaround for OOM when building with clang. + from io import StringIO + + def has_target(target): + buffer = StringIO() + self.run(f"cmake --build {cmake.build_folder} --target help {cmake.build_config}", output=buffer) + return target in buffer.getvalue() + + # Workaround for OOM when building with clang. # See https://github.com/conan-io/conan-center-index/pull/1891 for discussion - compile_jobs = os.getenv("CONAN_CPU_COUNT", int(math.ceil(tools.cpu_count() / 2))) - self.run(f"cmake --build {cmake.build_folder} {cmake.build_config} -- -j{compile_jobs}") - else: - cmake.build() + if has_target("pcl_filters"): + cmake.build(target="pcl_filters") + if has_target("pcl_features"): + cmake.parallel = False + cmake.build(target="pcl_features") + cmake.parallel = True + + cmake.build() def package(self): cmake = self._configure_cmake()