define.inc 5.1 KB
Newer Older
S
[TD-58]  
slguan 已提交
1 2 3 4
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(TDengine)

IF (TD_ACCOUNT)
S
slguan 已提交
5
  ADD_DEFINITIONS(-D_ACCT)
S
[TD-58]  
slguan 已提交
6 7
ENDIF ()

S
slguan 已提交
8 9 10 11
IF (TD_ADMIN)
  ADD_DEFINITIONS(-D_ADMIN)
ENDIF ()

S
[TD-63]  
slguan 已提交
12 13 14 15
IF (TD_GRANT)
  ADD_DEFINITIONS(-D_GRANT)
ENDIF ()

S
TD-1310  
Shengliang Guan 已提交
16 17
IF (TD_MQTT)
  ADD_DEFINITIONS(-D_MQTT)
S
Shengliang Guan 已提交
18
ENDIF ()
S
Shengliang Guan 已提交
19

H
TD-1027  
Hongze Cheng 已提交
20 21
IF (TD_TSDB_PLUGINS)
  ADD_DEFINITIONS(-D_TSDB_PLUGINS)
S
TD-1310  
Shengliang Guan 已提交
22 23
ENDIF ()

S
[TD-58]  
slguan 已提交
24 25 26 27
IF (TD_GODLL)
  ADD_DEFINITIONS(-D_TD_GO_DLL_)
ENDIF ()

H
Hui Li 已提交
28 29
IF (TD_POWER)
  ADD_DEFINITIONS(-D_TD_POWER_)
H
Hui Li 已提交
30 31
ENDIF ()

S
[TD-58]  
slguan 已提交
32 33 34
IF (TD_MEM_CHECK)
  ADD_DEFINITIONS(-DTAOS_MEM_CHECK)
ENDIF ()
35 36 37 38

IF (TD_RANDOM_FILE_FAIL)
  ADD_DEFINITIONS(-DTAOS_RANDOM_FILE_FAIL)
ENDIF ()
39 40 41 42

IF (TD_RANDOM_NETWORK_FAIL)
  ADD_DEFINITIONS(-DTAOS_RANDOM_NETWORK_FAIL)
ENDIF ()
S
Shengliang Guan 已提交
43

S
Shengliang Guan 已提交
44 45 46
IF (TD_LINUX_64)
  ADD_DEFINITIONS(-D_M_X64)
  ADD_DEFINITIONS(-D_TD_LINUX_64)
S
TD-1530  
Shengliang Guan 已提交
47
  MESSAGE(STATUS "linux64 is defined")
S
TD-1853  
Shengliang Guan 已提交
48
  SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -gdwarf-2 -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
49
  ADD_DEFINITIONS(-DUSE_LIBICONV)
S
Shengliang Guan 已提交
50 51 52 53 54
ENDIF ()

IF (TD_LINUX_32)
  ADD_DEFINITIONS(-D_TD_LINUX_32)
  ADD_DEFINITIONS(-DUSE_LIBICONV)
S
TD-1530  
Shengliang Guan 已提交
55
  MESSAGE(STATUS "linux32 is defined")
S
TD-1853  
Shengliang Guan 已提交
56
  SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -fsigned-char -munaligned-access -fpack-struct=8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
S
Shengliang Guan 已提交
57 58
ENDIF ()

S
TD-1057  
Shengliang Guan 已提交
59
IF (TD_ARM_64)
60
  ADD_DEFINITIONS(-D_M_X64)
S
TD-1530  
Shengliang Guan 已提交
61
  ADD_DEFINITIONS(-D_TD_ARM_64)
S
Shengliang Guan 已提交
62
  ADD_DEFINITIONS(-D_TD_ARM_)
S
Shengliang Guan 已提交
63
  ADD_DEFINITIONS(-DUSE_LIBICONV)
S
TD-1530  
Shengliang Guan 已提交
64
  MESSAGE(STATUS "arm64 is defined")
