|
@ -19,6 +19,31 @@ elseif (CMAKE_COMPILER_IS_MSVC) |
|
|
else () |
|
|
else () |
|
|
set(ETH_BUILD_PLATFORM "${ETH_BUILD_PLATFORM}/unknown") |
|
|
set(ETH_BUILD_PLATFORM "${ETH_BUILD_PLATFORM}/unknown") |
|
|
endif () |
|
|
endif () |
|
|
|
|
|
|
|
|
|
|
|
set(TARGET_PLATFORM CACHE STRING "linux") |
|
|
|
|
|
if (${TARGET_PLATFORM} STREQUAL "w64") |
|
|
|
|
|
set(CMAKE_SYSTEM_NAME Windows) |
|
|
|
|
|
|
|
|
|
|
|
set(CMAKE_CXX_LIBRARY_ARCHITECTURE x86_64-w64-mingw32) |
|
|
|
|
|
set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) |
|
|
|
|
|
set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) |
|
|
|
|
|
set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) |
|
|
|
|
|
set(CMAKE_AR x86_64-w64-mingw32-ar) |
|
|
|
|
|
set(CMAKE_RANLIB x86_64-w64-mingw32-ranlib) |
|
|
|
|
|
|
|
|
|
|
|
set(CMAKE_EXECUTABLE_SUFFIX .exe) |
|
|
|
|
|
|
|
|
|
|
|
set(CMAKE_FIND_ROOT_PATH |
|
|
|
|
|
/usr/x86_64-w64-mingw32 |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) |
|
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) |
|
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) |
|
|
|
|
|
|
|
|
|
|
|
set(CMAKE_INSTALL_PREFIX /usr/x86_64-w64-mingw32) |
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
# Initialize CXXFLAGS. |
|
|
# Initialize CXXFLAGS. |
|
|
set(CMAKE_CXX_FLAGS "-Wall -std=c++11") |
|
|
set(CMAKE_CXX_FLAGS "-Wall -std=c++11") |
|
|
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") |
|
|
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") |
|
@ -44,55 +69,58 @@ else () |
|
|
message(FATAL_ERROR "Your C++ compiler does not support C++11.") |
|
|
message(FATAL_ERROR "Your C++ compiler does not support C++11.") |
|
|
endif () |
|
|
endif () |
|
|
|
|
|
|
|
|
# Look for available Crypto++ version and if it is >= 5.6.2 |
|
|
if (${TARGET_PLATFORM} STREQUAL "w64") |
|
|
find_path(ID cryptlib.h |
|
|
else () |
|
|
/usr/include/cryptopp |
|
|
# Look for available Crypto++ version and if it is >= 5.6.2 |
|
|
/usr/include/crypto++ |
|
|
find_path(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++ |
|
|
PATHS |
|
|
) |
|
|
/usr/lib |
|
|
find_library(LS NAMES cryptoppeth cryptopp |
|
|
/usr/local/lib |
|
|
PATHS |
|
|
/opt/local/lib |
|
|
/usr/lib |
|
|
) |
|
|
/usr/local/lib |
|
|
|
|
|
/opt/local/lib |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
if(ID AND LS) |
|
|
if(ID AND LS) |
|
|
message(STATUS "Found Crypto++: ${ID}, ${LS}") |
|
|
message(STATUS "Found Crypto++: ${ID}, ${LS}") |
|
|
set(_CRYPTOPP_VERSION_HEADER ${ID}/config.h) |
|
|
set(_CRYPTOPP_VERSION_HEADER ${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) |
|
|
message(STATUS "System Crypto++ version found is smaller than 5.6.2.") |
|
|
message(STATUS "System Crypto++ version found is smaller than 5.6.2.") |
|
|
else() |
|
|
else() |
|
|
set(CRYPTOPP_INCLUDE_DIR ${ID} CACHE FILEPATH "" FORCE) |
|
|
set(CRYPTOPP_INCLUDE_DIR ${ID} CACHE FILEPATH "" FORCE) |
|
|
set(CRYPTOPP_LIBRARIES ${LS} CACHE FILEPATH "" FORCE) |
|
|
set(CRYPTOPP_LIBRARIES ${LS} CACHE FILEPATH "" FORCE) |
|
|
set(CRYPTOPP_FOUND TRUE) |
|
|
set(CRYPTOPP_FOUND TRUE) |
|
|
message(STATUS "System Crypto++ found and version greater or equal to 5.6.2") |
|
|
message(STATUS "System Crypto++ found and version greater or equal to 5.6.2") |
|
|
endif() |
|
|
endif() |
|
|
endif() |
|
|
endif() |
|
|
endif() |
|
|
endif() |
|
|
|
|
|
|
|
|
if(NOT CRYPTOPP_FOUND) |
|
|
if(NOT CRYPTOPP_FOUND) |
|
|
set(CRYPTOPP_INCLUDE_DIR "../cryptopp562" CACHE FILEPATH "" FORCE) |
|
|
set(CRYPTOPP_INCLUDE_DIR "../cryptopp562" CACHE FILEPATH "" FORCE) |
|
|
find_library(LSLOC NAMES cryptoppeth cryptopp |
|
|
find_library(LSLOC NAMES cryptoppeth cryptopp |
|
|
PATHS ../cryptopp562 |
|
|
PATHS ../cryptopp562 |
|
|
NO_DEFAULT_PATH |
|
|
NO_DEFAULT_PATH |
|
|
) |
|
|
) |
|
|
set(CRYPTOPP_LIBRARIES ${LSLOC} CACHE FILEPATH "" FORCE) |
|
|
set(CRYPTOPP_LIBRARIES ${LSLOC} CACHE FILEPATH "" FORCE) |
|
|
message(STATUS "System Crypto++ not found, broken or too old. We use ${LSLOC}") |
|
|
message(STATUS "System Crypto++ not found, broken or too old. We use ${LSLOC}") |
|
|
endif() |
|
|
endif() |
|
|
|
|
|
|
|
|
# Not really worth caching. We want to reevaluate anyway. |
|
|
# Not really worth caching. We want to reevaluate anyway. |
|
|
mark_as_advanced(CRYPTOPP_INCLUDE_DIR CRYPTOPP_LIBRARIES) |
|
|
mark_as_advanced(CRYPTOPP_INCLUDE_DIR CRYPTOPP_LIBRARIES) |
|
|
|
|
|
|
|
|
# Always "found", given last block. |
|
|
# Always "found", given last block. |
|
|
include_directories(${CRYPTOPP_INCLUDE_DIR}) |
|
|
include_directories(${CRYPTOPP_INCLUDE_DIR}) |
|
|
link_directories(${CRYPTOPP_LIBRARIES}) |
|
|
link_directories(${CRYPTOPP_LIBRARIES}) |
|
|
|
|
|
endif () |
|
|
|
|
|
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
|
|
link_directories(/usr/local/lib) |
|
|
link_directories(/usr/local/lib) |
|
|