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

Add PCL package #1891

Closed
wants to merge 54 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
78029bd
Add PCL package
planetmarshall Jun 13, 2020
07d0522
Fix hook errors
planetmarshall Jun 13, 2020
fd43a92
select correct version of flann library
planetmarshall Jun 13, 2020
8774793
rename class
planetmarshall Jun 13, 2020
32fef4e
rename module options
planetmarshall Jun 13, 2020
8b74bde
rename options and add opengl requirement
planetmarshall Jun 13, 2020
2c755e9
Remove most package options and just use sensible defaults
planetmarshall Jun 28, 2020
843cf55
use cmake to specify subfolder name
planetmarshall Jun 28, 2020
9050c8d
Address PR comments
planetmarshall Jun 28, 2020
6b6ddb5
Use cmake find package generator
planetmarshall Jun 28, 2020
3cc5c64
call convex hull operation in test package
planetmarshall Jun 28, 2020
3c21176
remove requirement for qhull to be static
planetmarshall Jun 28, 2020
13125af
remove fpic for windows
planetmarshall Jun 28, 2020
2347012
VS 2015 not supported
planetmarshall Jun 28, 2020
2f0a1ec
restore opengl requirement (accidentally deleted)
planetmarshall Jun 29, 2020
2145466
remove vs runtime files
planetmarshall Jun 29, 2020
d636240
fix vs runtime file path
planetmarshall Jun 29, 2020
2741a6e
remove qhull default option
planetmarshall Jun 29, 2020
c272820
support pcl 1.10 in test package
planetmarshall Jun 29, 2020
53da8bb
Update recipes/pcl/all/conanfile.py
planetmarshall Jun 29, 2020
8fd2f64
Update recipes/pcl/all/CMakeLists.txt
planetmarshall Jun 29, 2020
5646161
Update recipes/pcl/all/conanfile.py
planetmarshall Jun 29, 2020
d03b370
Update recipes/pcl/all/CMakeLists.txt
planetmarshall Jun 29, 2020
db4eb9a
Update recipes/pcl/all/conanfile.py
planetmarshall Jun 29, 2020
9129ede
Update recipes/pcl/all/test_package/conanfile.py
planetmarshall Jun 29, 2020
388be41
use cmake member variable
planetmarshall Jun 29, 2020
5143ee9
fix cmake member variable
planetmarshall Jun 29, 2020
605c465
Add topics and VS compatibility check
planetmarshall Jun 30, 2020
1652b16
Fix compiler version check
planetmarshall Jun 30, 2020
9a39937
Add pcl subsystems as components
planetmarshall Aug 29, 2020
6aa6ef9
fix package naming for generators
planetmarshall Aug 29, 2020
0bf1936
Make shared false by default
planetmarshall Aug 29, 2020
dae7be3
Remove v1.10 and update to v1.11.1
planetmarshall Sep 3, 2020
33499eb
Remove opengl requirement (not required)
planetmarshall Sep 3, 2020
00a4b9e
link qhull with non-reentrant lib by default
planetmarshall Sep 28, 2020
41911a9
ensure conan generated find modules are preferred
planetmarshall Oct 13, 2020
eba3a02
Add flann target alias
planetmarshall Oct 13, 2020
1730606
mimic custom PCL QHull detection
planetmarshall Oct 13, 2020
414e203
Remove unnecessary Flann workaround
planetmarshall Oct 13, 2020
19cb75d
re-introduce flann naming workaround
planetmarshall Oct 14, 2020
a71774f
Add suffix for MSVC debug builds
planetmarshall Oct 14, 2020
2235aaa
update boost and eigen packages
planetmarshall Dec 2, 2020
634a2f8
ensure minimum clang and libc++
planetmarshall Dec 2, 2020
e0d7968
fix failure due to missing boost mpi package
planetmarshall Dec 14, 2020
9382f89
fix several things
SpaceIm Mar 19, 2021
c6fef55
less boilerplate
SpaceIm Mar 20, 2021
8c9555e
add a comment about reentrant qhull
SpaceIm Mar 20, 2021
d1b16fe
Merge pull request #2 from SpaceIm/fix/pcl-components-options-openmp
planetmarshall Mar 20, 2021
de87a86
[pcl] bump to 1.12.1
planetmarshall Apr 17, 2022
ec5056e
[pcl] reentrant qhull
planetmarshall Apr 17, 2022
d7cc565
[pcl] modernize
planetmarshall Apr 17, 2022
a52af55
[pcl] revert test package modernization
planetmarshall Apr 17, 2022
74580bc
[pcl] try workaround for clang OOM
planetmarshall Apr 17, 2022
8476322
[pcl] another clang OOM workaround
planetmarshall Apr 18, 2022
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
25 changes: 25 additions & 0 deletions recipes/pcl/all/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 3.1)
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)
set_property(TARGET FLANN::FLANN PROPERTY INTERFACE_LINK_LIBRARIES flann::flann)
set(FLANN_FOUND TRUE)

