aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--CMakeLists.txt3
-rw-r--r--external/CMakeLists.txt5
-rw-r--r--external/db_drivers/CMakeLists.txt24
-rw-r--r--src/blockchain_db/CMakeLists.txt3
-rw-r--r--tests/unit_tests/BlockchainDB.cpp3
-rw-r--r--tests/unit_tests/CMakeLists.txt1
6 files changed, 37 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2916ff137..9e29dab59 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -162,6 +162,9 @@ include_directories(external/rapidjson)
# Final setup for liblmdb
include_directories(${LMDB_INCLUDE})
+# Final setup for Berkeley DB
+include_directories(${BDB_INCLUDE})
+
if(MSVC)
add_definitions("/bigobj /MP /W3 /GS- /D_CRT_SECURE_NO_WARNINGS /wd4996 /wd4345 /D_WIN32_WINNT=0x0600 /DWIN32_LEAN_AND_MEAN /DGTEST_HAS_TR1_TUPLE=0 /FIinline_c.h /D__SSE4_1__")
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Dinline=__inline")
diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt
index f0d363e35..527c5b5a9 100644
--- a/external/CMakeLists.txt
+++ b/external/CMakeLists.txt
@@ -103,3 +103,8 @@ set(LMDB_STATIC ${LMDB_STATIC} PARENT_SCOPE)
set(LMDB_INCLUDE ${LMDB_INCLUDE} PARENT_SCOPE)
set(LMDB_LIBRARY ${LMDB_LIBRARY} PARENT_SCOPE)
set(LMDB_LIBRARY_DIRS ${LMDB_LIBRARY_DIRS} PARENT_SCOPE)
+
+set(BDB_STATIC ${BDB_STATIC} PARENT_SCOPE)
+set(BDB_INCLUDE ${BDB_INCLUDE} PARENT_SCOPE)
+set(BDB_LIBRARY ${BDB_LIBRARY} PARENT_SCOPE)
+set(BDB_LIBRARY_DIRS ${BDB_LIBRARY_DIRS} PARENT_SCOPE)
diff --git a/external/db_drivers/CMakeLists.txt b/external/db_drivers/CMakeLists.txt
index 5993ed3a2..0498eaaf2 100644
--- a/external/db_drivers/CMakeLists.txt
+++ b/external/db_drivers/CMakeLists.txt
@@ -44,6 +44,28 @@ else()
set(LMDB_LIBRARY ${LMDB_LIBRARIES} PARENT_SCOPE)
set(LMDB_LIBRARY_DIRS "" PARENT_SCOPE)
else()
- die("Found liblmdb includes, but could not find liblmdb library. Please make sure you have installed liblmdb or liblmdb-dev or the equivalent")
+ die("Found liblmdb includes, but could not find liblmdb library. Please make sure you have installed liblmdb and liblmdb-dev or the equivalent")
+ endif()
+endif()
+
+find_package(BerkeleyDB)
+
+if(NOT DB_LIBRARIES OR STATIC)
+ add_subdirectory(libdb)
+ message(STATUS "BerkeleyDB not found, building from src tree")
+
+ set(BDB_STATIC true PARENT_SCOPE)
+ set(BDB_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/libdb" PARENT_SCOPE)
+ set(BDB_LIBRARY "db" PARENT_SCOPE)
+else()
+ message(STATUS "Found BerkeleyDB include (db.h) in ${DB_INCLUDE_DIR}")
+ if(DB_LIBRARIES)
+ message(STATUS "Found BerkeleyDB shared library")
+ set(BDB_STATIC false PARENT_SCOPE)
+ set(BDB_INCLUDE ${DB_INCLUDE_DIR} PARENT_SCOPE)
+ set(BDB_LIBRARY ${DB_LIBRARIES} PARENT_SCOPE)
+ set(BDB_LIBRARY_DIRS "" PARENT_SCOPE)
+ else()
+ die("Found BerkeleyDB includes, but could not find BerkeleyDB library. Please make sure you have installed libdb and libdb-dev or the equivalent")
endif()
endif()
diff --git a/src/blockchain_db/CMakeLists.txt b/src/blockchain_db/CMakeLists.txt
index 84b2d6a74..62b2eabe2 100644
--- a/src/blockchain_db/CMakeLists.txt
+++ b/src/blockchain_db/CMakeLists.txt
@@ -29,6 +29,7 @@
set(blockchain_db_sources
blockchain_db.cpp
lmdb/db_lmdb.cpp
+ berkeleydb/db_bdb.cpp
)
set(blockchain_db_headers)
@@ -36,6 +37,7 @@ set(blockchain_db_headers)
set(blockchain_db_private_headers
blockchain_db.h
lmdb/db_lmdb.h
+ berkeleydb/db_bdb.h
)
bitmonero_private_headers(blockchain_db
@@ -57,4 +59,5 @@ target_link_libraries(blockchain_db
${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
${LMDB_LIBRARY}
+ ${BDB_LIBRARY}
${EXTRA_LIBRARIES})
diff --git a/tests/unit_tests/BlockchainDB.cpp b/tests/unit_tests/BlockchainDB.cpp
index 4d39d7da8..bbe8582f9 100644
--- a/tests/unit_tests/BlockchainDB.cpp
+++ b/tests/unit_tests/BlockchainDB.cpp
@@ -35,6 +35,7 @@
#include "blockchain_db/blockchain_db.h"
#include "blockchain_db/lmdb/db_lmdb.h"
+#include "blockchain_db/berkeleydb/db_bdb.h"
#include "cryptonote_core/cryptonote_format_utils.h"
using namespace cryptonote;
@@ -209,7 +210,7 @@ protected:
using testing::Types;
-typedef Types<BlockchainLMDB> implementations;
+typedef Types<BlockchainLMDB, BlockchainBDB> implementations;
TYPED_TEST_CASE(BlockchainDBTest, implementations);
diff --git a/tests/unit_tests/CMakeLists.txt b/tests/unit_tests/CMakeLists.txt
index 54f25431d..b8a22e312 100644
--- a/tests/unit_tests/CMakeLists.txt
+++ b/tests/unit_tests/CMakeLists.txt
@@ -57,6 +57,7 @@ add_executable(unit_tests
target_link_libraries(unit_tests
LINK_PRIVATE
cryptonote_core
+ blockchain_db
rpc
wallet
${GTEST_MAIN_LIBRARIES}