diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 9f233f98..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: @@ -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..af12a99d 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -4,9 +4,18 @@ on: schedule: - cron: '0 0 * * 1' push: - branches: [ master ] + branches: + - master + - '[1-9].*' pull_request: - branches: [ master ] + types: + - synchronize + - reopened + - opened + branches: + - master + - '[1-9].*' + release: types: - published @@ -47,7 +56,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..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 ] + branches: + - master + - '[1-9].*' pull_request: - branches: [ master ] + types: + - synchronize + - reopened + - opened + branches: + - master + - '[1-9].*' release: types: @@ -73,9 +81,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..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 ] + branches: + - master + - '[1-9].*' pull_request: - branches: [ master ] + types: + - synchronize + - reopened + - opened + branches: + - master + - '[1-9].*' release: types: @@ -48,7 +56,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}} 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 77c1decf..10d8ed0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,15 +7,17 @@ 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" OFF) + +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" OFF) + PROJECT (CLICKHOUSE-CLIENT VERSION "${CLICKHOUSE_CPP_VERSION}" @@ -25,7 +27,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 +46,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 +74,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 +99,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 25810274..63a3facd 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 @@ -87,7 +87,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 (" @@ -107,7 +107,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 @@ -120,7 +120,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 ()