Merge pull request #23391 from taosdata/fix/TD-26189-libs3

cmake: new option: BUILD_S3
This commit is contained in:
Hongze Cheng 2023-10-24 22:37:20 -05:00 committed by GitHub
commit 3ff331b8b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 49 additions and 46 deletions

View File

@ -16,8 +16,6 @@ set(TD_SUPPORT_DIR "${TD_SOURCE_DIR}/cmake")
set(TD_CONTRIB_DIR "${TD_SOURCE_DIR}/contrib")
include(${TD_SUPPORT_DIR}/cmake.platform)
include(${TD_SUPPORT_DIR}/cmake.define)
include(${TD_SUPPORT_DIR}/cmake.options)

View File

@ -128,12 +128,16 @@ option(
IF(${TD_LINUX})
option(
BUILD_WITH_S3
BUILD_S3
"If build with s3"
ON
)
IF(${BUILD_WITH_S3})
option(
BUILD_WITH_S3
"If build with s3"
ON
)
option(
BUILD_WITH_COS
@ -141,16 +145,26 @@ option(
OFF
)
ENDIF ()
IF(${BUILD_S3})
IF(${BUILD_WITH_S3})
option(BUILD_WITH_COS "If build with cos" OFF)
ELSE ()
option(
BUILD_WITH_COS
"If build with cos"
ON
)
option(BUILD_WITH_COS "If build with cos" ON)
ENDIF ()
ELSE ()
option(BUILD_WITH_S3 "If build with s3" OFF)
option(BUILD_WITH_COS "If build with cos" OFF)
ENDIF ()
option(

View File

@ -1,12 +1,16 @@
# xml2
ExternalProject_Add(xml2
GIT_REPOSITORY https://github.com/GNOME/libxml2
GIT_TAG v2.11.5
URL https://github.com/GNOME/libxml2/archive/refs/tags/v2.11.5.tar.gz
#GIT_REPOSITORY https://github.com/GNOME/libxml2
#GIT_TAG v2.11.5
DOWNLOAD_NO_PROGRESS 1
DOWNLOAD_DIR "${TD_CONTRIB_DIR}/deps-download"
SOURCE_DIR "${TD_CONTRIB_DIR}/xml2"
BINARY_DIR ""
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
#BINARY_DIR ""
BUILD_IN_SOURCE TRUE
CONFIGURE_COMMAND ./autogen.sh && ./configure --prefix=$ENV{HOME}/.cos-local.2 --enable-shared=no --enable-static=yes --without-python
BUILD_COMMAND make -j
INSTALL_COMMAND make install && ln -s $ENV{HOME}/.cos-local.2/include/libxml2/libxml $ENV{HOME}/.cos-local.2/include/libxml
TEST_COMMAND ""
)

View File

@ -6,12 +6,10 @@ function(cat IN_FILE OUT_FILE)
file(APPEND ${OUT_FILE} "${CONTENTS}")
endfunction(cat IN_FILE OUT_FILE)
if(${TD_LINUX})
if(${BUILD_WITH_S3})
file(MAKE_DIRECTORY $ENV{HOME}/.cos-local.2/)
else()
elseif(${BUILD_WITH_COS})
set(CONTRIB_TMP_FILE3 "${CMAKE_BINARY_DIR}/deps_tmp_CMakeLists.txt.in3")
configure_file("${TD_SUPPORT_DIR}/deps_CMakeLists.txt.in" ${CONTRIB_TMP_FILE3})
@ -42,9 +40,8 @@ execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
WORKING_DIRECTORY "${TD_CONTRIB_DIR}/deps-download")
endif(${BUILD_WITH_S3})
endif()
endif(${TD_LINUX})
set(CONTRIB_TMP_FILE "${CMAKE_BINARY_DIR}/deps_tmp_CMakeLists.txt.in")
configure_file("${TD_SUPPORT_DIR}/deps_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
@ -170,19 +167,16 @@ if(${BUILD_WITH_S3})
cat("${TD_SUPPORT_DIR}/libs3_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
add_definitions(-DUSE_S3)
else()
# cos
if(${BUILD_WITH_COS})
elseif(${BUILD_WITH_COS})
#cat("${TD_SUPPORT_DIR}/mxml_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
#cat("${TD_SUPPORT_DIR}/apr_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
#cat("${TD_SUPPORT_DIR}/apr-util_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
#cat("${TD_SUPPORT_DIR}/curl_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
cat("${TD_SUPPORT_DIR}/cos_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
add_definitions(-DUSE_COS)
endif(${BUILD_WITH_COS})
endif(${BUILD_WITH_S3})
endif()
# lucene
if(${BUILD_WITH_LUCENE})
@ -267,9 +261,9 @@ target_include_directories(
unset(CMAKE_PROJECT_INCLUDE_BEFORE)
# xml2
if(${BUILD_WITH_S3})
add_subdirectory(xml2 EXCLUDE_FROM_ALL)
endif(${BUILD_WITH_S3})
#if(${BUILD_WITH_S3})
# add_subdirectory(xml2 EXCLUDE_FROM_ALL)
#endif()
# lz4
add_subdirectory(lz4/build/cmake EXCLUDE_FROM_ALL)
@ -417,10 +411,8 @@ if(${BUILD_WITH_S3})
INCLUDE_DIRECTORIES($ENV{HOME}/.cos-local.2/include)
MESSAGE("build with s3: ${BUILD_WITH_S3}")
else()
# cos
if(${BUILD_WITH_COS})
elseif(${BUILD_WITH_COS})
if(${TD_LINUX})
set(CMAKE_PREFIX_PATH $ENV{HOME}/.cos-local.1)
#ADD_DEFINITIONS(-DMINIXML_LIBRARY=${CMAKE_BINARY_DIR}/build/lib/libxml.a)
@ -442,9 +434,8 @@ if(${BUILD_WITH_COS})
else()
endif(${TD_LINUX})
endif(${BUILD_WITH_COS})
endif(${BUILD_WITH_S3})
endif()
# lucene
# To support build on ubuntu: sudo apt-get install libboost-all-dev

View File

@ -17,15 +17,11 @@ IF (TD_STORAGE)
ADD_DEFINITIONS(-D_STORAGE)
TARGET_LINK_LIBRARIES(common PRIVATE storage)
IF(${TD_LINUX})
IF(${BUILD_WITH_COS})
add_definitions(-DUSE_COS)
ENDIF(${BUILD_WITH_COS})
IF(${BUILD_WITH_S3})
add_definitions(-DUSE_S3)
ENDIF(${BUILD_WITH_S3})
ENDIF(${TD_LINUX})
IF(${BUILD_WITH_S3})
add_definitions(-DUSE_S3)
ELSEIF(${BUILD_WITH_COS})
add_definitions(-DUSE_COS)
ENDIF()
ENDIF ()

View File

@ -161,7 +161,7 @@ target_link_libraries(
PUBLIC index
)
if(${TD_LINUX})
if(${BUILD_S3})
if(${BUILD_WITH_S3})
target_include_directories(
@ -188,7 +188,7 @@ if(${BUILD_WITH_S3})
)
add_definitions(-DUSE_S3)
endif(${BUILD_WITH_S3})
endif()
if(${BUILD_WITH_COS})
@ -227,7 +227,7 @@ target_include_directories(
add_definitions(-DUSE_COS)
endif(${BUILD_WITH_COS})
endif(${TD_LINUX})
endif()
IF (TD_GRANT)
TARGET_LINK_LIBRARIES(vnode PUBLIC grant)