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

crossdb: add recipe #25704

Merged
merged 13 commits into from
Oct 31, 2024
4 changes: 4 additions & 0 deletions recipes/crossdb/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"0.9.0":
url: "https://github.com/crossdb-org/crossdb/archive/refs/tags/0.9.0.tar.gz"
sha256: "04defc43f0b5102cc6a341ba9e328302416982c04cc4c59bc16aef19cc1b020c"
49 changes: 49 additions & 0 deletions recipes/crossdb/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.files import copy, get
from conan.tools.microsoft import is_msvc
uilianries marked this conversation as resolved.
Show resolved Hide resolved
import os

required_conan_version = ">=1.53.0"

class CrossDBConan(ConanFile):
name = "crossdb"
description = "Ultra High-performance Lightweight Embedded and Server OLTP RDBMS✨"
uilianries marked this conversation as resolved.
Show resolved Hide resolved
license = "MPL-2.0"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/crossdb-org/crossdb"
topics = ("database", "oltp", "embedded")
package_type = "shared-library"
settings = "os", "arch", "compiler", "build_type"

def configure(self):
self.settings.rm_safe("compiler.cppstd")
self.settings.rm_safe("compiler.libcxx")

def layout(self):
cmake_layout(self, src_folder="src")

def validate(self):
if is_msvc(self):
raise ConanInvalidConfiguration(f"${self.ref} does not support MSVC")

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

def generate(self):
tc = CMakeToolchain(self)
tc.generate()

def build(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()
uilianries marked this conversation as resolved.
Show resolved Hide resolved

def package_info(self):
self.cpp_info.libs = ["crossdb"]
7 changes: 7 additions & 0 deletions recipes/crossdb/all/test_package/CMakeLists.txt
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(crossdb REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.c)
target_link_libraries(${PROJECT_NAME} PRIVATE crossdb::crossdb)
26 changes: 26 additions & 0 deletions recipes/crossdb/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")
10 changes: 10 additions & 0 deletions recipes/crossdb/all/test_package/test_package.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <crossdb.h>

int main () {
xdb_conn_t *pConn = xdb_open (":memory:");
XDB_CHECK (NULL != pConn, printf ("failed to create DB\n"); return -1;);

xdb_close (pConn);

return 0;
uilianries marked this conversation as resolved.
Show resolved Hide resolved
}
3 changes: 3 additions & 0 deletions recipes/crossdb/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"0.9.0":
folder: all