-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
193 lines (167 loc) · 4.14 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
cmake_minimum_required(VERSION 3.16)
project(rafter
VERSION 0.1
LANGUAGES CXX)
set(CMAKE_CXX_STANDARD
"20"
CACHE
STRING
"C++ standard to build with.")
set(CMAKE_C_FLAGS_SANITIZE
"-Os -g"
CACHE
STRING
"Flags used by the C compiler during sanitize builds."
FORCE)
set(CMAKE_CXX_FLAGS_SANITIZE
"-Os -g"
CACHE
STRING
"Flags used by the C++ compiler during sanitize builds."
FORCE)
set(CMAKE_BUILD_TYPE
"${CMAKE_BUILD_TYPE}"
CACHE
STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo Sanitize."
FORCE)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
endif ()
set(RAFTER_CXX_FLAGS -fcoroutines-ts -Wall)
set(RAFTER_LINKER_FLAGS -fuse-ld=mold)
if ((CMAKE_BUILD_TYPE STREQUAL "Debug") OR (CMAKE_BUILD_TYPE STREQUAL "Sanitize"))
list(APPEND RAFTER_CXX_FLAGS -fno-omit-frame-pointer -fno-optimize-sibling-calls)
else ()
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O3")
set(CMAKE_POLICY_DEFAULT_CMP0069 NEW)
include(CheckIPOSupported)
check_ipo_supported(RESULT result OUTPUT output)
if (result)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
else ()
message(WARNING "IPO is not supported: ${output}")
endif ()
endif ()
include_directories(${PROJECT_SOURCE_DIR})
add_subdirectory(seastar)
add_subdirectory(3rd)
add_subdirectory(test)
set(SOURCES
api/api.cc
api/api.hh
core/logger.cc
core/logger.hh
core/peer.cc
core/peer.hh
core/quiesce.cc
core/quiesce.hh
core/raft.cc
core/raft.hh
core/raft_log.cc
core/raft_log.hh
core/rate_limiter.hh
core/read_index.cc
core/read_index.hh
core/remote.cc
core/remote.hh
protocol/client.cc
protocol/client.hh
protocol/raft.cc
protocol/raft.hh
protocol/serializer.cc
protocol/serializer.hh
rafter/api_server.cc
rafter/api_server.hh
rafter/config.cc
rafter/config.hh
rafter/info.hh
rafter/logger.cc
rafter/logger.hh
rafter/node.cc
rafter/node.hh
rafter/nodehost.cc
rafter/nodehost.hh
rafter/request.cc
rafter/request.hh
rafter/statemachine.cc
rafter/statemachine.hh
rsm/files.cc
rsm/files.hh
rsm/logger.cc
rsm/logger.hh
rsm/membership.cc
rsm/membership.hh
rsm/session.cc
rsm/session.hh
rsm/session_manager.cc
rsm/session_manager.hh
rsm/snapshotter.cc
rsm/snapshotter.hh
rsm/statemachine_manager.cc
rsm/statemachine_manager.hh
server/environment.cc
server/environment.hh
server/logger.cc
server/logger.hh
server/snapshot_context.cc
server/snapshot_context.hh
storage/index.cc
storage/index.hh
storage/logdb.cc
storage/logdb.hh
storage/logger.cc
storage/logger.hh
storage/segment.cc
storage/segment.hh
storage/segment_manager.cc
storage/segment_manager.hh
storage/stats.cc
storage/stats.hh
transport/exchanger.cc
transport/exchanger.hh
transport/express.cc
transport/express.hh
transport/logger.cc
transport/logger.hh
transport/registry.cc
transport/registry.hh
transport/rpc.hh
transport/snapshot_chunk_tracker.cc
transport/snapshot_chunk_tracker.hh
util/backoff.hh
util/buffering_queue.hh
util/circuit_breaker.hh
util/endian.hh
util/error.cc
util/error.hh
util/file.cc
util/file.hh
util/fragmented_temporary_buffer.cc
util/fragmented_temporary_buffer.hh
util/lru.hh
util/rate_limiter.hh
util/seastarx.hh
util/serializer.hh
util/signal.cc
util/signal.hh
util/types.hh
util/util.hh
util/worker.hh
)
add_library(${PROJECT_NAME} ${SOURCES})
target_compile_options(${PROJECT_NAME}
PUBLIC ${RAFTER_CXX_FLAGS}
)
target_link_options(${PROJECT_NAME}
PUBLIC ${RAFTER_LINKER_FLAGS}
)
target_link_libraries(${PROJECT_NAME}
PUBLIC Seastar::seastar
PUBLIC simdjson
)
add_executable(${PROJECT_NAME}_main ${SOURCES} rafter/main.cc)
target_link_libraries(${PROJECT_NAME}_main
PUBLIC ${PROJECT_NAME}
PUBLIC Seastar::seastar)