-
Notifications
You must be signed in to change notification settings - Fork 172
/
CMakeLists.txt
544 lines (479 loc) · 16.3 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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
# Copyright (c) 2020-present Baidu, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.2)
project(BaikalDB C CXX)
option(WITH_BAIKAL_CLIENT "build baikal-client" ON)
option(DEBUG "Print debug logs" OFF)
option(WITH_SYSTEM_LIBS "use system installed headers and libraries instead of auto dependency" OFF)
option(WITH_DEBUG_SYMBOLS "With debug symbols" OFF)
option(WITH_TESTS "With tests" OFF)
option(WITH_GPERF "Link tcmalloc and profiler" ON)
message(STATUS "CXX compiler: ${CMAKE_CXX_COMPILER}, version: "
"${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")
message(STATUS "C compiler: ${CMAKE_C_COMPILER}, version: "
"${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}")
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# require at least gcc 4.8
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
message(FATAL_ERROR "GCC is too old, please install a newer version supporting C++11")
endif ()
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# require at least clang 3.3
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.3)
message(FATAL_ERROR "Clang is too old, please install a newer version supporting C++11")
endif ()
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
else ()
message(WARNING "You are using an unsupported compiler! Compilation has only been tested with Clang and GCC.")
endif ()
SET(THIRD_PARTY_PATH ${CMAKE_CURRENT_BINARY_DIR}/third-party)
SET(THIRD_PARTY_BUILD_TYPE Release)
SET(EXTERNAL_PROJECT_LOG_ARGS
LOG_DOWNLOAD 0
LOG_UPDATE 1
LOG_CONFIGURE 0
LOG_BUILD 0
LOG_TEST 1
LOG_INSTALL 0)
include(ProcessorCount)
#ProcessorCount(NUM_OF_PROCESSOR)
SET(NUM_OF_PROCESSOR 4)
message(NUM_OF_PROCESSOR: ${NUM_OF_PROCESSOR})
#thread
include(FindThreads)
#openssl
find_package(OpenSSL REQUIRED)
message(STATUS "ssl:" ${OPENSSL_SSL_LIBRARY})
message(STATUS "crypto:" ${OPENSSL_CRYPTO_LIBRARY})
ADD_LIBRARY(ssl SHARED IMPORTED GLOBAL)
SET_PROPERTY(TARGET ssl PROPERTY IMPORTED_LOCATION ${OPENSSL_SSL_LIBRARY})
ADD_LIBRARY(crypto SHARED IMPORTED GLOBAL)
SET_PROPERTY(TARGET crypto PROPERTY IMPORTED_LOCATION ${OPENSSL_CRYPTO_LIBRARY})
#zlib
if (NOT WITH_SYSTEM_LIBS)
include(zlib)
else ()
ADD_LIBRARY(zlib SHARED IMPORTED GLOBAL)
SET(ZLIB_LIBRARIES z)
endif ()
#bzip2
#include(bz2)
#boost
if (WITH_SYSTEM_LIBS)
SET(Boost_NO_BOOST_CMAKE 1)
SET(Boost_USE_MULTITHREADED ON)
SET(Boost_USE_STATIC_LIBS ON)
find_package(Boost 1.56.0 REQUIRED thread filesystem)
ADD_LIBRARY(boost SHARED IMPORTED GLOBAL)
else ()
include(boost)
endif ()
message(boost: ${Boost_VERSION}, ${Boost_LIB_VERSION}, DIRS: ${Boost_INCLUDE_DIRS}, LIBS: ${Boost_LIBRARIES})
#rapidjson
if (WITH_SYSTEM_LIBS)
find_path(RAPIDJSON_INCLUDE_DIR NAMES rapidjson/rapidjson.h)
if (NOT RAPIDJSON_INCLUDE_DIR)
message(FATAL_ERROR "Fail to find rapidjson")
endif ()
ADD_LIBRARY(rapidjson SHARED IMPORTED GLOBAL)
else ()
include(rapidjson)
endif ()
#apache arrow
if (WITH_SYSTEM_LIBS)
find_path(ARROW_INCLUDE_DIR NAMES arrow/api.h)
find_library(ARROW_LIBRARIES NAMES arrow)
if ((NOT ARROW_INCLUDE_DIR) OR (NOT ARROW_LIBRARIES))
message(FATAL_ERROR "Fail to find arrow")
endif ()
ADD_LIBRARY(arrow SHARED IMPORTED GLOBAL)
else ()
include(arrow)
endif ()
#openblas
if (WITH_SYSTEM_LIBS)
find_path(OPENBLAS_INCLUDE_DIR NAMES openblas/api.h)
find_library(OPENBLAS_LIBRARIES NAMES openblas)
if ((NOT OPENBLAS_INCLUDE_DIR) OR (NOT OPENBLAS_LIBRARIES))
message(FATAL_ERROR "Fail to find openblas")
endif ()
ADD_LIBRARY(openblas SHARED IMPORTED GLOBAL)
else ()
include(openblas)
endif ()
#faiss
if (WITH_SYSTEM_LIBS)
find_path(FAISS_INCLUDE_DIR NAMES faiss/api.h)
find_library(FAISS_LIBRARIES NAMES faiss)
if ((NOT FAISS_INCLUDE_DIR) OR (NOT FAISS_LIBRARIES))
message(FATAL_ERROR "Fail to find faiss")
endif ()
ADD_LIBRARY(faiss SHARED IMPORTED GLOBAL)
else ()
include(faiss)
endif ()
#croaring
if (WITH_SYSTEM_LIBS)
find_path(CROARING_INCLUDE_DIR NAMES roaring/roaring.h)
find_library(CROARING_LIBRARIES NAMES croaring)
if ((NOT CROARING_INCLUDE_DIR) OR (NOT CROARING_LIBRARIES))
message(FATAL_ERROR "Fail to find croaring")
endif ()
ADD_LIBRARY(croaring SHARED IMPORTED GLOBAL)
else ()
include(croaring)
endif ()
#gflags
if (WITH_SYSTEM_LIBS)
find_path(GFLAGS_INCLUDE_DIR NAMES gflags/gflags.h)
find_library(GFLAGS_LIBRARIES NAMES gflags)
if ((NOT GFLAGS_INCLUDE_DIR) OR (NOT GFLAGS_LIBRARIES))
message(FATAL_ERROR "Fail to find gflags")
endif ()
ADD_LIBRARY(gflags SHARED IMPORTED GLOBAL)
else ()
include(gflags)
endif ()
#glog
if (WITH_SYSTEM_LIBS)
find_path(GLOG_INCLUDE_DIR NAMES glog/logging.h)
find_library(GLOG_LIBRARIES NAMES glog)
if ((NOT GLOG_INCLUDE_DIR) OR (NOT GLOG_LIBRARIES))
message(FATAL_ERROR "Fail to find glog")
endif ()
ADD_LIBRARY(glog SHARED IMPORTED GLOBAL)
else ()
include(glog)
endif ()
#snappy
if (WITH_SYSTEM_LIBS)
find_path(SNAPPY_INCLUDE_DIR NAMES snappy.h)
find_library(SNAPPY_LIBRARIES NAMES snappy)
if ((NOT SNAPPY_INCLUDE_DIR) OR (NOT SNAPPY_LIBRARIES))
message(FATAL_ERROR "Fail to find snappy")
endif ()
ADD_LIBRARY(snappy SHARED IMPORTED GLOBAL)
else ()
include(snappy)
endif ()
#zstd
if (WITH_SYSTEM_LIBS)
find_path(ZSTD_INCLUDE_DIR NAMES zstd.h)
find_library(ZSTD_LIBRARIES names zstd)
if ((NOT ZSTD_INCLUDE_DIR) OR (NOT ZSTD_LIBRARIES))
message(FATAL_ERROR "Fail to find zstd")
endif ()
ADD_LIBRARY(zstd SHARED IMPORTED GLOBAL)
else ()
include(zstd)
endif ()
#lz4
if (WITH_SYSTEM_LIBS)
find_path(LZ4_INCLUDE_DIR NAMES lz4.h)
find_library(LZ4_LIBRARIES names lz4)
if ((NOT LZ4_INCLUDE_DIR) OR (NOT LZ4_LIBRARIES))
message(FATAL_ERROR "Fail to find lz4")
endif ()
ADD_LIBRARY(lz4 SHARED IMPORTED GLOBAL)
else ()
include(lz4)
endif ()
include(liburing)
#re2
if (WITH_SYSTEM_LIBS)
find_path(RE2_INCLUDE_DIR NAMES re2/re2.h)
find_library(RE2_LIBRARIES NAMES re2)
if ((NOT RE2_INCLUDE_DIR) OR (NOT RE2_LIBRARIES))
message(FATAL_ERROR "Fail to find re2")
endif ()
ADD_LIBRARY(re2 SHARED IMPORTED GLOBAL)
else ()
include(re2)
endif ()
#protobuf
include(protobuf)
#rocksdb
if (WITH_SYSTEM_LIBS)
find_path(ROCKSDB_INCLUDE_DIR NAMES rocksdb/db.h)
find_library(ROCKSDB_LIBRARIES NAMES rocksdb)
if ((NOT ROCKSDB_INCLUDE_DIR) OR (NOT ROCKSDB_LIBRARIES))
message(FATAL_ERROR "Fail to find rocksdb")
endif ()
ADD_LIBRARY(rocksdb SHARED IMPORTED GLOBAL)
else ()
include(rocksdb)
endif ()
#brpc
if (WITH_SYSTEM_LIBS)
#leveldb(for brpc)
find_library(LEVELDB_LIBRARIES NAMES leveldb)
if (NOT LEVELDB_LIBRARIES)
message(FATAL_ERROR "Fail to find leveldb")
endif ()
find_path(BRPC_INCLUDE_DIR NAMES brpc/server.h)
find_library(BRPC_LIBRARIES NAMES libbrpc.a brpc)
if ((NOT BRPC_INCLUDE_DIR) OR (NOT BRPC_LIBRARIES))
message(FATAL_ERROR "Fail to find brpc")
endif ()
else ()
include(leveldb)
include(brpc)
endif ()
message(BRPC:${BRPC_INCLUDE_DIR}, ${BRPC_LIBRARIES})
#braft
if (WITH_SYSTEM_LIBS)
find_path(BRAFT_INCLUDE_DIR NAMES braft/raft.h)
find_library(BRAFT_LIBRARIES NAMES libbraft.a brpc)
if ((NOT BRAFT_INCLUDE_DIR) OR (NOT BRAFT_LIBRARIES))
message(FATAL_ERROR "Fail to find braft")
endif ()
else ()
include(braft)
endif ()
message(braft lib : ${BRAFT_LIBRARIES})
if (WITH_BAIKAL_CLIENT)
#mysqlclient
if (WITH_SYSTEM_LIBS)
find_path(MARIADB_INCLUDE_DIR NAMES mariadb/mysql.h)
if (MARIADB_INCLUDE_DIR)
set(MARIADB_INCLUDE_DIR ${MARIADB_INCLUDE_DIR}/mariadb)
else ()
find_path(MARIADB_INCLUDE_DIR NAMES mysql.h)
endif ()
find_library(MARIADB_LIBRARIES NAMES mariadbclient)
if ((NOT MARIADB_INCLUDE_DIR) OR (NOT MARIADB_LIBRARIES))
message(FATAL_ERROR "Fail to find mariadbclient")
endif ()
ADD_LIBRARY(mariadb SHARED IMPORTED GLOBAL)
else ()
include(mariadb)
endif ()
message(mysqlclient: ${MARIADB_INCLUDE_DIR}, ${MARIADB_LIBRARIES})
endif ()
#tcmalloc
if (WITH_GPERF)
include(FindGperftools)
if (GPERFTOOLS_FOUND)
add_library(gperf SHARED IMPORTED GLOBAL)
set_property(TARGET gperf PROPERTY IMPORTED_LOCATION tcmalloc_and_profiler)
else ()
message("GPERFTOOLS NOT FOUND, downloading and compiling")
include(gperftools)
endif ()
endif ()
message(CUR_DIR : ${CMAKE_CURRENT_BINARY_DIR}, SRC_DIR : ${CMAKE_SOURCE_DIR})
file(GLOB PROTO_FILES ${CMAKE_SOURCE_DIR}/proto/*.proto)
message("protoc: ${PROTOBUF_PROTOC_EXECUTABLE}, proto inc: ${PROTOBUF_INCLUDE_DIRS}, lib: ${PROTOBUF_LIBRARIES}, ${PROTOBUF_PROTOC_LIBRARY}, protos: ${PROTO_FILES}")
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/proto)
foreach (PROTO ${PROTO_FILES})
message(proto : ${PROTO})
get_filename_component(PROTO_WE ${PROTO} NAME)
string(REPLACE ".proto" "" PROTO_WE ${PROTO_WE})
list(APPEND PROTO_HDRS "${CMAKE_CURRENT_BINARY_DIR}/proto/${PROTO_WE}.pb.h")
list(APPEND PROTO_SRCS "${CMAKE_CURRENT_BINARY_DIR}/proto/${PROTO_WE}.pb.cc")
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/proto/${PROTO_WE}.pb.h ${CMAKE_CURRENT_BINARY_DIR}/proto/${PROTO_WE}.pb.cc
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE}
--cpp_out=${CMAKE_CURRENT_BINARY_DIR}/proto
--proto_path=${PROTOBUF_INCLUDE_DIR}
--proto_path=${CMAKE_SOURCE_DIR}/proto ${PROTO}
DEPENDS protobuf
)
endforeach ()
add_library(PROTO_OBJS OBJECT ${PROTO_SRCS} ${PROTO_HDRS})
message("protoc: ${PROTOBUF_PROTOC_EXECUTABLE}, proto srcs : ${PROTO_SRCS}")
#sql parser
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/sqlparser)
execute_process(
COMMAND bash ${CMAKE_SOURCE_DIR}/include/sqlparser/gen_source.sh ${CMAKE_SOURCE_DIR} opensource ${CMAKE_CURRENT_BINARY_DIR}/sqlparser
RESULT_VARIABLE CMD_RET
)
if (NOT CMD_RET EQUAL 0)
message(FATAL_ERROR "failed to generate expression, please install flex and bison first")
endif ()
SET(DEP_INC
${CMAKE_CURRENT_BINARY_DIR}/proto
${OPENSSL_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
# ${BZ2_INCLUDE_DIR}
${Boost_INCLUDE_DIR}
${ARROW_INCLUDE_DIR}
${OPENBLAS_INCLUDE_DIR}
${FAISS_INCLUDE_DIR}
${CROARING_INCLUDE_DIR}
${RAPIDJSON_INCLUDE_DIR}
${PROTOBUF_INCLUDE_DIR}
${GFLAGS_INCLUDE_DIR}
${GLOG_INCLUDE_DIR}
${SNAPPY_INCLUDE_DIR}
${LZ4_INCLUDE_DIR}
${LIBURING_INCLUDE_DIR}
${ZSTD_INCLUDE_DIR}
${RE2_INCLUDE_DIR}
${ROCKSDB_INCLUDE_DIR}
${BRPC_INCLUDE_DIR}
${BRAFT_INCLUDE_DIR}
${GPERFTOOLS_INCLUDE_DIR}
)
SET(DEP_LIB
${BRAFT_LIBRARIES}
${BRPC_LIBRARIES}
${LEVELDB_LIBRARIES}
${ROCKSDB_LIBRARIES}
)
if (WITH_BAIKAL_CLIENT)
SET(DEP_LIB ${DEP_LIB} ${MARIADB_LIBRARIES})
SET(DEP_INC ${DEP_INC} ${MARIADB_INCLUDE_DIR})
endif ()
SET(DEP_LIB
${DEP_LIB}
${PROTOBUF_LIBRARIES}
${PROTOBUF_PROTOC_LIBRARY}
${GFLAGS_LIBRARIES}
${GLOG_LIBRARIES}
${SNAPPY_LIBRARIES}
${ZSTD_LIBRARIES}
${LZ4_LIBRARIES}
${LIBURING_LIBRARIES}
${RE2_LIBRARIES}
${ARROW_LIBRARIES}
${FAISS_LIBRARIES}
${OPENBLAS_LIBRARIES}
${CROARING_LIBRARIES}
${Boost_LIBRARIES}
# ${BZ2_LIBRARIES}
)
if (WITH_GPERF)
SET(DEP_LIB ${DEP_LIB} ${GPERFTOOLS_LIBRARIES})
endif ()
SET(DEP_LIB
${DEP_LIB}
${ZLIB_LIBRARIES}
${OPENSSL_SSL_LIBRARY}
${OPENSSL_CRYPTO_LIBRARY}
dl
rt
m
${CMAKE_THREAD_LIBS_INIT}
gfortran
)
message("DEP INCLUDES: ${DEP_INC}")
message("DEP LIBRARYS: ${DEP_LIB}")
if (WITH_DEBUG_SYMBOLS)
SET(DEBUG_SYMBOL "-ggdb")
endif ()
if (NOT DEBUG)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNDEBUG")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNDEBUG")
endif ()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 ${DEBUG_SYMBOL} -O2 -pipe -m64 -fopenmp -Wall -W -fPIC -Wno-unused-parameter -Wno-strict-aliasing -Wno-parentheses -fno-omit-frame-pointer ")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 ${DEBUG_SYMBOL} -O2 -pipe -m64 -fopenmp -Wall -W -fPIC -Wno-unused-parameter -Wno-strict-aliasing -Wno-parentheses -fno-omit-frame-pointer")
add_definitions(
-D_GNU_SOURCE
-D__STDC_FORMAT_MACROS
-D__STDC_LIMIT_MACROS
-D__STDC_CONSTANT_MACROS
-DBRPC_WITH_GLOG=1
)
file(GLOB ENGINE src/engine/*.cpp)
file(GLOB EXEC src/exec/*.cpp)
file(GLOB EXPR src/expr/*.cpp)
file(GLOB LOGICAL_PLAN src/logical_plan/*.cpp)
file(GLOB MEM_ROW src/mem_row/*.cpp)
file(GLOB PHYSICAL_PLAN src/physical_plan/*.cpp)
file(GLOB PROTOCOL src/protocol/*.cpp)
list(REMOVE_ITEM PROTOCOL src/protocol/main.cpp)
file(GLOB RAFT src/raft/*.cpp)
file(GLOB RAFT_META src/raft_meta/*.cpp)
file(GLOB REVERSE src/reverse/*.cpp src/vector_index/*.cpp)
file(GLOB RUNTIME src/runtime/*.cpp)
file(GLOB SESSION src/session/*.cpp)
file(GLOB SQLPARSER include/sqlparser/*.cc ${CMAKE_CURRENT_BINARY_DIR}/sqlparser/*.cc)
file(GLOB STORE src/store/*.cpp)
list(REMOVE_ITEM STORE src/store/main.cpp)
set(COMMON_INC
${DEP_INC}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}/proto
${CMAKE_CURRENT_BINARY_DIR}/sqlparser
include/common
include/engine
include/exec
include/expr
include/logical_plan
include/mem_row
include/physical_plan
include/protocol
include/raft
include/reverse
include/vector_index
include/reverse/boolean_engine
include/runtime
include/session
include/sqlparser
include/store
)
file(GLOB COMMON
${CMAKE_CURRENT_BINARY_DIR}/proto/*.pb.*
src/common/*.cpp
${ENGINE}
${EXEC}
${EXPR}
${LOGICAL_PLAN}
${MEM_ROW}
${PHYSICAL_PLAN}
${PROTOCOL}
${RAFT}
${RAFT_META}
${REVERSE}
${RUNTIME}
${SESSION}
${SQLPARSER}
${STORE}
)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/output/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/output/bin)
set(COMMON_DEPS ssl crypto zlib boost rapidjson arrow openblas faiss croaring glog gflags protobuf re2 snappy lz4 zstd rocksdb brpc braft liburing)
if (WITH_GPERF)
set(COMMON_DEPS ${COMMON_DEPS} gperf)
endif ()
add_library(common STATIC ${COMMON} $<TARGET_OBJECTS:PROTO_OBJS>)
add_dependencies(common ${COMMON_DEPS})
target_include_directories(common PUBLIC ${COMMON_INC})
set(CMAKE_VERBOSE_MAKEFILEON ON)
# baikalMeta
file(GLOB META_SERVER src/meta_server/*.cpp)
set(BAIKALMETA_INC ${COMMON_INC} include/meta_server)
add_executable(baikalMeta ${META_SERVER} ${RAFT_META})
add_dependencies(baikalMeta common)
target_include_directories(baikalMeta PUBLIC ${BAIKALMETA_INC})
target_link_libraries(baikalMeta PUBLIC common ${DEP_LIB})
# baikalStore
file(GLOB RAFT_STORE src/raft_store/*.cpp)
set(BAIKALSTORE_INC ${COMMON_INC})
add_executable(baikalStore src/store/main.cpp ${RAFT_STORE})
add_dependencies(baikalStore common)
target_include_directories(baikalStore PUBLIC ${BAIKALSTORE_INC})
target_link_libraries(baikalStore PUBLIC common ${DEP_LIB})
# baikaldb
file(GLOB RAFT_DUMMPY src/raft_dummy/*.cpp)
set(BAIKALDB_INC ${COMMON_INC})
add_executable(baikaldb src/protocol/main.cpp ${RAFT_DUMMPY})
add_dependencies(baikaldb common)
target_include_directories(baikaldb PUBLIC ${BAIKALDB_INC})
target_link_libraries(baikaldb PUBLIC common ${DEP_LIB})
if (WITH_BAIKAL_CLIENT)
add_subdirectory(baikal-client)
endif ()