Skip to content

Commit

Permalink
(#25704) crossdb: add recipe
Browse files Browse the repository at this point in the history
* crossdb: add recipe

* drop MSVC support

* simplify test_package.c

* Update recipes/crossdb/all/conanfile.py

* make rpath on macOS

* Simplify test package

* Avoid emojis in the recipe.

* Use fix_apple_shared_install_name to fix rpath

* Do not enforce CMAKE_MACOSX_RPATH

* Import fix_apple_shared_install_name

---------

Co-authored-by: Abril Rincón Blanco <git@rinconblanco.es>
Co-authored-by: Uilian Ries <uilianries@gmail.com>
  • Loading branch information
3 people authored Oct 31, 2024
1 parent 5679f33 commit 22589c7
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 0 deletions.
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"
51 changes: 51 additions & 0 deletions recipes/crossdb/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
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
from conan.tools.apple import fix_apple_shared_install_name
import os

required_conan_version = ">=1.53.0"

class CrossDBConan(ConanFile):
name = "crossdb"
description = "Ultra High-performance Lightweight Embedded and Server OLTP RDBMS"
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()
fix_apple_shared_install_name(self)

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")
9 changes: 9 additions & 0 deletions recipes/crossdb/all/test_package/test_package.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <stdio.h>
#include <stdlib.h>

#include <crossdb.h>

int main () {
printf("Cross DB Version: %s\n", xdb_version());
return EXIT_SUCCESS;
}
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

0 comments on commit 22589c7

Please sign in to comment.