CMakeLists.txt 4.0 KB
Newer Older
H
Hongze Cheng 已提交
1
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
H
hzcheng 已提交
2 3
PROJECT(TDengine)

S
slguan 已提交
4
INCLUDE_DIRECTORIES(${TD_OS_DIR}/inc)
S
slguan 已提交
5 6
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/inc)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/util/inc)
S
slguan 已提交
7
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/common/inc)
S
slguan 已提交
8

L
lihui 已提交
9
IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
S
slguan 已提交
10 11
  INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/cJson/inc)
  INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/lz4/inc)
S
slguan 已提交
12 13
  AUX_SOURCE_DIRECTORY(src SRC)
  ADD_LIBRARY(tutil ${SRC})
H
TD-166  
hzcheng 已提交
14
  TARGET_LINK_LIBRARIES(tutil pthread os m rt lz4)
15 16
  FIND_PATH(ICONV_INCLUDE_EXIST iconv.h /usr/include/ /usr/local/include/)
  IF (ICONV_INCLUDE_EXIST)
S
slguan 已提交
17
    ADD_DEFINITIONS(-DUSE_LIBICONV)
18 19 20 21 22
    FIND_PATH(ICONV_LIBRARY_A_EXIST libiconv.a /usr/lib/ /usr/local/lib/ /lib64)
    FIND_PATH(ICONV_LIBRARY_SO_EXIST libiconv.so /usr/lib/ /usr/local/lib/ /lib64)
    IF (ICONV_LIBRARY_A_EXIST OR ICONV_LIBRARY_SO_EXIST)
      MESSAGE(STATUS "Use the installed libiconv library")
      TARGET_LINK_LIBRARIES(tutil iconv)
S
slguan 已提交
23
    ELSE ()
24 25
      # libiconv library is already included in GLIBC,
      MESSAGE(STATUS "Use the iconv functions in GLIBC")
S
slguan 已提交
26
    ENDIF ()
27 28
  ELSE ()
    MESSAGE(STATUS "Failed to find iconv, use default encoding method")
H
hzcheng 已提交
29
  ENDIF ()
H
hjxilinx 已提交
30 31

  ADD_SUBDIRECTORY(tests)
S
slguan 已提交
32
ELSEIF (TD_WINDOWS_64)
S
slguan 已提交
33
  ADD_DEFINITIONS(-DUSE_LIBICONV)
S
slguan 已提交
34 35 36 37
  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}/src/inc)
S
slguan 已提交
38
  LIST(APPEND SRC ./src/hash.c)
S
slguan 已提交
39
  LIST(APPEND SRC ./src/ihash.c)
S
slguan 已提交
40
  LIST(APPEND SRC ./src/lz4.c)
S
slguan 已提交
41 42 43
  LIST(APPEND SRC ./src/shash.c)
  LIST(APPEND SRC ./src/tbase64.c)
  LIST(APPEND SRC ./src/tcache.c)
S
slguan 已提交
44
  LIST(APPEND SRC ./src/tcompression.c)
S
slguan 已提交
45 46 47 48 49 50 51 52 53 54
  LIST(APPEND SRC ./src/textbuffer.c)
  LIST(APPEND SRC ./src/tglobalcfg.c)
  LIST(APPEND SRC ./src/thash.c)
  LIST(APPEND SRC ./src/thashutil.c)
  LIST(APPEND SRC ./src/thistogram.c)
  LIST(APPEND SRC ./src/tidpool.c)
  LIST(APPEND SRC ./src/tinterpolation.c)
  LIST(APPEND SRC ./src/tlog.c)
  LIST(APPEND SRC ./src/tlosertree.c)
  LIST(APPEND SRC ./src/tmd5.c)
S
slguan 已提交
55
  LIST(APPEND SRC ./src/tmem.c)
S
slguan 已提交
56 57
  LIST(APPEND SRC ./src/tmempool.c)
  LIST(APPEND SRC ./src/tmodule.c)
