CMakeLists.txt 2.3 KB
Newer Older
H
refact  
Hongze Cheng 已提交
1 2 3 4 5 6 7 8 9 10 11 12
cmake_minimum_required(VERSION 3.16)

project(
    TDengine
    VERSION 3.0
    DESCRIPTION "An open-source big data platform designed and optimized for the Internet of Things(IOT)"
)

# ============================================================================
# DEPENDENCIES
# ============================================================================
set(CMAKE_SUPPORT_DIR "${CMAKE_SOURCE_DIR}/cmake")
H
refact  
Hongze Cheng 已提交
13
include(${CMAKE_SUPPORT_DIR}/cmake.options)
H
refact  
Hongze Cheng 已提交
14 15 16 17 18 19 20 21 22 23 24 25 26 27

function(cat IN_FILE OUT_FILE)
    file(READ ${IN_FILE} CONTENTS)
    file(APPEND ${OUT_FILE} "${CONTENTS}")
endfunction(cat IN_FILE OUT_FILE)

set(DEPS_TMP_FILE "${CMAKE_BINARY_DIR}/deps_tmp_CMakeLists.txt.in")
configure_file("${CMAKE_SUPPORT_DIR}/deps_CMakeLists.txt.in" ${DEPS_TMP_FILE})

## googletest
if(${BUILD_TEST})
    cat("${CMAKE_SUPPORT_DIR}/gtest_CMakeLists.txt.in" ${DEPS_TMP_FILE})
endif(${BUILD_TEST})

H
refact  
Hongze Cheng 已提交
28 29 30
## lz4
cat("${CMAKE_SUPPORT_DIR}/lz4_CMakeLists.txt.in" ${DEPS_TMP_FILE})

H
Hongze Cheng 已提交
31 32 33
## zlib
cat("${CMAKE_SUPPORT_DIR}/zlib_CMakeLists.txt.in" ${DEPS_TMP_FILE})

H
refact  
Hongze Cheng 已提交
34 35 36
## cJson
cat("${CMAKE_SUPPORT_DIR}/cjson_CMakeLists.txt.in" ${DEPS_TMP_FILE})

H
Hongze Cheng 已提交
37 38 39 40 41 42 43 44
## leveldb
if(${BUILD_WITH_LEVELDB})
    cat("${CMAKE_SUPPORT_DIR}/leveldb_CMakeLists.txt.in" ${DEPS_TMP_FILE})
endif(${BUILD_WITH_LEVELDB})

## rocksdb
if(${BUILD_WITH_ROCKSDB})
    cat("${CMAKE_SUPPORT_DIR}/rocksdb_CMakeLists.txt.in" ${DEPS_TMP_FILE})
H
refact  
Hongze Cheng 已提交
45
    add_definitions(-DUSE_ROCKSDB)
H
Hongze Cheng 已提交
46 47
endif(${BUILD_WITH_ROCKSDB})

H
Hongze Cheng 已提交
48 49 50 51 52
## lucene
if(${BUILD_WITH_LUCENE})
    cat("${CMAKE_SUPPORT_DIR}/lucene_CMakeLists.txt.in" ${DEPS_TMP_FILE})
endif(${BUILD_WITH_LUCENE})

H
Hongze Cheng 已提交
53 54 55 56 57
## NuRaft
if(${BUILD_WITH_NURAFT})
    cat("${CMAKE_SUPPORT_DIR}/nuraft_CMakeLists.txt.in" ${DEPS_TMP_FILE})
endif(${BUILD_WITH_NURAFT})

H
refact  
Hongze Cheng 已提交
58 59 60 61 62 63 64
## download dependencies
configure_file(${DEPS_TMP_FILE} "${CMAKE_SOURCE_DIR}/deps/deps-download/CMakeLists.txt")
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
        WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/deps/deps-download")
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
        WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/deps/deps-download")

S
Shengliang Guan 已提交
65 66
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -gdwarf-2 -msse4.2 -mfma")

H
refact  
Hongze Cheng 已提交
67 68 69
# deps
add_subdirectory(deps)

H
refact  
Hongze Cheng 已提交
70
# api
H
Hongze Cheng 已提交
71 72
add_library(api INTERFACE)
target_include_directories(api INTERFACE "include/client")
H
refact  
Hongze Cheng 已提交
73

H
refact  
Hongze Cheng 已提交
74
# src
H
refact  
Hongze Cheng 已提交
75
add_subdirectory(source)
H
refact  
Hongze Cheng 已提交
76

H
Hongze Cheng 已提交
77
# docs 
H
Hongze Cheng 已提交
78
add_subdirectory(docs)
H
more  
Hongze Cheng 已提交
79

L
Liu Jicong 已提交
80
# tests (TODO)