S
TD-1853  
Shengliang Guan 已提交
65
  SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -fsigned-char -fpack-struct=8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
S
Shengliang Guan 已提交
66 67
ENDIF ()

S
TD-1057  
Shengliang Guan 已提交
68
IF (TD_ARM_32)
S
TD-1530  
Shengliang Guan 已提交
69
  ADD_DEFINITIONS(-D_TD_ARM_32)
S
Shengliang Guan 已提交
70
  ADD_DEFINITIONS(-D_TD_ARM_)
S
TD-1530  
Shengliang Guan 已提交
71
  ADD_DEFINITIONS(-DUSE_LIBICONV)
S
TD-1530  
Shengliang Guan 已提交
72
  MESSAGE(STATUS "arm32 is defined")
S
TD-1853  
Shengliang Guan 已提交
73
  SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -fsigned-char -fpack-struct=8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast -Wno-incompatible-pointer-types ")
S
TD-1057  
Shengliang Guan 已提交
74 75 76 77
ENDIF ()

IF (TD_MIPS_64)
  ADD_DEFINITIONS(-D_TD_MIPS_64_)
S
TD-1530  
Shengliang Guan 已提交
78
  ADD_DEFINITIONS(-DUSE_LIBICONV)
S
TD-1530  
Shengliang Guan 已提交
79
  MESSAGE(STATUS "mips64 is defined")
S
TD-1853  
Shengliang Guan 已提交
80
  SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -gdwarf-2 -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
S
TD-1057  
Shengliang Guan 已提交
81 82 83 84
ENDIF ()

IF (TD_MIPS_32)
  ADD_DEFINITIONS(-D_TD_MIPS_32_)
S
TD-1530  
Shengliang Guan 已提交
85
  ADD_DEFINITIONS(-DUSE_LIBICONV)
S
TD-1530  
Shengliang Guan 已提交
86
  MESSAGE(STATUS "mips32 is defined")
S
TD-1853  
Shengliang Guan 已提交
87
  SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -gdwarf-2 -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
S
Shengliang Guan 已提交
88 89
ENDIF ()

S
TD-1057  
Shengliang Guan 已提交
90 91 92 93
IF (TD_APLHINE)
  SET(COMMON_FLAGS "${COMMON_FLAGS} -largp")
  link_libraries(/usr/lib/libargp.a)
  ADD_DEFINITIONS(-D_ALPINE)
S
TD-1530  
Shengliang Guan 已提交
94
  MESSAGE(STATUS "aplhine is defined")
S
Shengliang Guan 已提交
95 96 97 98
ENDIF ()

IF (TD_LINUX)
  ADD_DEFINITIONS(-DLINUX)
S
TD-1057  
Shengliang Guan 已提交
99
  ADD_DEFINITIONS(-D_LINUX)
S
Shengliang Guan 已提交
100 101
  ADD_DEFINITIONS(-D_TD_LINUX)
  ADD_DEFINITIONS(-D_REENTRANT -D__USE_POSIX -D_LIBC_REENTRANT)
H
Hui Li 已提交
102 103

  IF (TD_NINGSI_60)
S
TD-1530  
Shengliang Guan 已提交
104
    ADD_DEFINITIONS(-D_TD_NINGSI_60)
H
Hui Li 已提交
105 106
    MESSAGE(STATUS "set ningsi macro to true")
  ENDIF ()
S
Shengliang Guan 已提交
107
  
S
TD-1853  
Shengliang Guan 已提交
108
  SET(DEBUG_FLAGS "-O0 -g3 -DDEBUG")
S
Shengliang Guan 已提交
109
  SET(RELEASE_FLAGS "-O3 -Wno-error")