S
slguan 已提交
58
  LIST(APPEND SRC ./src/tnote.c)
59
  LIST(APPEND SRC ./src/tpercentile.c)
S
slguan 已提交
60 61 62
  LIST(APPEND SRC ./src/tsched.c)
  LIST(APPEND SRC ./src/tskiplist.c)
  LIST(APPEND SRC ./src/tsocket.c)
S
slguan 已提交
63
  LIST(APPEND SRC ./src/tstrbuild.c)
S
slguan 已提交
64 65 66 67 68 69
  LIST(APPEND SRC ./src/ttime.c)
  LIST(APPEND SRC ./src/ttimer.c)
  LIST(APPEND SRC ./src/ttokenizer.c)
  LIST(APPEND SRC ./src/ttypes.c)
  LIST(APPEND SRC ./src/tutil.c)
  LIST(APPEND SRC ./src/version.c)
S
slguan 已提交
70
  ADD_LIBRARY(tutil ${SRC}) 
H
TD-166  
hzcheng 已提交
71
  TARGET_LINK_LIBRARIES(tutil iconv regex pthread os winmm IPHLPAPI ws2_32 lz4)
S
slguan 已提交
72
ELSEIF(TD_DARWIN_64)
S
slguan 已提交
73
  ADD_DEFINITIONS(-DUSE_LIBICONV)
S
slguan 已提交
74
  LIST(APPEND SRC ./src/hash.c)
S
slguan 已提交
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
  LIST(APPEND SRC ./src/ihash.c)
  LIST(APPEND SRC ./src/lz4.c)
  LIST(APPEND SRC ./src/shash.c)
  LIST(APPEND SRC ./src/tbase64.c)
  LIST(APPEND SRC ./src/tcache.c)
  LIST(APPEND SRC ./src/tcompression.c)
  LIST(APPEND SRC ./src/textbuffer.c)
  LIST(APPEND SRC ./src/tglobalcfg.c)
  LIST(APPEND SRC ./src/thash.c)
  LIST(APPEND SRC ./src/thashutil.c)
  LIST(APPEND SRC ./src/thistogram.c)
  LIST(APPEND SRC ./src/tidpool.c)
  LIST(APPEND SRC ./src/tinterpolation.c)
  LIST(APPEND SRC ./src/tlog.c)
  LIST(APPEND SRC ./src/tlosertree.c)
  LIST(APPEND SRC ./src/tmd5.c)
  LIST(APPEND SRC ./src/tmem.c)
  LIST(APPEND SRC ./src/tmempool.c)
  LIST(APPEND SRC ./src/tmodule.c)
  LIST(APPEND SRC ./src/tnote.c)
95
  LIST(APPEND SRC ./src/tpercentile.c)
S
slguan 已提交
96 97 98 99 100 101 102 103 104 105
  LIST(APPEND SRC ./src/tsched.c)
  LIST(APPEND SRC ./src/tskiplist.c)
  LIST(APPEND SRC ./src/tsocket.c)
  LIST(APPEND SRC ./src/tstrbuild.c)
  LIST(APPEND SRC ./src/ttime.c)
  LIST(APPEND SRC ./src/ttimer.c)
  LIST(APPEND SRC ./src/ttokenizer.c)
  LIST(APPEND SRC ./src/ttypes.c)
  LIST(APPEND SRC ./src/tutil.c)
  LIST(APPEND SRC ./src/version.c)
sangshuduo's avatar
sangshuduo 已提交
106
  LIST(APPEND SRC ./src/hash.c)
S
slguan 已提交
107
  ADD_LIBRARY(tutil ${SRC})
H
TD-166  
hzcheng 已提交
108
  TARGET_LINK_LIBRARIES(tutil iconv pthread os lz4)
S
slguan 已提交
109
ENDIF()
S
slguan 已提交
110

S
slguan 已提交
111
#  TARGET_LINK_LIBRARIES(tutil mstorage)