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

S
slguan 已提交
4 5
INCLUDE_DIRECTORIES(inc)
INCLUDE_DIRECTORIES(jni)
6
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/query/inc)
7
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/zlib-1.2.11/inc)
8 9 10 11 12

IF (TD_BUILD_HTTP)
  INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/plugins/http/inc)
ENDIF ()

S
slguan 已提交
13
AUX_SOURCE_DIRECTORY(src SRC)
S
slguan 已提交
14

S
TD-1057  
Shengliang Guan 已提交
15
IF (TD_LINUX)
S
slguan 已提交
16
  INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/jni/linux)
17
  INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/cJson/inc)
S
slguan 已提交
18 19

  # set the static lib name
S
slguan 已提交
20
  ADD_LIBRARY(taos_static STATIC ${SRC})
21
  TARGET_LINK_LIBRARIES(taos_static common query trpc tutil pthread m rt cJson ${VAR_TSZ})
S
slguan 已提交
22
  SET_TARGET_PROPERTIES(taos_static PROPERTIES OUTPUT_NAME "taos_static")
S
slguan 已提交
23
  SET_TARGET_PROPERTIES(taos_static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
S
slguan 已提交
24

S
slguan 已提交
25 26
  # generate dynamic library (*.so)
  ADD_LIBRARY(taos SHARED ${SRC})
27
  TARGET_LINK_LIBRARIES(taos common query trpc tutil pthread m rt cJson)
28
  IF (TD_LINUX_64)
Z
zyyang 已提交
29
    TARGET_LINK_LIBRARIES(taos lua cJson)
30
  ENDIF ()
H
Haojun Liao 已提交
31

S
slguan 已提交
32 33 34 35 36
  SET_TARGET_PROPERTIES(taos PROPERTIES CLEAN_DIRECT_OUTPUT 1)

  #set version of .so
  #VERSION    so version
  #SOVERSION  api version
H
Hui Li 已提交
37 38
  #MESSAGE(STATUS "build version ${TD_VER_NUMBER}")
  SET_TARGET_PROPERTIES(taos PROPERTIES VERSION ${TD_VER_NUMBER} SOVERSION 1)
39 40 41

  ADD_SUBDIRECTORY(tests)

42 43
ELSEIF (TD_DARWIN)
  INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/jni/linux)
44
  INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/cJson/inc)
45 46 47

  # set the static lib name
  ADD_LIBRARY(taos_static STATIC ${SRC})
48
  TARGET_LINK_LIBRARIES(taos_static common query trpc tutil pthread m lua cJson)
49 50 51 52 53
  SET_TARGET_PROPERTIES(taos_static PROPERTIES OUTPUT_NAME "taos_static")
  SET_TARGET_PROPERTIES(taos_static PROPERTIES CLEAN_DIRECT_OUTPUT 1)

  # generate dynamic library (*.dylib)
  ADD_LIBRARY(taos SHARED ${SRC})
54
  TARGET_LINK_LIBRARIES(taos common query trpc tutil pthread m lua cJson)
55 56 57 58 59 60 61 62 63 64
  SET_TARGET_PROPERTIES(taos PROPERTIES CLEAN_DIRECT_OUTPUT 1)

  #set version of .dylib
  #VERSION    dylib version
  #SOVERSION  dylib version
  #MESSAGE(STATUS "build version ${TD_VER_NUMBER}")
  SET_TARGET_PROPERTIES(taos PROPERTIES VERSION ${TD_VER_NUMBER} SOVERSION 1)

  ADD_SUBDIRECTORY(tests)

S
TD-1037  
Shengliang Guan 已提交
65
ELSEIF (TD_WINDOWS)
S
slguan 已提交
66 67
  INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/jni/windows)
  INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/jni/windows/win32)
68
  INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/cJson/inc)
69 70 71

  CONFIGURE_FILE("${TD_COMMUNITY_DIR}/src/client/src/taos.rc.in" "${TD_COMMUNITY_DIR}/src/client/src/taos.rc")

S
slguan 已提交
72
  ADD_LIBRARY(taos_static STATIC ${SRC})
73
  TARGET_LINK_LIBRARIES(taos_static trpc tutil query cJson)
S
slguan 已提交
74 75

  # generate dynamic library (*.dll)
76
  ADD_LIBRARY(taos SHARED ${SRC} ${TD_COMMUNITY_DIR}/src/client/src/taos.rc)
L
[#1054]  
lihui 已提交
77 78 79
  IF (NOT TD_GODLL)
    SET_TARGET_PROPERTIES(taos PROPERTIES LINK_FLAGS /DEF:${TD_COMMUNITY_DIR}/src/client/src/taos.def)
  ENDIF ()
80
  TARGET_LINK_LIBRARIES(taos trpc tutil query lua cJson)
S
slguan 已提交
81

S
TD-1057  
Shengliang Guan 已提交
82
ELSEIF (TD_DARWIN)
S
slguan 已提交
83
  SET(CMAKE_MACOSX_RPATH 1)
S
slguan 已提交
84
  INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/jni/linux)
85
  INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/cJson/inc)
S
slguan 已提交
86 87

  ADD_LIBRARY(taos_static STATIC ${SRC})
88
  TARGET_LINK_LIBRARIES(taos_static query trpc tutil pthread m lua cJson)
S
slguan 已提交
89 90 91 92
  SET_TARGET_PROPERTIES(taos_static PROPERTIES OUTPUT_NAME "taos_static")

  # generate dynamic library (*.dylib)
  ADD_LIBRARY(taos SHARED ${SRC})
93
  TARGET_LINK_LIBRARIES(taos query trpc tutil pthread m lua cJson)
S
slguan 已提交
94 95 96 97 98 99

  SET_TARGET_PROPERTIES(taos PROPERTIES CLEAN_DIRECT_OUTPUT 1)

  #set version of .so
  #VERSION    so version
  #SOVERSION  api version
H
Hui Li 已提交
100 101
  #MESSAGE(STATUS "build version ${TD_VER_NUMBER}")
  SET_TARGET_PROPERTIES(taos PROPERTIES VERSION ${TD_VER_NUMBER} SOVERSION 1)
S
slguan 已提交
102
ENDIF ()
H
hzcheng 已提交
103