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") set(TD_CONTRIB_DIR "${TD_SOURCE_DIR}/contrib")
include(${TD_SUPPORT_DIR}/cmake.platform) include(${TD_SUPPORT_DIR}/cmake.platform)
include(${TD_SUPPORT_DIR}/cmake.define) include(${TD_SUPPORT_DIR}/cmake.define)
include(${TD_SUPPORT_DIR}/cmake.options) include(${TD_SUPPORT_DIR}/cmake.options)

View File

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

View File

@ -1,12 +1,16 @@
# xml2 # xml2
ExternalProject_Add(xml2 ExternalProject_Add(xml2
GIT_REPOSITORY https://github.com/GNOME/libxml2 URL https://github.com/GNOME/libxml2/archive/refs/tags/v2.11.5.tar.gz
GIT_TAG v2.11.5 #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" SOURCE_DIR "${TD_CONTRIB_DIR}/xml2"
BINARY_DIR "" #BINARY_DIR ""
CONFIGURE_COMMAND "" BUILD_IN_SOURCE TRUE
BUILD_COMMAND "" CONFIGURE_COMMAND ./autogen.sh && ./configure --prefix=$ENV{HOME}/.cos-local.2 --enable-shared=no --enable-static=yes --without-python
INSTALL_COMMAND "" 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 "" TEST_COMMAND ""
) )

View File

@ -6,12 +6,10 @@ function(cat IN_FILE OUT_FILE)
file(APPEND ${OUT_FILE} "${CONTENTS}") file(APPEND ${OUT_FILE} "${CONTENTS}")
endfunction(cat IN_FILE OUT_FILE) endfunction(cat IN_FILE OUT_FILE)
if(${TD_LINUX})
if(${BUILD_WITH_S3}) if(${BUILD_WITH_S3})
file(MAKE_DIRECTORY $ENV{HOME}/.cos-local.2/) 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") set(CONTRIB_TMP_FILE3 "${CMAKE_BINARY_DIR}/deps_tmp_CMakeLists.txt.in3")
configure_file("${TD_SUPPORT_DIR}/deps_CMakeLists.txt.in" ${CONTRIB_TMP_FILE3}) 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 . execute_process(COMMAND "${CMAKE_COMMAND}" --build .
WORKING_DIRECTORY "${TD_CONTRIB_DIR}/deps-download") 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") set(CONTRIB_TMP_FILE "${CMAKE_BINARY_DIR}/deps_tmp_CMakeLists.txt.in")
configure_file("${TD_SUPPORT_DIR}/deps_CMakeLists.txt.in" ${CONTRIB_TMP_FILE}) 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}) cat("${TD_SUPPORT_DIR}/libs3_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
add_definitions(-DUSE_S3) add_definitions(-DUSE_S3)
else()
# cos # cos
if(${BUILD_WITH_COS}) elseif(${BUILD_WITH_COS})
#cat("${TD_SUPPORT_DIR}/mxml_CMakeLists.txt.in" ${CONTRIB_TMP_FILE}) #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_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
#cat("${TD_SUPPORT_DIR}/apr-util_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}/curl_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
cat("${TD_SUPPORT_DIR}/cos_CMakeLists.txt.in" ${CONTRIB_TMP_FILE}) cat("${TD_SUPPORT_DIR}/cos_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
add_definitions(-DUSE_COS) add_definitions(-DUSE_COS)
endif(${BUILD_WITH_COS})
endif(${BUILD_WITH_S3}) endif()
# lucene # lucene
if(${BUILD_WITH_LUCENE}) if(${BUILD_WITH_LUCENE})
@ -267,9 +261,9 @@ target_include_directories(
unset(CMAKE_PROJECT_INCLUDE_BEFORE) unset(CMAKE_PROJECT_INCLUDE_BEFORE)
# xml2 # xml2
if(${BUILD_WITH_S3}) #if(${BUILD_WITH_S3})
add_subdirectory(xml2 EXCLUDE_FROM_ALL) # add_subdirectory(xml2 EXCLUDE_FROM_ALL)
endif(${BUILD_WITH_S3}) #endif()
# lz4 # lz4
add_subdirectory(lz4/build/cmake EXCLUDE_FROM_ALL) add_subdirectory(lz4/build/cmake EXCLUDE_FROM_ALL)
@ -417,10 +411,8 @@ if(${BUILD_WITH_S3})
INCLUDE_DIRECTORIES($ENV{HOME}/.cos-local.2/include) INCLUDE_DIRECTORIES($ENV{HOME}/.cos-local.2/include)
MESSAGE("build with s3: ${BUILD_WITH_S3}") MESSAGE("build with s3: ${BUILD_WITH_S3}")
else()
# cos # cos
if(${BUILD_WITH_COS}) elseif(${BUILD_WITH_COS})
if(${TD_LINUX}) if(${TD_LINUX})
set(CMAKE_PREFIX_PATH $ENV{HOME}/.cos-local.1) set(CMAKE_PREFIX_PATH $ENV{HOME}/.cos-local.1)
#ADD_DEFINITIONS(-DMINIXML_LIBRARY=${CMAKE_BINARY_DIR}/build/lib/libxml.a) #ADD_DEFINITIONS(-DMINIXML_LIBRARY=${CMAKE_BINARY_DIR}/build/lib/libxml.a)
@ -442,9 +434,8 @@ if(${BUILD_WITH_COS})
else() else()
endif(${TD_LINUX}) endif(${TD_LINUX})
endif(${BUILD_WITH_COS})
endif(${BUILD_WITH_S3}) endif()
# lucene # lucene
# To support build on ubuntu: sudo apt-get install libboost-all-dev # 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) ADD_DEFINITIONS(-D_STORAGE)
TARGET_LINK_LIBRARIES(common PRIVATE storage) TARGET_LINK_LIBRARIES(common PRIVATE storage)
IF(${TD_LINUX}) IF(${BUILD_WITH_S3})
IF(${BUILD_WITH_COS}) add_definitions(-DUSE_S3)
add_definitions(-DUSE_COS) ELSEIF(${BUILD_WITH_COS})
ENDIF(${BUILD_WITH_COS}) add_definitions(-DUSE_COS)
ENDIF()
IF(${BUILD_WITH_S3})
add_definitions(-DUSE_S3)
ENDIF(${BUILD_WITH_S3})
ENDIF(${TD_LINUX})
ENDIF () ENDIF ()

View File

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