S
Shengliang Guan 已提交
110 111 112 113 114 115 116
  
  IF (${COVER} MATCHES "true")
    MESSAGE(STATUS "Test coverage mode, add extra flags")
    SET(GCC_COVERAGE_COMPILE_FLAGS "-fprofile-arcs -ftest-coverage")
    SET(GCC_COVERAGE_LINK_FLAGS    "-lgcov --coverage")
    SET(COMMON_FLAGS "${COMMON_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}")
  ENDIF ()
S
TD-1057  
Shengliang Guan 已提交
117 118 119

  INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/cJson/inc)
  INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/lz4/inc)
S
Shengliang Guan 已提交
120 121 122 123 124 125 126
ENDIF ()

IF (TD_DARWIN_64)
  ADD_DEFINITIONS(-D_TD_DARWIN_64)
  ADD_DEFINITIONS(-DDARWIN)
  ADD_DEFINITIONS(-D_REENTRANT -D__USE_POSIX -D_LIBC_REENTRANT)
  ADD_DEFINITIONS(-DUSE_LIBICONV)
S
TD-1530  
Shengliang Guan 已提交
127
  MESSAGE(STATUS "darwin64 is defined")
S
TD-1853  
Shengliang Guan 已提交
128 129 130
  SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -Wno-missing-braces -fPIC -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
  SET(DEBUG_FLAGS "-O0 -g3 -DDEBUG")
  SET(RELEASE_FLAGS "-Og")
S
Shengliang Guan 已提交
131 132 133 134 135 136 137 138 139 140
ENDIF ()

IF (TD_WINDOWS)
  ADD_DEFINITIONS(-DWINDOWS)
  ADD_DEFINITIONS(-D__CLEANUP_C)
  ADD_DEFINITIONS(-DPTW32_STATIC_LIB)
  ADD_DEFINITIONS(-DPTW32_BUILD)
  ADD_DEFINITIONS(-D_MBCS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
  SET(CMAKE_GENERATOR "NMake Makefiles" CACHE INTERNAL "" FORCE)
  IF (NOT TD_GODLL)
141
    SET(COMMON_FLAGS "/nologo /WX /wd4018 /wd2220 /Oi /Oy- /Gm- /EHsc /MT /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Gd /errorReport:prompt /analyze-")
S
Shengliang Guan 已提交
142
    SET(DEBUG_FLAGS "/Zi /W3 /GL")
S
TD-1853  
Shengliang Guan 已提交
143
    SET(RELEASE_FLAGS "/W0 /O3 /GL")
S
Shengliang Guan 已提交
144
  ENDIF ()
S
TD-1057  
Shengliang Guan 已提交
145 146 147 148 149

  INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/pthread)
  INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/iconv)
  INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/regex)
  INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/wepoll/inc)
S
TD-1057  
Shengliang Guan 已提交
150
  INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/MsvcLibX/include)
S
Shengliang Guan 已提交
151 152 153 154 155 156
ENDIF () 

IF (TD_WINDOWS_64)
  ADD_DEFINITIONS(-D_M_X64)
  ADD_DEFINITIONS(-D_TD_WINDOWS_64)
  ADD_DEFINITIONS(-DUSE_LIBICONV)
S
TD-1530  
Shengliang Guan 已提交
157
  MESSAGE(STATUS "windows64 is defined")
S
Shengliang Guan 已提交
158 159 160 161
ENDIF ()

IF (TD_WINDOWS_32)
  ADD_DEFINITIONS(-D_TD_WINDOWS_32)
162
  ADD_DEFINITIONS(-DUSE_LIBICONV)
S
TD-1530  
Shengliang Guan 已提交
163
  MESSAGE(STATUS "windows32 is defined")
S
Shengliang Guan 已提交
164 165
ENDIF ()

S
TD-1057  
Shengliang Guan 已提交
166 167 168 169
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/inc)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/os/inc)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/util/inc)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/common/inc)
S
TD-1057  
Shengliang Guan 已提交
170 171

MESSAGE(STATUS "CMAKE_CXX_COMPILER_ID: " ${CMAKE_CXX_COMPILER_ID})