forked from mikaelh2/primecoin
-
Notifications
You must be signed in to change notification settings - Fork 24
/
CMakeLists.txt
118 lines (103 loc) · 3.34 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
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0)
###
### FIND ADDITIONAL CMAKE MODULES
###
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
###
### PROJECT
###
PROJECT(xolominer)
###
### OPENSSL
###
FIND_PACKAGE(OpenSSL REQUIRED)
IF(OPENSSL_FOUND)
MESSAGE("OpenSSL information: found")
MESSAGE(" OpenSSL_INCLUDE_DIR: ${OpenSSL_INCLUDE_DIR}")
MESSAGE(" OpenSSL_LIBRARIES: ${OpenSSL_LIBRARIES}")
INCLUDE_DIRECTORIES(${OpenSSL_INCLUDE_DIR})
ELSE(OPENSSL_FOUND)
MESSAGE(FATAL_ERROR "OpenSSL -NOT- found" )
ENDIF(OPENSSL_FOUND)
###
### LIBGMP
###
FIND_PACKAGE(GMP REQUIRED)
IF(GMP_FOUND)
MESSAGE("libGMP information: found")
MESSAGE(" GMP_INCLUDE_DIR: ${GMP_INCLUDE_DIR}")
MESSAGE(" GMP(XX)_LIBRARIES: ${GMP_LIBRARIES} (${GMPXX_LIBRARIES})")
INCLUDE_DIRECTORIES(${GMP_INCLUDE_DIR})
ELSE()
MESSAGE(FATAL_ERROR "libGMP -NOT- found" )
ENDIF()
###
### BOOST
###
SET(Boost_USE_MULTITHREADED ON)
SET(Boost_USE_STATIC_LIBS ON)
#SET(Boost_COMPILER "-gcc43") #set this to the compiler suffix used by Boost if FindBoost has problems
#SET(Boost_ADDITIONAL_VERSIONS "0.99" "0.99.0" "1.78" "1.78.0") #for future boost releases
FIND_PACKAGE(Boost 1.43.0 COMPONENTS system thread timer chrono REQUIRED)
MESSAGE("Boost information: found ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
MESSAGE(" Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS}")
MESSAGE(" Boost_LIBRARY_DIRS: ${Boost_LIBRARY_DIRS}")
MESSAGE(" Boost_LIBRARIES: ${Boost_LIBRARIES}")
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
###
### YASM (not needed atm)
###
#IF(APPLE)
# set(CMAKE_ASM_FLAGS "-f macho64 --prefix=_") #TODO: 32 BIT?
#ELSE(UNIX)
# SET(CMAKE_ASM_FLAGS "-f elf64") #TODO: 32 BIT?
#ELSE()
# SET(CMAKE_ASM_FLAGS "-f win64") #TODO: 32 BIT?
#ENDIF()
#
#SET(CMAKE_ASM_COMPILER "yasm")
#ENABLE_LANGUAGE(ASM)
###
### GENERAL SOURCE STUFF
###
INCLUDE_DIRECTORIES("src")
SET(SRC_FILES
src/prime.cpp
src/main_mining.cpp
src/main_poolminer.cpp
)
###
### EXECUTABLE
###
ADD_EXECUTABLE(xolominer
${SRC_FILES}
)
###
### LIBRARIES
###
#TARGET_LINK_LIBRARIES(xolominer ${Boost_SYSTEM_LIBRARY})
#TARGET_LINK_LIBRARIES(xolominer ${Boost_THREAD_LIBRARY})
#TARGET_LINK_LIBRARIES(xolominer ${Boost_TIMER_LIBRARY})
#TARGET_LINK_LIBRARIES(xolominer ${Boost_CHRONO_LIBRARY})
TARGET_LINK_LIBRARIES(xolominer ${Boost_LIBRARIES})
TARGET_LINK_LIBRARIES(xolominer ${GMP_LIBRARIES})
TARGET_LINK_LIBRARIES(xolominer ${GMPXX_LIBRARIES})
TARGET_LINK_LIBRARIES(xolominer ${OpenSSL_LIBRARIES})
TARGET_LINK_LIBRARIES(xolominer "pthread")
IF(WIN32) #<MINGW>
TARGET_LINK_LIBRARIES(xolominer "ws2_32")
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
SET(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++") #TODO: boost -> libwinpthread?
# TARGET_LINK_LIBRARIES(xolominer "mswsock") #needed? no.
# TARGET_LINK_LIBRARIES(xolominer "shlwapi") #needed? no.
# TARGET_LINK_LIBRARIES(xolominer "-DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -Wl,--dynamicbase -Wl,--nxcompat -static") #needed? no.
ELSEIF(UNIX)
TARGET_LINK_LIBRARIES(xolominer "rt") # -NOT- APPLE !?!
ENDIF()
###
### COMMON FLAGS
###
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3") # DEBUG/RELEASE flags omitted atm (for simplification)
#SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
#SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DGLIBC_XX_DEBUG -Wall -ggdb -g3 -fno-rounding-math -msse -O0")