-
Notifications
You must be signed in to change notification settings - Fork 662
/
CMakeLists.txt
125 lines (100 loc) · 3.26 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
cmake_minimum_required(VERSION 3.10)
set(CMAKE_CXX_STANDARD 17)
find_package(Git)
execute_process(
COMMAND ${GIT_EXECUTABLE} log -1 --format=%h
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
add_definitions("-DGIT_COMMIT_HASH=\"${GIT_COMMIT_HASH}\"")
project(chia-plotter C CXX ASM)
# Add path for custom modules
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules
)
if (${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "amd64")
set(TARGET_ARCH "x86_64")
else()
set(TARGET_ARCH ${CMAKE_HOST_SYSTEM_PROCESSOR})
endif()
message(STATUS "Architecture: ${TARGET_ARCH}")
#set(ENV{RELIC_MAIN} "1")
add_subdirectory(lib/bls-signatures)
add_subdirectory(lib/libbech32)
find_package(Threads REQUIRED)
if (SODIUM_FOUND)
message(STATUS "Found libsodium")
message(STATUS "Sodium include dir = ${sodium_INCLUDE_DIR}")
include_directories(${sodium_INCLUDE_DIR})
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unused-function")
set(BLAKE3_PATH lib/BLAKE3/c)
set(FSE_PATH lib/FSE/lib)
include_directories(
lib
include
lib/bls-signatures/src
lib/libbech32/include/libbech32
${BLAKE3_PATH}
${CMAKE_BINARY_DIR}/_deps/relic-src/include
${CMAKE_BINARY_DIR}/_deps/relic-build/include
)
IF (WIN32)
set(BLAKE3_SRC
${BLAKE3_PATH}/blake3.c
${BLAKE3_PATH}/blake3_portable.c
${BLAKE3_PATH}/blake3_dispatch.c
${BLAKE3_PATH}/blake3_sse41_x86-64_windows_gnu.S
${BLAKE3_PATH}/blake3_sse2_x86-64_windows_gnu.S
)
ELSEIF(TARGET_ARCH STREQUAL "x86_64")
set(BLAKE3_SRC
${BLAKE3_PATH}/blake3.c
${BLAKE3_PATH}/blake3_portable.c
${BLAKE3_PATH}/blake3_dispatch.c
${BLAKE3_PATH}/blake3_avx2_x86-64_unix.S
${BLAKE3_PATH}/blake3_avx512_x86-64_unix.S
${BLAKE3_PATH}/blake3_sse41_x86-64_unix.S
${BLAKE3_PATH}/blake3_sse2_x86-64_unix.S
)
ELSE()
set(BLAKE3_SRC
${BLAKE3_PATH}/blake3.c
${BLAKE3_PATH}/blake3_portable.c
${BLAKE3_PATH}/blake3_dispatch.c
)
ENDIF()
set(FSE_SRC
${FSE_PATH}/fse_compress.c
${FSE_PATH}/fse_decompress.c
${FSE_PATH}/entropy_common.c
${FSE_PATH}/hist.c
)
add_library(blake3 STATIC ${BLAKE3_SRC})
add_library(fse STATIC ${FSE_SRC})
add_library(chia_plotter STATIC
lib/chacha8.c
src/settings.cpp
)
target_link_libraries(chia_plotter blake3 fse bech32 Threads::Threads)
add_executable(test_copy test/test_copy.cpp)
add_executable(test_disk_sort test/test_disk_sort.cpp)
add_executable(test_phase_1 test/test_phase_1.cpp)
add_executable(test_phase_2 test/test_phase_2.cpp)
add_executable(test_phase_3 test/test_phase_3.cpp)
add_executable(test_phase_4 test/test_phase_4.cpp)
add_executable(check_phase_1 test/check_phase_1.cpp)
add_executable(chia_plot src/chia_plot.cpp)
add_executable(chia_plot_k34 src/chia_plot.cpp)
target_compile_definitions(chia_plot_k34 PUBLIC CHIA_K34=1)
target_link_libraries(test_copy chia_plotter)
target_link_libraries(test_disk_sort chia_plotter)
target_link_libraries(test_phase_1 chia_plotter)
target_link_libraries(test_phase_2 chia_plotter)
target_link_libraries(test_phase_3 chia_plotter)
target_link_libraries(test_phase_4 chia_plotter)
target_link_libraries(check_phase_1 chia_plotter)
target_link_libraries(chia_plot chia_plotter bls sodium)
target_link_libraries(chia_plot_k34 chia_plotter bls sodium)