@ -1,51 +1,37 @@
# c m a k e g l o b a l
project ( ethereum )
cmake_minimum_required ( VERSION 2.8.9 )
set ( CMAKE_AUTOMOC ON )
cmake_policy ( SET CMP0015 NEW )
set ( HEADLESS CACHE BOOL 0 )
set ( LANGUAGES CACHE BOOL 0 )
# u s e r d e f i n e d , d e f a u l t s
# N o r m a l l y , set ( ...CACHE... ) c r e a t e s c a c h e v a r i a b l e s , b u t d o e s n o t m o d i f y t h e m .
if ( "x${PARANOIA}" STREQUAL "x" )
if ( "x${CMAKE_BUILD_TYPE}" STREQUAL "xDebug" )
set ( PARANOIA CACHE BOOL 1 )
else ( )
set ( PARANOIA CACHE BOOL 0 )
endif ( )
endif ( )
set ( HEADLESS OFF CACHE BOOL "Do not compile GUI (AlethZero)" )
set ( LANGUAGES OFF CACHE BOOL "Limit build to Serpent/LLL tools" )
set ( VMTRACE OFF CACHE BOOL "VM tracing and run-time checks (useful for cross-implementation VM debugging)" )
set ( PARANOIA OFF CACHE BOOL "Additional run-time checks" )
if ( "x${VMTRACE}" STREQUAL "x" )
if ( "x${CMAKE_BUILD_TYPE}" STREQUAL "xDebug" )
set ( VMTRACE CACHE BOOL 1 )
else ( )
set ( VMTRACE CACHE BOOL 0 )
endif ( )
if ( LANGUAGES )
add_definitions ( -DETH_LANGUAGES )
endif ( )
if ( PARANOIA )
add_definitions ( -DETH_PARANOIA )
else ( )
set ( PARANOIA 0 )
if ( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" )
add_definitions ( -DETH_PARANOIA )
else ( )
message ( FATAL_ERROR "Paranoia requires debug." )
endif ( )
endif ( )
if ( VMTRACE )
add_definitions ( -DETH_VMTRACE )
else ( )
set ( VMTRACE 0 )
endif ( )
if ( LANGUAGES )
add_definitions ( -DETH_LANGUAGES )
else ( )
set ( LANGUAGES 0 )
if ( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" )
add_definitions ( -DETH_VMTRACE )
else ( )
message ( FATAL_ERROR "VM tracing requires debug." )
endif ( )
endif ( )
if ( NOT HEADLESS )
set ( HEADLESS 0 )
endif ( )
message ( "LANGUAGES: ${LANGUAGES}; VMTRACE: ${VMTRACE}; PARANOIA: ${PARANOIA}; HEADLESS: ${HEADLESS}" )
# D e f a u l t T A R G E T _ P L A T F O R M t o " l i n u x " .
@ -58,13 +44,19 @@ if ("${TARGET_PLATFORM}" STREQUAL "linux")
set ( CMAKE_THREAD_LIBS_INIT pthread )
endif ( )
# I n i t i a l i z e C X X F L A G S .
# S e t d e f a u l t b u i l d t y p e t o R e l e a s e w / d e b u g i n f o
# if ( NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE )
# set ( CMAKE_BUILD_TYPE RelWithDebInfo )
# endif ( )
# I n i t i a l i z e C X X F L A G S
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_MINSIZEREL "-Os -DNDEBUG -DETH_RELEASE" )
set ( CMAKE_CXX_FLAGS_RELEASE "-O4 -DNDEBUG -DETH_RELEASE" )
set ( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DETH_DEBUG" )
# W i n d o w s
if ( "${TARGET_PLATFORM}" STREQUAL "w64" )
set ( CMAKE_SYSTEM_NAME Windows )
@ -96,6 +88,7 @@ else ()
set ( ETH_SHARED 1 )
endif ( )
# S e t b u i l d p l a t f o r m ; t o b e w r i t t e n t o B u i l d I n f o . h
if ( CMAKE_COMPILER_IS_MINGW )
set ( ETH_BUILD_PLATFORM "${ETH_BUILD_PLATFORM}/mingw" )
elseif ( CMAKE_COMPILER_IS_MSYS )
@ -104,16 +97,17 @@ elseif (CMAKE_COMPILER_IS_GNUCXX)
set ( ETH_BUILD_PLATFORM "${ETH_BUILD_PLATFORM}/g++" )
elseif ( CMAKE_COMPILER_IS_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 ( )
set ( ETH_BUILD_PLATFORM "${ETH_BUILD_PLATFORM}/unknown" )
endif ( )
message ( "CXXFLAGS: ${CMAKE_CXX_FLAGS}" )
# add_definitions ( "-DETH_BUILD_TYPE=${ETH_BUILD_TYPE}" )
# add_definitions ( "-DETH_BUILD_PLATFORM=${ETH_BUILD_PLATFORM}" )
# C o m p i l e r - s p e c i f i c C + + 1 1 a c t i v a t i o n .
# C + + 1 1 c h e c k a n d a c t i v a t i o n
if ( "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" )
execute_process (
C O M M A N D $ { C M A K E _ C X X _ C O M P I L E R } - d u m p v e r s i o n O U T P U T _ V A R I A B L E G C C _ V E R S I O N )
@ -133,51 +127,43 @@ if("${TARGET_PLATFORM}" STREQUAL "w64")
set ( CRYPTOPP_ID /usr/x86_64-w64-mingw32/include/cryptopp )
else ( )
# L o o k f o r a v a i l a b l e C r y p t o + + v e r s i o n a n d i f i t i s > = 5 . 6 . 2
find_path ( CRYPTOPP_ ID cryptlib.h
find_path ( ID cryptlib.h
. . / c r y p t o p p / s r c
. . / . . / c r y p t o p p / s r c )
if ( CRYPTOPP_ID STREQUAL "CRYPTOPP_ID-NOTFOUND" )
message ( "Trying system cryptopp..." )
find_path ( CRYPTOPP_ID cryptlib.h
/ u s r / i n c l u d e / c r y p t o p p
/ u s r / i n c l u d e / c r y p t o + +
/ u s r / l o c a l / i n c l u d e / c r y p t o p p
/ u s r / l o c a l / i n c l u d e / c r y p t o + +
/ o p t / l o c a l / i n c l u d e / c r y p t o p p
/ o p t / l o c a l / i n c l u d e / c r y p t o + +
)
find_library ( CRYPTOPP_LS NAMES cryptoppeth cryptopp
P A T H S
/ u s r / l i b
/ u s r / l o c a l / l i b
/ o p t / l o c a l / l i b
)
else ( )
message ( "Local cryptopp OK." )
set ( CRYPTOPP_LS ${ CRYPTOPP_ID } /../target/build/release/libcryptopp.so )
endif ( )
. . / . . / c r y p t o p p / s r c
/ u s r / i n c l u d e / c r y p t o p p
/ u s r / i n c l u d e / c r y p t o + +
/ u s r / l o c a l / i n c l u d e / c r y p t o p p
/ u s r / l o c a l / i n c l u d e / c r y p t o + +
/ o p t / l o c a l / i n c l u d e / c r y p t o p p
/ o p t / l o c a l / i n c l u d e / c r y p t o + +
)
find_library ( LS NAMES cryptoppeth cryptopp
. . / c r y p t o p p / s r c / . . / t a r g e t / b u i l d / r e l e a s e
. . / . . / c r y p t o p p / s r c / . . / t a r g e t / b u i l d / r e l e a s e
P A T H S
/ u s r / l i b
/ u s r / l o c a l / l i b
/ o p t / l o c a l / l i b
)
if ( CRYPTOPP_LS STREQUAL "CRYPTOPP_LS-NOTFOUND" )
message ( FATAL_ERROR "Couldn't find Crypto++ version >= 5.6.2." )
else ( )
message ( STATUS "Found Crypto++: ${CRYPTOPP_ID}, ${CRYPTOPP_LS}" )
set ( _CRYPTOPP_VERSION_HEADER ${ CRYPTOPP_ID } /config.h )
if ( ID AND LS )
message ( STATUS "Found Crypto++: ${ID}, ${LS}" )
set ( _CRYPTOPP_VERSION_HEADER ${ ID } /config.h )
if ( EXISTS ${ _CRYPTOPP_VERSION_HEADER } )
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 } )
if ( ${ _CRYPTOPP_VERSION } LESS 562 )
set ( CRYPTOPP_ID CACHE FILEPATH "" FORCE )
set ( CRYPTOPP_LS CACHE FILEPATH "" FORCE )
message ( STATUS "Crypto++ version found is smaller than 5.6.2." )
message ( FATAL_ERROR "Crypto++ version found is smaller than 5.6.2." )
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" )
endif ( )
endif ( )
else ( )
message ( STATUS "Crypto++ Not Found: ${CRYPTOPP_ID}, ${CRYPTOPP_LS}" )
endif ( )
# N o t r e a l l y w o r t h c a c h i n g . W e w a n t t o r e e v a l u a t e a n y w a y .
mark_as_advanced ( CRYPTOPP_ID CRYPTOPP_LS )
find_path ( LEVELDB_ID leveldb/db.h
/ u s r / i n c l u d e
/ u s r / l o c a l / i n c l u d e
@ -310,40 +296,32 @@ else()
endif ( )
if ( CRYPTOPP_ID )
include_directories ( ${ CRYPTOPP_ID } )
include_directories ( ${ CRYPTOPP_ID } )
endif ( )
if ( PYTHON_ID )
include_directories ( ${ PYTHON_ID } )
include_directories ( ${ PYTHON_ID } )
endif ( )
if ( MINIUPNPC_ID )
include_directories ( ${ MINIUPNPC_ID } )
include_directories ( ${ MINIUPNPC_ID } )
endif ( )
if ( LEVELDB_ID )
include_directories ( ${ LEVELDB_ID } )
include_directories ( ${ LEVELDB_ID } )
endif ( )
if ( READLINE_ID )
include_directories ( ${ READLINE_ID } )
include_directories ( ${ READLINE_ID } )
endif ( )
if ( JSONRPC_ID )
include_directories ( ${ JSONRPC_ID } )
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 ( )
# G e n e r a t e h e a d e r f i l e c o n t a i n i n g u s e f u l b u i l d i n f o r m a t i o n
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 } )
if ( ${ CMAKE_SYSTEM_NAME } MATCHES "Darwin" )
link_directories ( /usr/local/lib )
include_directories ( /usr/local/include )
endif ( ${ CMAKE_SYSTEM_NAME } MATCHES "Darwin" )
endif ( )
add_subdirectory ( libethential )
add_subdirectory ( libevmface )
@ -357,34 +335,40 @@ endif()
add_subdirectory ( lllc )
add_subdirectory ( sc )
if ( NOT LANGUAGES )
add_subdirectory ( secp256k1 )
add_subdirectory ( libethcore )
add_subdirectory ( libevm )
add_subdirectory ( libethereum )
add_subdirectory ( test )
add_subdirectory ( eth )
if ( "x${CMAKE_BUILD_TYPE}" STREQUAL "xDebug" )
add_subdirectory ( exp )
endif ( )
if ( NOT ( "${TARGET_PLATFORM}" STREQUAL "w64" ) )
add_subdirectory ( neth )
endif ( )
if ( QTQML )
add_definitions ( -DETH_QTQML )
endif ( )
add_subdirectory ( secp256k1 )
add_subdirectory ( libethcore )
add_subdirectory ( libevm )
add_subdirectory ( libethereum )
add_subdirectory ( test )
add_subdirectory ( eth )
if ( "x${CMAKE_BUILD_TYPE}" STREQUAL "xDebug" )
add_subdirectory ( exp )
endif ( )
if ( NOT ( "${TARGET_PLATFORM}" STREQUAL "w64" ) )
add_subdirectory ( neth )
endif ( )
if ( QTQML )
add_definitions ( -DETH_QTQML )
endif ( )
if ( NOT HEADLESS )
add_subdirectory ( libqethereum )
add_subdirectory ( alethzero )
if ( QTQML )
add_subdirectory ( walleth )
endif ( )
endif ( )
if ( NOT HEADLESS )
if ( "${TARGET_PLATFORM}" STREQUAL "w64" )
cmake_policy ( SET CMP0020 NEW )
endif ( )
add_subdirectory ( libqethereum )
add_subdirectory ( alethzero )
if ( QTQML )
add_subdirectory ( walleth )
endif ( )
endif ( )
endif ( )
set ( CMAKE_INCLUDE_CURRENT_DIR ON )
set ( SRC_LIST BuildInfo.h )
enable_testing ( )
add_test ( NAME alltests WORKING_DIRECTORY ${ CMAKE_BINARY_DIR } /test COMMAND testeth )
# unset ( HEADLESS CACHE )
# unset ( TARGET_PLATFORM CACHE )