diff options
author | warptangent <warptangent@inbox.com> | 2015-01-25 21:36:09 -0800 |
---|---|---|
committer | warptangent <warptangent@inbox.com> | 2015-02-02 11:53:09 -0800 |
commit | 84fe5fbd65100a731608471ef0a4c462ea8f5626 (patch) | |
tree | 70c9a0f292631feb8145aa97eff38f564087dc32 /CMakeLists.txt | |
parent | Merge PR 25 into blockchain (diff) | |
download | monero-84fe5fbd65100a731608471ef0a4c462ea8f5626.tar.xz |
Add compile-time support for both db implementations: in-memory and LMDB
Usage:
default is lmdb for blockchain branch:
$ make release
same as:
$ DATABASE=lmdb make release
for original in-memory implementation:
$ DATABASE=memory make release
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a094fe8be..ef479095f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,6 +116,27 @@ if(STATIC) endif() endif() +# default database: +# should be lmdb for testing, memory for production still +# set(DATABASE memory) +set(DATABASE lmdb) + +if (DEFINED ENV{DATABASE}) + set(DATABASE $ENV{DATABASE}) + message(STATUS "DATABASE set: ${DATABASE}") +else() + message(STATUS "Could not find DATABASE in env (not required unless you want to change database type from default: ${DATABASE})") +endif() +if (DATABASE STREQUAL "lmdb") + set(BLOCKCHAIN_DB DB_LMDB) +elseif (DATABASE STREQUAL "memory") + set(BLOCKCHAIN_DB DB_MEMORY) +else() + die("Invalid database type: ${DATABASE}") +endif() + +add_definitions("-DBLOCKCHAIN_DB=${BLOCKCHAIN_DB}") + if (UNIX AND NOT APPLE) # Note that at the time of this writing the -Wstrict-prototypes flag added below will make this fail find_package(Threads) |