forked from mtrlt/Reaper_prime
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
135 lines (110 loc) · 2.82 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
cmake_minimum_required(VERSION 2.8)
project(reaper)
## Version ##
set(REAPER_VERSION "v13")
## Options ##
option(CPU_MINING_ONLY "Do not compile the GPU mining part" OFF)
if (WIN32)
message("setting up for win32 build")
option(REAPER_BUILD_32BIT "AUTOMATIC, DO NOT TOUCH: Compiling 32bit" ON)
else (WIN32)
if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
option(REAPER_BUILD_64BIT "AUTOMATIC, DO NOT TOUCH: Compiling 64bit" ON)
else( CMAKE_SIZEOF_VOID_P EQUAL 8 )
option(REAPER_BUILD_32BIT "AUTOMATIC, DO NOT TOUCH: Compiling 32bit" ON)
endif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
endif(WIN32)
## Libs ##
#FIND_LIBRARY( OPENCL_LIBRARY NAMES OpenCL PATH
# $ENV{OPENCL_LIB_DIR}
# $ENV{HOME}/.local/lib
# /usr/lib
# /usr/lib64
# /usr/local/lib
# /usr/local/cuda/lib64
# /usr/local/cuda/lib
#)
## Global config ##
configure_file(
"${PROJECT_SOURCE_DIR}/CMakeConf.h.in"
"${PROJECT_BINARY_DIR}/CMakeConf.h"
)
## Source files ##
set(SOURCES
App.cpp
AppOpenCL.cpp
Config.cpp
CPUAlgos_global.cpp
CPUAlgos_mtrlt.cpp
CPUAlgos_hp7.cpp
CPUMiner.cpp
Curl.cpp
main.cpp
ServerSettings.cpp
SHA256.cpp
Util.cpp
Sieve.cpp
Primes.cpp
CSieveOfEratosthenes.cpp
)
set(HEADERS
App.h
AppOpenCL.h
Config.h
CPUAlgos.h
CPUAlgos_global.h
CPUMiner.h
Curl.h
Global.h
ServerSettings.h
SHA256.h
Util.h
Sieve.h
Primes.h
CSieveOfEratosthenes.h
)
## Targets ##
add_executable(reaper ${SOURCES} ${HEADERS})
include_directories(
${PROJECT_BINARY_DIR}
)
include_directories(
"/usr/include/libblkmaker-0.1"
"/usr/local/include/libblkmaker-0.1"
"/usr/local/include"
"${PROJECT_SOURCE_DIR}/libblkmaker"
)
link_directories(
"/usr/lib"
"/lib"
"/c/mingw/lib"
"/usr/local/lib"
)
set_target_properties(reaper PROPERTIES COMPILE_FLAGS -O2)
## OpenCL detection ##
if(NOT CPU_MINING_ONLY)
if (WIN32)
message("setting up for win32 build")
find_library(OPENCL_LIBRARY libOpenCL PATHS "$ENV{AMDAPPSDKROOT}/lib/x86")
else(WIN32)
if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
find_library(OPENCL_LIBRARY NAMES OpenCL PATHS "$ENV{AMDAPPSDKROOT}/lib/x86_64")
else( CMAKE_SIZEOF_VOID_P EQUAL 8 )
find_library(OPENCL_LIBRARY NAMES OpenCL PATHS "$ENV{AMDAPPSDKROOT}/lib/x86")
endif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
endif(WIN32)
if(APPLE)
find_path(OPENCL_INCLUDE_DIR OpenCL/cl.h PATHS "$ENV{AMDAPPSDKROOT}/include")
else(APPLE)
find_path(OPENCL_INCLUDE_DIR CL/cl.h PATHS "$ENV{AMDAPPSDKROOT}/include")
endif(APPLE)
mark_as_advanced(OPENCL_INCLUDE_DIR OPENCL_LIBRARY)
include_directories(${OPENCL_INCLUDE_DIR})
endif(NOT CPU_MINING_ONLY)
# Dependencies
message("asking for OpenCL = " ${OPENCL_LIBRARY})
if(CPU_MINING_ONLY)
target_link_libraries(reaper gmp blkmaker-0.1 blkmaker_jansson-0.1 jansson pthread curl)
else(CPU_MINING_ONLY)
target_link_libraries(reaper gmp blkmaker-0.1 blkmaker_jansson-0.1 jansson pthread curl ${OPENCL_LIBRARY})
endif(CPU_MINING_ONLY)