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

S
slguan 已提交
4 5 6 7
INCLUDE_DIRECTORIES(inc)
INCLUDE_DIRECTORIES(jni)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/inc)
INCLUDE_DIRECTORIES(${TD_OS_DIR}/inc)
H
hzcheng 已提交
8
AUX_SOURCE_DIRECTORY(./src SRC)
S
slguan 已提交
9

L
lihui 已提交
10
IF ((TD_LINUX_64) OR (TD_LINUX_32 AND _TD_ARM_))
S
slguan 已提交
11
  INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/jni/linux)
S
slguan 已提交
12 13

  # set the static lib name
S
slguan 已提交
14 15
  ADD_LIBRARY(taos_static STATIC ${SRC})
  TARGET_LINK_LIBRARIES(taos_static trpc tutil pthread m rt)
S
slguan 已提交
16
  SET_TARGET_PROPERTIES(taos_static PROPERTIES OUTPUT_NAME "taos_static")
S
slguan 已提交
17
  SET_TARGET_PROPERTIES(taos_static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
S
slguan 已提交
18

S
slguan 已提交
19 20 21
  # generate dynamic library (*.so)
  ADD_LIBRARY(taos SHARED ${SRC})
  TARGET_LINK_LIBRARIES(taos trpc tutil pthread m rt)
S
slguan 已提交
22 23 24 25 26
  SET_TARGET_PROPERTIES(taos PROPERTIES CLEAN_DIRECT_OUTPUT 1)

  #set version of .so
  #VERSION    so version
  #SOVERSION  api version
S
slguan 已提交
27 28 29 30 31 32 33 34
  IF (TD_LITE)
    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 lite version ${VERSION_INFO}")
  ELSE ()
    execute_process(COMMAND chmod 777 ${TD_COMMUNITY_DIR}/packaging/tools/get_version.sh)
S
slguan 已提交
35
    execute_process(COMMAND ${TD_COMMUNITY_DIR}/packaging/tools/get_version.sh ${TD_COMMUNITY_DIR}/src/util/src/version.c
S
slguan 已提交
36 37 38 39 40
            OUTPUT_VARIABLE
            VERSION_INFO)
    MESSAGE(STATUS "build cluster version ${VERSION_INFO}")
  ENDIF ()

S
slguan 已提交
41 42 43
  MESSAGE(STATUS "build version ${VERSION_INFO}")
  SET_TARGET_PROPERTIES(taos PROPERTIES VERSION ${VERSION_INFO} SOVERSION 1)
  
S
slguan 已提交
44 45 46 47
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 已提交
48 49 50
  
  ADD_LIBRARY(taos_static STATIC ${SRC})
  TARGET_LINK_LIBRARIES(taos_static trpc tutil)
S
slguan 已提交
51 52

  # generate dynamic library (*.dll)
S
slguan 已提交
53
  ADD_LIBRARY(taos SHARED ${SRC})
S
slguan 已提交
54
  SET_TARGET_PROPERTIES(taos PROPERTIES LINK_FLAGS /DEF:${TD_COMMUNITY_DIR}/src/client/src/taos.def)
S
slguan 已提交
55 56
  TARGET_LINK_LIBRARIES(taos trpc)

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

  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 已提交
67
  
S
slguan 已提交
68
ENDIF ()
H
hzcheng 已提交
69