-
Notifications
You must be signed in to change notification settings - Fork 22
/
CMakeLists.txt
468 lines (429 loc) · 20.2 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
cmake_minimum_required(VERSION 3.20)
macro(logproxy_define VAR DEFAULT)
if (NOT DEFINED ${VAR})
set(${VAR} ${DEFAULT})
endif ()
endmacro()
logproxy_define(OBLOGPROXY_PACKAGE_RELEASE 1)
# Distinguish between community and enterprise builds, and with the default being a enterprise build.
option(COMMUNITY_BUILD "Set to true if this is a community build" ON)
option(WITH_ASAN "Compile with AddressSanitizer" OFF)
option(WITH_DEBUG "With debug symbols" ON)
option(WITH_TEST "With Tests" OFF)
option(WITH_DEMO "With Demos" OFF)
option(LOGGER_LEVEL "Log level" 0)
option(WITH_SECURITY_COMPILE "security compile" OFF)
# options for dev
option(WITH_DEPS "With precompiled deps" OFF)
option(WITH_US_TIMESTAMP "Enable microseconds start timestamp" ON)
######### global vars ############################################################
set(OMS_PROJECT_BUILD_PATH ${CMAKE_CURRENT_BINARY_DIR})
set(EXECUTABLE_OUTPUT_PATH ${OMS_PROJECT_BUILD_PATH})
set(LIBRARY_OUTPUT_PATH ${OMS_PROJECT_BUILD_PATH})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(DEP_VAR ${OMS_PROJECT_BUILD_PATH}/deps)
message(STATUS "CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}")
message(STATUS "DEP_VAR: ${DEP_VAR}")
add_compile_definitions(WITH_US_TIMESTAMP=1)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
#set(CMAKE_CXX_CLANG_TIDY
# clang-tidy;
# -header-filter=.;
# -checks=*;)
######### common settings for compilers ############################################################
# output CXX_LIB_DIR, GCC_LIB_DIR that defined gcc libs path
include(env)
######### project settings ############################################################
# set the project version from file VERSION.txt
file(STRINGS ${CMAKE_SOURCE_DIR}/rpm/oboms-logproxy-VER.txt PROJECT_VERSION
LIMIT_COUNT 1
REGEX "^[ \t]*[0-9]+\\.[0-9]+\\.[0-9]+[ \t]*$")
project(oms-logproxy VERSION ${PROJECT_VERSION} LANGUAGES CXX)
############## cmake common options #########################################################################
execute_process(
COMMAND git log -1 --format=%H
OUTPUT_VARIABLE GIT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
)
if (NOT GIT_VERSION)
message(WARNING "oblogproxy fetch git version empty, use current time as program version")
STRING(TIMESTAMP GIT_VERSION "%Y-%m-%d_%H:%M:%S")
endif ()
message(STATUS "build type: ${CMAKE_BUILD_TYPE}")
set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS 0)
set(CMAKE_POSITION_INDEPENDENT_CODE 1)
message(STATUS "oblogproxy version: ${PROJECT_VERSION}-${GIT_VERSION}")
############## include 3rd #########################################################################
#thread, provides Threads::Threads
include(FindThreads)
set(THIRD_PARTY_PATH ${CMAKE_CURRENT_BINARY_DIR}/third-party)
set(THIRD_PARTY_BUILD_TYPE RelWithDebInfo)
set(EXTERNAL_PROJECT_LOG_ARGS
LOG_DOWNLOAD 0
LOG_UPDATE 0
LOG_CONFIGURE 0
LOG_BUILD 0
LOG_TEST 0
LOG_INSTALL 0)
#===================================> target logproxy_proto for codec_communication <=======================================
# make protoc found libstdc++
SET(PROTOC_LINK_FLAGS "-L${CXX_LIB_DIR} -static-libstdc++ -Wl,-z,relro,-z,now")
if (CXX_LIB_DIR)
SET(PROTOC_LINK_FLAGS "${PROTOC_LINK_FLAGS} -L${CXX_LIB_DIR}")
endif ()
if (GCC_LIB_DIR)
SET(PROTOC_LINK_FLAGS "${PROTOC_LINK_FLAGS} -L${GCC_LIB_DIR}")
endif ()
include(protobuf)
########### libcdc && logmsg #############################################################################################
if (WITH_DEPS)
message(FATAL_ERROR "Unsupported build WITH_DEPS=ON in opensource.")
endif ()
include(obcdc)
include(lz4)
include(jsoncpp)
include(libevent)
include(spdlog)
include(rapidjson)
include(mariadb-connector-cpp)
include(logmsg_wrapper)
include(proj)
include(gdal)
include(prometheus-cpp)
file(GLOB PROTO_FILES ${CMAKE_SOURCE_DIR}/proto/*.proto)
message(STATUS "logproxy protos: ${PROTO_FILES}")
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/proto)
foreach (PROTO ${PROTO_FILES})
message(STATUS "protoc ${PROTO}")
get_filename_component(PROTO_WE ${PROTO} NAME_WE)
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=${CMAKE_SOURCE_DIR}/proto
${PROTO}
DEPENDS protoc)
endforeach ()
add_library(logproxy_proto STATIC ${PROTO_SRCS})
target_include_directories(logproxy_proto PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/proto)
target_link_libraries(logproxy_proto PUBLIC protobuf)
#=====================================> sql parser <===========================================
# Build sql-parser library
set(PARSER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/sqlparser)
set(PARSER_BUILD_COMMAND $(MAKE) clean && $(MAKE) CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER})
add_custom_target(parser_build ALL COMMAND ${PARSER_BUILD_COMMAND} WORKING_DIRECTORY ${PARSER_DIR})
add_library(sqlparser STATIC IMPORTED GLOBAL)
add_dependencies(sqlparser parser_build)
set_target_properties(sqlparser PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/src/sqlparser/libsqlparser.a)
target_include_directories(sqlparser INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src/sqlparser/src)
#===================================> define new targets <=======================================
#===== common =====
find_package(OpenSSL REQUIRED)
file(GLOB COMMON_SRC
${CMAKE_CURRENT_SOURCE_DIR}/src/codec/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/common/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/common/*.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/communication/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/metric/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/obaccess/*.cpp
)
add_library(common STATIC ${COMMON_SRC})
target_compile_definitions(common PUBLIC __OMS_VERSION__=\"${PROJECT_VERSION}-${GIT_VERSION}\")
target_include_directories(common
PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/proto
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/common/
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/logmsg/
)
include(gflags)
find_package(ZLIB REQUIRED)
target_link_libraries(common
PUBLIC logproxy_proto
PUBLIC logmsg_wrapper # for drcmsg/oblogmsg
PUBLIC libevent::core
PUBLIC libevent::pthreads
PUBLIC libevent::extra
PUBLIC jsoncpp
PUBLIC rapidjson
PUBLIC lz4
PUBLIC libmariadbcpp
PUBLIC Threads::Threads
PUBLIC spdlog
PUBLIC sqlparser
PUBLIC gdal
PUBLIC proj
PUBLIC prometheus-cpp
PUBLIC ZLIB::ZLIB
PUBLIC OpenSSL::SSL
)
if (COMMUNITY_BUILD)
target_compile_definitions(common PUBLIC _OBLOG_MSG_)
add_definitions(-DBUILD_OPENSOURCE)
endif ()
get_target_property(COMMON_INCLUDE_PATH common INCLUDE_DIRECTORIES)
get_target_property(COMMON_DEP_INCLUDE_PATH common INTERFACE_INCLUDE_DIRECTORIES)
message(STATUS "COMMON_INCLUDE_PATH: ${COMMON_INCLUDE_PATH}, COMMON_DEP_INCLUDE_PATH: ${COMMON_DEP_INCLUDE_PATH}")
#message(STATUS "COMMON_SRC: ${COMMON_SRC}")
#======= obcdc wrapper =======
function(add_obcdc_access_library OB_CDC_TARGET_NAME LIBOBCDC_TARGET_NAME)
add_library(${OB_CDC_TARGET_NAME} SHARED src/obcdcaccess/obcdc/obcdc_access.cpp)
target_include_directories(${OB_CDC_TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/obcdcaccess/obcdc)
target_link_libraries(${OB_CDC_TARGET_NAME}
PRIVATE ${LIBOBCDC_TARGET_NAME}
PRIVATE common
)
set_target_properties(${OB_CDC_TARGET_NAME} PROPERTIES INSTALL_RPATH "$ORIGIN"
OUTPUT_NAME "obcdcaccess"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${OB_CDC_TARGET_NAME}")
endfunction()
# obcdc_access
add_obcdc_access_library(obcdc-ce-3 libobcdcce3)
execute_process(
COMMAND bash deps/find_dep_config_file.sh
OUTPUT_VARIABLE OUTPUT
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
)
file(STRINGS ${OUTPUT} file_contents)
set(version_list)
foreach (line IN LISTS file_contents)
if (NOT line)
continue()
endif ()
string(REGEX MATCH "oceanbase-ce-cdc-([0-9]+\\.[0-9]+\\.[0-9]+)" version_match ${line})
if (version_match)
list(APPEND version_list ${CMAKE_MATCH_1})
endif ()
endforeach ()
list(REMOVE_DUPLICATES version_list)
foreach (version IN LISTS version_list)
add_obcdc_access_library(obcdc-ce-${version} libobcdcce${version})
endforeach ()
# obcdc_base
add_library(obcdc_base STATIC ${CMAKE_CURRENT_SOURCE_DIR}/src/obcdcaccess/obcdc_factory.cpp)
target_include_directories(obcdc_base PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/obcdcaccess/)
target_link_libraries(obcdc_base
PRIVATE common
PRIVATE dl)
if (COMMUNITY_BUILD)
target_compile_definitions(obcdc_base PRIVATE _COMMUNITY_)
endif ()
#===== oblogreader =====
file(GLOB OBLOGREADER_SRC ./src/oblogreader/*.cpp)
add_library(oblogreader_static STATIC ${OBLOGREADER_SRC})
set_target_properties(oblogreader_static PROPERTIES OUTPUT_NAME "oblogreader")
target_include_directories(oblogreader_static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/oblogreader/)
target_link_libraries(oblogreader_static
PUBLIC common
PRIVATE obcdc_base)
# target mysql_protocol
add_library(mysql_protocol INTERFACE)
target_include_directories(mysql_protocol INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/mysql-protocol)
# ===== target ob_binlog_server =====
include(etransfer)
add_library(ddl_converter STATIC
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/ddl-converter/ddl_converter.cpp
)
target_link_libraries(ddl_converter
PUBLIC common
PUBLIC etransfer
)
target_include_directories(ddl_converter
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/ddl-converter
)
add_library(cluster STATIC
${CMAKE_CURRENT_SOURCE_DIR}/src/cluster/gossip/gossip.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cluster/gossip/gossip_broadcast.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cluster/transport.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cluster/node.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cluster/cluster.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cluster/instance_meta.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cluster/task.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cluster/database_protocol.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cluster/cluster_protocol.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cluster/standalone_protocol.cpp
)
target_include_directories(cluster PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/cluster)
target_link_libraries(cluster
PRIVATE common
PRIVATE libevent::pthreads
)
# ===== target ob_binlog_server =====
# binlog instance
add_library(binlog_instance_static STATIC
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/binlog-instance/instance_socket_listener.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/binlog-instance/binlog_converter.cpp # binlog converter ----->
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/binlog-instance/clog_reader_routine.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/binlog-instance/binlog_convert.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/binlog-instance/binlog_storage.cpp # <----- binlog converter
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/binlog-instance/binlog_dumper.cpp # binlog dumper
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/binlog-instance/binlog_func.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/binlog-instance/table_cache.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/binlog_index.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/ob_log_event.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/data_type.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/connection.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/env.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/tcp_port_pool.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/event_dispatch.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/event_wrapper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/cmd_processor.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/sql_cmd_processor.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/sql_parser.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/binlog_state_machine.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/instance_tasks.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/instance_client.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/gtid_manager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/selection_strategy.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/token_bucket.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/rate_limiter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/binlog-instance/binlog_dumper_manager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/password.cpp)
target_include_directories(binlog_instance_static
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/binlog
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/binlog-instance)
target_link_libraries(binlog_instance_static
PRIVATE mysql_protocol
PUBLIC ddl_converter
PUBLIC common
PRIVATE obcdc_base
PRIVATE rapidjson
PRIVATE cluster
PRIVATE gdal
PRIVATE libevent::pthreads
)
# binlog manager
add_library(binlog_manager_static STATIC
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/binlog_manager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/binlog_state_machine.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/instance_tasks.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/instance_client.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/tcp_port_pool.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/connection.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/env.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/event_dispatch.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/event_wrapper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/cmd_processor.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/sql_cmd_processor.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/sql_parser.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/binlog_index.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/ob_log_event.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/data_type.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/gtid_manager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/selection_strategy.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/gtid_inspector.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/binlog-instance/binlog_dumper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/binlog-instance/binlog_func.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/password.cpp
)
target_include_directories(binlog_manager_static
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/binlog
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/binlog-instance)
target_link_libraries(binlog_manager_static
PRIVATE mysql_protocol
PRIVATE common
PRIVATE rapidjson
PRIVATE cluster
PRIVATE libevent::pthreads
PRIVATE binlog_instance_static
)
#===== logproxy static =====
file(GLOB LOGPROXY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/arranger/*.cpp)
add_library(logproxy_static STATIC ${LOGPROXY_SRC})
set_target_properties(logproxy_static PROPERTIES OUTPUT_NAME "logproxy")
target_include_directories(logproxy_static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/arranger/)
target_link_libraries(logproxy_static PRIVATE common)
get_target_property(LOGPROXY_STATIC_INCLUDE_PATH logproxy_static INTERFACE_INCLUDE_DIRECTORIES)
message(STATUS "LOGPROXY_STATIC_INCLUDE_PATH: ${LOGPROXY_STATIC_INCLUDE_PATH}")
if (WITH_DEMO)
# demo client
file(GLOB DEMO_CLIENT_SRC ./src/demo/client_demo.cpp)
add_executable(demo_client ${DEMO_CLIENT_SRC})
add_dependencies(demo_client common)
target_include_directories(demo_client PUBLIC ${COMMON_INC})
target_link_libraries(demo_client
PRIVATE common
)
target_link_options(demo_client PUBLIC -static-libstdc++ ${ASAN_LINK_OPTION})
endif ()
include(gtest)
include(GoogleTest)
# target test_base
message(STATUS "target test_base")
add_executable(test_base
${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_entry.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_binlog_event_convert.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_binlog_event.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_data_type.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_index_file.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_thread_pool_executor.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_tcp_port_pool.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_ddl_parser.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_sql_parser.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_gtid_manager.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_selection_strategy.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_instance_tasks.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_instance_meta.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_gtid_inspector.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_defer.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_aes.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_codec.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_compress.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_conf.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_http.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_message_buffer.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_net.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_ob_mysql.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_ob_sha1.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_queue.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_binlog_dumper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_json_parse.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_model.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_mysql_connection.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_database_protocol.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_sys_metric.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_prometheus.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/test/test_rate_limiter.cpp
)
target_include_directories(test_base
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/test
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/binlog)
target_link_libraries(test_base
PRIVATE cluster
PRIVATE common
PRIVATE logproxy_static
PRIVATE binlog_instance_static
PRIVATE binlog_manager_static
)
target_link_options(test_base PUBLIC -static-libstdc++ ${ASAN_LINK_OPTION})
gtest_discover_tests(test_base)
#===== oblogreader =====
add_executable(oblogreader ${CMAKE_CURRENT_SOURCE_DIR}/src/oblogreader/oblogreader_entry.cpp)
target_link_options(oblogreader PRIVATE -rdynamic)
target_link_libraries(oblogreader PRIVATE oblogreader_static)
get_target_property(OBLOGREADER_INCLUDE_PATH oblogreader INCLUDE_DIRECTORIES)
message(STATUS "OBLOGREADER_OUTPUT_PATH: ${EXECUTABLE_OUTPUT_PATH}, OBLOGREADER_INCLUDE_PATH: ${OBLOGREADER_INCLUDE_PATH}")
#===== binlog instance =====
add_executable(binlog_instance ${CMAKE_CURRENT_SOURCE_DIR}/src/binlog/binlog-instance/binlog_instance_entry.cpp
src/test/test_prometheus.cpp)
target_link_options(binlog_instance PRIVATE -rdynamic)
target_link_libraries(binlog_instance PRIVATE binlog_instance_static)
get_target_property(BINLOG_INSTANCE_INCLUDE_PATH binlog_instance INCLUDE_DIRECTORIES)
message(STATUS "BINLOG_INSTANCE_INCLUDE_PATH: ${EXECUTABLE_OUTPUT_PATH}, BINLOG_INSTANCE_INCLUDE_PATH: " ${BINLOG_INSTANCE_INCLUDE_PATH})
#===== main =====
add_executable(logproxy ${CMAKE_CURRENT_SOURCE_DIR}/src/entry.cpp)
target_link_libraries(logproxy
PRIVATE common
PRIVATE logproxy_static
PRIVATE cluster
PRIVATE binlog_manager_static
)
get_target_property(LOGPROXY_INCLUDE_PATH logproxy INCLUDE_DIRECTORIES)
message(STATUS "LOGPROXY_OUTPUT_PATH: ${EXECUTABLE_OUTPUT_PATH}, LOGPROXY_INCLUDE_PATH: ${LOGPROXY_INCLUDE_PATH}")
include(rpm)