[clickhouse-cpp] update to 2.4.0 (#34082)

This commit is contained in:
Jia Yue Hua 2023-10-04 11:33:13 +08:00 committed by GitHub
parent 0111592cf3
commit 9997c0aa76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 64 additions and 97 deletions

View File

@ -1,88 +1,42 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 31cd8a5..d8ee404 100644
index aed0d85..b5f36e2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,11 +29,12 @@ PROJECT (CLICKHOUSE-CLIENT)
INCLUDE_DIRECTORIES (.)
INCLUDE_DIRECTORIES (contrib)
@@ -63,21 +63,21 @@ PROJECT (CLICKHOUSE-CLIENT)
ENDIF ()
+ find_package(absl CONFIG REQUIRED)
+ find_package(cityhash CONFIG REQUIRED)
+ find_package(lz4 CONFIG REQUIRED)
+
SUBDIRS (
clickhouse
- contrib/absl
- contrib/cityhash
- contrib/lz4
)
IF (WITH_SYSTEM_ABSEIL)
- FIND_PACKAGE(absl REQUIRED)
+ FIND_PACKAGE(absl CONFIG REQUIRED)
ELSE ()
INCLUDE_DIRECTORIES (contrib/absl)
SUBDIRS (contrib/absl/absl)
ENDIF ()
IF (BUILD_BENCHMARK)
IF (WITH_SYSTEM_LZ4)
- FIND_PACKAGE(lz4 REQUIRED)
+ FIND_PACKAGE(lz4 CONFIG REQUIRED)
ELSE ()
INCLUDE_DIRECTORIES (contrib/lz4/lz4)
SUBDIRS (contrib/lz4/lz4)
ENDIF ()
IF (WITH_SYSTEM_CITYHASH)
- FIND_PACKAGE(cityhash REQUIRED)
+ FIND_PACKAGE(cityhash CONFIG REQUIRED)
ELSE ()
INCLUDE_DIRECTORIES (contrib/cityhash/cityhash)
SUBDIRS (contrib/cityhash/cityhash)
diff --git a/clickhouse/CMakeLists.txt b/clickhouse/CMakeLists.txt
index d96ff88..ad1cb0d 100644
index 67663ec..e67ba81 100644
--- a/clickhouse/CMakeLists.txt
+++ b/clickhouse/CMakeLists.txt
@@ -36,19 +36,21 @@ IF (WITH_OPENSSL)
LIST(APPEND clickhouse-cpp-lib-src base/sslsocket.cpp)
ENDIF ()
-ADD_LIBRARY (clickhouse-cpp-lib SHARED ${clickhouse-cpp-lib-src})
-SET_TARGET_PROPERTIES(clickhouse-cpp-lib PROPERTIES LINKER_LANGUAGE CXX)
-TARGET_LINK_LIBRARIES (clickhouse-cpp-lib
- absl-lib
- cityhash-lib
- lz4-lib
-)
-
-ADD_LIBRARY (clickhouse-cpp-lib-static STATIC ${clickhouse-cpp-lib-src})
-TARGET_LINK_LIBRARIES (clickhouse-cpp-lib-static
- absl-lib
- cityhash-lib
- lz4-lib
+set(LIB_NAME "")
+
+if(BUILD_SHARED_LIBS)
+ ADD_LIBRARY (clickhouse-cpp-lib SHARED ${clickhouse-cpp-lib-src})
+ SET_TARGET_PROPERTIES(clickhouse-cpp-lib PROPERTIES LINKER_LANGUAGE CXX)
+ set(LIB_NAME "clickhouse-cpp-lib")
+else()
+ ADD_LIBRARY (clickhouse-cpp-lib-static STATIC ${clickhouse-cpp-lib-src})
+ set(LIB_NAME "clickhouse-cpp-lib-static")
+endif()
+
+TARGET_LINK_LIBRARIES ("${LIB_NAME}"
+ absl::base absl::numeric
@@ -42,7 +42,7 @@ ADD_LIBRARY (clickhouse-cpp-lib ${clickhouse-cpp-lib-src})
SET_TARGET_PROPERTIES (clickhouse-cpp-lib PROPERTIES LINKER_LANGUAGE CXX)
TARGET_LINK_LIBRARIES (clickhouse-cpp-lib
absl::int128
- cityhash::cityhash
+ cityhash
+ lz4::lz4
lz4::lz4
)
IF (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
@@ -68,12 +70,11 @@ IF (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# /usr/bin/ld: CMakeFiles/simple-test.dir/main.cpp.o: undefined reference to symbol '_Unwind_Resume@@GCC_3.0'
# /usr/bin/ld: /lib/x86_64-linux-gnu/libgcc_s.so.1: error adding symbols: DSO missing from command line
# FIXME: that workaround breaks clang build on mingw
- TARGET_LINK_LIBRARIES (clickhouse-cpp-lib gcc_s)
- TARGET_LINK_LIBRARIES (clickhouse-cpp-lib-static gcc_s)
+ TARGET_LINK_LIBRARIES (${LIB_NAME} gcc_s)
ENDIF ()
ENDIF ()
-INSTALL (TARGETS clickhouse-cpp-lib clickhouse-cpp-lib-static
+INSTALL (TARGETS ${LIB_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
)
@@ -123,11 +124,9 @@ INSTALL(FILES types/type_parser.h DESTINATION include/clickhouse/types/)
INSTALL(FILES types/types.h DESTINATION include/clickhouse/types/)
IF (WITH_OPENSSL)
- TARGET_LINK_LIBRARIES (clickhouse-cpp-lib OpenSSL::SSL)
- TARGET_LINK_LIBRARIES (clickhouse-cpp-lib-static OpenSSL::SSL)
+ TARGET_LINK_LIBRARIES (${LIB_NAME} OpenSSL::SSL)
ENDIF ()
IF (WIN32 OR MINGW)
- TARGET_LINK_LIBRARIES (clickhouse-cpp-lib wsock32 ws2_32)
- TARGET_LINK_LIBRARIES (clickhouse-cpp-lib-static wsock32 ws2_32)
+ TARGET_LINK_LIBRARIES (${LIB_NAME} wsock32 ws2_32)
ENDIF ()
TARGET_INCLUDE_DIRECTORIES (clickhouse-cpp-lib

View File

@ -0,0 +1,17 @@
diff --git a/clickhouse/base/socket.cpp b/clickhouse/base/socket.cpp
index 48e90c7..73503fb 100644
--- a/clickhouse/base/socket.cpp
+++ b/clickhouse/base/socket.cpp
@@ -129,10 +129,10 @@ void SetNonBlock(SOCKET fd, bool value) {
void SetTimeout(SOCKET fd, const SocketTimeoutParams& timeout_params) {
#if defined(_unix_)
- timeval recv_timeout{ timeout_params.recv_timeout.count() / 1000, static_cast<int>(timeout_params.recv_timeout.count() % 1000 * 1000) };
+ timeval recv_timeout{ static_cast<time_t>(timeout_params.recv_timeout.count() / 1000), static_cast<suseconds_t>(timeout_params.recv_timeout.count() % 1000 * 1000) };
auto recv_ret = setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &recv_timeout, sizeof(recv_timeout));
- timeval send_timeout{ timeout_params.send_timeout.count() / 1000, static_cast<int>(timeout_params.send_timeout.count() % 1000 * 1000) };
+ timeval send_timeout{ static_cast<time_t>(timeout_params.send_timeout.count() / 1000), static_cast<suseconds_t>(timeout_params.send_timeout.count() % 1000 * 1000) };
auto send_ret = setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &send_timeout, sizeof(send_timeout));
if (recv_ret == -1 || send_ret == -1) {

View File

@ -1,13 +0,0 @@
diff --git a/clickhouse/base/socket.cpp b/clickhouse/base/socket.cpp
index c6dc920..43bbd02 100644
--- a/clickhouse/base/socket.cpp
+++ b/clickhouse/base/socket.cpp
@@ -27,7 +27,7 @@ char const* windowsErrorCategory::name() const noexcept {
std::string windowsErrorCategory::message(int c) const {
char error[UINT8_MAX];
- auto len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, static_cast<DWORD>(c), 0, error, sizeof(error), nullptr);
+ auto len = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, static_cast<DWORD>(c), 0, error, sizeof(error), nullptr);
if (len == 0) {
return "unknown";
}

View File

@ -5,12 +5,12 @@ endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO ClickHouse/clickhouse-cpp
REF v2.2.1
SHA512 cf9f14e6bdbf2b739a25004c8f30ef8057cf4afa618c91fc2672059869cbbbdafb72f3027863b3f731f7f2cc239d5690e5e87301bf7930b79fe71d7a4ae3f833
REF "v${VERSION}"
SHA512 2719c034a2dc2de7e992aa17859ea437551bfe89395e6a708a4549ed274f366aee0c0f0bcd90a690c15f5361a8f8198bb4f1d7d986da98c1d632489bcfb8bdd0
HEAD_REF master
PATCHES
fix-deps-and-build-type.patch
fix-uwp.patch
fix-timeval.patch
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
@ -20,7 +20,11 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS ${FEATURE_OPTIONS}
OPTIONS
${FEATURE_OPTIONS}
-DWITH_SYSTEM_ABSEIL=ON
-DWITH_SYSTEM_LZ4=ON
-DWITH_SYSTEM_CITYHASH=ON
)
vcpkg_cmake_install()

View File

@ -1,6 +1,6 @@
{
"name": "clickhouse-cpp",
"version": "2.2.1",
"version": "2.4.0",
"description": "C++ client for Yandex ClickHouse",
"homepage": "https://github.com/ClickHouse/clickhouse-cpp",
"license": "Apache-2.0",

View File

@ -1601,7 +1601,7 @@
"port-version": 0
},
"clickhouse-cpp": {
"baseline": "2.2.1",
"baseline": "2.4.0",
"port-version": 0
},
"clipboardxx": {

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "d665e3d36b571b68596140563d1934e8b416aa23",
"version": "2.4.0",
"port-version": 0
},
{
"git-tree": "10588d8080311cbc920f1805d3dd51e5b9c27ebe",
"version": "2.2.1",