Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pcl: add v1.14.0, use llvm-openmp for OpenMP #22152

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions recipes/pcl/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
sources:
"1.14.1":
url: "https://github.com/PointCloudLibrary/pcl/archive/refs/tags/pcl-1.14.1.tar.gz"
sha256: "5dc5e09509644f703de9a3fb76d99ab2cc67ef53eaf5637db2c6c8b933b28af6"
"1.13.1":
url: https://github.com/PointCloudLibrary/pcl/archive/refs/tags/pcl-1.13.1.tar.gz
sha256: 8ab98a9db371d822de0859084a375a74bdc7f31c96d674147710cf4101b79621
url: "https://github.com/PointCloudLibrary/pcl/archive/refs/tags/pcl-1.13.1.tar.gz"
sha256: "8ab98a9db371d822de0859084a375a74bdc7f31c96d674147710cf4101b79621"
patches:
"1.14.1":
- patch_file: "patches/1.14.1/0001-cmake_use_conan_targets.patch"
patch_description: "Update PCL CMake files to work with Conan"
patch_type: "conan"
- patch_file: "patches/1.13.1/0002-fix-FindOpenNI-bug.patch"
patch_description: "Fix a libusb detection bug in FindOpenNI.cmake"
patch_type: "bugfix"
"1.13.1":
- patch_file: "patches/1.13.1-0001-cmake_use_conan_targets.patch"
- patch_file: "patches/1.13.1/0001-cmake_use_conan_targets.patch"
patch_description: "Update PCL CMake files to work with Conan"
patch_type: "conan"
- patch_file: "patches/1.13.1-0002-fix-FindOpenNI-bug.patch"
- patch_file: "patches/1.13.1/0002-fix-FindOpenNI-bug.patch"
patch_description: "Fix a libusb detection bug in FindOpenNI.cmake"
patch_type: "bugfix"
- patch_file: "patches/1.13.1-0003-Add-Eigen3-Eigen-target-in-pcl_common-target.patch"
- patch_file: "patches/1.13.1/0003-Add-Eigen3-Eigen-target-in-pcl_common-target.patch"
patch_description: "Add Eigen3::Eigen target to pcl_common target"
patch_type: "conan"
- patch_file: "patches/1.13.1-0004-ReportFixAboutMemoryConsumptionDuringBuild.patch"
- patch_file: "patches/1.13.1/0004-ReportFixAboutMemoryConsumptionDuringBuild.patch"
patch_description: "MovingLeastSquares: reduce the number of instantiations to reduce compile time"
patch_source: "https://github.com/PointCloudLibrary/pcl/pull/5764"
patch_type: "conan"
- patch_file: "patches/1.13.1-0005-ply_parser-include-functional.patch"
- patch_file: "patches/1.13.1/0005-ply_parser-include-functional.patch"
patch_description: "Fix missing functional include in ply_parser.h"
patch_source: "https://github.com/PointCloudLibrary/pcl/pull/5964"
patch_type: "portability"
73 changes: 52 additions & 21 deletions recipes/pcl/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.apple import is_apple_os
from conan.tools.build import check_min_cppstd
from conan.tools.build import check_min_cppstd, can_run
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, rm
from conan.tools.gnu import PkgConfigDeps
from conan.tools.microsoft import is_msvc
from conan.tools.scm import Version
from conan.tools.system import package_manager
import os
Expand Down Expand Up @@ -373,9 +374,9 @@ def requirements(self):
if self._is_enabled("png"):
self.requires("libpng/[>=1.6 <2]")
if self._is_enabled("qhull"):
self.requires("qhull/8.0.1", transitive_headers=True)
self.requires("qhull/cci.20231130", transitive_headers=True)
if self._is_enabled("qt"):
self.requires("qt/6.6.1")
self.requires("qt/[>=6.7 <7]")
if self._is_enabled("libusb"):
self.requires("libusb/1.0.26", transitive_headers=True)
if self._is_enabled("pcap"):
Expand Down Expand Up @@ -436,8 +437,34 @@ def validate(self):
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support."
)

def _patch_sources(self):
apply_conandata_patches(self)
find_modules_to_remove = [
"ClangFormat",
"DSSDK",
"Ensenso",
"FLANN",
"GLEW",
"GTestSource",
"OpenMP",
"OpenNI",
"OpenNI2",
"Pcap",
"Qhull",
"RSSDK",
"RSSDK2",
"Sphinx",
"davidSDK",
"libusb",
]
if Version(self.version) < "1.14.0":
find_modules_to_remove.append("Eigen")
for mod in find_modules_to_remove:
os.remove(os.path.join(self.source_folder, "cmake", "Modules", f"Find{mod}.cmake"))

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
self._patch_sources()

def generate(self):
tc = CMakeToolchain(self)
Expand All @@ -461,7 +488,7 @@ def generate(self):
tc.cache_variables["PCL_ONLY_CORE_POINT_TYPES"] = self.options.precompile_only_core_point_types
# The default False setting breaks OpenGL detection in CMake
tc.cache_variables["PCL_ALLOW_BOTH_SHARED_AND_STATIC_DEPENDENCIES"] = True
tc.variables["OpenGL_GL_PREFERENCE"] = "GLVND"
tc.cache_variables["OpenGL_GL_PREFERENCE"] = "GLVND"

