CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(TDengine)

INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/inc)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/os/inc)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/util/inc)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/common/inc)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/cJson/inc)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/lz4/inc)
INCLUDE_DIRECTORIES(inc)

IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
  AUX_SOURCE_DIRECTORY(src SRC)
ELSEIF (TD_DARWIN_64)
  AUX_SOURCE_DIRECTORY(src SRC)
ELSEIF (TD_WINDOWS_64)
  INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/pthread)
  AUX_SOURCE_DIRECTORY(src SRC)
ENDIF ()

ADD_LIBRARY(trpc ${SRC})
TARGET_LINK_LIBRARIES(trpc tutil lz4 common)

ADD_SUBDIRECTORY(test)

