define.inc 4.2 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-58]  
slguan 已提交
16 17 18 19 20 21 22
IF (TD_GODLL)
  ADD_DEFINITIONS(-D_TD_GO_DLL_)
ENDIF ()

IF (TD_MEM_CHECK)
  ADD_DEFINITIONS(-DTAOS_MEM_CHECK)
ENDIF ()
23 24 25 26

IF (TD_RANDOM_FILE_FAIL)
  ADD_DEFINITIONS(-DTAOS_RANDOM_FILE_FAIL)
ENDIF ()
27 28 29 30

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

S
Shengliang Guan 已提交
32 33 34 35
IF (TD_LINUX_64)
  ADD_DEFINITIONS(-D_M_X64)
  ADD_DEFINITIONS(-D_TD_LINUX_64)
  SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -g3 -gdwarf-2 -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
36
  ADD_DEFINITIONS(-DUSE_LIBICONV)
S
Shengliang Guan 已提交
37 38 39 40 41 42 43 44
ENDIF ()

IF (TD_LINUX_32)
  ADD_DEFINITIONS(-D_TD_LINUX_32)
  ADD_DEFINITIONS(-DUSE_LIBICONV)
  SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -g -fsigned-char -munaligned-access -fpack-struct=8 -latomic -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
ENDIF ()

S
TD-1057  
Shengliang Guan 已提交
45
IF (TD_ARM_64)
46
  ADD_DEFINITIONS(-D_M_X64)
S
TD-1057  
Shengliang Guan 已提交
47
  ADD_DEFINITIONS(-D_TD_ARM_64_)
S
Shengliang Guan 已提交
48
  ADD_DEFINITIONS(-D_TD_ARM_)
S
Shengliang Guan 已提交
49
  ADD_DEFINITIONS(-DUSE_LIBICONV)
S
TD-1057  
Shengliang Guan 已提交
50
  SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -g -fsigned-char -fpack-struct=8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
S
Shengliang Guan 已提交
51 52
ENDIF ()

S
TD-1057  
Shengliang Guan 已提交
53 54
IF (TD_ARM_32)
  ADD_DEFINITIONS(-D_TD_ARM_32_)
S
Shengliang Guan 已提交
55
  ADD_DEFINITIONS(-D_TD_ARM_)
S
TD-1057  
Shengliang Guan 已提交
56 57 58 59 60 61 62 63 64 65 66
  SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -g -fsigned-char -fpack-struct=8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
ENDIF ()

IF (TD_MIPS_64)
  ADD_DEFINITIONS(-D_TD_MIPS_64_)
  SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -g3 -gdwarf-2 -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
ENDIF ()

IF (TD_MIPS_32)
  ADD_DEFINITIONS(-D_TD_MIPS_32_)
  SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -g3 -gdwarf-2 -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
S
Shengliang Guan 已提交
67 68
ENDIF ()

S
TD-1057  
Shengliang Guan 已提交
69 70 71 72
IF (TD_APLHINE)
  SET(COMMON_FLAGS "${COMMON_FLAGS} -largp")
  link_libraries(/usr/lib/libargp.a)
  ADD_DEFINITIONS(-D_ALPINE)
S
Shengliang Guan 已提交
73 74 75 76
ENDIF ()

IF (TD_LINUX)
  ADD_DEFINITIONS(-DLINUX)
S
TD-1057  
Shengliang Guan 已提交
77
  ADD_DEFINITIONS(-D_LINUX)
S
Shengliang Guan 已提交
78 79 80 81 82 83 84 85 86 87 88 89
  ADD_DEFINITIONS(-D_TD_LINUX)
  ADD_DEFINITIONS(-D_REENTRANT -D__USE_POSIX -D_LIBC_REENTRANT)
  
  SET(DEBUG_FLAGS "-O0 -DDEBUG")
  SET(RELEASE_FLAGS "-O0")
  
  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 已提交
90 91 92

  INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/cJson/inc)
  INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/lz4/inc)
S
Shengliang Guan 已提交
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
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)
  SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -Wno-missing-braces -fPIC -g -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
  SET(DEBUG_FLAGS "-O0 -DDEBUG")
  SET(RELEASE_FLAGS "-O0")
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)
    SET(COMMON_FLAGS "/nologo /WX /Oi /Oy- /Gm- /EHsc /MT /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Gd /errorReport:prompt /analyze-")
    SET(DEBUG_FLAGS "/Zi /W3 /GL")
    SET(RELEASE_FLAGS "/W0 /GL")
  ENDIF ()
S
TD-1057  
Shengliang Guan 已提交
117 118 119 120 121

  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 已提交
122
  INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/MsvcLibX/include)
S
Shengliang Guan 已提交
123 124 125 126 127 128 129 130 131 132
ENDIF () 

IF (TD_WINDOWS_64)
  ADD_DEFINITIONS(-D_M_X64)
  ADD_DEFINITIONS(-D_TD_WINDOWS_64)
  ADD_DEFINITIONS(-DUSE_LIBICONV)
ENDIF ()

IF (TD_WINDOWS_32)
  ADD_DEFINITIONS(-D_TD_WINDOWS_32)
133
  ADD_DEFINITIONS(-DUSE_LIBICONV)
S
Shengliang Guan 已提交
134 135
ENDIF ()

S
TD-1057  
Shengliang Guan 已提交
136 137 138 139
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 已提交
140 141

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