From d189bef5a6aa39f1631a9501632109ff624e9c0d Mon Sep 17 00:00:00 2001 From: German Date: Tue, 13 Feb 2024 23:40:25 +0300 Subject: [PATCH 1/4] Added the `CLICKHOUSE_CPP_` prefix for all cmake build options. --- .travis.yml | 2 +- CMakeLists.txt | 38 +++++++++++++++++++------------------- README.md | 2 +- clickhouse/CMakeLists.txt | 6 +++--- clickhouse/client.cpp | 8 ++++---- cmake/openssl.cmake | 4 ++-- ut/CMakeLists.txt | 2 +- 7 files changed, 31 insertions(+), 31 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7167c0c5..e80f7615 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,6 +57,6 @@ script: | eval "${MATRIX_EVAL}" mkdir build cd build - cmake .. -DBUILD_TESTS=ON && make + cmake .. -DCLICKHOUSE_CPP_BUILD_TESTS=ON && make if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./ut/clickhouse-cpp-ut ; fi if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./ut/clickhouse-cpp-ut --gtest_filter=-"Client/*:*Performance*" ; fi diff --git a/CMakeLists.txt b/CMakeLists.txt index e2639f0d..26ee4bec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,15 +7,15 @@ INCLUDE (subdirs) INCLUDE (openssl) INCLUDE (version) -OPTION (BUILD_BENCHMARK "Build benchmark" OFF) -OPTION (BUILD_TESTS "Build tests" OFF) -OPTION (BUILD_SHARED_LIBS "Build shared libs" OFF) -OPTION (WITH_OPENSSL "Use OpenSSL for TLS connections" OFF) -OPTION (WITH_SYSTEM_ABSEIL "Use system ABSEIL" OFF) -OPTION (WITH_SYSTEM_LZ4 "Use system LZ4" OFF) -OPTION (WITH_SYSTEM_CITYHASH "Use system cityhash" OFF) -OPTION (DEBUG_DEPENDENCIES "Print debug info about dependencies duting build" ON) -OPTION (CHECK_VERSION "Check that version number corresponds to git tag, usefull in CI/CD to validate that new version published on GitHub has same version in sources" ON) +OPTION (CLICKHOUSE_CPP_BUILD_BENCHMARK "Build benchmark" OFF) +OPTION (CLICKHOUSE_CPP_BUILD_TESTS "Build tests" OFF) +OPTION (CLICKHOUSE_CPP_BUILD_SHARED_LIBS "Build shared libs" OFF) +OPTION (CLICKHOUSE_CPP_WITH_OPENSSL "Use OpenSSL for TLS connections" OFF) +OPTION (CLICKHOUSE_CPP_WITH_SYSTEM_ABSEIL "Use system ABSEIL" OFF) +OPTION (CLICKHOUSE_CPP_WITH_SYSTEM_LZ4 "Use system LZ4" OFF) +OPTION (CLICKHOUSE_CPP_WITH_SYSTEM_CITYHASH "Use system cityhash" OFF) +OPTION (CLICKHOUSE_CPP_DEBUG_DEPENDENCIES "Print debug info about dependencies duting build" ON) +OPTION (CLICKHOUSE_CPP_CHECK_VERSION "Check that version number corresponds to git tag, usefull in CI/CD to validate that new version published on GitHub has same version in sources" ON) PROJECT (CLICKHOUSE-CLIENT VERSION "${CLICKHOUSE_CPP_VERSION}" @@ -25,7 +25,7 @@ PROJECT (CLICKHOUSE-CLIENT USE_CXX17 () USE_OPENSSL () -IF (CHECK_VERSION) +IF (CLICKHOUSE_CPP_CHECK_VERSION) clickhouse_cpp_check_library_version(FATAL_ERROR) ENDIF () @@ -44,7 +44,7 @@ IF (UNIX) ENDIF () IF (APPLE OR MSVC) - IF(BUILD_SHARED_LIBS) + IF(CLICKHOUSE_CPP_BUILD_SHARED_LIBS) MESSAGE(FATAL "Does not support shared on this platform") ENDIF() ENDIF() @@ -72,21 +72,21 @@ IF (CLANG_WITH_LIB_STDCXX) SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcc_s") ENDIF () -IF (WITH_SYSTEM_ABSEIL) +IF (CLICKHOUSE_CPP_WITH_SYSTEM_ABSEIL) FIND_PACKAGE(absl REQUIRED) ELSE () INCLUDE_DIRECTORIES (contrib/absl) SUBDIRS (contrib/absl/absl) ENDIF () -IF (WITH_SYSTEM_LZ4) +IF (CLICKHOUSE_CPP_WITH_SYSTEM_LZ4) FIND_PACKAGE(lz4 REQUIRED) ELSE () INCLUDE_DIRECTORIES (contrib/lz4/lz4) SUBDIRS (contrib/lz4/lz4) ENDIF () -IF (WITH_SYSTEM_CITYHASH) +IF (CLICKHOUSE_CPP_WITH_SYSTEM_CITYHASH) FIND_PACKAGE(cityhash REQUIRED) ELSE () INCLUDE_DIRECTORIES (contrib/cityhash/cityhash) @@ -97,20 +97,20 @@ SUBDIRS ( clickhouse ) -IF (BUILD_BENCHMARK) +IF (CLICKHOUSE_CPP_BUILD_BENCHMARK) SUBDIRS (bench) -ENDIF (BUILD_BENCHMARK) +ENDIF (CLICKHOUSE_CPP_BUILD_BENCHMARK) -IF (BUILD_TESTS) +IF (CLICKHOUSE_CPP_BUILD_TESTS) INCLUDE_DIRECTORIES (contrib/gtest/include contrib/gtest) SUBDIRS ( contrib/gtest tests/simple ut ) -ENDIF (BUILD_TESTS) +ENDIF (CLICKHOUSE_CPP_BUILD_TESTS) -if(DEBUG_DEPENDENCIES) +if(CLICKHOUSE_CPP_DEBUG_DEPENDENCIES) function(print_target_properties target) MESSAGE("${target} properties:") set(properties "${ARGN}") diff --git a/README.md b/README.md index 04fd2485..9340750f 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Optional dependencies: ```sh $ mkdir build . $ cd build -$ cmake .. [-DBUILD_TESTS=ON] +$ cmake .. [-DCLICKHOUSE_CPP_BUILD_TESTS=ON] $ make ``` diff --git a/clickhouse/CMakeLists.txt b/clickhouse/CMakeLists.txt index 1919418a..5a70403f 100644 --- a/clickhouse/CMakeLists.txt +++ b/clickhouse/CMakeLists.txt @@ -98,7 +98,7 @@ else() endif() endif() -IF (WITH_OPENSSL) +IF (CLICKHOUSE_CPP_WITH_OPENSSL) LIST(APPEND clickhouse-cpp-lib-src base/sslsocket.cpp) ENDIF () @@ -118,7 +118,7 @@ TARGET_INCLUDE_DIRECTORIES (clickhouse-cpp-lib PUBLIC ${PROJECT_SOURCE_DIR} ) -IF (NOT BUILD_SHARED_LIBS) +IF (NOT CLICKHOUSE_CPP_BUILD_SHARED_LIBS) ADD_LIBRARY (clickhouse-cpp-lib-static ALIAS clickhouse-cpp-lib) ELSE () SET_TARGET_PROPERTIES (clickhouse-cpp-lib @@ -206,7 +206,7 @@ INSTALL(FILES columns/uuid.h DESTINATION include/clickhouse/columns/) INSTALL(FILES types/type_parser.h DESTINATION include/clickhouse/types/) INSTALL(FILES types/types.h DESTINATION include/clickhouse/types/) -IF (WITH_OPENSSL) +IF (CLICKHOUSE_CPP_WITH_OPENSSL) TARGET_LINK_LIBRARIES (clickhouse-cpp-lib OpenSSL::SSL) ENDIF () diff --git a/clickhouse/client.cpp b/clickhouse/client.cpp index 7afafa4f..248f7b0a 100644 --- a/clickhouse/client.cpp +++ b/clickhouse/client.cpp @@ -13,7 +13,7 @@ #include #include -#if defined(WITH_OPENSSL) +#if defined(CLICKHOUSE_CPP_WITH_OPENSSL) #include "base/sslsocket.h" #endif @@ -71,7 +71,7 @@ std::ostream& operator<<(std::ostream& os, const ClientOptions& opt) { << " retry_timeout:" << opt.retry_timeout.count() << " compression_method:" << (opt.compression_method == CompressionMethod::LZ4 ? "LZ4" : "None"); -#if defined(WITH_OPENSSL) +#if defined(CLICKHOUSE_CPP_WITH_OPENSSL) if (opt.ssl_options) { const auto & ssl_options = *opt.ssl_options; os << " SSL (" @@ -91,7 +91,7 @@ std::ostream& operator<<(std::ostream& os, const ClientOptions& opt) { ClientOptions& ClientOptions::SetSSLOptions(ClientOptions::SSLOptions options) { -#ifdef WITH_OPENSSL +#ifdef CLICKHOUSE_CPP_WITH_OPENSSL ssl_options = options; return *this; #else @@ -104,7 +104,7 @@ namespace { std::unique_ptr GetSocketFactory(const ClientOptions& opts) { (void)opts; -#if defined(WITH_OPENSSL) +#if defined(CLICKHOUSE_CPP_WITH_OPENSSL) if (opts.ssl_options) return std::make_unique(opts); else diff --git a/cmake/openssl.cmake b/cmake/openssl.cmake index 05bd767e..75ce6862 100644 --- a/cmake/openssl.cmake +++ b/cmake/openssl.cmake @@ -1,8 +1,8 @@ MACRO (USE_OPENSSL) - IF (WITH_OPENSSL) + IF (CLICKHOUSE_CPP_WITH_OPENSSL) FIND_PACKAGE (OpenSSL REQUIRED) - ADD_COMPILE_DEFINITIONS (WITH_OPENSSL=1) + ADD_COMPILE_DEFINITIONS (CLICKHOUSE_CPP_WITH_OPENSSL=1) ENDIF () ENDMACRO () diff --git a/ut/CMakeLists.txt b/ut/CMakeLists.txt index 13ad51d8..b0068a53 100644 --- a/ut/CMakeLists.txt +++ b/ut/CMakeLists.txt @@ -28,7 +28,7 @@ SET ( clickhouse-cpp-ut-src low_cardinality_nullable_tests.cpp ) -IF (WITH_OPENSSL) +IF (CLICKHOUSE_CPP_WITH_OPENSSL) LIST (APPEND clickhouse-cpp-ut-src ssl_ut.cpp) ENDIF () From f78f0f2e1e2bf7a91fabfc3c8027b66e251284b5 Mon Sep 17 00:00:00 2001 From: German Date: Wed, 14 Feb 2024 00:54:49 +0300 Subject: [PATCH 2/4] Workflows fixed --- .github/workflows/linux.yml | 2 +- .github/workflows/macos.yml | 2 +- .github/workflows/windows_mingw.yml | 6 +++--- .github/workflows/windows_msvc.yml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 9f233f98..db7f8288 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -99,7 +99,7 @@ jobs: -D CMAKE_C_COMPILER=${{matrix.C_COMPILER}} \ -D CMAKE_CXX_COMPILER=${{matrix.CXX_COMPILER}} \ -D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ - -D BUILD_TESTS=ON \ + -D CLICKHOUSE_CPP_BUILD_TESTS=ON \ ${{matrix.SSL_CMAKE_OPTION}} \ ${{matrix.DEPENDENCIES_CMAKE_OPTIONS}} \ -S ${{github.workspace}} \ diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index b3faae21..b6d36e5b 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -47,7 +47,7 @@ jobs: run: | cmake \ -D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ - -D BUILD_TESTS=ON \ + -D CLICKHOUSE_CPP_BUILD_TESTS=ON \ ${{matrix.SSL_CMAKE_OPTION}} \ -S ${{github.workspace}} \ -B ${{github.workspace}}/build diff --git a/.github/workflows/windows_mingw.yml b/.github/workflows/windows_mingw.yml index 5681c7c4..6cff77fd 100644 --- a/.github/workflows/windows_mingw.yml +++ b/.github/workflows/windows_mingw.yml @@ -73,9 +73,9 @@ jobs: tar - name: Configure CMake - run: cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTS=ON -DCHECK_VERSION=OFF - # -DWITH_OPENSSL=ON was not able to make it work (some strange issues with CA paths, need debug) - # -DCHECK_VERSION=OFF since it requires git, which can't be found from within cmake for some reason. + run: cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCLICKHOUSE_CPP_BUILD_TESTS=ON -DCLICKHOUSE_CPP_CHECK_VERSION=OFF + # -DCLICKHOUSE_CPP_WITH_OPENSSL=ON was not able to make it work (some strange issues with CA paths, need debug) + # -DCLICKHOUSE_CPP_CHECK_VERSION=OFF since it requires git, which can't be found from within cmake for some reason. - name: Build run: cmake --build build --config ${{env.BUILD_TYPE}} --target all diff --git a/.github/workflows/windows_msvc.yml b/.github/workflows/windows_msvc.yml index 47fb6764..056bf976 100644 --- a/.github/workflows/windows_msvc.yml +++ b/.github/workflows/windows_msvc.yml @@ -48,7 +48,7 @@ jobs: - uses: ilammy/msvc-dev-cmd@v1 - name: Configure CMake - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTS=ON + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCLICKHOUSE_CPP_BUILD_TESTS=ON - name: Build run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} From 08d5f6550a618c9bead438c2392c3d03a2ce4a16 Mon Sep 17 00:00:00 2001 From: Vasily Nemkov Date: Sat, 24 Feb 2024 10:19:46 +0100 Subject: [PATCH 3/4] Starting CI/CD workflows on 3.0 --- .github/workflows/linux.yml | 4 ++-- .github/workflows/macos.yml | 5 +++-- .github/workflows/windows_mingw.yml | 4 ++-- .github/workflows/windows_msvc.yml | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index db7f8288..9994762a 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -4,9 +4,9 @@ on: schedule: - cron: '0 0 * * 1' push: - branches: [ master ] + branches: [ master, '[1-9].*' ] pull_request: - branches: [ master ] + branches: [ master, '[1-9].*' ] release: types: diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index b6d36e5b..d80566a4 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -4,9 +4,10 @@ on: schedule: - cron: '0 0 * * 1' push: - branches: [ master ] + branches: [ master, '[1-9].*' ] pull_request: - branches: [ master ] + branches: [ master, '[1-9].*' ] + release: types: - published diff --git a/.github/workflows/windows_mingw.yml b/.github/workflows/windows_mingw.yml index 6cff77fd..d5e00799 100644 --- a/.github/workflows/windows_mingw.yml +++ b/.github/workflows/windows_mingw.yml @@ -4,9 +4,9 @@ on: schedule: - cron: '0 0 * * 1' push: - branches: [ master ] + branches: [ master, '3.*' ] pull_request: - branches: [ master ] + branches: [ master, '3.*' ] release: types: diff --git a/.github/workflows/windows_msvc.yml b/.github/workflows/windows_msvc.yml index 056bf976..94c5aa6c 100644 --- a/.github/workflows/windows_msvc.yml +++ b/.github/workflows/windows_msvc.yml @@ -4,9 +4,9 @@ on: schedule: - cron: '0 0 * * 1' push: - branches: [ master ] + branches: [ master, '[1-9]*' ] pull_request: - branches: [ master ] + branches: [ master, '[1-9]*' ] release: types: From b94789970675f829fa90887d3728f2bec7abc37d Mon Sep 17 00:00:00 2001 From: Vasily Nemkov Date: Sat, 24 Feb 2024 10:22:20 +0100 Subject: [PATCH 4/4] start workflows on more events --- .github/workflows/macos.yml | 12 ++++++++++-- .github/workflows/windows_mingw.yml | 12 ++++++++++-- .github/workflows/windows_msvc.yml | 12 ++++++++++-- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index d80566a4..af12a99d 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -4,9 +4,17 @@ on: schedule: - cron: '0 0 * * 1' push: - branches: [ master, '[1-9].*' ] + branches: + - master + - '[1-9].*' pull_request: - branches: [ master, '[1-9].*' ] + types: + - synchronize + - reopened + - opened + branches: + - master + - '[1-9].*' release: types: diff --git a/.github/workflows/windows_mingw.yml b/.github/workflows/windows_mingw.yml index d5e00799..36148755 100644 --- a/.github/workflows/windows_mingw.yml +++ b/.github/workflows/windows_mingw.yml @@ -4,9 +4,17 @@ on: schedule: - cron: '0 0 * * 1' push: - branches: [ master, '3.*' ] + branches: + - master + - '[1-9].*' pull_request: - branches: [ master, '3.*' ] + types: + - synchronize + - reopened + - opened + branches: + - master + - '[1-9].*' release: types: diff --git a/.github/workflows/windows_msvc.yml b/.github/workflows/windows_msvc.yml index 94c5aa6c..828e2d8b 100644 --- a/.github/workflows/windows_msvc.yml +++ b/.github/workflows/windows_msvc.yml @@ -4,9 +4,17 @@ on: schedule: - cron: '0 0 * * 1' push: - branches: [ master, '[1-9]*' ] + branches: + - master + - '[1-9].*' pull_request: - branches: [ master, '[1-9]*' ] + types: + - synchronize + - reopened + - opened + branches: + - master + - '[1-9].*' release: types: