|
@ -1,51 +1,37 @@ |
|
|
|
|
|
# cmake global |
|
|
project(ethereum) |
|
|
project(ethereum) |
|
|
cmake_minimum_required(VERSION 2.8.9) |
|
|
cmake_minimum_required(VERSION 2.8.9) |
|
|
|
|
|
|
|
|
set(CMAKE_AUTOMOC ON) |
|
|
set(CMAKE_AUTOMOC ON) |
|
|
|
|
|
|
|
|
cmake_policy(SET CMP0015 NEW) |
|
|
cmake_policy(SET CMP0015 NEW) |
|
|
|
|
|
|
|
|
set(HEADLESS CACHE BOOL 0) |
|
|
# user defined, defaults |
|
|
set(LANGUAGES CACHE BOOL 0) |
|
|
# Normally, set(...CACHE...) creates cache variables, but does not modify them. |
|
|
|
|
|
|
|
|
if ("x${PARANOIA}" STREQUAL "x") |
|
|
set(HEADLESS OFF CACHE BOOL "Do not compile GUI (AlethZero)") |
|
|
if ("x${CMAKE_BUILD_TYPE}" STREQUAL "xDebug") |
|
|
set(LANGUAGES OFF CACHE BOOL "Limit build to Serpent/LLL tools") |
|
|
set(PARANOIA CACHE BOOL 1) |
|
|
set(VMTRACE OFF CACHE BOOL "VM tracing and run-time checks (useful for cross-implementation VM debugging)") |
|
|
else () |
|
|
set(PARANOIA OFF CACHE BOOL "Additional run-time checks") |
|
|
set(PARANOIA CACHE BOOL 0) |
|
|
|
|
|
endif () |
|
|
|
|
|
endif () |
|
|
|
|
|
|
|
|
|
|
|
if ("x${VMTRACE}" STREQUAL "x") |
|
|
if (LANGUAGES) |
|
|
if ("x${CMAKE_BUILD_TYPE}" STREQUAL "xDebug") |
|
|
add_definitions(-DETH_LANGUAGES) |
|
|
set(VMTRACE CACHE BOOL 1) |
|
|
|
|
|
else () |
|
|
|
|
|
set(VMTRACE CACHE BOOL 0) |
|
|
|
|
|
endif () |
|
|
|
|
|
endif () |
|
|
endif () |
|
|
|
|
|
|
|
|
if (PARANOIA) |
|
|
if (PARANOIA) |
|
|
add_definitions(-DETH_PARANOIA) |
|
|
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") |
|
|
else() |
|
|
add_definitions(-DETH_PARANOIA) |
|
|
set(PARANOIA 0) |
|
|
else () |
|
|
|
|
|
message(FATAL_ERROR "Paranoia requires debug.") |
|
|
|
|
|
endif () |
|
|
endif () |
|
|
endif () |
|
|
|
|
|
|
|
|
if (VMTRACE) |
|
|
if (VMTRACE) |
|
|
add_definitions(-DETH_VMTRACE) |
|
|
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") |
|
|
else() |
|
|
add_definitions(-DETH_VMTRACE) |
|
|
set(VMTRACE 0) |
|
|
else () |
|
|
endif () |
|
|
message(FATAL_ERROR "VM tracing requires debug.") |
|
|
|
|
|
endif () |
|
|
if (LANGUAGES) |
|
|
|
|
|
add_definitions(-DETH_LANGUAGES) |
|
|
|
|
|
else() |
|
|
|
|
|
set(LANGUAGES 0) |
|
|
|
|
|
endif () |
|
|
endif () |
|
|
|
|
|
|
|
|
if (NOT HEADLESS) |
|
|
|
|
|
set(HEADLESS 0) |
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
message("LANGUAGES: ${LANGUAGES}; VMTRACE: ${VMTRACE}; PARANOIA: ${PARANOIA}; HEADLESS: ${HEADLESS}") |
|
|
message("LANGUAGES: ${LANGUAGES}; VMTRACE: ${VMTRACE}; PARANOIA: ${PARANOIA}; HEADLESS: ${HEADLESS}") |
|
|
|
|
|
|
|
|
# Default TARGET_PLATFORM to "linux". |
|
|
# Default TARGET_PLATFORM to "linux". |
|
@ -58,13 +44,19 @@ if ("${TARGET_PLATFORM}" STREQUAL "linux") |
|
|
set(CMAKE_THREAD_LIBS_INIT pthread) |
|
|
set(CMAKE_THREAD_LIBS_INIT pthread) |
|
|
endif () |
|
|
endif () |
|
|
|
|
|
|
|
|
# Initialize CXXFLAGS. |
|
|
# Set default build type to Release w/debug info |
|
|
|
|
|
# if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) |
|
|
|
|
|
# set(CMAKE_BUILD_TYPE RelWithDebInfo) |
|
|
|
|
|
# endif() |
|
|
|
|
|
|
|
|
|
|
|
# Initialize CXXFLAGS |
|
|
set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wno-unknown-pragmas -Wextra -DSHAREDLIB") |
|
|
set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wno-unknown-pragmas -Wextra -DSHAREDLIB") |
|
|
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -DETH_DEBUG") |
|
|
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -DETH_DEBUG") |
|
|
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG -DETH_RELEASE") |
|
|
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG -DETH_RELEASE") |
|
|
set(CMAKE_CXX_FLAGS_RELEASE "-O4 -DNDEBUG -DETH_RELEASE") |
|
|
set(CMAKE_CXX_FLAGS_RELEASE "-O4 -DNDEBUG -DETH_RELEASE") |
|
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DETH_DEBUG") |
|
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DETH_DEBUG") |
|
|
|
|
|
|
|
|
|
|
|
# Windows |
|
|
if ("${TARGET_PLATFORM}" STREQUAL "w64") |
|
|
if ("${TARGET_PLATFORM}" STREQUAL "w64") |
|
|
set(CMAKE_SYSTEM_NAME Windows) |
|
|
set(CMAKE_SYSTEM_NAME Windows) |
|
|
|
|
|
|
|
@ -96,6 +88,7 @@ else () |
|
|
set(ETH_SHARED 1) |
|
|
set(ETH_SHARED 1) |
|
|
endif() |
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
# Set build platform; to be written to BuildInfo.h |
|
|
if (CMAKE_COMPILER_IS_MINGW) |
|
|
if (CMAKE_COMPILER_IS_MINGW) |
|
|
set(ETH_BUILD_PLATFORM "${ETH_BUILD_PLATFORM}/mingw") |
|
|
set(ETH_BUILD_PLATFORM "${ETH_BUILD_PLATFORM}/mingw") |
|
|
elseif (CMAKE_COMPILER_IS_MSYS) |
|
|
elseif (CMAKE_COMPILER_IS_MSYS) |
|
@ -104,16 +97,17 @@ elseif (CMAKE_COMPILER_IS_GNUCXX) |
|
|
set(ETH_BUILD_PLATFORM "${ETH_BUILD_PLATFORM}/g++") |
|
|
set(ETH_BUILD_PLATFORM "${ETH_BUILD_PLATFORM}/g++") |
|
|
elseif (CMAKE_COMPILER_IS_MSVC) |
|
|
elseif (CMAKE_COMPILER_IS_MSVC) |
|
|
set(ETH_BUILD_PLATFORM "${ETH_BUILD_PLATFORM}/msvc") |
|
|
set(ETH_BUILD_PLATFORM "${ETH_BUILD_PLATFORM}/msvc") |
|
|
|
|
|
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") |
|
|
|
|
|
set(ETH_BUILD_PLATFORM "${ETH_BUILD_PLATFORM}/clang") |
|
|
else () |
|
|
else () |
|
|
set(ETH_BUILD_PLATFORM "${ETH_BUILD_PLATFORM}/unknown") |
|
|
set(ETH_BUILD_PLATFORM "${ETH_BUILD_PLATFORM}/unknown") |
|
|
endif () |
|
|
endif () |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
message("CXXFLAGS: ${CMAKE_CXX_FLAGS}") |
|
|
message("CXXFLAGS: ${CMAKE_CXX_FLAGS}") |
|
|
#add_definitions("-DETH_BUILD_TYPE=${ETH_BUILD_TYPE}") |
|
|
#add_definitions("-DETH_BUILD_TYPE=${ETH_BUILD_TYPE}") |
|
|
#add_definitions("-DETH_BUILD_PLATFORM=${ETH_BUILD_PLATFORM}") |
|
|
#add_definitions("-DETH_BUILD_PLATFORM=${ETH_BUILD_PLATFORM}") |
|
|
|
|
|
|
|
|
# Compiler-specific C++11 activation. |
|
|
# C++11 check and activation |
|
|
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") |
|
|
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") |
|
|
execute_process( |
|
|
execute_process( |
|
|
COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) |
|
|
COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) |
|
@ -133,51 +127,43 @@ if("${TARGET_PLATFORM}" STREQUAL "w64") |
|
|
set(CRYPTOPP_ID /usr/x86_64-w64-mingw32/include/cryptopp) |
|
|
set(CRYPTOPP_ID /usr/x86_64-w64-mingw32/include/cryptopp) |
|
|
else() |
|
|
else() |
|
|
# Look for available Crypto++ version and if it is >= 5.6.2 |
|
|
# Look for available Crypto++ version and if it is >= 5.6.2 |
|
|
find_path(CRYPTOPP_ID cryptlib.h |
|
|
find_path(ID cryptlib.h |
|
|
../cryptopp/src |
|
|
../cryptopp/src |
|
|
../../cryptopp/src) |
|
|
../../cryptopp/src |
|
|
if(CRYPTOPP_ID STREQUAL "CRYPTOPP_ID-NOTFOUND") |
|
|
/usr/include/cryptopp |
|
|
message("Trying system cryptopp...") |
|
|
/usr/include/crypto++ |
|
|
find_path(CRYPTOPP_ID cryptlib.h |
|
|
/usr/local/include/cryptopp |
|
|
/usr/include/cryptopp |
|
|
/usr/local/include/crypto++ |
|
|
/usr/include/crypto++ |
|
|
/opt/local/include/cryptopp |
|
|
/usr/local/include/cryptopp |
|
|
/opt/local/include/crypto++ |
|
|
/usr/local/include/crypto++ |
|
|
) |
|
|
/opt/local/include/cryptopp |
|
|
find_library(LS NAMES cryptoppeth cryptopp |
|
|
/opt/local/include/crypto++ |
|
|
../cryptopp/src/../target/build/release |
|
|
) |
|
|
../../cryptopp/src/../target/build/release |
|
|
find_library(CRYPTOPP_LS NAMES cryptoppeth cryptopp |
|
|
PATHS |
|
|
PATHS |
|
|
/usr/lib |
|
|
/usr/lib |
|
|
/usr/local/lib |
|
|
/usr/local/lib |
|
|
/opt/local/lib |
|
|
/opt/local/lib |
|
|
) |
|
|
) |
|
|
|
|
|
else() |
|
|
|
|
|
message("Local cryptopp OK.") |
|
|
|
|
|
set(CRYPTOPP_LS ${CRYPTOPP_ID}/../target/build/release/libcryptopp.so) |
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
if (CRYPTOPP_LS STREQUAL "CRYPTOPP_LS-NOTFOUND") |
|
|
if (ID AND LS) |
|
|
message(FATAL_ERROR "Couldn't find Crypto++ version >= 5.6.2.") |
|
|
message(STATUS "Found Crypto++: ${ID}, ${LS}") |
|
|
else() |
|
|
set(_CRYPTOPP_VERSION_HEADER ${ID}/config.h) |
|
|
message(STATUS "Found Crypto++: ${CRYPTOPP_ID}, ${CRYPTOPP_LS}") |
|
|
|
|
|
set(_CRYPTOPP_VERSION_HEADER ${CRYPTOPP_ID}/config.h) |
|
|
|
|
|
if(EXISTS ${_CRYPTOPP_VERSION_HEADER}) |
|
|
if(EXISTS ${_CRYPTOPP_VERSION_HEADER}) |
|
|
file(STRINGS ${_CRYPTOPP_VERSION_HEADER} _CRYPTOPP_VERSION REGEX "^#define CRYPTOPP_VERSION[ \t]+[0-9]+$") |
|
|
file(STRINGS ${_CRYPTOPP_VERSION_HEADER} _CRYPTOPP_VERSION REGEX "^#define CRYPTOPP_VERSION[ \t]+[0-9]+$") |
|
|
string(REGEX REPLACE "^#define CRYPTOPP_VERSION[ \t]+([0-9]+)" "\\1" _CRYPTOPP_VERSION ${_CRYPTOPP_VERSION}) |
|
|
string(REGEX REPLACE "^#define CRYPTOPP_VERSION[ \t]+([0-9]+)" "\\1" _CRYPTOPP_VERSION ${_CRYPTOPP_VERSION}) |
|
|
if(${_CRYPTOPP_VERSION} LESS 562) |
|
|
if(${_CRYPTOPP_VERSION} LESS 562) |
|
|
set(CRYPTOPP_ID CACHE FILEPATH "" FORCE) |
|
|
message(FATAL_ERROR "Crypto++ version found is smaller than 5.6.2.") |
|
|
set(CRYPTOPP_LS CACHE FILEPATH "" FORCE) |
|
|
|
|
|
message(STATUS "Crypto++ version found is smaller than 5.6.2.") |
|
|
|
|
|
else() |
|
|
else() |
|
|
|
|
|
set(CRYPTOPP_ID ${ID} CACHE FILEPATH "") |
|
|
|
|
|
set(CRYPTOPP_LS ${LS} CACHE FILEPATH "") |
|
|
message(STATUS "Crypto++ found and version greater or equal to 5.6.2") |
|
|
message(STATUS "Crypto++ found and version greater or equal to 5.6.2") |
|
|
endif() |
|
|
endif() |
|
|
endif() |
|
|
endif() |
|
|
|
|
|
else() |
|
|
|
|
|
message(STATUS "Crypto++ Not Found: ${CRYPTOPP_ID}, ${CRYPTOPP_LS}") |
|
|
endif() |
|
|
endif() |
|
|
|
|
|
|
|
|
# Not really worth caching. We want to reevaluate anyway. |
|
|
|
|
|
mark_as_advanced(CRYPTOPP_ID CRYPTOPP_LS) |
|
|
|
|
|
|
|
|
|
|
|
find_path( LEVELDB_ID leveldb/db.h |
|
|
find_path( LEVELDB_ID leveldb/db.h |
|
|
/usr/include |
|
|
/usr/include |
|
|
/usr/local/include |
|
|
/usr/local/include |
|
@ -310,40 +296,32 @@ else() |
|
|
endif() |
|
|
endif() |
|
|
|
|
|
|
|
|
if(CRYPTOPP_ID) |
|
|
if(CRYPTOPP_ID) |
|
|
include_directories(${CRYPTOPP_ID}) |
|
|
include_directories(${CRYPTOPP_ID}) |
|
|
endif() |
|
|
endif() |
|
|
if(PYTHON_ID) |
|
|
if(PYTHON_ID) |
|
|
include_directories(${PYTHON_ID}) |
|
|
include_directories(${PYTHON_ID}) |
|
|
endif() |
|
|
endif() |
|
|
if(MINIUPNPC_ID) |
|
|
if(MINIUPNPC_ID) |
|
|
include_directories(${MINIUPNPC_ID}) |
|
|
include_directories(${MINIUPNPC_ID}) |
|
|
endif() |
|
|
endif() |
|
|
if(LEVELDB_ID) |
|
|
if(LEVELDB_ID) |
|
|
include_directories(${LEVELDB_ID}) |
|
|
include_directories(${LEVELDB_ID}) |
|
|
endif() |
|
|
endif() |
|
|
if(READLINE_ID) |
|
|
if(READLINE_ID) |
|
|
include_directories(${READLINE_ID}) |
|
|
include_directories(${READLINE_ID}) |
|
|
endif() |
|
|
endif() |
|
|
if(JSONRPC_ID) |
|
|
if(JSONRPC_ID) |
|
|
include_directories(${JSONRPC_ID}) |
|
|
include_directories(${JSONRPC_ID}) |
|
|
endif() |
|
|
endif() |
|
|
|
|
|
|
|
|
# if (NOT APPLE) |
|
|
|
|
|
# link_directories(${CRYPTOPP_LS}) |
|
|
|
|
|
# link_directories(${LEVELDB_LS}) |
|
|
|
|
|
# link_directories(${MINIUPNPC_LS}) |
|
|
|
|
|
# link_directories(${PYTHON_LS}) |
|
|
|
|
|
# link_directories(${READLINE_LS}) |
|
|
|
|
|
# link_directories(${JSONRPC_LS}) |
|
|
|
|
|
# endif() |
|
|
|
|
|
|
|
|
|
|
|
# Generate header file containing useful build information |
|
|
# Generate header file containing useful build information |
|
|
add_custom_target(BuildInfo.h ALL COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/BuildInfo.sh ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BUILD_TYPE} ${ETH_BUILD_PLATFORM}) |
|
|
add_custom_target(BuildInfo.h ALL COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/BuildInfo.sh ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BUILD_TYPE} ${ETH_BUILD_PLATFORM}) |
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR}) |
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR}) |
|
|
|
|
|
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
|
|
link_directories(/usr/local/lib) |
|
|
link_directories(/usr/local/lib) |
|
|
include_directories(/usr/local/include) |
|
|
include_directories(/usr/local/include) |
|
|
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
|
|
endif() |
|
|
|
|
|
|
|
|
add_subdirectory(libethential) |
|
|
add_subdirectory(libethential) |
|
|
add_subdirectory(libevmface) |
|
|
add_subdirectory(libevmface) |
|
@ -357,34 +335,40 @@ endif() |
|
|
add_subdirectory(lllc) |
|
|
add_subdirectory(lllc) |
|
|
add_subdirectory(sc) |
|
|
add_subdirectory(sc) |
|
|
if (NOT LANGUAGES) |
|
|
if (NOT LANGUAGES) |
|
|
add_subdirectory(secp256k1) |
|
|
add_subdirectory(secp256k1) |
|
|
add_subdirectory(libethcore) |
|
|
add_subdirectory(libethcore) |
|
|
add_subdirectory(libevm) |
|
|
add_subdirectory(libevm) |
|
|
add_subdirectory(libethereum) |
|
|
add_subdirectory(libethereum) |
|
|
add_subdirectory(test) |
|
|
add_subdirectory(test) |
|
|
add_subdirectory(eth) |
|
|
add_subdirectory(eth) |
|
|
if("x${CMAKE_BUILD_TYPE}" STREQUAL "xDebug") |
|
|
if("x${CMAKE_BUILD_TYPE}" STREQUAL "xDebug") |
|
|
add_subdirectory(exp) |
|
|
add_subdirectory(exp) |
|
|
endif () |
|
|
endif () |
|
|
if(NOT ("${TARGET_PLATFORM}" STREQUAL "w64")) |
|
|
if(NOT ("${TARGET_PLATFORM}" STREQUAL "w64")) |
|
|
add_subdirectory(neth) |
|
|
add_subdirectory(neth) |
|
|
endif () |
|
|
endif () |
|
|
if(QTQML) |
|
|
if(QTQML) |
|
|
add_definitions(-DETH_QTQML) |
|
|
add_definitions(-DETH_QTQML) |
|
|
endif() |
|
|
endif() |
|
|
|
|
|
|
|
|
if(NOT HEADLESS) |
|
|
if(NOT HEADLESS) |
|
|
add_subdirectory(libqethereum) |
|
|
if ("${TARGET_PLATFORM}" STREQUAL "w64") |
|
|
add_subdirectory(alethzero) |
|
|
cmake_policy(SET CMP0020 NEW) |
|
|
if(QTQML) |
|
|
endif () |
|
|
add_subdirectory(walleth) |
|
|
|
|
|
endif() |
|
|
add_subdirectory(libqethereum) |
|
|
endif() |
|
|
add_subdirectory(alethzero) |
|
|
|
|
|
if(QTQML) |
|
|
|
|
|
add_subdirectory(walleth) |
|
|
|
|
|
endif() |
|
|
|
|
|
endif() |
|
|
endif() |
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON) |
|
|
|
|
|
set(SRC_LIST BuildInfo.h) |
|
|
|
|
|
|
|
|
enable_testing() |
|
|
enable_testing() |
|
|
add_test(NAME alltests WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/test COMMAND testeth) |
|
|
add_test(NAME alltests WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/test COMMAND testeth) |
|
|
|
|
|
|
|
|
#unset(HEADLESS CACHE) |
|
|
|
|
|
#unset(TARGET_PLATFORM CACHE) |
|
|
#unset(TARGET_PLATFORM CACHE) |
|
|
|
|
|
|
|
|