diff --git a/CMakeLists.txt b/CMakeLists.txt index 9324daef20..9533514ebc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,12 +20,18 @@ 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 -option(BUILD_TEST "If build unit tests using googletest" OFF) +option(BUILD_TEST "If build unit tests using googletest" ON) if(${BUILD_TEST}) cat("${CMAKE_SUPPORT_DIR}/gtest_CMakeLists.txt.in" ${DEPS_TMP_FILE}) endif(${BUILD_TEST}) +## lz4 +cat("${CMAKE_SUPPORT_DIR}/lz4_CMakeLists.txt.in" ${DEPS_TMP_FILE}) + +## cJson +cat("${CMAKE_SUPPORT_DIR}/cjson_CMakeLists.txt.in" ${DEPS_TMP_FILE}) + ## download dependencies configure_file(${DEPS_TMP_FILE} "${CMAKE_SOURCE_DIR}/deps/deps-download/CMakeLists.txt") execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" . @@ -36,6 +42,10 @@ execute_process(COMMAND "${CMAKE_COMMAND}" --build . # deps add_subdirectory(deps) +# api +aux_source_directory(include/client API_SRC) +add_library(api INTERFACE ${API_SRC}) + # src add_subdirectory(source) diff --git a/cmake/cjson_CMakeLists.txt.in b/cmake/cjson_CMakeLists.txt.in new file mode 100644 index 0000000000..83f34ae794 --- /dev/null +++ b/cmake/cjson_CMakeLists.txt.in @@ -0,0 +1,12 @@ + +# cjson +ExternalProject_Add(cjson + GIT_REPOSITORY git@github.com:taosdata-contrib/cJSON.git + GIT_TAG v1.7.15 + SOURCE_DIR "${CMAKE_SOURCE_DIR}/deps/cJson" + BINARY_DIR "${CMAKE_BINARY_DIR}/cJson-build" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + TEST_COMMAND "" + ) \ No newline at end of file diff --git a/cmake/gtest_CMakeLists.txt.in b/cmake/gtest_CMakeLists.txt.in index ba4eaef8fb..6de66e23de 100644 --- a/cmake/gtest_CMakeLists.txt.in +++ b/cmake/gtest_CMakeLists.txt.in @@ -1,8 +1,8 @@ # googletest ExternalProject_Add(googletest - GIT_REPOSITORY git@github.com:google/googletest.git - GIT_TAG master + GIT_REPOSITORY git@github.com:taosdata-contrib/googletest.git + GIT_TAG release-1.11.0 SOURCE_DIR "${CMAKE_SOURCE_DIR}/deps/googletest" BINARY_DIR "${CMAKE_BINARY_DIR}/googletest-build" CONFIGURE_COMMAND "" diff --git a/cmake/lz4_CMakeLists.txt.in b/cmake/lz4_CMakeLists.txt.in new file mode 100644 index 0000000000..56e5fbd258 --- /dev/null +++ b/cmake/lz4_CMakeLists.txt.in @@ -0,0 +1,12 @@ + +# lz4 +ExternalProject_Add(lz4 + GIT_REPOSITORY git@github.com:taosdata-contrib/lz4.git + GIT_TAG v1.9.3 + SOURCE_DIR "${CMAKE_SOURCE_DIR}/deps/lz4" + BINARY_DIR "${CMAKE_BINARY_DIR}/lz4-build" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + TEST_COMMAND "" + ) \ No newline at end of file diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index 2bb75b07c9..1d8eac00aa 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -1,3 +1,6 @@ if(${BUILD_TEST}) add_subdirectory(googletest) endif(${BUILD_TEST}) + +add_subdirectory(cJson) +add_subdirectory(lz4/build/cmake) diff --git a/source/client/CMakeLists.txt b/source/client/CMakeLists.txt index 26623d3cdc..2313c1633c 100644 --- a/source/client/CMakeLists.txt +++ b/source/client/CMakeLists.txt @@ -2,6 +2,9 @@ aux_source_directory(src CLIENT_SRC) add_library(taos ${CLIENT_SRC}) target_include_directories( taos - PUBLIC "${CMAKE_SOURCE_DIR}/include/client" PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/inc" +) +target_link_libraries( + taos + INTERFACE api ) \ No newline at end of file