Skip to content

Commit b770f95

Browse files
author
Philemon Benner
committed
add ORYX_DB_INSTALL to let user control install
1 parent 4f271a7 commit b770f95

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ project(kvdb-cpp VERSION 0.1.0 LANGUAGES CXX)
44

55
option(ORYX_KVDB_ENABLE_TESTS "Build Tests" ON)
66
option(ORYX_KVDB_BUILD_DEPS "Build Dependencies from source" ON)
7+
option(ORYX_KVDB_INSTALL "Install the project" ${PROJECT_IS_TOP_LEVEL})
78

89
set(CMAKE_CXX_STANDARD_REQUIRED ON)
910
if(NOT DEFINED CMAKE_CXX_STANDARD)
@@ -18,7 +19,7 @@ if(ORYX_KVDB_BUILD_DEPS)
1819
FetchContent_Declare(
1920
reflectcpp
2021
GIT_REPOSITORY https://github.com/getml/reflect-cpp.git
21-
GIT_TAG v0.19.0
22+
GIT_TAG 2a0fdeabe35bdab0e07e05d4f869ca88bd6d2b8c
2223
OVERRIDE_FIND_PACKAGE
2324
)
2425

@@ -31,7 +32,8 @@ if(ORYX_KVDB_BUILD_DEPS)
3132

3233
option(LEVELDB_BUILD_BENCHMARKS "Build LevelDB benchmarks" OFF)
3334
option(LEVELDB_BUILD_TESTS "Build LevelDB tests" OFF)
34-
#option(REFLECTCPP_INSTALL "Install ReflectCpp" ON)
35+
option(LEVELDB_INSTALL "Install LevelDB" ${ORYX_KVDB_INSTALL})
36+
option(REFLECTCPP_INSTALL "Install ReflectCpp" ${ORYX_KVDB_INSTALL})
3537
FetchContent_MakeAvailable(reflectcpp leveldb)
3638

3739
add_library(reflectcpp::reflectcpp ALIAS reflectcpp)
@@ -66,7 +68,7 @@ target_include_directories(${PROJECT_NAME} INTERFACE
6668

6769
target_compile_options(${PROJECT_NAME} INTERFACE $<$<CONFIG:Debug>:-Wall -Wextra>)
6870

69-
if(PROJECT_IS_TOP_LEVEL)
71+
if(ORYX_KVDB_INSTALL)
7072
include(GNUInstallDirs)
7173
include(CMakePackageConfigHelpers)
7274

include/oryx/key_value_database.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ class KeyValueDatabase {
118118
return handle_->Delete(opts, key);
119119
}
120120

121-
[[nodiscard]] auto IsOpen() const { return handle_ != nullptr; }
121+
[[nodiscard]] auto IsOpen() const -> bool { return static_cast<bool>(handle_); }
122+
[[nodiscard]] auto handle() const -> leveldb::DB& { return *handle_; }
122123

123124
static auto DefaultOptions() -> leveldb::Options {
124125
leveldb::Options opts{};

tests/main.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
2-
#include "doctest.hpp"
2+
#include "doctest.hpp"
3+
4+
#include <rfl/Result.hpp>
5+
#include <rfl/json/write.hpp>
6+
#include <rfl/json/read.hpp>

0 commit comments

Comments
 (0)