2021-04-13 18:53:55 +00:00
|
|
|
add_subdirectory(divide)
|
|
|
|
|
2021-04-24 19:47:52 +00:00
|
|
|
include("${ClickHouse_SOURCE_DIR}/cmake/dbms_glob_sources.cmake")
|
2018-12-23 14:19:11 +00:00
|
|
|
add_headers_and_sources(clickhouse_functions .)
|
2018-06-19 18:09:09 +00:00
|
|
|
|
2022-07-04 07:01:39 +00:00
|
|
|
list(REMOVE_ITEM clickhouse_functions_sources IFunction.cpp FunctionFactory.cpp FunctionHelpers.cpp extractTimeZoneFromFunctionArguments.cpp FunctionsLogical.cpp)
|
|
|
|
list(REMOVE_ITEM clickhouse_functions_headers IFunction.h FunctionFactory.h FunctionHelpers.h extractTimeZoneFromFunctionArguments.h FunctionsLogical.h)
|
2017-04-21 17:47:27 +00:00
|
|
|
|
2022-07-04 07:01:39 +00:00
|
|
|
add_library(clickhouse_functions_obj OBJECT ${clickhouse_functions_sources})
|
2018-04-07 02:29:12 +00:00
|
|
|
|
2022-07-04 07:01:39 +00:00
|
|
|
list (APPEND OBJECT_LIBS $<TARGET_OBJECTS:clickhouse_functions_obj>)
|
|
|
|
|
|
|
|
list (APPEND PUBLIC_LIBS
|
2022-05-09 13:37:03 +00:00
|
|
|
ch_contrib::wyhash
|
2022-01-17 19:09:12 +00:00
|
|
|
ch_contrib::cityhash
|
2022-01-17 19:16:12 +00:00
|
|
|
ch_contrib::farmhash
|
2018-11-28 11:37:12 +00:00
|
|
|
clickhouse_dictionaries
|
2019-07-03 16:53:20 +00:00
|
|
|
clickhouse_dictionaries_embedded
|
2020-08-17 08:20:20 +00:00
|
|
|
clickhouse_parsers
|
2022-01-20 14:12:54 +00:00
|
|
|
ch_contrib::consistent_hashing
|
2020-06-09 10:54:49 +00:00
|
|
|
dbms
|
2022-01-20 14:22:24 +00:00
|
|
|
ch_contrib::metrohash
|
2022-01-20 14:25:19 +00:00
|
|
|
ch_contrib::murmurhash
|
2022-05-18 23:40:28 +00:00
|
|
|
ch_contrib::hashidsxx
|
2022-09-25 17:58:00 +00:00
|
|
|
ch_contrib::morton_nd
|
2022-07-04 07:01:39 +00:00
|
|
|
)
|
2019-07-03 16:53:20 +00:00
|
|
|
|
2022-07-04 07:01:39 +00:00
|
|
|
list (APPEND PRIVATE_LIBS
|
2022-01-16 10:34:54 +00:00
|
|
|
ch_contrib::zlib
|
2020-06-09 10:54:49 +00:00
|
|
|
boost::filesystem
|
2021-04-13 18:53:55 +00:00
|
|
|
divide_impl
|
2022-11-25 23:14:08 +00:00
|
|
|
ch_contrib::xxHash
|
2019-03-22 11:18:24 +00:00
|
|
|
)
|
2018-04-07 02:29:12 +00:00
|
|
|
|
2022-09-12 19:51:43 +00:00
|
|
|
if (TARGET ch_rust::blake3)
|
2022-08-02 17:44:12 +00:00
|
|
|
list (APPEND PUBLIC_LIBS
|
2022-09-12 19:51:43 +00:00
|
|
|
ch_rust::blake3
|
2022-08-02 17:44:12 +00:00
|
|
|
)
|
2022-01-09 19:52:03 +00:00
|
|
|
endif()
|
|
|
|
|
2022-01-17 05:45:10 +00:00
|
|
|
if (TARGET OpenSSL::Crypto)
|
2022-07-04 07:01:39 +00:00
|
|
|
list (APPEND PUBLIC_LIBS OpenSSL::Crypto)
|
2019-03-22 11:18:24 +00:00
|
|
|
endif()
|
2018-04-07 02:29:12 +00:00
|
|
|
|
2022-06-29 16:21:28 +00:00
|
|
|
if (OMIT_HEAVY_DEBUG_SYMBOLS)
|
2022-07-04 07:01:39 +00:00
|
|
|
target_compile_options(clickhouse_functions_obj PRIVATE "-g0")
|
2020-09-09 18:17:01 +00:00
|
|
|
endif()
|
2017-10-24 13:30:44 +00:00
|
|
|
|
2022-01-17 19:20:39 +00:00
|
|
|
if (TARGET ch_contrib::icu)
|
2022-07-04 07:01:39 +00:00
|
|
|
list (APPEND PRIVATE_LIBS ch_contrib::icu)
|
2018-01-19 17:04:32 +00:00
|
|
|
endif ()
|
|
|
|
|
2022-01-17 21:07:59 +00:00
|
|
|
if (TARGET ch_contrib::fastops)
|
2022-07-04 07:01:39 +00:00
|
|
|
list (APPEND PRIVATE_LIBS ch_contrib::fastops)
|
2017-08-03 12:44:39 +00:00
|
|
|
endif ()
|
|
|
|
|
2021-04-26 22:51:42 +00:00
|
|
|
if (ENABLE_EXAMPLES)
|
|
|
|
add_subdirectory(examples)
|
2017-04-10 17:43:30 +00:00
|
|
|
endif ()
|
Add a JIT interface for row-wise default-nullable functions.
Not actually implemented, though. It does print out some jit-compiled stuff,
but that's about it. For example, this query:
select number from system.numbers where something(cast(number as Float64)) == 4
results in this on server's stderr:
define double @"something(CAST(number, 'Float64'))"(void**, i8*, void*) {
"something(CAST(number, 'Float64'))":
ret double 1.234500e+04
}
(and an exception, because that's what the non-jitted method does.)
As one may notice, this function neither reads the input (first argument;
tuple of arrays) nor writes the output (third argument; array), instead
returning some general nonsense.
In addition, `#if USE_EMBEDDED_COMPILER` doesn't work for some reason,
including LLVM headers requires -Wno-unused-parameter, this probably only
works on LLVM 5.0 due to rampant API instability, and I'm definitely
no expert on CMake. In short, there's still a long way to go.
2018-04-23 22:29:39 +00:00
|
|
|
|
2022-01-18 06:48:23 +00:00
|
|
|
if (TARGET ch_contrib::llvm)
|
2022-07-04 07:01:39 +00:00
|
|
|
list (APPEND PRIVATE_LIBS ch_contrib::llvm)
|
Add a JIT interface for row-wise default-nullable functions.
Not actually implemented, though. It does print out some jit-compiled stuff,
but that's about it. For example, this query:
select number from system.numbers where something(cast(number as Float64)) == 4
results in this on server's stderr:
define double @"something(CAST(number, 'Float64'))"(void**, i8*, void*) {
"something(CAST(number, 'Float64'))":
ret double 1.234500e+04
}
(and an exception, because that's what the non-jitted method does.)
As one may notice, this function neither reads the input (first argument;
tuple of arrays) nor writes the output (third argument; array), instead
returning some general nonsense.
In addition, `#if USE_EMBEDDED_COMPILER` doesn't work for some reason,
including LLVM headers requires -Wno-unused-parameter, this probably only
works on LLVM 5.0 due to rampant API instability, and I'm definitely
no expert on CMake. In short, there's still a long way to go.
2018-04-23 22:29:39 +00:00
|
|
|
endif ()
|
2018-10-11 16:22:50 +00:00
|
|
|
|
2022-01-17 20:32:13 +00:00
|
|
|
if (TARGET ch_contrib::base64)
|
2022-07-04 07:01:39 +00:00
|
|
|
list (APPEND PRIVATE_LIBS ch_contrib::base64)
|
2018-11-23 18:52:00 +00:00
|
|
|
endif()
|
2019-02-24 21:20:46 +00:00
|
|
|
|
2022-01-25 09:54:43 +00:00
|
|
|
if (ENABLE_NLP)
|
2022-07-04 07:01:39 +00:00
|
|
|
list (APPEND PRIVATE_LIBS ch_contrib::cld2)
|
2021-05-31 13:38:51 +00:00
|
|
|
endif()
|
2019-03-25 14:34:52 +00:00
|
|
|
|
2022-01-17 21:17:35 +00:00
|
|
|
if (TARGET ch_contrib::h3)
|
2022-07-04 07:01:39 +00:00
|
|
|
list (APPEND PRIVATE_LIBS ch_contrib::h3)
|
2019-03-25 14:34:52 +00:00
|
|
|
endif()
|
2019-06-20 10:53:17 +00:00
|
|
|
|
2022-06-17 10:15:19 +00:00
|
|
|
if (TARGET ch_contrib::vectorscan)
|
2022-07-04 07:01:39 +00:00
|
|
|
list (APPEND PRIVATE_LIBS ch_contrib::vectorscan)
|
2022-01-18 07:21:41 +00:00
|
|
|
endif()
|
2019-03-14 04:48:30 +00:00
|
|
|
|
2022-01-17 19:29:50 +00:00
|
|
|
if (TARGET ch_contrib::simdjson)
|
2022-07-04 07:01:39 +00:00
|
|
|
list (APPEND PRIVATE_LIBS ch_contrib::simdjson)
|
2019-05-15 17:19:39 +00:00
|
|
|
endif()
|
2019-05-16 17:40:24 +00:00
|
|
|
|
2022-01-17 19:37:33 +00:00
|
|
|
if (TARGET ch_contrib::rapidjson)
|
2022-07-04 07:01:39 +00:00
|
|
|
list (APPEND PRIVATE_LIBS ch_contrib::rapidjson)
|
2019-05-16 17:40:24 +00:00
|
|
|
endif()
|
2019-06-20 15:49:54 +00:00
|
|
|
|
2019-06-21 15:31:37 +00:00
|
|
|
add_subdirectory(GatherUtils)
|
2022-07-04 07:01:39 +00:00
|
|
|
list (APPEND PRIVATE_LIBS clickhouse_functions_gatherutils)
|
2019-06-21 15:31:37 +00:00
|
|
|
|
2019-06-20 15:49:54 +00:00
|
|
|
add_subdirectory(URL)
|
2022-07-04 07:01:39 +00:00
|
|
|
list (APPEND OBJECT_LIBS $<TARGET_OBJECTS:clickhouse_functions_url>)
|
2019-06-21 15:31:37 +00:00
|
|
|
|
|
|
|
add_subdirectory(array)
|
2022-07-04 07:01:39 +00:00
|
|
|
list (APPEND OBJECT_LIBS $<TARGET_OBJECTS:clickhouse_functions_array>)
|
2020-07-09 10:57:05 +00:00
|
|
|
|
2022-08-05 06:11:52 +00:00
|
|
|
if (TARGET ch_contrib::datasketches)
|
|
|
|
add_subdirectory(UniqTheta)
|
|
|
|
list (APPEND OBJECT_LIBS $<TARGET_OBJECTS:clickhouse_functions_uniqtheta>)
|
|
|
|
endif()
|
|
|
|
|
2021-03-24 19:47:28 +00:00
|
|
|
add_subdirectory(JSONPath)
|
2022-07-04 07:01:39 +00:00
|
|
|
list (APPEND PRIVATE_LIBS clickhouse_functions_jsonpath)
|
2021-03-24 19:47:28 +00:00
|
|
|
|
2021-02-03 18:23:54 +00:00
|
|
|
# Signed integer overflow on user-provided data inside boost::geometry - ignore.
|
|
|
|
set_source_files_properties("pointInPolygon.cpp" PROPERTIES COMPILE_FLAGS -fno-sanitize=signed-integer-overflow)
|
2021-04-28 22:16:45 +00:00
|
|
|
|
2021-08-10 11:52:34 +00:00
|
|
|
if (ENABLE_FUZZING)
|
|
|
|
add_compile_definitions(FUZZING_MODE=1)
|
|
|
|
endif ()
|
2022-07-04 07:01:39 +00:00
|
|
|
|
|
|
|
target_link_libraries(clickhouse_functions_obj PUBLIC ${PUBLIC_LIBS} PRIVATE ${PRIVATE_LIBS})
|
|
|
|
|
|
|
|
if (USE_STATIC_LIBRARIES OR NOT SPLIT_SHARED_LIBRARIES)
|
|
|
|
# Used to forward the linking information to the final binaries such as clickhouse / unit_tests_dbms,
|
|
|
|
# since such information are lost after we convert to OBJECT target
|
|
|
|
add_library(clickhouse_functions INTERFACE)
|
|
|
|
target_link_libraries(clickhouse_functions INTERFACE ${OBJECT_LIBS} ${PUBLIC_LIBS} ${PRIVATE_LIBS})
|
|
|
|
else()
|
|
|
|
add_library(clickhouse_functions SHARED ${OBJECT_LIBS})
|
|
|
|
target_link_libraries(clickhouse_functions PUBLIC ${PUBLIC_LIBS} PRIVATE ${PRIVATE_LIBS})
|
|
|
|
endif ()
|