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(inc)
INCLUDE_DIRECTORIES(jni)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/inc)
S
Shengliang Guan 已提交
7
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/os/inc)
S
slguan 已提交
8
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/util/inc)
9
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/query/inc)
H
hjxilinx 已提交
10
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/common/inc)
S
slguan 已提交
11 12
INCLUDE_DIRECTORIES(${TD_ENTERPRISE_DIR}/src/inc)
AUX_SOURCE_DIRECTORY(src SRC)
S
slguan 已提交
13

L
lihui 已提交
14
IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
S
slguan 已提交
15
  INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/jni/linux)
S
slguan 已提交
16 17

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

S
slguan 已提交
23 24
  # generate dynamic library (*.so)
  ADD_LIBRARY(taos SHARED ${SRC})
sangshuduo's avatar
sangshuduo 已提交
25
  TARGET_LINK_LIBRARIES(taos common query trpc tutil pthread m rt)
S
slguan 已提交
26 27 28 29 30
  SET_TARGET_PROPERTIES(taos PROPERTIES CLEAN_DIRECT_OUTPUT 1)

  #set version of .so
  #VERSION    so version
  #SOVERSION  api version
S
slguan 已提交
31 32 33 34
  execute_process(COMMAND chmod 777 ${TD_COMMUNITY_DIR}/packaging/tools/get_version.sh)
  execute_process(COMMAND ${TD_COMMUNITY_DIR}/packaging/tools/get_version.sh ${TD_COMMUNITY_DIR}/src/util/src/version.c
        OUTPUT_VARIABLE
        VERSION_INFO)
S
slguan 已提交
35 36
  MESSAGE(STATUS "build version ${VERSION_INFO}")
  SET_TARGET_PROPERTIES(taos PROPERTIES VERSION ${VERSION_INFO} SOVERSION 1)
37 38 39

  ADD_SUBDIRECTORY(tests)

S
slguan 已提交
40 41 42 43
ELSEIF (TD_WINDOWS_64)
  INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/jni/windows)
  INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/jni/windows/win32)
  INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/pthread)
S
slguan 已提交
44 45 46
  
  ADD_LIBRARY(taos_static STATIC ${SRC})
  TARGET_LINK_LIBRARIES(taos_static trpc tutil)
S
slguan 已提交
47 48

  # generate dynamic library (*.dll)
S
slguan 已提交
49
  ADD_LIBRARY(taos SHARED ${SRC})
L
[#1054]  
lihui 已提交
50 51 52
  IF (NOT TD_GODLL)
    SET_TARGET_PROPERTIES(taos PROPERTIES LINK_FLAGS /DEF:${TD_COMMUNITY_DIR}/src/client/src/taos.def)
  ENDIF ()
H
hjxilinx 已提交
53
  TARGET_LINK_LIBRARIES(taos trpc tutil)
S
slguan 已提交
54

S
slguan 已提交
55
ELSEIF (TD_DARWIN_64)
S
slguan 已提交
56
  SET(CMAKE_MACOSX_RPATH 1)
S
slguan 已提交
57
  INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/jni/linux)
S
slguan 已提交
58 59 60 61 62 63 64 65

  ADD_LIBRARY(taos_static STATIC ${SRC})
  TARGET_LINK_LIBRARIES(taos_static trpc tutil pthread m)
  SET_TARGET_PROPERTIES(taos_static PROPERTIES OUTPUT_NAME "taos_static")

  # generate dynamic library (*.dylib)
  ADD_LIBRARY(taos SHARED ${SRC})
  TARGET_LINK_LIBRARIES(taos trpc tutil pthread m)
S
slguan 已提交
66 67 68 69 70 71 72 73 74 75 76 77

  SET_TARGET_PROPERTIES(taos PROPERTIES CLEAN_DIRECT_OUTPUT 1)

  #set version of .so
  #VERSION    so version
  #SOVERSION  api version
  execute_process(COMMAND chmod 777 ${TD_COMMUNITY_DIR}/packaging/tools/get_version.sh)
  execute_process(COMMAND ${TD_COMMUNITY_DIR}/packaging/tools/get_version.sh ${TD_COMMUNITY_DIR}/src/util/src/version.c
      OUTPUT_VARIABLE
      VERSION_INFO)
  MESSAGE(STATUS "build version ${VERSION_INFO}")
  SET_TARGET_PROPERTIES(taos PROPERTIES VERSION ${VERSION_INFO} SOVERSION 1)
S
slguan 已提交
78
ENDIF ()
H
hzcheng 已提交
79