diff --git a/recipes/seq/all/conandata.yml b/recipes/seq/all/conandata.yml new file mode 100644 index 0000000000000..776f263259b49 --- /dev/null +++ b/recipes/seq/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "1.1.0": + url: "https://github.com/Thermadiag/seq/archive/refs/tags/v1.1.0.tar.gz" + sha256: "806e5f0ed692d662caba3295ef23f8177147853365d97fa2ff9bbc2aa412c840" +patches: + "1.1.0": + - patch_file: "patches/1.1.0-0001-support-clang.patch" + patch_description: "support clang about is_trivially_copyable" + patch_type: "portability" + patch_source: "https://github.com/Thermadiag/seq/pull/4" diff --git a/recipes/seq/all/conanfile.py b/recipes/seq/all/conanfile.py new file mode 100644 index 0000000000000..a13e47d422f6d --- /dev/null +++ b/recipes/seq/all/conanfile.py @@ -0,0 +1,79 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, rm +import os + +required_conan_version = ">=2.1" + +class PackageConan(ConanFile): + name = "seq" + description = "A collection of original C++14 STL-like containers and related tools" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Thermadiag/seq" + topics = ("formatting", "hashmap", "radix") + package_type = "shared-library" + settings = "os", "arch", "compiler", "build_type" + short_paths = True + options = { + "header_only": [True, False], + } + default_options = { + "header_only": False, + } + + def export_sources(self): + export_conandata_patches(self) + + def configure(self): + if self.options.header_only: + self.package_type = "header-library" + + def layout(self): + cmake_layout(self, src_folder="src") + + def package_id(self): + if self.info.options.header_only: + self.info.clear() + + def validate(self): + check_min_cppstd(self, 14) + + 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) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["HEADER_ONLY"] = self.options.header_only + tc.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + if not self.options.header_only: + rm(self, "*.cpp", os.path.join(self.package_folder, "include"), recursive=True) + + def package_info(self): + if self.options.header_only: + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + else: + self.cpp_info.libs = ["seq"] + + self.cpp_info.set_property("cmake_module_file_name", "seq") + self.cpp_info.set_property("cmake_module_target_name", "seq::seq") + self.cpp_info.set_property("pkg_config_name", "seq") diff --git a/recipes/seq/all/patches/1.1.0-0001-support-clang.patch b/recipes/seq/all/patches/1.1.0-0001-support-clang.patch new file mode 100644 index 0000000000000..747bdc39e67cf --- /dev/null +++ b/recipes/seq/all/patches/1.1.0-0001-support-clang.patch @@ -0,0 +1,13 @@ +diff --git a/seq/type_traits.hpp b/seq/type_traits.hpp +index 9ee7058..376f6fc 100644 +--- a/seq/type_traits.hpp ++++ b/seq/type_traits.hpp +@@ -35,7 +35,7 @@ + + namespace std + { +-#if defined(__GNUG__) && (__GNUC__ < 5) ++#if !defined(__clang__) && defined(__GNUG__) && (__GNUC__ < 5) + + // Reimplement the wheel for older gcc + diff --git a/recipes/seq/all/test_package/CMakeLists.txt b/recipes/seq/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..9afb91bc0a1df --- /dev/null +++ b/recipes/seq/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(seq REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE seq::seq) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/seq/all/test_package/conanfile.py b/recipes/seq/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ef5d7042163ec --- /dev/null +++ b/recipes/seq/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 requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + 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/seq/all/test_package/test_package.cpp b/recipes/seq/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..22047b5fd3522 --- /dev/null +++ b/recipes/seq/all/test_package/test_package.cpp @@ -0,0 +1,15 @@ +#include +#include "seq/devector.hpp" + +int main(void) { + seq::devector vec; + + vec.emplace_front(5); + vec.emplace_front(3); + vec.emplace_front(9); + vec.emplace_front(4); + vec.emplace_front(8); + vec.emplace_front(1); + + return EXIT_SUCCESS; +} diff --git a/recipes/seq/config.yml b/recipes/seq/config.yml new file mode 100644 index 0000000000000..b5c0d3cb2d409 --- /dev/null +++ b/recipes/seq/config.yml @@ -0,0 +1,3 @@ +versions: + "1.1.0": + folder: all