diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index e64b8406..ac0fdcfe 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -14,8 +14,9 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - compiler: [clang-6, gcc-7, gcc-8, gcc-9] - ssl: [ssl_ON, ssl_OFF] + compiler: [] + ssl: [] + dependencies: [] include: - compiler: clang-6 INSTALL: clang-6.0 @@ -39,10 +40,16 @@ jobs: - ssl: ssl_ON INSTALL_SSL: libssl-dev - EXTRA_CMAKE_FLAGS: -DWITH_OPENSSL=ON + OPENSSL_CMAKE_OPTION: -DWITH_OPENSSL=ON - ssl: ssl_OFF - EXTRA_CMAKE_FLAGS: -DWITH_OPENSSL=OFF + OPENSSL_CMAKE_OPTION: -DWITH_OPENSSL=OFF + + - dependencies: dependencies_SYSTEM + DEPENDENCIES_CMAKE_OPTIONS: -DWITH_SYSTEM_ABSEIL=ON -DWITH_SYSTEM_LZ4=ON -DWITH_SYSTEM_CITYHASH=ON + + - dependencies: dependencies_BUILT_IN + DEPENDENCIES_CMAKE_OPTIONS: -DWITH_SYSTEM_ABSEIL=OFF -DWITH_SYSTEM_LZ4=OFF -DWITH_SYSTEM_CITYHASH=OFF steps: - uses: actions/checkout@v2 @@ -57,7 +64,8 @@ jobs: -DCMAKE_CXX_COMPILER=${{ matrix.CXX_COMPILER}} \ -B ${{github.workspace}}/build \ -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTS=ON \ - ${{ matrix.EXTRA_CMAKE_FLAGS }} + ${{ matrix.OPENSSL_CMAKE_OPTION}} \ + ${{ matrix.DEPENDENCIES_CMAKE_OPTIONS }} - name: Build run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target all diff --git a/CMakeLists.txt b/CMakeLists.txt index 31cd8a5a..fe721ae3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,9 @@ INCLUDE (cmake/openssl.cmake) OPTION (BUILD_BENCHMARK "Build benchmark" OFF) OPTION (BUILD_TESTS "Build tests" OFF) OPTION (WITH_OPENSSL "Use OpenSSL for TLS connections" OFF) +OPTION (USE_SYSTEM_ABSEIL "Use system ABSEIL" OFF) +OPTION (USE_SYSTEM_LZ4 "Use system LZ4" OFF) +OPTION (USE_SYSTEM_CITYHASH "Use system cityhash" OFF) PROJECT (CLICKHOUSE-CLIENT) @@ -27,13 +30,30 @@ PROJECT (CLICKHOUSE-CLIENT) ENDIF () INCLUDE_DIRECTORIES (.) - INCLUDE_DIRECTORIES (contrib) + + IF (USE_SYSTEM_ABSEIL) + FIND_PACKAGE(absl REQUIRED) + ELSE () + INCLUDE_DIRECTORIES (contrib/absl) + SUBDIRS (contrib/absl/absl) + ENDIF () + + IF (USE_SYSTEM_LZ4) + FIND_PACKAGE(lz4 REQUIRED) + ELSE () + INCLUDE_DIRECTORIES (contrib/lz4/lz4) + SUBDIRS (contrib/lz4/lz4) + ENDIF () + + IF (USE_SYSTEM_CITYHASH) + FIND_PACKAGE(cityhash REQUIRED) + ELSE () + INCLUDE_DIRECTORIES (contrib/cityhash/cityhash) + SUBDIRS (contrib/cityhash/cityhash) + ENDIF () SUBDIRS ( clickhouse - contrib/absl - contrib/cityhash - contrib/lz4 ) IF (BUILD_BENCHMARK) diff --git a/clickhouse/CMakeLists.txt b/clickhouse/CMakeLists.txt index 3ad235a3..1f6f9d2f 100644 --- a/clickhouse/CMakeLists.txt +++ b/clickhouse/CMakeLists.txt @@ -38,16 +38,16 @@ 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 + absl::absl + cityhash::cityhash + lz4::lz4 ) ADD_LIBRARY (clickhouse-cpp-lib-static STATIC ${clickhouse-cpp-lib-src}) TARGET_LINK_LIBRARIES (clickhouse-cpp-lib-static - absl-lib - cityhash-lib - lz4-lib + absl::absl + cityhash::cityhash + lz4::lz4 ) IF (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") diff --git a/clickhouse/base/compressed.cpp b/clickhouse/base/compressed.cpp index baf0ffed..0a701b0d 100644 --- a/clickhouse/base/compressed.cpp +++ b/clickhouse/base/compressed.cpp @@ -3,8 +3,8 @@ #include "output.h" #include "../exceptions.h" -#include -#include +#include +#include #include #include diff --git a/clickhouse/columns/lowcardinality.cpp b/clickhouse/columns/lowcardinality.cpp index 694e3eda..1b5bc937 100644 --- a/clickhouse/columns/lowcardinality.cpp +++ b/clickhouse/columns/lowcardinality.cpp @@ -4,7 +4,7 @@ #include "nullable.h" #include "../base/wire_format.h" -#include +#include #include #include diff --git a/clickhouse/types/types.cpp b/clickhouse/types/types.cpp index 8dc6688b..9649bd1f 100644 --- a/clickhouse/types/types.cpp +++ b/clickhouse/types/types.cpp @@ -2,7 +2,7 @@ #include "../exceptions.h" -#include +#include #include diff --git a/contrib/absl/CMakeLists.txt b/contrib/absl/CMakeLists.txt deleted file mode 100644 index 87c8dff1..00000000 --- a/contrib/absl/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -ADD_LIBRARY (absl-lib STATIC - numeric/int128.cc -) diff --git a/contrib/absl/absl/CMakeLists.txt b/contrib/absl/absl/CMakeLists.txt new file mode 100644 index 00000000..eaec8673 --- /dev/null +++ b/contrib/absl/absl/CMakeLists.txt @@ -0,0 +1,5 @@ +ADD_LIBRARY (absl STATIC + numeric/int128.cc +) + +ADD_LIBRARY (absl::absl ALIAS absl) diff --git a/contrib/absl/base/attributes.h b/contrib/absl/absl/base/attributes.h similarity index 100% rename from contrib/absl/base/attributes.h rename to contrib/absl/absl/base/attributes.h diff --git a/contrib/absl/base/config.h b/contrib/absl/absl/base/config.h similarity index 100% rename from contrib/absl/base/config.h rename to contrib/absl/absl/base/config.h diff --git a/contrib/absl/base/internal/bits.h b/contrib/absl/absl/base/internal/bits.h similarity index 100% rename from contrib/absl/base/internal/bits.h rename to contrib/absl/absl/base/internal/bits.h diff --git a/contrib/absl/base/macros.h b/contrib/absl/absl/base/macros.h similarity index 100% rename from contrib/absl/base/macros.h rename to contrib/absl/absl/base/macros.h diff --git a/contrib/absl/base/optimization.h b/contrib/absl/absl/base/optimization.h similarity index 100% rename from contrib/absl/base/optimization.h rename to contrib/absl/absl/base/optimization.h diff --git a/contrib/absl/base/options.h b/contrib/absl/absl/base/options.h similarity index 100% rename from contrib/absl/base/options.h rename to contrib/absl/absl/base/options.h diff --git a/contrib/absl/base/policy_checks.h b/contrib/absl/absl/base/policy_checks.h similarity index 100% rename from contrib/absl/base/policy_checks.h rename to contrib/absl/absl/base/policy_checks.h diff --git a/contrib/absl/base/port.h b/contrib/absl/absl/base/port.h similarity index 100% rename from contrib/absl/base/port.h rename to contrib/absl/absl/base/port.h diff --git a/contrib/absl/numeric/int128.cc b/contrib/absl/absl/numeric/int128.cc similarity index 100% rename from contrib/absl/numeric/int128.cc rename to contrib/absl/absl/numeric/int128.cc diff --git a/contrib/absl/numeric/int128.h b/contrib/absl/absl/numeric/int128.h similarity index 100% rename from contrib/absl/numeric/int128.h rename to contrib/absl/absl/numeric/int128.h diff --git a/contrib/absl/numeric/int128_have_intrinsic.inc b/contrib/absl/absl/numeric/int128_have_intrinsic.inc similarity index 100% rename from contrib/absl/numeric/int128_have_intrinsic.inc rename to contrib/absl/absl/numeric/int128_have_intrinsic.inc diff --git a/contrib/absl/numeric/int128_no_intrinsic.inc b/contrib/absl/absl/numeric/int128_no_intrinsic.inc similarity index 100% rename from contrib/absl/numeric/int128_no_intrinsic.inc rename to contrib/absl/absl/numeric/int128_no_intrinsic.inc diff --git a/contrib/cityhash/CMakeLists.txt b/contrib/cityhash/CMakeLists.txt deleted file mode 100644 index e31bc245..00000000 --- a/contrib/cityhash/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -ADD_LIBRARY (cityhash-lib STATIC - city.cc -) - -set_property(TARGET cityhash-lib PROPERTY POSITION_INDEPENDENT_CODE ON) diff --git a/contrib/cityhash/BUCK b/contrib/cityhash/cityhash/BUCK similarity index 100% rename from contrib/cityhash/BUCK rename to contrib/cityhash/cityhash/BUCK diff --git a/contrib/cityhash/cityhash/CMakeLists.txt b/contrib/cityhash/cityhash/CMakeLists.txt new file mode 100644 index 00000000..d1311562 --- /dev/null +++ b/contrib/cityhash/cityhash/CMakeLists.txt @@ -0,0 +1,7 @@ +ADD_LIBRARY (cityhash STATIC + city.cc +) + +set_property(TARGET cityhash PROPERTY POSITION_INDEPENDENT_CODE ON) + +ADD_LIBRARY (cityhash::cityhash ALIAS cityhash) diff --git a/contrib/cityhash/COPYING b/contrib/cityhash/cityhash/COPYING similarity index 100% rename from contrib/cityhash/COPYING rename to contrib/cityhash/cityhash/COPYING diff --git a/contrib/cityhash/city.cc b/contrib/cityhash/cityhash/city.cc similarity index 100% rename from contrib/cityhash/city.cc rename to contrib/cityhash/cityhash/city.cc diff --git a/contrib/cityhash/city.h b/contrib/cityhash/cityhash/city.h similarity index 100% rename from contrib/cityhash/city.h rename to contrib/cityhash/cityhash/city.h diff --git a/contrib/cityhash/citycrc.h b/contrib/cityhash/cityhash/citycrc.h similarity index 100% rename from contrib/cityhash/citycrc.h rename to contrib/cityhash/cityhash/citycrc.h diff --git a/contrib/cityhash/config.h b/contrib/cityhash/cityhash/config.h similarity index 100% rename from contrib/cityhash/config.h rename to contrib/cityhash/cityhash/config.h diff --git a/contrib/lz4/CMakeLists.txt b/contrib/lz4/CMakeLists.txt deleted file mode 100644 index 7b471da3..00000000 --- a/contrib/lz4/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -ADD_LIBRARY (lz4-lib STATIC - lz4.c - lz4hc.c -) - -set_property(TARGET lz4-lib PROPERTY POSITION_INDEPENDENT_CODE ON) diff --git a/contrib/lz4/BUCK b/contrib/lz4/lz4/BUCK similarity index 100% rename from contrib/lz4/BUCK rename to contrib/lz4/lz4/BUCK diff --git a/contrib/lz4/lz4/CMakeLists.txt b/contrib/lz4/lz4/CMakeLists.txt new file mode 100644 index 00000000..1ec7fb07 --- /dev/null +++ b/contrib/lz4/lz4/CMakeLists.txt @@ -0,0 +1,8 @@ +ADD_LIBRARY (lz4 STATIC + lz4.c + lz4hc.c +) + +set_property(TARGET lz4 PROPERTY POSITION_INDEPENDENT_CODE ON) + +ADD_LIBRARY(lz4::lz4 ALIAS lz4) diff --git a/contrib/lz4/LICENSE b/contrib/lz4/lz4/LICENSE similarity index 100% rename from contrib/lz4/LICENSE rename to contrib/lz4/lz4/LICENSE diff --git a/contrib/lz4/lz4.c b/contrib/lz4/lz4/lz4.c similarity index 100% rename from contrib/lz4/lz4.c rename to contrib/lz4/lz4/lz4.c diff --git a/contrib/lz4/lz4.h b/contrib/lz4/lz4/lz4.h similarity index 100% rename from contrib/lz4/lz4.h rename to contrib/lz4/lz4/lz4.h diff --git a/contrib/lz4/lz4hc.c b/contrib/lz4/lz4/lz4hc.c similarity index 100% rename from contrib/lz4/lz4hc.c rename to contrib/lz4/lz4/lz4hc.c diff --git a/contrib/lz4/lz4hc.h b/contrib/lz4/lz4/lz4hc.h similarity index 100% rename from contrib/lz4/lz4hc.h rename to contrib/lz4/lz4/lz4hc.h