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

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

L
lihui 已提交
7
IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
S
slguan 已提交
8 9 10
  AUX_SOURCE_DIRECTORY(src SRC)
  ADD_LIBRARY(tutil ${SRC})
  TARGET_LINK_LIBRARIES(tutil pthread os m rt)
S
slguan 已提交
11
  IF (TD_CLUSTER) 
S
slguan 已提交
12
    ADD_DEFINITIONS(-DUSE_LIBICONV)
S
slguan 已提交
13 14 15 16 17 18 19 20 21 22 23 24 25 26
    TARGET_LINK_LIBRARIES(tutil iconv)
  ELSE()
    FIND_PATH(ICONV_INCLUDE_EXIST iconv.h /usr/include/ /usr/local/include/)
    IF (ICONV_INCLUDE_EXIST)
      ADD_DEFINITIONS(-DUSE_LIBICONV)
      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)
      ELSE ()
        # libiconv library is already included in GLIBC,
        MESSAGE(STATUS "Use the iconv functions in GLIBC")
      ENDIF ()
S
slguan 已提交
27
    ELSE ()
S
slguan 已提交
28
      MESSAGE(STATUS "Failed to find iconv, use default encoding method")
S
slguan 已提交
29
    ENDIF ()
H
hzcheng 已提交
30
  ENDIF ()
S
slguan 已提交
31
ELSEIF (TD_WINDOWS_64)
S
slguan 已提交
32
  ADD_DEFINITIONS(-DUSE_LIBICONV)
S
slguan 已提交
33 34 35 36
  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 已提交
37
  LIST(APPEND SRC ./src/ihash.c)
S
slguan 已提交
38
  LIST(APPEND SRC ./src/lz4.c)
S
slguan 已提交
39 40 41
  LIST(APPEND SRC ./src/shash.c)
  LIST(APPEND SRC ./src/tbase64.c)
  LIST(APPEND SRC ./src/tcache.c)
S
slguan 已提交
42
  LIST(APPEND SRC ./src/tcompression.c)
S
slguan 已提交
43 44 45 46 47 48 49 50 51 52
  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 已提交
53
  LIST(APPEND SRC ./src/tmem.c)
S
slguan 已提交
54 55
  LIST(APPEND SRC ./src/tmempool.c)
  LIST(APPEND SRC ./src/tmodule.c)
S
slguan 已提交
56
  LIST(APPEND SRC ./src/tnote.c)
S
slguan 已提交
57 58 59 60
  LIST(APPEND SRC ./src/tsched.c)
  LIST(APPEND SRC ./src/tskiplist.c)
  LIST(APPEND SRC ./src/tsocket.c)
  LIST(APPEND SRC ./src/tstatus.c)
S
slguan 已提交
61
  LIST(APPEND SRC ./src/tstrbuild.c)
S
slguan 已提交
62 63 64 65 66 67
  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 已提交
68
  ADD_LIBRARY(tutil ${SRC}) 
S
slguan 已提交
69
  TARGET_LINK_LIBRARIES(tutil iconv regex pthread os winmm IPHLPAPI ws2_32)
S
slguan 已提交
70
ELSEIF(TD_DARWIN_64)
S
slguan 已提交
71
  ADD_DEFINITIONS(-DUSE_LIBICONV)
S
slguan 已提交
72 73 74
  AUX_SOURCE_DIRECTORY(src SRC)
  LIST(REMOVE_ITEM SRC ./src/tcrc32c.c)
  LIST(REMOVE_ITEM SRC ./src/tdes.c)
S
slguan 已提交
75 76
  ADD_LIBRARY(tutil ${SRC})
  TARGET_LINK_LIBRARIES(tutil iconv pthread os)
S
slguan 已提交
77
ENDIF()
S
slguan 已提交
78

S
slguan 已提交
79 80
IF (TD_CLUSTER) 
  TARGET_LINK_LIBRARIES(tutil tutil_cluster)
S
slguan 已提交
81
ENDIF ()
H
hzcheng 已提交
82

S
slguan 已提交
83 84