Browse Source

project working on mac, FindGmp.cmake && couple of todos

cl-refactor
Marek Kotewicz 10 years ago
parent
commit
f7c44f3866
  1. 23
      cmake/EthDependencies.cmake
  2. 32
      cmake/FindGmp.cmake
  3. 2
      cmake/FindLevelDB.cmake
  4. 7
      libethereum/CMakeLists.txt
  5. 21
      secp256k1/CMakeLists.txt

23
cmake/EthDependencies.cmake

@ -6,7 +6,12 @@
string(TOLOWER ${CMAKE_SYSTEM_NAME} _system_name)
set (CMAKE_DEPENDENCY_INSTALL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/extdep/install/${_system_name}")
set (CMAKE_PREFIX_PATH ${CMAKE_DEPENDENCY_INSTALL_DIR})
if (WIN32)
# Qt5 requires opengl
# TODO use proper version of windows SDK (32 vs 64)
# TODO make it possible to use older versions of windows SDK (7.0+ should also work)
# TODO it windows SDK is NOT FOUND, throw ERROR
if (${CMAKE_CXX_COMPILER_ID} MATCHES "MSVC")
set (CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "C:/Program Files/Windows Kits/8.1/Lib/winv6.3/um/x86")
#set (CMAKE_PREFIX_PATH "C:/Program Files/Windows Kits/8.1/Lib/winv6.3/um/x64")
endif()
@ -28,6 +33,7 @@ message(" - Jsoncpp lib : ${JSONCPP_LIBRARIES}")
# TODO the JsonRpcCpp package does not yet check for correct version number
# json-rpc-cpp support is currently not mandatory
# TODO make headless client optional
find_package (JsonRpcCpp 0.3.2)
if (${JSON_RPC_CPP_FOUND})
message (" - json-rpc-cpp header: ${JSON_RPC_CPP_INCLUDE_DIRS}")
@ -35,6 +41,13 @@ if (${JSON_RPC_CPP_FOUND})
add_definitions(-DETH_JSONRPC)
endif()
# TODO gmp package does not yet check for correct version number
# TODO it is also not required in msvc build
find_package (Gmp 6.0.0)
message(" - Gmp Header: ${GMP_INCLUDE_DIR}")
message(" - Gmp lib : ${GMP_LIBRARY}")
# TODO make headless client optional
find_package (QT5Core REQUIRED)
find_package (QT5Gui REQUIRED)
find_package (Qt5Quick REQUIRED)
@ -46,18 +59,18 @@ find_package (Qt5WebKitWidgets REQUIRED)
# we have to specify here if we want static and boost version, that is really important
# win32 msvc 2013 boost
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
# TODO hanlde other msvc versions or it will fail find them
if (${CMAKE_CXX_COMPILER_ID} MATCHES "MSVC")
set(Boost_COMPILER -vc120)
endif()
find_package(Boost 1.55.0 REQUIRED COMPONENTS thread date_time system regex chrono filesystem)
if (Boost_FOUND)
message(" - boost header: ${Boost_INCLUDE_DIRS}")
message(" - boost lib : ${Boost_LIBRARIES}")
endif()

32
cmake/FindGmp.cmake

@ -0,0 +1,32 @@
# Find gmp
#
# Find the gmp includes and library
#
# if you nee to add a custom library search path, do it via via CMAKE_FIND_ROOT_PATH
#
# This module defines
# GMP_INCLUDE_DIR, where to find header, etc.
# GMP_LIBRARY, the libraries needed to use leveldb.
# GMP_FOUND, If false, do not try to use leveldb.
# only look in default directories
find_path(
GMP_INCLUDE_DIR
NAMES gmp.h
DOC "gmp include dir"
)
find_library(
GMP_LIBRARY
NAMES gmp
DOC "gmp library"
)
# handle the QUIETLY and REQUIRED arguments and set GMP_FOUND to TRUE
# if all listed variables are TRUE, hide their existence from configuration view
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(gmp DEFAULT_MSG
GMP_INCLUDE_DIR GMP_LIBRARY)
mark_as_advanced (GMP_INCLUDE_DIR GMP_LIBRARY)

2
cmake/FindLevelDB.cmake

@ -26,7 +26,7 @@ find_library(
# message (" - leveldb lib : ${LEVELDB_LIBRARY}")
# handle the QUIETLY and REQUIRED arguments and set JSON_RPC_CPP_FOUND to TRUE
# handle the QUIETLY and REQUIRED arguments and set LEVELDB_FOUND to TRUE
# if all listed variables are TRUE, hide their existence from configuration view
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(leveldb DEFAULT_MSG

7
libethereum/CMakeLists.txt

@ -5,6 +5,9 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTATICLIB")
aux_source_directory(. SRC_LIST)
include_directories(${LEVELDB_INCLUDE_DIR})
include_directories(..)
set(EXECUTABLE ethereum)
file(GLOB HEADERS "*.h")
@ -15,10 +18,8 @@ else()
add_library(${EXECUTABLE} SHARED ${SRC_LIST} ${HEADERS})
endif()
include_directories(${LEVELDB_INCLUDE_DIR})
include_directories(..)
target_link_libraries(${EXECUTABLE} ${LEVELDB_LIBRARY})
target_link_libraries(${EXECUTABLE} ${Boost_REGEX_LIBRARY_RELEASE})
if (MINIUPNPC_LS)
target_link_libraries(${EXECUTABLE} ${MINIUPNPC_LS})

21
secp256k1/CMakeLists.txt

@ -3,19 +3,32 @@ set(CMAKE_AUTOMOC OFF)
set(CMAKE_ASM_COMPILER "yasm")
include_directories(${Boost_INCLUDE_DIRS})
set(EXECUTABLE secp256k1)
file(GLOB HEADERS "*.h")
if (${CMAKE_CXX_COMPILER_ID} MATCHES "MSVC")
include_directories(${Boost_INCLUDE_DIRS})
if(ETH_STATIC)
add_library(${EXECUTABLE} STATIC ${EXECUTABLE}.c)
else()
add_library(${EXECUTABLE} SHARED ${EXECUTABLE}.c)
endif()
# /TP - compile project as cpp project
set_target_properties(${EXECUTABLE} PROPERTIES COMPILE_FLAGS "/TP")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_NUM_BOOST -DUSE_FIELD_10X26 -DUSE_FIELD_INV_BUILTIN")
elseif (APPLE OR UNIX)
if (ETH_STATIC)
add_library(${EXECUTABLE} STATIC ${EXECUTABLE}.c field_5x52_asm.asm)
else()
add_library(${EXECUTABLE} SHARED ${EXECUTABLE}.c field_5x52_asm.asm)
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -DUSE_FIELD_GMP -DUSE_NUM_GMP -DUSE_FIELD_INV_NUM")
target_link_libraries(${EXECUTABLE} ${GMP_LIBRARY})
endif()
install( TARGETS ${EXECUTABLE} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib )
install( FILES ${HEADERS} DESTINATION include/${EXECUTABLE} )

Loading…
Cancel
Save