diff --git a/.github/workflows/publish-conan-branch-package.yml b/.github/workflows/publish-conan-branch-package.yml index 3f3fdb4..10966d1 100644 --- a/.github/workflows/publish-conan-branch-package.yml +++ b/.github/workflows/publish-conan-branch-package.yml @@ -11,9 +11,10 @@ jobs: with: public_artifactory: true os: ubuntu-22.04 - compiler: clang-14 + compiler: clang-15 cmake-version: 3.22.6 - conan-options: -o boost:header_only=True + conan-version: 2.0.13 + conan-options: -o boost/*:header_only=True secrets: CONAN_USER: ${{ secrets.CONAN_USER }} CONAN_PW: ${{ secrets.CONAN_PW }} diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 9be5ec5..3773eaa 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -17,10 +17,10 @@ jobs: with: public_artifactory: true os: ubuntu-22.04 - compiler: clang-14 + compiler: clang-15 cmake-version: 3.22.6 - conan-version: 1.59 - conan-options: -o boost:header_only=True + conan-version: 2.0.13 + conan-options: -o boost/*:header_only=True secrets: CONAN_USER: ${{ secrets.CONAN_USER }} CONAN_PW: ${{ secrets.CONAN_PW }} diff --git a/.gitignore b/.gitignore index 0c1449c..b3ee570 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .idea/ cmake-build* +test_package/build/ +test_package/CMakeUserPresets.json \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index f60b0a1..7439dd9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 3.17) -project(metall-ffi VERSION 0.2.1) +cmake_minimum_required(VERSION 3.22) +project(metall-ffi VERSION 0.2.2) include(cmake/boilerplate_init.cmake) boilerplate_init() diff --git a/conanfile.py b/conanfile.py index 86fa821..4bce9bf 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,10 +1,7 @@ import os import re - -from conan.tools.cmake import CMake - from conan import ConanFile - +from conan.tools.cmake import CMake from conan.tools.files import load, copy, rmdir @@ -15,7 +12,7 @@ class Recipe(ConanFile): author = "https://github.com/dice-group/metall-ffi" url = "https://github.com/dice-group/metall-ffi" description = "FFI for the metall libary" - topics = ("FFI", "persistent memory") + topics = "FFI", "persistent memory" # Binary configuration settings = "os", "compiler", "build_type", "arch" @@ -23,17 +20,15 @@ class Recipe(ConanFile): default_options = {"shared": False, "fPIC": True, "with_test_deps": False} exports = "LICENSE", exports_sources = "src/*", "CMakeLists.txt", "cmake/*" - - generators = ("CMakeDeps", "CMakeToolchain") + generators = "CMakeDeps", "CMakeToolchain" def requirements(self): - self.requires("metall/0.21") - self.requires("boost/1.81.0") # override to fix dependencies + self.requires("metall/0.26", transitive_headers=True) + self.requires("boost/1.83.0", transitive_headers=True, force=True) if self.options.with_test_deps: self.requires("doctest/2.4.11") - def set_version(self): if not hasattr(self, 'version') or self.version is None: cmake_file = load(self, os.path.join(self.recipe_folder, "CMakeLists.txt")) @@ -64,3 +59,10 @@ def package(self): def package_info(self): self.cpp_info.libs = ["metall-ffi"] + self.cpp_info.set_property("cmake_find_mode", "both") + self.cpp_info.set_property("cmake_file_name", self.name) + self.cpp_info.set_property("cmake_target_name", f"{self.name}::{self.name}") + self.cpp_info.requires = [ + "metall::metall", + "boost::headers", + ] diff --git a/src/dice/ffi/metall.cpp b/src/dice/ffi/metall.cpp index b209504..4261058 100644 --- a/src/dice/ffi/metall.cpp +++ b/src/dice/ffi/metall.cpp @@ -60,7 +60,7 @@ bool metall_remove(char const *path) { } void *metall_malloc(metall_manager *manager, char const *name, size_t size) { - auto *ptr = reinterpret_cast(manager)->construct(name)[size](); + auto *ptr = reinterpret_cast(manager)->construct(name)[size](); if (ptr == nullptr) { errno = ENOMEM; } @@ -69,7 +69,7 @@ void *metall_malloc(metall_manager *manager, char const *name, size_t size) { } void *metall_find(metall_manager *manager, char const *name) { - auto *ptr = reinterpret_cast(manager)->find(name).first; + auto *ptr = reinterpret_cast(manager)->find(name).first; if (ptr == nullptr) { errno = ENOENT; } @@ -78,7 +78,7 @@ void *metall_find(metall_manager *manager, char const *name) { } bool metall_free(metall_manager *manager, char const *name) { - auto const res = reinterpret_cast(manager)->destroy(name); + auto const res = reinterpret_cast(manager)->destroy(name); if (!res) { errno = ENOENT; } diff --git a/src/dice/ffi/metall_internal.hpp b/src/dice/ffi/metall_internal.hpp index a6a0faa..4182495 100644 --- a/src/dice/ffi/metall_internal.hpp +++ b/src/dice/ffi/metall_internal.hpp @@ -8,7 +8,7 @@ namespace dice::metall_ffi::internal { * @brief The metall manager type used internally. * This object type is whats actually behind the opaque ::metall_manager * in the interface */ - using metall_manager = metall::basic_manager; + using metall_manager = metall::basic_manager; } // namespace #endif//DICE_METALLFFI_METALLINTERNAL_HPP diff --git a/test_package/CMakeLists.txt b/test_package/CMakeLists.txt new file mode 100644 index 0000000..5edaf1c --- /dev/null +++ b/test_package/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.15) +project(PackageTest CXX) + +find_package(metall-ffi REQUIRED) + +add_executable(example example.cpp) + +target_link_libraries(example PUBLIC + metall-ffi::metall-ffi + ) + +set_target_properties( + example PROPERTIES + CXX_STANDARD 20 + CXX_STANDARD_REQUIRED ON + CXX_EXTENSIONS OFF +) diff --git a/test_package/conanfile.py b/test_package/conanfile.py new file mode 100644 index 0000000..355d54e --- /dev/null +++ b/test_package/conanfile.py @@ -0,0 +1,27 @@ +import os +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout + +required_conan_version = ">=1.59" + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + 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): + cmd = os.path.join(self.cpp.build.bindir, "example") + self.run(cmd, env="conanrun") diff --git a/test_package/example.cpp b/test_package/example.cpp new file mode 100644 index 0000000..20f6b9b --- /dev/null +++ b/test_package/example.cpp @@ -0,0 +1,5 @@ +#include + +int main() { + metall_open("/tmp/test"); +} diff --git a/tests/tests_Sanity.cpp b/tests/tests_Sanity.cpp index 691adcb..b17393f 100644 --- a/tests/tests_Sanity.cpp +++ b/tests/tests_Sanity.cpp @@ -9,7 +9,7 @@ TEST_SUITE("metall-ffi") { TEST_CASE("sanity check") { char const *obj_name = "obj"; - std::string const path = "/tmp/" + std::to_string(std::random_device{}()); + std::string const path = "/tmp/metall-ffi" + std::to_string(std::random_device{}()); std::string const snap_path = path + "-snap"; {