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

seq: add recipe #25182

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 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
10 changes: 10 additions & 0 deletions recipes/seq/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -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"
79 changes: 79 additions & 0 deletions recipes/seq/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -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 config_options(self):
uilianries marked this conversation as resolved.
Show resolved Hide resolved
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")
13 changes: 13 additions & 0 deletions recipes/seq/all/patches/1.1.0-0001-support-clang.patch
Original file line number Diff line number Diff line change
@@ -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

8 changes: 8 additions & 0 deletions recipes/seq/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
26 changes: 26 additions & 0 deletions recipes/seq/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -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")
15 changes: 15 additions & 0 deletions recipes/seq/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <iostream>
#include "seq/devector.hpp"

int main(void) {
seq::devector<int> 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;
}
3 changes: 3 additions & 0 deletions recipes/seq/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"1.1.0":
folder: all