Skip to content

Commit

Permalink
(#8819) nanoflann: add 1.4.2 + modernize
Browse files Browse the repository at this point in the history
* add nanoflann/1.4.2

* modernize
  • Loading branch information
SpaceIm authored Jan 12, 2022
1 parent 26ceff2 commit b0961bb
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 17 deletions.
7 changes: 5 additions & 2 deletions recipes/nanoflann/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
sources:
"1.4.2":
url: "https://github.com/jlblancoc/nanoflann/archive/refs/tags/v1.4.2.tar.gz"
sha256: "97fce650eb644a359a767af526cab9ba31842e53790a7279887e1ae2fffe7319"
"1.3.2":
url: "https://github.com/jlblancoc/nanoflann/archive/v1.3.2.tar.gz"
sha256: e100b5fc8d72e9426a80312d852a62c05ddefd23f17cbb22ccd8b458b11d0bea
sha256: "e100b5fc8d72e9426a80312d852a62c05ddefd23f17cbb22ccd8b458b11d0bea"
"1.3.1":
url: "https://github.com/jlblancoc/nanoflann/archive/v1.3.1.tar.gz"
sha256: b1b1ac9bf6c3bac284014b326480388ad469bdeca78bd27a34ba2ae1da1a03ff
sha256: "b1b1ac9bf6c3bac284014b326480388ad469bdeca78bd27a34ba2ae1da1a03ff"
26 changes: 16 additions & 10 deletions recipes/nanoflann/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import os
from conans import ConanFile, tools
import os

required_conan_version = ">=1.43.0"


class NanoflannConan(ConanFile):
Expand All @@ -8,30 +10,34 @@ class NanoflannConan(ConanFile):
of datasets with different topologies: R2, R3 (point clouds),
SO(2) and SO(3) (2D and 3D rotation groups).
"""
topics = ("conan", "nanoflann", "nearest-neighbor", "kd-trees")
topics = ("nanoflann", "nearest-neighbor", "kd-trees")
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/jlblancoc/nanoflann"
license = "BSD-2-Clause"
settings = "compiler"
settings = "os", "arch", "compiler", "build_type"
no_copy_source = True

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

def configure(self):
if self.settings.compiler.cppstd:
def validate(self):
if self.settings.compiler.get_safe("cppstd"):
tools.check_min_cppstd(self, 11)

def package_id(self):
self.info.header_only()

def source(self):
tools.get(**self.conan_data["sources"][self.version])
extracted_dir = self.name + "-" + self.version
os.rename(extracted_dir, self._source_subfolder)
tools.get(**self.conan_data["sources"][self.version],
destination=self._source_subfolder, strip_root=True)

def package(self):
include_folder = os.path.join(self._source_subfolder, "include")
self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder)
self.copy(pattern="*", dst="include", src=include_folder)

def package_id(self):
self.info.header_only()
def package_info(self):
self.cpp_info.set_property("cmake_file_name", "nanoflann")
self.cpp_info.set_property("cmake_target_name", "nanoflann::nanoflann")
self.cpp_info.set_property("pkg_config_name", "nanoflann")
6 changes: 4 additions & 2 deletions recipes/nanoflann/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ cmake_minimum_required(VERSION 3.1)
project(test_package)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
conan_basic_setup(TARGETS)

find_package(nanoflann REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
target_link_libraries(${PROJECT_NAME} nanoflann::nanoflann)
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11)
6 changes: 3 additions & 3 deletions recipes/nanoflann/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@


class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
settings = "os", "arch", "compiler", "build_type"
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):
if not tools.cross_building(self):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)
2 changes: 2 additions & 0 deletions recipes/nanoflann/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"1.4.2":
folder: "all"
"1.3.2":
folder: "all"
"1.3.1":
Expand Down

0 comments on commit b0961bb

Please sign in to comment.