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

Add tllist #10763

Merged
merged 16 commits into from
May 19, 2022
4 changes: 4 additions & 0 deletions recipes/tllist/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"1.0.5":
url: "https://codeberg.org/dnkl/tllist/archive/1.0.5.tar.gz"
sha256: b0f32c9b2c2015c8d8dd068fd4e8b586aa91ca1670badc274ec962559ee0aadd
40 changes: 40 additions & 0 deletions recipes/tllist/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from conan import ConanFile
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the requirement in terms of conan version?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/conan-io/conan/releases/tag/1.43.0 from 1.43.0
I am updating the required version right now 🏃 Thanks! 🦅 👁️

from conans import tools
from conans.errors import ConanInvalidConfiguration


required_conan_version = ">=1.43.0"
danimtb marked this conversation as resolved.
Show resolved Hide resolved


class TllistConan(ConanFile):
name = "tllist"
license = "MIT"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://codeberg.org/dnkl/tllist"
description = "A C header file only implementation of a typed linked list."
topics = ("list", "utils", "typed-linked-list")
settings = "os", "arch", "build_type", "compiler"
no_copy_source = True

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

danimtb marked this conversation as resolved.
Show resolved Hide resolved
def validate(self):
# tllist relies on __typeof__, not implemented in Visual Studio
if self.settings.compiler == "Visual Studio":
raise ConanInvalidConfiguration("Visual Studio compiler is not supported")

def source(self):
tools.get(**self.conan_data["sources"][self.version],
destination=self._source_subfolder, strip_root=True)

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

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

def package_info(self):
danimtb marked this conversation as resolved.
Show resolved Hide resolved
self.cpp_info.set_property("pkg_config_name", "tllist")
10 changes: 10 additions & 0 deletions recipes/tllist/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 3.1)
project(test_package C)

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

find_package(tllist CONFIG REQUIRED)

add_executable(${PROJECT_NAME} test_package.c)
target_link_libraries(${PROJECT_NAME} tllist::tllist)
17 changes: 17 additions & 0 deletions recipes/tllist/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from conans import ConanFile, CMake, tools
import os


class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
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):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)
10 changes: 10 additions & 0 deletions recipes/tllist/all/test_package/test_package.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <stdlib.h>
#include <tllist.h>

int main(int argc, const char *const *argv) {
tll(int) l = tll_init();

tll_push_back(l, 43);

return EXIT_SUCCESS;
}
3 changes: 3 additions & 0 deletions recipes/tllist/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"1.0.5":
folder: "all"