This repository has been archived by the owner on Mar 18, 2020. It is now read-only.
forked from BeamMW/opencl-miner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
94 lines (76 loc) · 2.67 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
cmake_minimum_required(VERSION 3.1)
project(beam-opencl-miner)
set(TARGET_NAME beam-opencl-miner)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_STATIC_RUNTIME ON)
set(OPENSSL_USE_STATIC_LIBS TRUE)
find_package(Boost REQUIRED COMPONENTS system date_time thread)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
endif()
if (MSVC)
# use static runtime
foreach(flag_var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO
flag_var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
if(${flag_var} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endif(${flag_var} MATCHES "/MD")
endforeach(flag_var)
set(OPENSSL_USE_STATIC_LIBS TRUE)
set(OPENSSL_MSVC_STATIC_RT TRUE)
endif()
find_package(OpenSSL REQUIRED)
if( OpenSSL_FOUND )
link_directories(${OPENSSL_LIBRARIES})
include_directories(${OPENSSL_INCLUDE_DIR})
message(STATUS "Using OpenSSL ${OPENSSL_VERSION}")
else()
message(FATAL_ERROR "error, OpenSSL not found, please install: 'apt-get install libssl-dev' on Ubuntu")
endif()
find_package(OpenCL REQUIRED)
if(OpenCL_FOUND)
include_directories(${OpenCL_INCLUDE_DIRS})
link_directories(${OpenCL_LIBRARIES})
message(STATUS "Using OpenCL ${OpenCL_VERSION_STRING}")
else()
message(FATAL_ERROR "error, OpenCL not found")
endif()
set (HEADERS
beam/utility/common.h
beam/core/difficulty.h
)
set(MINER_SRC
beamStratum.cpp
clHost.cpp
main.cpp
crypto/sha256.c
beam/core/difficulty.cpp
beam/core/uintBig.cpp
beam/utility/common.cpp
)
add_executable(${TARGET_NAME} ${MINER_SRC} ${HEADERS} )
target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/beam)
target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/clHeaders)
if(UNIX)
find_package(Threads)
target_link_libraries(${TARGET_NAME} Threads::Threads)
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")
endif()
if(MSVC)
target_link_libraries(${TARGET_NAME} crypt32.lib)
if(MSVC_VERSION GREATER_EQUAL 1900)
target_link_libraries(${TARGET_NAME} legacy_stdio_definitions.lib)
endif()
endif()
target_link_libraries(${TARGET_NAME} OpenCL::OpenCL)
target_link_libraries(${TARGET_NAME} ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY})
target_link_libraries(${TARGET_NAME} ${Boost_LIBRARIES})
if(UNIX)
target_link_libraries(${TARGET_NAME} -ldl)
endif()