-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
131 lines (107 loc) · 3.87 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
# Copyright (C) 1883 Thomas Edison - All Rights Reserved
# You may use, distribute and modify this code under the
# terms of the GPLv3 license, which unfortunately won't be
# written for another century.
#
# You should have received a copy of the LICENSE file with
# this file.
SET(CMAKE_AR "gcc-ar")
SET(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>")
SET(CMAKE_CXX_ARCHIVE_FINISH true)
# CMAKE_C_ARCHIVE_CREATE ( = <CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>)
# CMAKE_C_ARCHIVE_CREATE ( = true)
if(UNIX)
set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
endif()
cmake_minimum_required(VERSION 3.5)
include(cmake/cable/bootstrap.cmake)
# include(CableBuildInfo)
include(CableBuildType)
include(CableToolchains)
include(HunterGate)
include(defaults/HunterCacheServers)
cable_configure_toolchain(DEFAULT cxx17)
set(HUNTER_CONFIGURATION_TYPES Release CACHE STRING "Build type of Hunter packages")
set(HUNTER_JOBS_NUMBER 6 CACHE STRING "Number of parallel builds used by Hunter")
HunterGate(
URL "https://github.com/cpp-pm/hunter/archive/v0.23.299.tar.gz"
SHA1 "3d215b4bfac80824778fe9a93510e5f651d79e3a"
LOCAL
)
project(nsfminer)
set(PROJECT_VERSION 1.3.13) # Update version
cable_set_build_type(DEFAULT Release CONFIGURATION_TYPES Release RelWithDebInfo)
option(ETHASHCL "Build with OpenCL mining" ON)
option(ETHASHCUDA "Build with CUDA mining" ON)
option(ETHASHCPU "Build with CPU mining (only for development)" OFF)
option(APICORE "Build with API Server support" ON)
option(DEVBUILD "Log developer metrics" OFF)
# propagates CMake configuration options to the compiler
function(configureProject)
if (ETHASHCL)
add_definitions(-DETH_ETHASHCL)
endif()
if (ETHASHCUDA)
add_definitions(-DETH_ETHASHCUDA)
endif()
if (ETHASHCPU)
add_definitions(-DETH_ETHASHCPU)
endif()
if (APICORE)
add_definitions(-DAPI_CORE)
endif()
if (DEVBUILD)
add_definitions(-DDEV_BUILD)
endif()
endfunction()
hunter_add_package(Boost COMPONENTS system filesystem thread program_options)
find_package(Boost CONFIG REQUIRED COMPONENTS system filesystem thread program_options)
hunter_add_package(jsoncpp)
find_package(jsoncpp CONFIG REQUIRED)
hunter_add_package(ethash)
find_package(ethash CONFIG REQUIRED)
configureProject()
message("----------------------------------------------------------------------------")
message("-- CMake ${CMAKE_VERSION}")
message("-- Build ${CMAKE_BUILD_TYPE} / ${CMAKE_SYSTEM_NAME}")
message("----------------------------------------------------------------- components")
message("-- ETHASHCL Build OpenCL components ${ETHASHCL}")
message("-- ETHASHCUDA Build CUDA components ${ETHASHCUDA}")
message("-- ETHASHCPU Build CPU components (only for development) ${ETHASHCPU}")
message("-- APICORE Build API Server components ${APICORE}")
message("-- DEVBUILD Build with dev logging ${DEVBUILD}")
message("----------------------------------------------------------------------------")
message("")
include(EthCompilerSettings)
if(UNIX)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++")
endif()
# cable_add_buildinfo_library(PROJECT_NAME ${PROJECT_NAME})
add_subdirectory(libdev)
add_subdirectory(libeth)
add_subdirectory(libhwmon)
add_subdirectory(libpool)
if (ETHASHCL)
add_subdirectory(libcl)
endif ()
if (ETHASHCUDA)
add_subdirectory(libcuda)
endif ()
if (ETHASHCPU)
add_subdirectory(libcpu)
endif ()
if (APICORE)
add_subdirectory(libapi)
endif()
add_subdirectory(nsfminer)
if(WIN32)
set(CPACK_GENERATOR ZIP)
else()
set(CPACK_GENERATOR TGZ)
endif()
set(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME})
set(CPACK_PACKAGE_CHECKSUM SHA256)
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY FALSE)
include(CPack)