2019-12-15 06:34:43 +00:00
|
|
|
configure_file(config_functions.h.in ${ConfigIncludePath}/config_functions.h)
|
2019-06-20 09:12:49 +00:00
|
|
|
|
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
|
|
|
|
2021-05-17 07:30:42 +00:00
|
|
|
list(REMOVE_ITEM clickhouse_functions_sources IFunction.cpp FunctionFactory.cpp FunctionHelpers.cpp)
|
|
|
|
list(REMOVE_ITEM clickhouse_functions_headers IFunction.h FunctionFactory.h FunctionHelpers.h)
|
2017-04-21 17:47:27 +00:00
|
|
|
|
2019-04-24 09:06:28 +00:00
|
|
|
add_library(clickhouse_functions ${clickhouse_functions_sources})
|
2018-04-07 02:29:12 +00:00
|
|
|
|
2018-11-28 11:37:12 +00:00
|
|
|
target_link_libraries(clickhouse_functions
|
|
|
|
PUBLIC
|
2020-06-09 10:54:49 +00:00
|
|
|
${BASE64_LIBRARY}
|
|
|
|
${CITYHASH_LIBRARIES}
|
|
|
|
${FARMHASH_LIBRARIES}
|
|
|
|
${FASTOPS_LIBRARY}
|
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
|
2020-03-12 22:26:16 +00:00
|
|
|
consistent-hashing
|
2020-06-09 10:54:49 +00:00
|
|
|
dbms
|
|
|
|
metrohash
|
2018-11-28 11:37:12 +00:00
|
|
|
murmurhash
|
2019-07-03 16:53:20 +00:00
|
|
|
|
|
|
|
PRIVATE
|
2019-08-04 00:19:03 +00:00
|
|
|
${ZLIB_LIBRARIES}
|
2020-06-09 10:54:49 +00:00
|
|
|
boost::filesystem
|
2021-04-13 18:53:55 +00:00
|
|
|
divide_impl
|
2019-03-22 11:18:24 +00:00
|
|
|
)
|
2018-04-07 02:29:12 +00:00
|
|
|
|
2019-03-22 11:18:24 +00:00
|
|
|
if (OPENSSL_CRYPTO_LIBRARY)
|
|
|
|
target_link_libraries(clickhouse_functions PUBLIC ${OPENSSL_CRYPTO_LIBRARY})
|
|
|
|
endif()
|
2018-04-07 02:29:12 +00:00
|
|
|
|
2020-06-09 10:54:49 +00:00
|
|
|
target_include_directories(clickhouse_functions SYSTEM PRIVATE ${SPARSEHASH_INCLUDE_DIR})
|
2017-04-21 17:47:27 +00:00
|
|
|
|
2020-09-10 11:07:08 +00:00
|
|
|
if (CMAKE_BUILD_TYPE_UC STREQUAL "RELEASE"
|
|
|
|
OR CMAKE_BUILD_TYPE_UC STREQUAL "RELWITHDEBINFO"
|
|
|
|
OR CMAKE_BUILD_TYPE_UC STREQUAL "MINSIZEREL")
|
|
|
|
set (STRIP_DSF_DEFAULT ON)
|
|
|
|
else()
|
|
|
|
set (STRIP_DSF_DEFAULT OFF)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2020-09-15 21:12:37 +00:00
|
|
|
# Provides faster linking and lower binary size.
|
|
|
|
# Tradeoff is the inability to debug some source files with e.g. gdb
|
|
|
|
# (empty stack frames and no local variables)."
|
|
|
|
option(STRIP_DEBUG_SYMBOLS_FUNCTIONS "Do not generate debugger info for ClickHouse functions" ${STRIP_DSF_DEFAULT})
|
2020-09-09 18:17:01 +00:00
|
|
|
|
|
|
|
if (STRIP_DEBUG_SYMBOLS_FUNCTIONS)
|
|
|
|
message(WARNING "Not generating debugger info for ClickHouse functions")
|
|
|
|
target_compile_options(clickhouse_functions PRIVATE "-g0")
|
|
|
|
else()
|
|
|
|
message(STATUS "Generating debugger info for ClickHouse functions")
|
|
|
|
endif()
|
2017-10-24 13:30:44 +00:00
|
|
|
|
2018-01-19 17:04:32 +00:00
|
|
|
if (USE_ICU)
|
2018-11-27 15:34:21 +00:00
|
|
|
target_link_libraries (clickhouse_functions PRIVATE ${ICU_LIBRARIES})
|
2019-02-02 11:09:22 +00:00
|
|
|
target_include_directories(clickhouse_functions SYSTEM PRIVATE ${ICU_INCLUDE_DIRS})
|
2018-01-19 17:04:32 +00:00
|
|
|
endif ()
|
|
|
|
|
2019-08-01 00:29:32 +00:00
|
|
|
if (USE_FASTOPS)
|
|
|
|
target_include_directories (clickhouse_functions SYSTEM PRIVATE ${FASTOPS_INCLUDE_DIR})
|
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
|
|
|
|
|
|
|
if (USE_EMBEDDED_COMPILER)
|
2019-01-11 16:52:46 +00:00
|
|
|
target_link_libraries(clickhouse_functions PRIVATE ${REQUIRED_LLVM_LIBRARIES})
|
|
|
|
target_include_directories(clickhouse_functions SYSTEM BEFORE PUBLIC ${LLVM_INCLUDE_DIRS})
|
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
|
|
|
|
2019-01-11 16:52:46 +00:00
|
|
|
if(USE_BASE64)
|
|
|
|
target_include_directories(clickhouse_functions SYSTEM PRIVATE ${BASE64_INCLUDE_DIR})
|
2018-11-23 18:52:00 +00:00
|
|
|
endif()
|
2019-02-24 21:20:46 +00:00
|
|
|
|
2020-06-09 10:54:49 +00:00
|
|
|
target_link_libraries(clickhouse_functions PRIVATE lz4)
|
2019-03-25 14:34:52 +00:00
|
|
|
|
|
|
|
if (USE_H3)
|
|
|
|
target_link_libraries(clickhouse_functions PRIVATE ${H3_LIBRARY})
|
|
|
|
target_include_directories(clickhouse_functions SYSTEM PRIVATE ${H3_INCLUDE_DIR})
|
|
|
|
endif()
|
2019-06-20 10:53:17 +00:00
|
|
|
|
2020-06-09 10:54:49 +00:00
|
|
|
target_link_libraries(clickhouse_functions PRIVATE hyperscan)
|
2019-03-14 04:48:30 +00:00
|
|
|
|
2020-09-18 14:18:59 +00:00
|
|
|
if(USE_SIMDJSON)
|
2020-07-11 21:03:30 +00:00
|
|
|
target_link_libraries(clickhouse_functions PRIVATE simdjson)
|
2019-05-15 17:19:39 +00:00
|
|
|
endif()
|
2019-05-16 17:40:24 +00:00
|
|
|
|
|
|
|
if(USE_RAPIDJSON)
|
|
|
|
target_include_directories(clickhouse_functions SYSTEM PRIVATE ${RAPIDJSON_INCLUDE_DIR})
|
|
|
|
endif()
|
2019-06-20 15:49:54 +00:00
|
|
|
|
2020-09-19 17:14:37 +00:00
|
|
|
# ClickHouse developers may use platform-dependent code under some macro (e.g. `#ifdef ENABLE_MULTITARGET`).
|
2020-09-19 16:42:36 +00:00
|
|
|
# If turned ON, this option defines such macro.
|
|
|
|
# See `src/Functions/TargetSpecific.h`
|
|
|
|
option(ENABLE_MULTITARGET_CODE "Enable platform-dependent code" ON)
|
|
|
|
|
2020-05-16 19:30:00 +00:00
|
|
|
if (ENABLE_MULTITARGET_CODE)
|
2020-05-26 15:56:46 +00:00
|
|
|
add_definitions(-DENABLE_MULTITARGET_CODE=1)
|
2020-05-16 19:30:00 +00:00
|
|
|
else()
|
2020-05-26 15:56:46 +00:00
|
|
|
add_definitions(-DENABLE_MULTITARGET_CODE=0)
|
2020-05-16 19:30:00 +00:00
|
|
|
endif()
|
2020-04-14 15:48:33 +00:00
|
|
|
|
2019-06-21 15:31:37 +00:00
|
|
|
add_subdirectory(GatherUtils)
|
|
|
|
target_link_libraries(clickhouse_functions PRIVATE clickhouse_functions_gatherutils)
|
|
|
|
|
2019-06-20 15:49:54 +00:00
|
|
|
add_subdirectory(URL)
|
|
|
|
target_link_libraries(clickhouse_functions PRIVATE clickhouse_functions_url)
|
2019-06-21 15:31:37 +00:00
|
|
|
|
|
|
|
add_subdirectory(array)
|
|
|
|
target_link_libraries(clickhouse_functions PRIVATE clickhouse_functions_array)
|
2020-07-09 10:57:05 +00:00
|
|
|
|
2021-03-24 19:47:28 +00:00
|
|
|
add_subdirectory(JSONPath)
|
|
|
|
|
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-05-28 07:48:31 +00:00
|
|
|
# target_link_libraries(clickhouse_functions PRIVATE ${S2_LIBRARY})
|
2021-07-06 13:20:52 +00:00
|
|
|
target_include_directories(clickhouse_functions SYSTEM PUBLIC ${S2_GEOMETRY_INCLUDE_DIR})
|
2021-08-10 11:52:34 +00:00
|
|
|
|
|
|
|
if (ENABLE_FUZZING)
|
|
|
|
add_compile_definitions(FUZZING_MODE=1)
|
|
|
|
endif ()
|