diff --git a/cmake/EthDependencies.cmake b/cmake/EthDependencies.cmake index 376a6c03f..09de078c0 100644 --- a/cmake/EthDependencies.cmake +++ b/cmake/EthDependencies.cmake @@ -3,14 +3,18 @@ # 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") +string(TOLOWER ${CMAKE_SYSTEM_NAME} system_name) +set (CMAKE_FIND_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/extdep/install/${system_name}") -find_package (CryptoPP 5.6.2 REQUIRED) + +# Dependencies must have a version number + EXACT, to ensure reproducible builds + +find_package (CryptoPP 5.6.2 EXACT REQUIRED) message(" - CryptoPP header: ${CRYPTOPP_INCLUDE_DIRS}") message(" - CryptoPP lib : ${CRYPTOPP_LIBRARIES}") -find_package (JsonRpcCpp REQUIRED) +find_package (JsonRpcCpp 0.2.1 EXACT 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}") diff --git a/eth/CMakeLists.txt b/eth/CMakeLists.txt index cb3b01b4e..fbd7d6835 100644 --- a/eth/CMakeLists.txt +++ b/eth/CMakeLists.txt @@ -3,6 +3,7 @@ cmake_policy(SET CMP0015 NEW) aux_source_directory(. SRC_LIST) include_directories(..) +include_directories(${JSON_RPC_CPP_INCLUDE_DIRS}) set(EXECUTABLE eth) diff --git a/extdep/CMakeLists.txt b/extdep/CMakeLists.txt index 666ea5f15..88f4fba0a 100644 --- a/extdep/CMakeLists.txt +++ b/extdep/CMakeLists.txt @@ -2,8 +2,10 @@ cmake_minimum_required(VERSION 2.8) include(ExternalProject) -# all dependencies will be installed into this directory -set(ETH_DEPENDENCY_INSTALL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/install") + +# all dependencies will be installed into this directory, separated by platform +string(TOLOWER ${CMAKE_SYSTEM_NAME} SYSTEM_NAME) +set(ETH_DEPENDENCY_INSTALL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/install/${SYSTEM_NAME}") file(MAKE_DIRECTORY ${ETH_DEPENDENCY_INSTALL_DIR}) include(cryptopp.cmake) diff --git a/extdep/cryptopp.cmake b/extdep/cryptopp.cmake index 39a848649..3a1513e29 100644 --- a/extdep/cryptopp.cmake +++ b/extdep/cryptopp.cmake @@ -1,18 +1,21 @@ -if(${APPLE}) -ExternalProject_Add(cryptopp - URL https://downloads.sourceforge.net/project/cryptopp/cryptopp/5.6.2/cryptopp562.zip - BINARY_DIR cryptopp-prefix/src/cryptopp - CONFIGURE_COMMAND "" - BUILD_COMMAND make CXX=clang++ CXXFLAGS=-DCRYPTOPP_DISABLE_ASM - INSTALL_COMMAND make install PREFIX=${ETH_DEPENDENCY_INSTALL_DIR} +# CryptoPP does not have good cross-platform support, there exist several different other projects to make it work ... + +if(APPLE) + ExternalProject_Add(cryptopp + URL https://downloads.sourceforge.net/project/cryptopp/cryptopp/5.6.2/cryptopp562.zip + BINARY_DIR cryptopp-prefix/src/cryptopp + CONFIGURE_COMMAND "" + BUILD_COMMAND make CXX=clang++ CXXFLAGS=-DCRYPTOPP_DISABLE_ASM + INSTALL_COMMAND make install PREFIX=${ETH_DEPENDENCY_INSTALL_DIR} ) +# on Linux, the default Makefile does not work. else() -ExternalProject_Add(cryptopp - URL https://github.com/mmoss/cryptopp/archive/v5.6.2.zip - BINARY_DIR cryptopp-prefix/src/cryptopp - CONFIGURE_COMMAND "" - BUILD_COMMAND scons --shared --prefix=${ETH_DEPENDENCY_INSTALL_DIR} - INSTALL_COMMAND "" + ExternalProject_Add(cryptopp + URL https://github.com/mmoss/cryptopp/archive/v5.6.2.zip + BINARY_DIR cryptopp-prefix/src/cryptopp + CONFIGURE_COMMAND "" + BUILD_COMMAND scons --shared --prefix=${ETH_DEPENDENCY_INSTALL_DIR} + INSTALL_COMMAND "" ) endif() diff --git a/extdep/curl.cmake b/extdep/curl.cmake index 13e10361d..fa06d7ba0 100644 --- a/extdep/curl.cmake +++ b/extdep/curl.cmake @@ -1,20 +1,13 @@ - -set (CONFIG_CMD ./configure --prefix=${ETH_DEPENDENCY_INSTALL_DIR} --exec-prefix=${ETH_DEPENDENCY_INSTALL_DIR}) - -if(${APPLE}) +if(APPLE) set(CONFIG_CMD ./configure --with-darwinssl --prefix=${ETH_DEPENDENCY_INSTALL_DIR} --exec-prefix=${ETH_DEPENDENCY_INSTALL_DIR}) +else() + set (CONFIG_CMD ./configure --prefix=${ETH_DEPENDENCY_INSTALL_DIR} --exec-prefix=${ETH_DEPENDENCY_INSTALL_DIR}) endif() - - -ExternalProject_Add( - curl +ExternalProject_Add(curl URL http://curl.haxx.se/download/curl-7.38.0.tar.bz2 BINARY_DIR curl-prefix/src/curl CONFIGURE_COMMAND ${CONFIG_CMD} BUILD_COMMAND make -j 3 INSTALL_COMMAND make install ) - - - diff --git a/extdep/json-rpc-cpp.cmake b/extdep/json-rpc-cpp.cmake index ea26851b9..8d3b29c19 100644 --- a/extdep/json-rpc-cpp.cmake +++ b/extdep/json-rpc-cpp.cmake @@ -1,11 +1,21 @@ +# json-rpc-cpp is under heavy development, and multiplatform builds are not yet available. All the platforms currently need patches to make them work. + +if(APPLE) + set(PATCH_CMD patch -d src/example < ${CMAKE_CURRENT_SOURCE_DIR}/json-rpc-cpp_osx.patch) + set(CONFIG_CMD 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 .) +else() + set(PATCH_CMD patch --input=${CMAKE_CURRENT_SOURCE_DIR}/json-rpc-cpp_linux.patch --strip=1) + set(CONFIG_CMD 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 .) +endif() + + ExternalProject_Add(json-rpc-cpp DEPENDS curl GIT_REPOSITORY https://github.com/cinemast/libjson-rpc-cpp.git GIT_TAG 0.2.1 BINARY_DIR json-rpc-cpp-prefix/src/json-rpc-cpp - CONFIGURE_COMMAND patch -d src/example < ${CMAKE_CURRENT_SOURCE_DIR}/json-rpc-cpp_osx.patch && 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 . + PATCH_COMMAND ${PATCH_CMD} + CONFIGURE_COMMAND ${CONFIG_CMD} BUILD_COMMAND make jsonrpc -j 3 INSTALL_COMMAND make install - ) - - +) diff --git a/extdep/json-rpc-cpp_linux.patch b/extdep/json-rpc-cpp_linux.patch new file mode 100644 index 000000000..40662f2a8 --- /dev/null +++ b/extdep/json-rpc-cpp_linux.patch @@ -0,0 +1,13 @@ +diff --git a/src/jsonrpc/CMakeLists.txt b/src/jsonrpc/CMakeLists.txt +index 79e8515..4e93eef 100644 +--- a/src/jsonrpc/CMakeLists.txt ++++ b/src/jsonrpc/CMakeLists.txt +@@ -12,7 +12,7 @@ set(VERSION_STRING ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}) + set_target_properties(jsonrpc jsonrpcStatic PROPERTIES VERSION "${VERSION_STRING}" SOVERSION "${VERSION_MAJOR}") + + +-target_link_libraries(jsonrpc ${CURL_LIBRARIES}) ++target_link_libraries(jsonrpc ${CURL_LIBRARIES} dl pthread) + target_link_libraries(jsonrpcStatic ${CURL_LIBRARIES}) + + install(FILES ${jsonrpc_header} DESTINATION include/jsonrpc) diff --git a/neth/CMakeLists.txt b/neth/CMakeLists.txt index d9f551b18..bef34c4e3 100644 --- a/neth/CMakeLists.txt +++ b/neth/CMakeLists.txt @@ -4,6 +4,7 @@ aux_source_directory(. SRC_LIST) include_directories(..) include_directories(${LEVELDB_ID}) +include_directories(${JSON_RPC_CPP_INCLUDE_DIRS}) set(EXECUTABLE neth)