if(WITH_QHULL)
find_package(Qhull REQUIRED CONFIG)
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)
4 changes: 4 additions & 0 deletions recipes/pcl/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"1.12.1":
url: "https://github.com/PointCloudLibrary/pcl/archive/pcl-1.12.1.tar.gz"
sha256: "dc0ac26f094eafa7b26c3653838494cc0a012bd1bdc1f1b0dc79b16c2de0125a"
318 changes: 318 additions & 0 deletions recipes/pcl/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,318 @@
from conans import ConanFile, CMake, tools
from conans.errors import ConanInvalidConfiguration

import os
import textwrap

required_conan_version = ">=1.33.0"


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"
planetmarshall marked this conversation as resolved.
Show resolved Hide resolved
topics = ("pointcloud", "computer-vision", "point-cloud")

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],
planetmarshall marked this conversation as resolved.
Show resolved Hide resolved
"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,
}

exports = ["CMakeLists.txt"]
generators = ["cmake", "cmake_find_package", "cmake_find_package_multi"]
_cmake = None

@property
def _source_subfolder(self):
return "source_subfolder"

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"):
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)
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 _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):
if self.options.shared:
del self.options.fPIC
self._check_msvc()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested on macOS. This line needed to prevent fail.

Suggested change
self._check_msvc()
if self.settings.compiler=="msvc":
self._check_msvc()

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After that getting error. Not sure what is wrong.
Screenshot 2023-02-28 at 21 40 12

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sakrist The error on that picture is different, it shows that the package version that you passed to conan create command does not exist in conandata.yml file. Please, share your entire build log as pure text.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. This is new error I get after fix in first comment.
oh, I try build 1.12.0 but available only 1.12.1

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully compiled 1.12.1 package on MacBook M1 Pro.

self._check_cxx_standard()
self._check_libcxx_compatibility()

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 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 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
tools.replace_in_file(
os.path.join(self._source_subfolder, "cmake", "pcl_find_boost.cmake"),
"find_package(Boost 1.65.0 QUIET COMPONENTS serialization mpi)",
"find_package(Boost 1.65.0 QUIET OPTIONAL_COMPONENTS serialization)"
)

def _configure_cmake(self):
if self._cmake:
return self._cmake

