From 859cbb451dea323c7f86fd8ad7af18f440d809c4 Mon Sep 17 00:00:00 2001 From: debris Date: Thu, 27 Nov 2014 10:17:28 +0100 Subject: [PATCH] leveldb on windows --- cmake/EthDependencies.cmake | 6 ++++++ cmake/FindLevelDB.cmake | 35 +++++++++++++++++++++++++++++++++++ extdep/CMakeLists.txt | 1 - extdep/leveldb.cmake | 6 +++--- 4 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 cmake/FindLevelDB.cmake diff --git a/cmake/EthDependencies.cmake b/cmake/EthDependencies.cmake index 1d6d3418d..c234cdee4 100644 --- a/cmake/EthDependencies.cmake +++ b/cmake/EthDependencies.cmake @@ -13,6 +13,12 @@ find_package (CryptoPP 5.6.2 EXACT REQUIRED) message(" - CryptoPP header: ${CRYPTOPP_INCLUDE_DIRS}") message(" - CryptoPP lib : ${CRYPTOPP_LIBRARIES}") +# TODO the Jsoncpp package does not yet check for correct version number + +find_package (LevelDB REQUIRED) +message(" - LevelDB header: ${LEVELDB_INCLUDE_DIR}") +message(" - LevelDB lib: ${LEVELDB_LIBRARY}") + # TODO the Jsoncpp package does not yet check for correct version number find_package (Jsoncpp 0.60 EXACT REQUIRED) message(" - Jsoncpp header: ${JSONCPP_INCLUDE_DIRS}") diff --git a/cmake/FindLevelDB.cmake b/cmake/FindLevelDB.cmake new file mode 100644 index 000000000..7daff29f6 --- /dev/null +++ b/cmake/FindLevelDB.cmake @@ -0,0 +1,35 @@ +# Find leveldb +# +# Find the leveldb includes and library +# +# if you nee to add a custom library search path, do it via via CMAKE_FIND_ROOT_PATH +# +# This module defines +# LEVELDB_INCLUDE_DIR, where to find header, etc. +# LEVELDB_LIBRARY, the libraries needed to use leveldb. +# LEVELDB_FOUND, If false, do not try to use leveldb. + +# only look in default directories +find_path( + LEVELDB_INCLUDE_DIR + NAMES leveldb/db.h + DOC "leveldb include dir" +) + +find_library( + LEVELDB_LIBRARY + NAMES leveldb + DOC "leveldb library" +) + +# message (" - leveldb header : ${LEVELDB_INCLUDE_DIR}") +# message (" - leveldb lib : ${LEVELDB_LIBRARY}") + + +# handle the QUIETLY and REQUIRED arguments and set JSON_RPC_CPP_FOUND to TRUE +# if all listed variables are TRUE, hide their existence from configuration view +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(leveldb DEFAULT_MSG + LEVELDB_INCLUDE_DIR LEVELDB_LIBRARY) +mark_as_advanced (LEVELDB_INCLUDE_DIR LEVELDB_LIBRARY) + diff --git a/extdep/CMakeLists.txt b/extdep/CMakeLists.txt index 4a3214d75..53f3751ed 100644 --- a/extdep/CMakeLists.txt +++ b/extdep/CMakeLists.txt @@ -17,6 +17,5 @@ include(snappy.cmake) include(leveldb.cmake) # will be re-eanbled later -# include(curl.cmake) # include(miniupnpc.cmake) diff --git a/extdep/leveldb.cmake b/extdep/leveldb.cmake index 82d9f5a05..8b494457f 100644 --- a/extdep/leveldb.cmake +++ b/extdep/leveldb.cmake @@ -9,12 +9,12 @@ ExternalProject_Add(leveldb ) elseif(WIN32) ExternalProject_Add(leveldb - GIT_REPOSITORY https://code.google.com/p/leveldb - GIT_TAG windows + GIT_REPOSITORY https://github.com/debris/leveldb-win32.git + GIT_TAG master BINARY_DIR leveldb-prefix/src/leveldb CONFIGURE_COMMAND "" BUILD_COMMAND "" - INSTALL_COMMAND "" + INSTALL_COMMAND cmd /c cp lib/LibLevelDB.lib ${ETH_DEPENDENCY_INSTALL_DIR}/lib/leveldb.lib && cp -R include/leveldb ${ETH_DEPENDENCY_INSTALL_DIR}/include ) else()