forked from oceanbase/oceanbase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
155 lines (125 loc) · 4.34 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
cmake_minimum_required(VERSION 3.20)
include(cmake/Utils.cmake)
include(cmake/Env.cmake)
project("OceanBase_CE"
VERSION 4.2.0.0
DESCRIPTION "OceanBase distributed database system"
HOMEPAGE_URL "https://open.oceanbase.com/"
LANGUAGES CXX C ASM)
message(STATUS "open source build enabled")
if(ENABLE_COMPILE_DLL_MODE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DCOMPILE_DLL_MODE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCOMPILE_DLL_MODE")
endif()
if(OB_ERRSIM)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DERRSIM")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DERRSIM")
set(OB_TRANS_ERRSIM ON)
endif()
if(OB_DIS_SEARRAY)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDISABLE_SE_ARRAY")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDISABLE_SE_ARRAY")
endif()
if(OB_TRANS_ERRSIM)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTRANS_ERRSIM")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTRANS_ERRSIM")
endif()
if(TRANS_MODULE_TEST)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTRANS_MODULE_TEST")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTRANS_MODULE_TEST")
endif()
if(ENABLE_LATCH_DIAGNOSE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_LATCH_DIAGNOSE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_LATCH_DIAGNOSE")
endif()
if(ENABLE_SMART_VAR_CHECK)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_SMART_VAR_CHECK")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_SMART_VAR_CHECK")
endif()
if(ENABLE_DEBUG_LOG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_DEBUG_LOG")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_DEBUG_LOG")
endif()
if (OB_GPERF_MODE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__NEED_PERF__")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__NEED_PERF__")
endif()
if (ENABLE_PERF_MODE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPERF_MODE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPERF_MODE")
endif()
if (ENABLE_MEMORY_DIAGNOSIS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMEMORY_DIAGNOSIS=1")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMEMORY_DIAGNOSIS=1")
endif()
if (ENABLE_OBJ_LEAK_CHECK)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_OBJ_LEAK_CHECK=1")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_OBJ_LEAK_CHECK=1")
endif()
if (ENABLE_FATAL_ERROR_HANG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFATAL_ERROR_HANG")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DFATAL_ERROR_HANG")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_500_MEMORY_LIMIT")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_500_MEMORY_LIMIT")
endif()
if(OB_USE_ASAN)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DOB_USE_ASAN")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOB_USE_ASAN")
endif()
if (ENABLE_SANITY)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_SANITY")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_SANITY")
endif()
message(STATUS "This is BINARY dir " ${PROJECT_BINARY_DIR})
message(STATUS "This is SOURCE dir " ${PROJECT_SOURCE_DIR})
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_subdirectory(deps/easy)
add_subdirectory(deps/oblib)
add_subdirectory(src/objit)
add_subdirectory(src)
include(CMakeDependentOption)
# OB_BUILD_RPM => include tools and build them.
# otherwise => include tools but don't build them.
option(OB_INCLUDE_TOOLS "" ON)
cmake_dependent_option(
OB_BUILD_TOOLS "Build tools" ON
"OB_BUILD_RPM" OFF)
# OB_BUILD_RPM => don't include unittest or build them.
# otherwise => include unittest but don't build them.
cmake_dependent_option(
OB_INCLUDE_UNITTEST "Include unittest" ON
"NOT OB_BUILD_RPM" OFF)
option(OB_BUILD_UNITTEST "" OFF)
# OB_BUILD_RPM => don't include test or build them.
# otherwise => include test but don't build them.
cmake_dependent_option(
OB_INCLUDE_TEST "Include test" ON
"NOT OB_BUILD_RPM" OFF)
option(OB_BUILD_TEST "" OFF)
# OB_BUILD_RPM => build sql proxy parser
cmake_dependent_option(
OB_BUILD_LIBOB_SQL_PROXY_PARSER "Build lib_sql_proxy_parser" OFF
"NOT OB_BUILD_RPM" ON
)
# OB_BUILD_RPM => build OB_BUILD_LIBOBTABLE
cmake_dependent_option(
OB_BUILD_LIBOBTABLE "Build liboblog" OFF
"NOT OB_BUILD_RPM" ON
)
# OB_BUILD_RPM => build OB_BUILD_OBADMIN
cmake_dependent_option(
OB_BUILD_OBADMIN "Build ob_admin" OFF
"NOT OB_BUILD_RPM" ON
)
include(CTest)
if (OB_BUILD_UNITTEST)
add_subdirectory(unittest)
elseif(OB_INCLUDE_UNITTEST)
add_subdirectory(unittest EXCLUDE_FROM_ALL)
endif()
if (OB_BUILD_TOOLS)
add_subdirectory(tools)
elseif (OB_INCLUDE_TOOLS)
add_subdirectory(tools EXCLUDE_FROM_ALL)
endif()
include(cmake/RPM.cmake)