aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorThomas Winget <tewinget@gmail.com>2015-02-03 04:47:33 -0500
committerThomas Winget <tewinget@gmail.com>2015-02-03 05:18:12 -0500
commitd1f40506fabcc006c326df355c6d471ed739b783 (patch)
tree70c9a0f292631feb8145aa97eff38f564087dc32 /CMakeLists.txt
parentMerge PR 25 into blockchain (diff)
parentAdd compile-time support for both db implementations: in-memory and LMDB (diff)
downloadmonero-d1f40506fabcc006c326df355c6d471ed739b783.tar.xz
Merge PR #26
Usage: default is lmdb for blockchain branch: $ make release same as: $ DATABASE=lmdb make release for original in-memory implementation: $ DATABASE=memory make release COMMITS: - Add compile-time support for both db implementations: in-memory and LMDB NOTE: The default should be changed to lmdb when this is merged upstream unless we're 100% sure the LMDB implementation is ready.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt21
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)