From 550e430c2836cbe600165d2e156d8a07de545960 Mon Sep 17 00:00:00 2001 From: Robert Schulze Date: Mon, 1 May 2023 20:37:33 +0000 Subject: [PATCH] A better way of excluding ISA-L on non-x86 Follow-up to #49256. More 'modern', i.e. uses a CMake TARGET exists check instead of an internal variable. --- CMakeLists.txt | 18 +++--------------- contrib/CMakeLists.txt | 16 +++------------- contrib/isa-l-cmake/CMakeLists.txt | 4 ++++ contrib/libhdfs3-cmake/CMakeLists.txt | 2 +- 4 files changed, 11 insertions(+), 29 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c6ca18773a7..263b202049b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -170,18 +170,6 @@ else () set(NO_WHOLE_ARCHIVE --no-whole-archive) endif () -option(ENABLE_CURL_BUILD "Enable curl, azure, sentry build on by default except MacOS." ON) -if (OS_DARWIN) - # Disable the curl, azure, senry build on MacOS - set (ENABLE_CURL_BUILD OFF) -endif () - -option(ENABLE_ISAL_LIBRARY "Enable ISA-L library ON by default except on aarch64." ON) -if (ARCH_AARCH64) - # Disable ISA-L libray on aarch64. - set (ENABLE_ISAL_LIBRARY OFF) -endif () - if (NOT CMAKE_BUILD_TYPE_UC STREQUAL "RELEASE") # Can be lld or ld-lld or lld-13 or /path/to/lld. if (LINKER_NAME MATCHES "lld") @@ -399,9 +387,9 @@ else() endif () option (ENABLE_GWP_ASAN "Enable Gwp-Asan" ON) -# We use mmap for allocations more heavily in debug builds, -# but GWP-ASan also wants to use mmap frequently, -# and due to a large number of memory mappings, +# We use mmap for allocations more heavily in debug builds, +# but GWP-ASan also wants to use mmap frequently, +# and due to a large number of memory mappings, # it does not work together well. if ((NOT OS_LINUX AND NOT OS_ANDROID) OR (CMAKE_BUILD_TYPE_UC STREQUAL "DEBUG")) set(ENABLE_GWP_ASAN OFF) diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index f88323f022b..53aa12f8aca 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -141,20 +141,19 @@ add_contrib (libuv-cmake libuv) add_contrib (liburing-cmake liburing) add_contrib (amqpcpp-cmake AMQP-CPP) # requires: libuv add_contrib (cassandra-cmake cassandra) # requires: libuv - -if (ENABLE_CURL_BUILD) +if (NOT OS_DARWIN) add_contrib (curl-cmake curl) add_contrib (azure-cmake azure) add_contrib (sentry-native-cmake sentry-native) # requires: curl endif() - add_contrib (fmtlib-cmake fmtlib) add_contrib (krb5-cmake krb5) add_contrib (cyrus-sasl-cmake cyrus-sasl) # for krb5 add_contrib (libgsasl-cmake libgsasl) # requires krb5 add_contrib (librdkafka-cmake librdkafka) # requires: libgsasl add_contrib (nats-io-cmake nats-io) -add_contrib (libhdfs3-cmake libhdfs3) # requires: protobuf, krb5 +add_contrib (isa-l-cmake isa-l) +add_contrib (libhdfs3-cmake libhdfs3) # requires: protobuf, krb5, isa-l add_contrib (hive-metastore-cmake hive-metastore) # requires: thrift/avro/arrow/libhdfs3 add_contrib (cppkafka-cmake cppkafka) add_contrib (libpqxx-cmake libpqxx) @@ -178,23 +177,14 @@ add_contrib (s2geometry-cmake s2geometry) add_contrib (c-ares-cmake c-ares) add_contrib (qpl-cmake qpl) add_contrib (morton-nd-cmake morton-nd) - if (ARCH_S390X) add_contrib(crc32-s390x-cmake crc32-s390x) endif() - add_contrib (annoy-cmake annoy) - add_contrib (xxHash-cmake xxHash) - add_contrib (google-benchmark-cmake google-benchmark) - add_contrib (ulid-c-cmake ulid-c) -if (ENABLE_ISAL_LIBRARY) - add_contrib (isa-l-cmake isa-l) -endif() - # Put all targets defined here and in subdirectories under "contrib/" folders in GUI-based IDEs. # Some of third-party projects may override CMAKE_FOLDER or FOLDER property of their targets, so they would not appear # in "contrib/..." as originally planned, so we workaround this by fixing FOLDER properties of all targets manually, diff --git a/contrib/isa-l-cmake/CMakeLists.txt b/contrib/isa-l-cmake/CMakeLists.txt index 5c549cbba02..234a02f218e 100644 --- a/contrib/isa-l-cmake/CMakeLists.txt +++ b/contrib/isa-l-cmake/CMakeLists.txt @@ -1,3 +1,7 @@ +if (NOT ARCH_AMD64) + return() +endif () + set(ISAL_SOURCE_DIR "${ClickHouse_SOURCE_DIR}/contrib/isa-l") # The YASM and NASM assembers are somewhat mutually compatible. ISAL specifically needs NASM. If only YASM is installed, then check_language(ASM_NASM) diff --git a/contrib/libhdfs3-cmake/CMakeLists.txt b/contrib/libhdfs3-cmake/CMakeLists.txt index ecc0627354a..fd9ed7dc182 100644 --- a/contrib/libhdfs3-cmake/CMakeLists.txt +++ b/contrib/libhdfs3-cmake/CMakeLists.txt @@ -172,7 +172,7 @@ if (TARGET OpenSSL::SSL) target_link_libraries(_hdfs3 PRIVATE OpenSSL::Crypto OpenSSL::SSL) endif() -if (ENABLE_ISAL_LIBRARY) +if (TARGET ch_contrib::isal) target_link_libraries(_hdfs3 PRIVATE ch_contrib::isal) add_definitions(-DHADOOP_ISAL_LIBRARY) endif()