Skip to content

Commit

Permalink
(#9152) tsl-array-hash: modernize
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceIm authored Feb 3, 2022
1 parent c5bc15f commit 791faf4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
15 changes: 11 additions & 4 deletions recipes/tsl-array-hash/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 TslArrayHashConan(ConanFile):
name = "tsl-array-hash"
license = "MIT"
description = "C++ implementation of a fast and memory efficient hash map and hash set specialized for strings."
topics = ("conan", "string", "structure", "hash map", "hash set")
topics = ("string", "structure", "hash map", "hash set")
homepage = "https://github.com/Tessil/array-hash"
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("array-hash-{}".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-array-hash")
self.cpp_info.set_property("cmake_target_name", "tsl::array_hash")

# TODO: to remove in conan v2 once cmake_find_package* generators removed
self.cpp_info.filenames["cmake_find_package"] = "tsl-array-hash"
self.cpp_info.filenames["cmake_find_package_multi"] = "tsl-array-hash"
self.cpp_info.names["cmake_find_package"] = "tsl"
self.cpp_info.names["cmake_find_package_multi"] = "tsl"
self.cpp_info.components["array_hash"].names["cmake_find_package"] = "array_hash"
self.cpp_info.components["array_hash"].names["cmake_find_package_multi"] = "array_hash"
self.cpp_info.components["array_hash"].set_property("cmake_target_name", "tsl::array_hash")
2 changes: 1 addition & 1 deletion recipes/tsl-array-hash/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-array-hash REQUIRED CONFIG)

Expand Down
7 changes: 4 additions & 3 deletions recipes/tsl-array-hash/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,8 +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 @@ -11,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)

0 comments on commit 791faf4

Please sign in to comment.