diff --git a/recipes/manif/all/conandata.yml b/recipes/manif/all/conandata.yml new file mode 100644 index 0000000000000..5d0f0b0b2a6f2 --- /dev/null +++ b/recipes/manif/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.0.5": + url: "https://github.com/artivis/manif/archive/refs/tags/0.0.5.tar.gz" + sha256: "246a781c54a5c57179d48096faca0d108944e120f69d8fd7fb69e3cb4a0a67fb" diff --git a/recipes/manif/all/conanfile.py b/recipes/manif/all/conanfile.py new file mode 100644 index 0000000000000..f0f62f808f152 --- /dev/null +++ b/recipes/manif/all/conanfile.py @@ -0,0 +1,66 @@ +import os + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" + + +class PackageConan(ConanFile): + name = "manif" + description = "A small C++11 header-only library for Lie theory" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://artivis.github.io/manif" + topics = ("lie-groups", "state-estimation", "geometry", "robotics", "computer-vision", "header-only") + + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 11 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "6", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("eigen/3.4.0") + self.requires("tl-optional/1.1.0") + + def package_id(self): + self.info.clear() + + 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 source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "*.h", os.path.join(self.source_folder, "include"), os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "manif") + self.cpp_info.set_property("cmake_target_name", "MANIF::manif") + + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/manif/all/test_package/CMakeLists.txt b/recipes/manif/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..84ba50bb17606 --- /dev/null +++ b/recipes/manif/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(manif REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE MANIF::manif) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/manif/all/test_package/conanfile.py b/recipes/manif/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/manif/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/manif/all/test_package/test_package.cpp b/recipes/manif/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..c82dc520226c0 --- /dev/null +++ b/recipes/manif/all/test_package/test_package.cpp @@ -0,0 +1,10 @@ +#include + +using namespace manif; + +int main() { + SE3d X = SE3d::Random(); + SE3Tangentd w = SE3Tangentd::Random(); + SE3d::Jacobian J_o_x, J_o_w; + auto X_plus_w = X.plus(w, J_o_x, J_o_w); +} diff --git a/recipes/manif/config.yml b/recipes/manif/config.yml new file mode 100644 index 0000000000000..6506e357707be --- /dev/null +++ b/recipes/manif/config.yml @@ -0,0 +1,3 @@ +versions: + "0.0.5": + folder: all