cmake_definitions = {
"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": self.options.with_png,
"WITH_QHULL": self.options.with_qhull,
"WITH_CUDA": self.options.with_cuda,
"WITH_VTK": False,
"WITH_PCAP": False,
"WITH_OPENGL": False,
"WITH_OPENNI": False,
"WITH_OPENNI2": False,
"WITH_ENSENSO": False,
"WITH_DAVIDSDK": False,
"WITH_DSSDK": False,
"WITH_RSSDK": False,
"PCL_SHARED_LIBS": self.options.shared,
}
pcl_features = {
"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,
}

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):
self._patch_sources()
cmake = self._configure_cmake()
if self.settings.compiler == "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
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()
cmake.install()
self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder)

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),
{"PCL_{}_LIBRARIES".format(comp.upper()): "PCL::{}".format(comp) for comp 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")

@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 package_info(self):
Copy link
Contributor

@SpaceIm SpaceIm Jul 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PCL creates several pkgconfig files (one per component) and one CMake config file (PCLConfig.cmake) with a lot of non namespaced imported targets: common kdtree octree search sample_consensus filters 2d geometry io features ml segmentation surface registration keypoints tracking recognition stereo.

Here are inter dependencies extracted from PCLConfig.cmake:

#list each component dependencies IN PCL
set(pcl_kdtree_int_dep common )
set(pcl_octree_int_dep common )
set(pcl_search_int_dep common kdtree octree )
set(pcl_sample_consensus_int_dep common search )
set(pcl_filters_int_dep common sample_consensus search kdtree octree )
set(pcl_2d_int_dep common filters )
set(pcl_geometry_int_dep common )
set(pcl_io_int_dep common octree )
set(pcl_features_int_dep common search kdtree octree filters 2d )
set(pcl_ml_int_dep common )
set(pcl_segmentation_int_dep common geometry search sample_consensus kdtree octree features filters ml )
set(pcl_surface_int_dep common search kdtree octree )
set(pcl_registration_int_dep common octree kdtree search sample_consensus features filters )
set(pcl_keypoints_int_dep common search kdtree octree features filters )
set(pcl_tracking_int_dep common search kdtree filters octree )
set(pcl_recognition_int_dep common io search kdtree octree features filters registration sample_consensus ml )
set(pcl_stereo_int_dep common io )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conan center index packages do not support custom PKG config or cmake files.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but package_info should contain all necessary stuff to mimic those files through pkg_config, cmake_find_package and cmake_find_package_multi generators.
Even without using components, libs should be listed in proper order.

Copy link
Contributor

@SpaceIm SpaceIm Jul 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here is a starter to help you:

    def package_info(self):
        self.cpp_info.names["cmake_find_package"] = "PCL"
        self.cpp_info.names["cmake_find_package_multi"] = "PCL"
        # common
        self.cpp_info.components["common"].names["pkg_config"] = "pcl_common"
        self.cpp_info.components["common"].libs = ["common"]
        # kdtree
        self.cpp_info.components["kdtree"].names["pkg_config"] = "pcl_kdtree"
        self.cpp_info.components["kdtree"].libs = ["kdtree"]
        self.cpp_info.components["kdtree"].requires = ["common"]
        ...

Maybe some values are wrong, didn't check exact lib names or pkgconfig files. You'll have also to properly define external dependencies of each component (and eventually system libs dependencies if any depending on os).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Components is still marked as an experimental feature. Are there any other conan center index packages doing this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's experimental yet, but it should not break, probably it should be increased. Yes, we have a lot of recipe using it (thanks to @SpaceIm): https://github.com/conan-io/conan-center-index/search?l=Python&q=components&type=Code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attempted to get as close as I can to PCL's target names, however it creates targets without namespaces along the lines of PCL_SURFACE_LIBRARIES etc. I've mimicked this with components, but conan's targets will be namespaced so PCL::PCL_SURFACE_LIBRARIES.

I don't see a way in conan/cmake to distinguish between a non-namespaced target called PCL_SURFACE_LIBRARIES and a plain cmake variable called PCL_SURFACE_LIBRARIES that contains the list of libraries to link to.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conan cmake generator, primarily, focus on the targets approach since that is considered the best practice now a days.

We can not create and variables (yet).

I think the components work done is complete for a first PR, feel free to mark this resolved!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have now several recipes which are able to provide non-namespaced targets. Take a look at OpenCV recipe for a complex example with targets.

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", [])
self.cpp_info.components[comp].libs = [self._lib_name(lib) for lib in libs]
self.cpp_info.components[comp].requires = values["requires"]

_update_components(self._pcl_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)
11 changes: 11 additions & 0 deletions recipes/pcl/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
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)
target_compile_features(pcl_test_package PUBLIC cxx_std_14)
target_link_libraries(pcl_test_package PRIVATE PCL_SURFACE_LIBRARIES)
16 changes: 16 additions & 0 deletions recipes/pcl/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from conans import ConanFile, CMake, tools
import os

class PclTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake", "cmake_find_package_multi"

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
if not tools.cross_building(self.settings):
bin_path = os.path.join("bin", "pcl_test_package")
self.run(bin_path, run_environment=True)
Loading