if not self.options.add_build_type_postfix:
tc.cache_variables["CMAKE_DEBUG_POSTFIX"] = ""
Expand All @@ -483,10 +510,13 @@ def generate(self):

tc.cache_variables["PCL_ENABLE_SSE"] = self.options.get_safe("use_sse", False)

# Do not overwrite CMakeToolchain variables with cache variables
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW"
tc.generate()

deps = CMakeDeps(self)
deps.set_property("eigen", "cmake_file_name", "EIGEN")
valgur marked this conversation as resolved.
Show resolved Hide resolved
if Version(self.version) < "1.14.0":
deps.set_property("eigen", "cmake_file_name", "EIGEN")
deps.set_property("flann", "cmake_file_name", "FLANN")
deps.set_property("flann", "cmake_target_name", "FLANN::FLANN")
deps.set_property("libpcap", "cmake_file_name", "PCAP")
Expand All @@ -497,13 +527,7 @@ def generate(self):
deps = PkgConfigDeps(self)
deps.generate()

def _patch_sources(self):
apply_conandata_patches(self)
for mod in ["Eigen", "FLANN", "GLEW", "Pcap", "Qhull", "libusb"]:
os.remove(os.path.join(self.source_folder, "cmake", "Modules", f"Find{mod}.cmake"))

def build(self):
self._patch_sources()
cmake = CMake(self)
cmake.configure()
cmake.build()
Expand Down Expand Up @@ -574,19 +598,26 @@ def package_info(self):
if not self.options.shared:
if self.settings.os in ["Linux", "FreeBSD"]:
common.system_libs.append("pthread")
if self.options.with_openmp:
if self.settings.os == "Linux":
if self.settings.compiler == "gcc":
common.sharedlinkflags.append("-fopenmp")
common.exelinkflags.append("-fopenmp")
elif self.settings.os == "Windows":
if self.settings.compiler == "msvc":
common.system_libs.append("delayimp")
elif self.settings.compiler == "gcc":
common.system_libs.append("gomp")
if self.settings.os == "Windows":
common.system_libs.append("ws2_32")

if self.options.with_openmp:
openmp_flags = []
if is_msvc(self):
openmp_flags = ["-openmp"]
elif self.settings.compiler == "gcc":
openmp_flags = ["-fopenmp"]
elif self.settings.compiler == "clang":
return ["-fopenmp"]
elif self.settings.compiler == "apple-clang":
return ["-Xclang", "-fopenmp"]
elif self.settings.compiler == "intel-cc":
openmp_flags = ["/Qopenmp"] if self.settings.os == "Windows" else ["-Qopenmp"]
self.cpp_info.cflags += openmp_flags
self.cpp_info.cxxflags += openmp_flags
self.cpp_info.sharedlinkflags += openmp_flags
self.cpp_info.exelinkflags += openmp_flags

# TODO: Legacy, to be removed on Conan 2.0
self.cpp_info.names["cmake_find_package"] = "PCL"
self.cpp_info.names["cmake_find_package_multi"] = "PCL"
37 changes: 37 additions & 0 deletions recipes/pcl/all/patches/1.14.1/0001-cmake_use_conan_targets.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -297,6 +297,6 @@
# OpenMP (optional)
option(WITH_OPENMP "Build with parallelization using OpenMP" TRUE)
if(WITH_OPENMP)
- find_package(OpenMP COMPONENTS C CXX)
+ find_package(OpenMP REQUIRED COMPONENTS C CXX)
endif()
if(OpenMP_FOUND)
@@ -365,7 +365,7 @@
# LibPNG
option(WITH_PNG "PNG file support" TRUE)
if(WITH_PNG)
- find_package(PNG)
+ find_package(PNG REQUIRED CONFIG)
if(PNG_FOUND)
set(HAVE_PNG ON)
endif()
@@ -374,7 +374,7 @@
# Qhull
option(WITH_QHULL "Include convex-hull operations" TRUE)
if(WITH_QHULL)
- find_package(Qhull)
+ find_package(QHULL REQUIRED CONFIG)
if(NOT (${QHULL_LIBRARY_TYPE} MATCHES ${PCL_QHULL_REQUIRED_TYPE}) AND NOT (${PCL_QHULL_REQUIRED_TYPE} MATCHES "DONTCARE"))
message(FATAL_ERROR "Qhull was selected with ${PCL_QHULL_REQUIRED_TYPE} but found as ${QHULL_LIBRARY_TYPE}")
endif()
@@ -409,7 +409,7 @@
#Find PCAP
option(WITH_PCAP "pcap file capabilities in Velodyne HDL driver" TRUE)
if(WITH_PCAP)
- find_package(Pcap)
+ find_package(PCAP REQUIRED CONFIG)
endif()

# OpenGL and GLUT
2 changes: 2 additions & 0 deletions recipes/pcl/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
versions:
"1.14.1":
folder: all
"1.13.1":
folder: all