diff --git a/CMakeLists.txt b/CMakeLists.txt index f3de28909..34a2447b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -149,9 +149,6 @@ if (NOT LANGUAGES) if ("${TARGET_PLATFORM}" STREQUAL "w64") cmake_policy(SET CMP0020 NEW) endif () - if (NOT JSONRPC_LS) - message(FATAL_ERROR "Alethzero requires jsonrpc.") - endif() add_subdirectory(libjsqrc) add_subdirectory(libqethereum) diff --git a/cmake/EthDependencies.cmake b/cmake/EthDependencies.cmake index 5934b1512..376a6c03f 100644 --- a/cmake/EthDependencies.cmake +++ b/cmake/EthDependencies.cmake @@ -1,11 +1,18 @@ # all dependencies that are not directly included in the cpp-ethereum distribution are defined here # for this to work, download the dependency via the cmake script in extdep or install them manually! -set(ETH_DEPENDENCY_INSTALL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/extdep/install") +# by defining this variable, cmake will look for dependencies first in our own repository before looking in system paths like /usr/local/ ... +# this must be set to point to the same directory as $ETH_DEPENDENCY_INSTALL_DIR in /extdep directory +set (CMAKE_FIND_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/extdep/install") -set (CRYPTOPP_ROOT_DIR ${ETH_DEPENDENCY_INSTALL_DIR}) find_package (CryptoPP 5.6.2 REQUIRED) -message("-- CryptoPP header: ${CRYPTOPP_INCLUDE_DIRS}") -message("-- CryptoPP libs : ${CRYPTOPP_LIBRARIES}") +message(" - CryptoPP header: ${CRYPTOPP_INCLUDE_DIRS}") +message(" - CryptoPP lib : ${CRYPTOPP_LIBRARIES}") +find_package (JsonRpcCpp REQUIRED) +if (${JSON_RPC_CPP_FOUND}) + message (" - json-rpc-cpp header: ${JSON_RPC_CPP_INCLUDE_DIRS}") + message (" - json-rpc-cpp lib : ${JSON_RPC_CPP_LIBRARIES}") + add_definitions(-DETH_JSONRPC) +endif() diff --git a/cmake/EthDependenciesDeprecated.cmake b/cmake/EthDependenciesDeprecated.cmake index 4be546a13..aacb625db 100644 --- a/cmake/EthDependenciesDeprecated.cmake +++ b/cmake/EthDependenciesDeprecated.cmake @@ -85,29 +85,6 @@ else() message(STATUS "Failed to find the miniupnpc headers!") endif () - find_path( JSONRPC_ID jsonrpc/rpc.h - /usr/include - /usr/local/include - ) - if ( JSONRPC_ID ) - message(STATUS "Found jsonrpc headers") - find_library( JSONRPC_LS NAMES jsonrpc - PATHS - /usr/lib - /usr/local/lib - /opt/local/lib - /usr/lib/*/ - ) - if ( JSONRPC_LS ) - message(STATUS "Found jsonrpc library: ${JSONRPC_LS}") - add_definitions(-DETH_JSONRPC) - else () - message(STATUS "Failed to find the jsonrpc library!") - endif () - else () - message(STATUS "Failed to find the jsonrpc headers!") - endif () - find_path( READLINE_ID readline/readline.h /usr/include /usr/local/include @@ -152,9 +129,6 @@ endif() if(READLINE_ID) include_directories(${READLINE_ID}) endif() -if(JSONRPC_ID) - include_directories(${JSONRPC_ID}) -endif() diff --git a/cmake/FindCryptoPP.cmake b/cmake/FindCryptoPP.cmake index 74a01e83a..a9e7183c0 100644 --- a/cmake/FindCryptoPP.cmake +++ b/cmake/FindCryptoPP.cmake @@ -104,5 +104,5 @@ SET (CRYPTOPP_LIBRARIES ${CRYPTOPP_LIBRARY}) MARK_AS_ADVANCED (CRYPTOPP_INCLUDE_DIR CRYPTOPP_LIBRARY CRYPTOPP_LIBRARY_DEBUG CRYPTOPP_LIBRARY_RELEASE) -FIND_PACKAGE_HANDLE_STANDARD_ARGS (CryptoPP REQUIRED_VARS CRYPTOPP_ROOT_DIR +FIND_PACKAGE_HANDLE_STANDARD_ARGS (CryptoPP REQUIRED_VARS CRYPTOPP_INCLUDE_DIR CRYPTOPP_LIBRARY VERSION_VAR CRYPTOPP_VERSION) diff --git a/cmake/FindJsonRcpCpp.cmake b/cmake/FindJsonRpcCpp.cmake similarity index 85% rename from cmake/FindJsonRcpCpp.cmake rename to cmake/FindJsonRpcCpp.cmake index 1a7d45069..c056418b0 100644 --- a/cmake/FindJsonRcpCpp.cmake +++ b/cmake/FindJsonRpcCpp.cmake @@ -9,12 +9,6 @@ # JSON_RCP_CPP_LIBRARIES, the libraries needed to use jsoncpp. # JSON_RCP_CPP_FOUND, If false, do not try to use jsoncpp. -if (JSON_RPC_CPP_LIBRARIES AND JSON_RPC_CPP_INCLUDE_DIRS) - # in cache already - set(JSON_RPC_CPP_FOUND TRUE) -endif() - - # only look in default directories find_path( JSON_RPC_CPP_INCLUDE_DIR @@ -32,10 +26,14 @@ find_library( set (JSON_RPC_CPP_INCLUDE_DIRS ${JSON_RPC_CPP_INCLUDE_DIR}) set (JSON_RPC_CPP_LIBRARIES ${JSON_RPC_CPP_LIBRARY}) +# message (" - json-rcp-cpp header : ${JSON_RPC_CPP_INCLUDE_DIRS}") +# message (" - json-rcp-cpp lib : ${JSON_RPC_CPP_LIBRARIES}") + + include(FindPackageHandleStandardArgs) # handle the QUIETLY and REQUIRED arguments and set JSON_RPC_CPP_FOUND to TRUE # if all listed variables are TRUE -find_package_handle_standard_args(json-rpc-cpp DEFAULT_MSG +find_package_handle_standard_args(json_rpc_cpp DEFAULT_MSG JSON_RPC_CPP_LIBRARY JSON_RPC_CPP_INCLUDE_DIR) diff --git a/extdep/CMakeLists.txt b/extdep/CMakeLists.txt index 121f21067..666ea5f15 100644 --- a/extdep/CMakeLists.txt +++ b/extdep/CMakeLists.txt @@ -2,13 +2,12 @@ cmake_minimum_required(VERSION 2.8) include(ExternalProject) -# dependencies will be installed into this directory +# all dependencies will be installed into this directory set(ETH_DEPENDENCY_INSTALL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/install") - file(MAKE_DIRECTORY ${ETH_DEPENDENCY_INSTALL_DIR}) include(cryptopp.cmake) include(curl.cmake) include(json-rpc-cpp.cmake) -include(miniupnpc.cmake) +#include(miniupnpc.cmake) diff --git a/extdep/FindCURL.cmake b/extdep/FindCURL.cmake index 6a82ebb22..22d51591c 100644 --- a/extdep/FindCURL.cmake +++ b/extdep/FindCURL.cmake @@ -1,4 +1,4 @@ -# hacky way to resolve nested dependencies +# hacky way to resolve nested dependencies - needed for json-rpc-cpp find_library(CURL_LIBRARY NAMES curl PATHS ${ETH_DEPENDENCY_INSTALL_DIR}/lib diff --git a/extdep/curl.cmake b/extdep/curl.cmake index 5d915c79b..13e10361d 100644 --- a/extdep/curl.cmake +++ b/extdep/curl.cmake @@ -1,12 +1,20 @@ + +set (CONFIG_CMD ./configure --prefix=${ETH_DEPENDENCY_INSTALL_DIR} --exec-prefix=${ETH_DEPENDENCY_INSTALL_DIR}) + if(${APPLE}) -ExternalProject_Add(curl + set(CONFIG_CMD ./configure --with-darwinssl --prefix=${ETH_DEPENDENCY_INSTALL_DIR} --exec-prefix=${ETH_DEPENDENCY_INSTALL_DIR}) +endif() + + + +ExternalProject_Add( + curl URL http://curl.haxx.se/download/curl-7.38.0.tar.bz2 BINARY_DIR curl-prefix/src/curl - CONFIGURE_COMMAND ./configure --with-darwinssl --prefix=${ETH_DEPENDENCY_INSTALL_DIR} --exec-prefix=${ETH_DEPENDENCY_INSTALL_DIR} + CONFIGURE_COMMAND ${CONFIG_CMD} BUILD_COMMAND make -j 3 INSTALL_COMMAND make install - ) -else() +) + -endif() diff --git a/extdep/json-rpc-cpp.cmake b/extdep/json-rpc-cpp.cmake new file mode 100644 index 000000000..28c5f7cf1 --- /dev/null +++ b/extdep/json-rpc-cpp.cmake @@ -0,0 +1,11 @@ +ExternalProject_Add(json-rpc-cpp + DEPENDS curl + GIT_REPOSITORY https://github.com/cinemast/libjson-rpc-cpp.git + GIT_TAG eaca2481e2889d5a5b748383fb02b1d395969cd4 + BINARY_DIR json-rpc-cpp-prefix/src/json-rpc-cpp + CONFIGURE_COMMAND cmake -DCMAKE_INSTALL_PREFIX=${ETH_DEPENDENCY_INSTALL_DIR} -DCMAKE_MODULE_PATH:PATH=${CMAKE_CURRENT_SOURCE_DIR} -DETH_DEPENDENCY_INSTALL_DIR:PATH=${ETH_DEPENDENCY_INSTALL_DIR} -DCMAKE_BUILD_TYPE=None -DCMAKE_FIND_FRAMEWORK=LAST -Wno-dev . + BUILD_COMMAND make jsonrpc -j 3 + INSTALL_COMMAND make install + ) + +