-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
small_gicp: new recipe #23458
Open
valgur
wants to merge
13
commits into
conan-io:master
Choose a base branch
from
valgur:new/small_gicp
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+204
−0
Open
small_gicp: new recipe #23458
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
040692f
small_gicp: new recipe
valgur 1201f3b
small_gicp: patch has been merged upstream
valgur d3644fd
small_gicp: OpenMP cannot be disabled, add proper support
valgur c2659b4
small_gicp: require newer CMake
valgur f0281bc
small_gicp: bump snapshot version
valgur aa242d9
small_gicp: fix a Clang / libc++ compilation error
valgur c358ed2
small_gicp: set _USE_MATH_DEFINES
valgur 5639248
small_gicp: bump onetbb
valgur b4f803f
small_gicp: patch has been merged
valgur fa85ac2
small_gicp: llvm-openmp is required for MSVC
valgur a125c66
small_gicp: update
valgur d58fc0e
small_gicp: update to v0.1.2
valgur deb3160
small_gicp: update to v1.0.0
valgur File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sources: | ||
"1.0.0": | ||
url: "https://github.com/koide3/small_gicp/archive/refs/tags/v1.0.0.tar.gz" | ||
sha256: "8ace22cfc79b1ea1c827d199c98f1efd01fd5a6686cda99e684ef21cb86ebbbf" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
from conan import ConanFile | ||
from conan.errors import ConanInvalidConfiguration | ||
from conan.tools.build import check_min_cppstd | ||
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout | ||
from conan.tools.env import VirtualBuildEnv | ||
from conan.tools.files import copy, get, rm, rmdir, download | ||
from conan.tools.scm import Version | ||
import os | ||
|
||
required_conan_version = ">=1.53.0" | ||
|
||
|
||
class IridescenceConan(ConanFile): | ||
name = "small_gicp" | ||
description = "Efficient and parallelized algorithms for point cloud registration" | ||
license = "MIT AND BSD" # BSD is from nanoflann and Sophus | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://github.com/koide3/small_gicp" | ||
topics = ("point-cloud", "icp", "registration", "scan-matching", "pcl") | ||
|
||
package_type = "library" # TODO: could add a header_only option as well | ||
settings = "os", "arch", "compiler", "build_type" | ||
options = { | ||
"shared": [True, False], | ||
"fPIC": [True, False], | ||
"with_openmp": [True, False], | ||
"with_tbb": [True, False], | ||
} | ||
default_options = { | ||
"shared": False, | ||
"fPIC": True, | ||
"with_openmp": True, | ||
"with_tbb": True, | ||
} | ||
|
||
@property | ||
def _min_cppstd(self): | ||
return 17 | ||
|
||
@property | ||
def _compilers_minimum_version(self): | ||
return { | ||
"gcc": "7", | ||
"clang": "7", | ||
"apple-clang": "10", | ||
"Visual Studio": "15", | ||
"msvc": "191", | ||
} | ||
|
||
def config_options(self): | ||
if self.settings.os == "Windows": | ||
del self.options.fPIC | ||
|
||
def configure(self): | ||
if self.options.shared: | ||
self.options.rm_safe("fPIC") | ||
|
||
def layout(self): | ||
cmake_layout(self, src_folder="src") | ||
|
||
def requirements(self): | ||
self.requires("eigen/3.4.0", transitive_headers=True) | ||
if self.options.with_openmp: | ||
# '#pragma omp' is used in public headers | ||
# Note: native MSVC OpenMP is not compatible | ||
self.requires("llvm-openmp/18.1.8", transitive_headers=True, transitive_libs=True) | ||
if self.options.with_tbb: | ||
self.requires("onetbb/2021.12.0", transitive_headers=True, transitive_libs=True) | ||
|
||
def validate(self): | ||
if self.settings.compiler.cppstd: | ||
check_min_cppstd(self, self._min_cppstd) | ||
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) | ||
if minimum_version and Version(self.settings.compiler.version) < minimum_version: | ||
raise ConanInvalidConfiguration( | ||
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." | ||
) | ||
|
||
def build_requirements(self): | ||
self.tool_requires("cmake/[>=3.16 <4]") | ||
|
||
def source(self): | ||
get(self, **self.conan_data["sources"][self.version], strip_root=True) | ||
download(self, "https://github.com/jlblancoc/nanoflann/blob/568ae53f5fcd82d5398bb1b32144fa22028518d5/COPYING", "LICENSE.nanoflann") | ||
download(self, "https://github.com/strasdat/Sophus/blob/593db47500ea1a2de5f0e6579c86147991509c59/LICENSE.txt", "LICENSE.sophus") | ||
|
||
def generate(self): | ||
venv = VirtualBuildEnv(self) | ||
venv.generate() | ||
|
||
tc = CMakeToolchain(self) | ||
tc.variables["BUILD_HELPER"] = True | ||
tc.variables["BUILD_WITH_OPENMP"] = self.options.with_openmp | ||
tc.variables["BUILD_WITH_TBB"] = self.options.with_tbb | ||
tc.generate() | ||
|
||
deps = CMakeDeps(self) | ||
deps.generate() | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def package(self): | ||
copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) | ||
# The source code contains fragments from nanoflann and Sophus | ||
copy(self, "LICENSE.nanoflann", self.source_folder, os.path.join(self.package_folder, "licenses")) | ||
copy(self, "LICENSE.sophus", self.source_folder, os.path.join(self.package_folder, "licenses")) | ||
cmake = CMake(self) | ||
cmake.install() | ||
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) | ||
rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) | ||
rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) | ||
rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) | ||
|
||
def package_info(self): | ||
self.cpp_info.set_property("cmake_file_name", "small_gicp") | ||
self.cpp_info.set_property("cmake_target_name", "small_gicp::small_gicp") | ||
|
||
self.cpp_info.libs = ["small_gicp"] | ||
|
||
if self.settings.os in ["Linux", "FreeBSD"]: | ||
self.cpp_info.system_libs.append("m") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
project(test_package LANGUAGES CXX) | ||
|
||
find_package(small_gicp REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE small_gicp::small_gicp) | ||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "CMakeDeps", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def generate(self): | ||
tc = CMakeToolchain(self) | ||
if self.dependencies["small_gicp"].options.with_openmp: | ||
tc.preprocessor_definitions["WITH_OPENMP"] = "" | ||
if self.dependencies["small_gicp"].options.with_tbb: | ||
tc.preprocessor_definitions["WITH_TBB"] = "" | ||
tc.generate() | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindir, "test_package") | ||
self.run(bin_path, env="conanrun") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include <small_gicp/points/point_cloud.hpp> | ||
#include <small_gicp/ann/kdtree.hpp> | ||
#ifdef WITH_OPENMP | ||
#include <small_gicp/ann/kdtree_omp.hpp> | ||
#endif | ||
#ifdef WITH_TBB | ||
#include <small_gicp/ann/kdtree_tbb.hpp> | ||
#endif | ||
|
||
using namespace small_gicp; | ||
|
||
int main() { | ||
std::vector<Eigen::Vector4f> target_points = { | ||
{1.0f, 2.0f, 3.0f, 1.0f}, | ||
{4.0f, 5.0f, 6.0f, 1.0f}, | ||
{7.0f, 8.0f, 9.0f, 1.0f}, | ||
}; | ||
auto target = std::make_shared<PointCloud>(target_points); | ||
|
||
const int num_threads = 1; | ||
std::make_shared<KdTree<PointCloud>>(target, KdTreeBuilderOMP(num_threads)); | ||
|
||
#ifdef WITH_OPENMP | ||
std::make_shared<KdTree<PointCloud>>(target, KdTreeBuilderOMP()); | ||
#endif | ||
|
||
#ifdef WITH_TBB | ||
std::make_shared<KdTree<PointCloud>>(target, KdTreeBuilderTBB()); | ||
#endif | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
"1.0.0": | ||
folder: all |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we
validate()
this configuration out to be able to move this forward while work on mp progresses?