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

tsl-robin-map: modernize #9148

Merged
merged 1 commit into from
Feb 3, 2022
Merged
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
15 changes: 11 additions & 4 deletions recipes/tsl-robin-map/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
from conans import ConanFile, tools
import os

required_conan_version = ">=1.28.0"
required_conan_version = ">=1.43.0"


class TslRobinMapConan(ConanFile):
name = "tsl-robin-map"
license = "MIT"
description = "C++ implementation of a fast hash map and hash set using robin hood hashing."
topics = ("conan", "robin-map", "structure", "hash map", "hash set")
topics = ("robin-map", "structure", "hash map", "hash set")
homepage = "https://github.com/Tessil/robin-map"
url = "https://github.com/conan-io/conan-center-index"
settings = "os", "arch", "compiler", "build_type"
no_copy_source = True

@property
Expand All @@ -20,17 +22,22 @@ def package_id(self):
self.info.header_only()

def source(self):
tools.get(**self.conan_data["sources"][self.version])
os.rename("robin-map-{}".format(self.version), self._source_subfolder)
tools.get(**self.conan_data["sources"][self.version],
destination=self._source_subfolder, strip_root=True)

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

def package_info(self):
self.cpp_info.set_property("cmake_file_name", "tsl-robin-map")
self.cpp_info.set_property("cmake_target_name", "tsl::robin_map")

# TODO: to remove in conan v2 once cmake_find_package* generators removed
self.cpp_info.filenames["cmake_find_package"] = "tsl-robin-map"
self.cpp_info.filenames["cmake_find_package_multi"] = "tsl-robin-map"
self.cpp_info.names["cmake_find_package"] = "tsl"
self.cpp_info.names["cmake_find_package_multi"] = "tsl"
self.cpp_info.components["robin_map"].names["cmake_find_package"] = "robin_map"
self.cpp_info.components["robin_map"].names["cmake_find_package_multi"] = "robin_map"
self.cpp_info.components["robin_map"].set_property("cmake_target_name", "tsl::robin_map")
2 changes: 1 addition & 1 deletion recipes/tsl-robin-map/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.1)
project(test_package)

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

find_package(tsl-robin-map REQUIRED CONFIG)

Expand Down
6 changes: 3 additions & 3 deletions recipes/tsl-robin-map/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import os
from conans import ConanFile, CMake, tools
import os


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

def build(self):
Expand All @@ -12,6 +12,6 @@ def build(self):
cmake.build()

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