CMakeLists.txt 2.1 KB
Newer Older
H
refact  
Hongze Cheng 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
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")

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
H
Hongze Cheng 已提交
23
option(BUILD_TEST "If build unit tests using googletest" ON)
H
refact  
Hongze Cheng 已提交
24 25 26 27 28

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

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

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

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

H
Hongze Cheng 已提交
38 39 40 41 42 43 44 45 46 47 48 49
## leveldb
option(BUILD_WITH_LEVELDB "If build with leveldb" ON)
if(${BUILD_WITH_LEVELDB})
    cat("${CMAKE_SUPPORT_DIR}/leveldb_CMakeLists.txt.in" ${DEPS_TMP_FILE})
endif(${BUILD_WITH_LEVELDB})

## rocksdb
option(BUILD_WITH_ROCKSDB "If build with rocksdb" ON)
if(${BUILD_WITH_ROCKSDB})
    cat("${CMAKE_SUPPORT_DIR}/rocksdb_CMakeLists.txt.in" ${DEPS_TMP_FILE})
endif(${BUILD_WITH_ROCKSDB})

H
refact  
Hongze Cheng 已提交
50 51 52 53 54 55 56
## 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 已提交
57 58
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -gdwarf-2 -msse4.2 -mfma")

H
refact  
Hongze Cheng 已提交
59 60 61
# deps
add_subdirectory(deps)

H
refact  
Hongze Cheng 已提交
62
# api
H
Hongze Cheng 已提交
63 64
add_library(api INTERFACE)
target_include_directories(api INTERFACE "include/client")
H
refact  
Hongze Cheng 已提交
65

H
refact  
Hongze Cheng 已提交
66
# src
H
refact  
Hongze Cheng 已提交
67
add_subdirectory(source)
H
refact  
Hongze Cheng 已提交
68

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