From 91998e2ae64595f2121003874b7b45519918e38c Mon Sep 17 00:00:00 2001 From: Shun Wang Date: Tue, 26 Nov 2024 07:27:26 +0000 Subject: [PATCH] fix --- recipes/librdata/all/conanfile.py | 16 +++++++--------- recipes/librdata/all/test_package/conanfile.py | 3 +-- recipes/librdata/all/test_package/test_package.c | 15 ++++++++++++--- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/recipes/librdata/all/conanfile.py b/recipes/librdata/all/conanfile.py index 174e37152269cc..8d68019b241f63 100644 --- a/recipes/librdata/all/conanfile.py +++ b/recipes/librdata/all/conanfile.py @@ -2,11 +2,11 @@ from conan import ConanFile from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain -from conan.tools.env import VirtualBuildEnv, VirtualRunEnv -from conan.tools.files import copy, rm, rmdir +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" @@ -40,7 +40,7 @@ def configure(self): self.options.rm_safe("fPIC") def layout(self): - cmake_layout(self, src_folder="src") + basic_layout(self, src_folder="src") def requirements(self): if self.options.with_zip: @@ -49,12 +49,12 @@ def requirements(self): self.requires("xz_utils/5.6.3") def source(self): - git = Git(self) - git.clone(url="https://github.com/WizardMac/librdata.git", target=".") + # git = Git(self) + # git.clone(url="https://github.com/WizardMac/librdata.git", target=".") + get(self, **self.conan_data["sources"][self.version], strip_root=True) + def generate(self): - env = VirtualBuildEnv(self) - env.generate() tc = AutotoolsToolchain(self) tc.generate() tc = AutotoolsDeps(self) @@ -73,7 +73,6 @@ def package(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, "*.lib", src=self.source_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) @@ -84,7 +83,6 @@ def package(self): fix_apple_shared_install_name(self) def package_info(self): - self.cpp_info.set_property("pkg_config_name", "readstat") suffix = "_i" if is_msvc(self) and self.options.shared else "" self.cpp_info.libs = [f"librdata{suffix}"] if self.settings.os in ("FreeBSD", "Linux"): diff --git a/recipes/librdata/all/test_package/conanfile.py b/recipes/librdata/all/test_package/conanfile.py index a9fb96656f2039..da6493fdf21f20 100644 --- a/recipes/librdata/all/test_package/conanfile.py +++ b/recipes/librdata/all/test_package/conanfile.py @@ -6,8 +6,7 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" - test_type = "explicit" + generators = "CMakeDeps", "CMakeToolchain" def requirements(self): self.requires(self.tested_reference_str) diff --git a/recipes/librdata/all/test_package/test_package.c b/recipes/librdata/all/test_package/test_package.c index 2f2c9c919474c2..ba6fc372f82f91 100644 --- a/recipes/librdata/all/test_package/test_package.c +++ b/recipes/librdata/all/test_package/test_package.c @@ -1,7 +1,16 @@ #include "rdata.h" -static int handle_table(const char *name, void *ctx) { - printf("Read table: %s\n", name); + +int main(int argc, char const *argv[]) +{ + rdata_parser_t *parser = rdata_parser_init(); + if (parser == NULL) { + fprintf(stderr, "Failed to initialize rdata_parser.\n"); + return 1; + } + + rdata_parser_free(parser); + printf("librdata is successfully included, linked, and used.\n"); return 0; -} \ No newline at end of file +}