-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
56 lines (42 loc) · 1.68 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
set(CMAKE_CXX_FLAGS "-std=c++14")
add_subdirectory(ethash/src/libethash)
if(MSVC)
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc" )
# set( CMAKE_VS_PLATFORM_TOOLSET "LLVM-vs2017")
endif()
if (NOT MSVC)
if ( LIBCXX_BUILD )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++" )
endif()
endif()
file(GLOB ETHER_HEADERS "include/eth-crypto/core/*.h" "include/eth-crypto/crypto/*.h")
file(GLOB ETHER_SOURCES "src/core/*.cpp" "src/crypto/*.cpp")
FIND_PACKAGE(Boost 1.65 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
include_directories(${Boost_INCLUDE_DIR}
"ethash/src/libethash"
"${CMAKE_SOURCE_DIR}/libraries/secp256k1/include"
)
IF(NOT "$ENV{OPENSSL_ROOT_DIR}" STREQUAL "")
set(OPENSSL_ROOT_DIR $ENV{OPENSSL_ROOT_DIR} )
set(OPENSSL_INCLUDE_DIR ${OPENSSL_ROOT_DIR}/include)
message(STATUS "Setting up OpenSSL root and include vars to ${OPENSSL_ROOT_DIR}, ${OPENSSL_INCLUDE_DIR}")
ENDIF()
include_directories(${Boost_INCLUDE_DIR}
"ethash/src/libethash"
"${CMAKE_SOURCE_DIR}/libraries/secp256k1/include"
${OPENSSL_INCLUDE_DIR}
)
find_package(OpenSSL REQUIRED)
add_library( eth-crypto ${ETHER_SOURCES} ${ETHER_HEADERS} )
if (MSVC)
target_link_libraries( eth-crypto secp256k1 ${OPENSSL_LIBRARIES} ${CMAKE_USE_PTHREADS_INIT} ethash )
else()
target_link_libraries( eth-crypto secp256k1 ${OPENSSL_LIBRARIES} ${CMAKE_USE_PTHREADS_INIT} dl ethash )
endif()
target_include_directories( eth-crypto
PUBLIC "${Boost_INCLUDE_DIR}"
PUBLIC "${CMAKE_SOURCE_DIR}/libraries/eth-crypto/include"
PUBLIC "${CMAKE_SOURCE_DIR}/libraries/secp256k1/include"
PUBLIC "${OPENSSL_INCLUDE_DIR}"
PRIVATE "ethash/src/libethash"
)