Browse Source

Move towards more flexible cryptopp discovery.

cl-refactor
Gav Wood 11 years ago
parent
commit
4792ac9236
  1. 52
      CMakeLists.txt
  2. 5
      alephzero/alephzero.pro
  3. 3
      eth/CMakeLists.txt
  4. 3
      libethereum/CMakeLists.txt
  5. 3
      test/CMakeLists.txt

52
CMakeLists.txt

@ -23,6 +23,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 ()
# Override the cryptopp search until we can get the qmake stuff sorted.
set(CRYPTOPP_INCLUDE_DIR "../cryptopp562" CACHE FILEPATH "" FORCE)
set(CRYPTOPP_LIBRARIES "../cryptopp562" CACHE FILEPATH "" FORCE)
# Look for availabe Crypto++ version and if it is >= 5.6.2
if(CRYPTOPP_INCLUDE_DIR AND CRYPTOPP_LIBRARIES)
set(CRYPTOPP_FOUND TRUE)
message(STATUS "Found Crypto++: ${CRYPTOPP_INCLUDE_DIR}, ${CRYPTOPP_LIBRARIES}")
else()
find_path(CRYPTOPP_INCLUDE_DIR cryptlib.h
/usr/include/crypto++
/usr/include/cryptopp
/usr/local/include/crypto++
/usr/local/include/cryptopp
/opt/local/include/crypto++
/opt/local/include/cryptopp
)
find_library(CRYPTOPP_LIBRARIES NAMES cryptopp
PATHS
/usr/lib
/usr/local/lib
/opt/local/lib
)
if(CRYPTOPP_INCLUDE_DIR AND CRYPTOPP_LIBRARIES)
set(CRYPTOPP_FOUND TRUE)
message(STATUS "Found Crypto++: ${CRYPTOPP_INCLUDE_DIR}, ${CRYPTOPP_LIBRARIES}")
set(_CRYPTOPP_VERSION_HEADER ${CRYPTOPP_INCLUDE_DIR}/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)
message(STATUS "Crypto++ version found is smaller than 5.6.2. We use ../cryptopp562")
set(CRYPTOPP_INCLUDE_DIR "../cryptopp562" CACHE FILEPATH "" FORCE)
set(CRYPTOPP_LIBRARIES "../cryptopp562" CACHE FILEPATH "" FORCE)
else()
message(STATUS "Crypto++ found and version greater or equal to 5.6.2")
endif()
endif()
else()
set(CRYPTOPP_FOUND TRUE) # Ugly
message(STATUS "Crypto++ not found. We use ../cryptopp562")
set(CRYPTOPP_INCLUDE_DIR "../cryptopp562" CACHE FILEPATH "" FORCE)
set(CRYPTOPP_LIBRARIES "../cryptopp562" CACHE FILEPATH "" FORCE)
endif()
mark_as_advanced(CRYPTOPP_INCLUDE_DIR CRYPTOPP_LIBRARIES)
endif()
if(CRYPTOPP_FOUND)
include_directories(${CRYPTOPP_INCLUDE_DIR})
link_directories(${CRYPTOPP_LIBRARIES})
endif()
add_subdirectory(libethereum) add_subdirectory(libethereum)
add_subdirectory(test) add_subdirectory(test)
add_subdirectory(eth) add_subdirectory(eth)

5
alephzero/alephzero.pro

@ -13,9 +13,10 @@ TEMPLATE = app
CONFIG(debug, debug|release): DEFINES += ETH_DEBUG CONFIG(debug, debug|release): DEFINES += ETH_DEBUG
QMAKE_CXXFLAGS += -std=c++11 QMAKE_CXXFLAGS += -std=c++11
QMAKE_LIBDIR += ../../cpp-ethereum-build/libethereum ../../secp256k1 ../../cryptopp562 QMAKE_LIBDIR += ../../cpp-ethereum-build/libethereum ../../secp256k1 ../../cryptopp562
LIBS += -Wl,-rpath,../../cpp-ethereum-build/libethereum -Wl,-rpath,../../secp256k1 -Wl,-rpath,../../cryptopp562 -lethereum -lminiupnpc -lsecp256k1 -lleveldb -lcryptopp -lgmp -lboost_filesystem -lboost_system LIBS += -Wl,-rpath,../../cpp-ethereum-build/libethereum -Wl,-rpath,../../secp256k1 -Wl,-rpath,../../cryptopp562 -lethereum -lcryptopp -lminiupnpc -lsecp256k1 -lleveldb -lgmp -lboost_filesystem -lboost_system
INCLUDEPATH = ../../secp256k1/include ../../cryptopp562 ../../cpp-ethereum INCLUDEPATH = ../../secp256k1/include ../../cpp-ethereum
SOURCES += main.cpp \ SOURCES += main.cpp \
MainWin.cpp MainWin.cpp

3
eth/CMakeLists.txt

@ -5,9 +5,6 @@ aux_source_directory(. SRC_LIST)
include_directories(../../secp256k1/include) include_directories(../../secp256k1/include)
link_directories(../../secp256k1) link_directories(../../secp256k1)
include_directories(../../cryptopp562)
link_directories(../../cryptopp562)
include_directories(../libethereum) include_directories(../libethereum)
link_directories(../libethereum) link_directories(../libethereum)

3
libethereum/CMakeLists.txt

@ -3,9 +3,6 @@ cmake_policy(SET CMP0015 NEW)
include_directories(../../secp256k1/include) include_directories(../../secp256k1/include)
link_directories(../../secp256k1) link_directories(../../secp256k1)
include_directories(../../cryptopp562)
link_directories(../../cryptopp562)
aux_source_directory(. SRC_LIST) aux_source_directory(. SRC_LIST)
add_library(ethereum ${SRC_LIST}) add_library(ethereum ${SRC_LIST})

3
test/CMakeLists.txt

@ -5,9 +5,6 @@ aux_source_directory(. SRC_LIST)
include_directories(../../secp256k1/include) include_directories(../../secp256k1/include)
link_directories(../../secp256k1) link_directories(../../secp256k1)
include_directories(../../cryptopp562)
link_directories(../../cryptopp562)
include_directories(../libethereum) include_directories(../libethereum)
link_directories(../libethereum) link_directories(../libethereum)

Loading…
Cancel
Save