-
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
[librdata] Add new recipe library #26024
Open
shun2wang
wants to merge
11
commits into
conan-io:master
Choose a base branch
from
shun2wang:addLibrdata
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+131
−0
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
cd5a1c4
init add librdata library
shun2wang 0774bd0
clean build
shun2wang 38227a5
autoreconf for build
shun2wang 316d1cf
Update recipes/librdata/all/conandata.yml
jcar87 0f8a727
Update recipes/librdata/all/conanfile.py
jcar87 05c0299
Update recipes/librdata/all/conanfile.py
jcar87 842e205
Update recipes/librdata/all/conanfile.py
jcar87 744c505
Update recipes/librdata/all/conanfile.py
jcar87 53ecc5c
Update recipes/librdata/all/conanfile.py
jcar87 1114f40
Update recipes/librdata/all/test_package/test_package.c
jcar87 b8839c3
Update recipes/librdata/config.yml
jcar87 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: | ||
"0.0.0.cci.20231003": | ||
url: "https://github.com/WizardMac/librdata/archive/33bd276ecb0bbcd8997ccc71a544149b3da0d940.tar.gz" | ||
sha256: "fc3e0d655c21d4b5144a0ad73f79a249903b5dde4dc8f7091cd0393d214294a2" |
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,82 @@ | ||
import os | ||
|
||
from conan import ConanFile | ||
from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain | ||
from conan.tools.files import copy, rm, rmdir, get | ||
from conan.tools.apple import fix_apple_shared_install_name | ||
from conan.tools.microsoft import is_msvc | ||
from conan.tools.scm import Git | ||
from conan.tools.layout import basic_layout | ||
|
||
required_conan_version = ">=2.0.0" | ||
|
||
class Libreadstat(ConanFile): | ||
name = "librdata" | ||
description = "librdata is a library for read and write R data frames from C" | ||
license = "MIT" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://github.com/WizardMac/librdata" | ||
topics = ("r", "rdata", "rds", "data-frames") | ||
package_type = "library" | ||
settings = "os", "arch", "compiler", "build_type" | ||
options = { | ||
"shared": [True, False], | ||
"fPIC": [True, False], | ||
} | ||
default_options = { | ||
"shared": False, | ||
"fPIC": True, | ||
} | ||
|
||
def config_options(self): | ||
if self.settings.os == "Windows": | ||
del self.options.fPIC | ||
|
||
def configure(self): | ||
if self.options.shared: | ||
self.options.rm_safe("fPIC") | ||
|
||
def layout(self): | ||
basic_layout(self, src_folder="src") | ||
|
||
def requirements(self): | ||
self.requires("bzip2/1.0.8") | ||
self.requires("zlib/[>=1.2.11 <2]") | ||
self.requires("xz_utils/[>=5.4.5 <6]") | ||
|
||
def source(self): | ||
get(self, **self.conan_data["sources"][self.version], strip_root=True) | ||
|
||
|
||
def generate(self): | ||
tc = AutotoolsToolchain(self) | ||
tc.generate() | ||
dep = AutotoolsDeps(self) | ||
dep.generate() | ||
|
||
def build(self): | ||
autotools = Autotools(self) | ||
autotools.autoreconf() | ||
autotools.configure() | ||
autotools.make() | ||
|
||
def package(self): | ||
copy(self, pattern="LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) | ||
if is_msvc(self): | ||
copy(self, "rdata.h", src=os.path.join(self.source_folder, "headers"), dst=os.path.join(self.package_folder, "include")) | ||
copy(self, "*.a", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) | ||
copy(self, "*.so", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) | ||
copy(self, "*.dll", src=self.source_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) | ||
else: | ||
autotools = Autotools(self) | ||
autotools.install() | ||
rm(self, "*.la", os.path.join(self.package_folder, "lib")) | ||
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) | ||
rmdir(self, os.path.join(self.package_folder, "share")) | ||
fix_apple_shared_install_name(self) | ||
|
||
def package_info(self): | ||
suffix = "_i" if is_msvc(self) and self.options.shared else "" | ||
self.cpp_info.libs = [f"rdata{suffix}"] | ||
if self.settings.os in ("FreeBSD", "Linux"): | ||
self.cpp_info.system_libs.append("m") |
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,7 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
project(test_package LANGUAGES C) | ||
|
||
find_package(librdata REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.c) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE librdata::librdata) |
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,25 @@ | ||
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" | ||
|
||
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.bindirs[0], "test_package") | ||
self.run(bin_path, env="conanrun") |
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 "rdata.h" | ||
|
||
|
||
int main() | ||
{ | ||
rdata_parser_t *parser = rdata_parser_init(); | ||
rdata_parser_free(parser); | ||
|
||
return 0; | ||
} |
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: | ||
"0.0.0.cci.20231003": | ||
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.
Have you really tested on Windows? Usually, it requires more when talking about autotools. In case you did not and has no intention, the recipe still can be accepted in CCI, just need more information.
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.
Thanks for your comment!
I really just want to build it for MacOS and Windows instead of Linux, but even so far I haven't found a suitable way to successfully build on Windows. Always fails at the config stage.
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.
I could take a look during the week for windows support. Right now, I don't have access to windows machine, but I'll have by tomorrow. You can take a look in gettext recipe as example: https://github.com/conan-io/conan-center-index/blob/master/recipes/libgettext/all/conanfile.py