CMakeLists.txt 1.9 KB
Newer Older
1
CMAKE_MINIMUM_REQUIRED(VERSION 3.0...3.20)
S
slguan 已提交
2 3 4
PROJECT(TDengine)

ADD_SUBDIRECTORY(monitor)
5 6

IF (TD_BUILD_HTTP)
7 8 9
  MESSAGE("")
  MESSAGE("${Yellow} use original embedded httpd ${ColourReset}")
  MESSAGE("")
10
  ADD_SUBDIRECTORY(http)
11 12 13
ELSE ()
  MESSAGE("")
  MESSAGE("${Green} use blm3 as httpd ${ColourReset}")
14
  EXECUTE_PROCESS(
15
      COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR}/blm3
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
      )
  EXECUTE_PROCESS(
      COMMAND git rev-parse --short HEAD
      RESULT_VARIABLE commit_sha1
      OUTPUT_VARIABLE blm3_commit_sha1
      )
  IF ("${blm3_commit_sha1}" STREQUAL "")
        SET(blm3_commit_sha1 "unknown")
  ELSE ()
        STRING(SUBSTRING "${blm3_commit_sha1}" 0 7 blm3_commit_sha1)
        STRING(STRIP "${blm3_commit_sha1}" blm3_commit_sha1)
  ENDIF ()
  MESSAGE("${Green} blm3 commit: ${blm3_commit_sha1} ${ColourReset}")
  EXECUTE_PROCESS(
      COMMAND cd ..
      )
32 33 34 35 36 37 38 39
  include(ExternalProject)
  ExternalProject_Add(blm3
    PREFIX        "blm3"
    SOURCE_DIR    ${CMAKE_CURRENT_SOURCE_DIR}/blm3
    BUILD_ALWAYS         off
    DEPENDS             taos
    BUILD_IN_SOURCE     1
    CONFIGURE_COMMAND cmake -E echo "blm3 no need cmake to config"
40 41
    PATCH_COMMAND
        COMMAND     git clean -f -d
42
    BUILD_COMMAND CGO_CFLAGS=-I${CMAKE_CURRENT_SOURCE_DIR}/../inc CGO_LDFLAGS=-L${CMAKE_BINARY_DIR}/build/lib  go build -ldflags "-s -w -X github.com/taosdata/blm3/version.CommitID=${blm3_commit_sha1}"
43 44 45 46 47
    INSTALL_COMMAND
        COMMAND curl -sL https://github.com/upx/upx/releases/download/v3.96/upx-3.96-amd64_linux.tar.xz -o upx.tar.xz && tar xvJf upx.tar.xz --strip-components 1 && ./upx blm3
        COMMAND cmake -E copy blm3 ${CMAKE_BINARY_DIR}/build/bin
        COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/test/cfg/
        COMMAND cmake -E copy ./example/config/blm.toml ${CMAKE_BINARY_DIR}/test/cfg/
48
  )
49 50
ENDIF ()

S
TD-1207  
Shengliang Guan 已提交
51
IF (TD_LINUX AND TD_MQTT)
S
TD-1310  
Shengliang Guan 已提交
52
  ADD_SUBDIRECTORY(mqtt)
53
ENDIF ()