-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 library #8588
Closed
Closed
add tllist library #8588
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import os | ||
|
||
from conans import ConanFile, Meson, tools | ||
from conans.errors import ConanInvalidConfiguration | ||
|
||
required_conan_version = ">=1.43.0" | ||
|
||
|
||
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", "tllist") | ||
generators = ("pkg_config") | ||
settings = "os", "arch", "build_type" | ||
no_copy_source = True | ||
_meson = None | ||
|
||
@property | ||
def _source_subfolder(self): | ||
return "source_subfolder" | ||
|
||
def validate(self): | ||
if self.settings.os != "Linux": | ||
raise ConanInvalidConfiguration("Only Linux supported") | ||
|
||
def build_requirements(self): | ||
self.build_requires("pkgconf/[>=1.7.4]") | ||
self.build_requires("meson/[>=0.60.0]") | ||
self.build_requires("ninja/[>=1.10.0]") | ||
|
||
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version], | ||
destination=self._source_subfolder, strip_root=True) | ||
|
||
def _configure_meson(self): | ||
if self._meson: | ||
return self._meson | ||
self._meson = Meson(self) | ||
self._meson.configure(source_folder=self._source_subfolder) | ||
return self._meson | ||
|
||
def build(self): | ||
meson = self._configure_meson() | ||
meson.build() | ||
meson.test() | ||
|
||
def package(self): | ||
self.copy("LICENSE", src=self._source_subfolder, dst="licenses") | ||
meson = self._configure_meson() | ||
meson.install() | ||
tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) | ||
tools.rmdir(os.path.join(self.package_folder, "share")) | ||
|
||
def package_id(self): | ||
self.info.header_only() | ||
|
||
def package_info(self): | ||
self.cpp_info.includedirs.append(os.path.join("include")) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from conans import ConanFile, Meson, tools | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
generators = "pkg_config" | ||
settings = "os", "compiler", "build_type", "arch" | ||
|
||
def build_requirements(self): | ||
self.build_requires("pkgconf/[>=1.7.4]") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don't use version ranges, but as it's a test_package, should be harmless? |
||
self.build_requires("meson/[>=0.60.0]") | ||
self.build_requires("ninja/[>=1.10.0]") | ||
|
||
def build(self): | ||
meson = Meson(self) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. meson-based test package, something unusual, but still welcomed! |
||
meson.configure() | ||
meson.build() | ||
|
||
def test(self): | ||
bin_path = os.path.join(".", "test_package") | ||
self.run(bin_path, run_environment=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
project('test_package', 'c') | ||
tllist = dependency('tllist') | ||
|
||
executable('test_package', 'test_package.c', dependencies : tllist) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
"1.0.5": | ||
folder: "all" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please don't use version ranges here