2017-04-21 17:47:27 +00:00
|
|
|
include(${ClickHouse_SOURCE_DIR}/cmake/dbms_glob_sources.cmake)
|
2017-07-30 12:31:58 +00:00
|
|
|
|
2018-01-10 15:45:05 +00:00
|
|
|
add_headers_and_sources(clickhouse_functions ./GatherUtils)
|
2018-12-23 14:19:11 +00:00
|
|
|
add_headers_and_sources(clickhouse_functions .)
|
2018-06-19 18:09:09 +00:00
|
|
|
|
2017-04-21 17:47:27 +00:00
|
|
|
|
2017-12-09 07:32:32 +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
|
|
|
|
2018-10-18 19:28:05 +00:00
|
|
|
add_library(clickhouse_functions ${LINK_MODE} ${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
|
2018-12-21 17:53:16 +00:00
|
|
|
dbms
|
2018-11-28 11:37:12 +00:00
|
|
|
PRIVATE
|
|
|
|
clickhouse_dictionaries
|
|
|
|
${CONSISTENT_HASHING_LIBRARY}
|
|
|
|
consistent-hashing-sumbur
|
|
|
|
${FARMHASH_LIBRARIES}
|
|
|
|
${METROHASH_LIBRARIES}
|
|
|
|
murmurhash
|
|
|
|
${BASE64_LIBRARY}
|
2018-12-21 17:53:16 +00:00
|
|
|
${OPENSSL_CRYPTO_LIBRARY}
|
|
|
|
${LZ4_LIBRARY})
|
2018-04-07 02:29:12 +00:00
|
|
|
|
2018-06-06 20:21:58 +00:00
|
|
|
target_include_directories (clickhouse_functions SYSTEM BEFORE PUBLIC ${DIVIDE_INCLUDE_DIR})
|
2017-04-21 17:47:27 +00:00
|
|
|
|
2018-08-30 19:07:24 +00:00
|
|
|
if (CONSISTENT_HASHING_INCLUDE_DIR)
|
|
|
|
target_include_directories (clickhouse_functions PRIVATE ${CONSISTENT_HASHING_INCLUDE_DIR})
|
|
|
|
endif ()
|
|
|
|
|
2017-10-25 18:39:10 +00:00
|
|
|
if (CMAKE_BUILD_TYPE_UC STREQUAL "RELEASE" OR CMAKE_BUILD_TYPE_UC STREQUAL "RELWITHDEBINFO" OR CMAKE_BUILD_TYPE_UC STREQUAL "MINSIZEREL")
|
2017-10-24 13:30:44 +00:00
|
|
|
# Won't generate debug info for files with heavy template instantiation to achieve faster linking and lower size.
|
|
|
|
target_compile_options(clickhouse_functions PRIVATE "-g0")
|
|
|
|
endif ()
|
|
|
|
|
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})
|
2018-01-19 17:04:32 +00:00
|
|
|
endif ()
|
|
|
|
|
2017-08-03 12:44:39 +00:00
|
|
|
if (USE_VECTORCLASS)
|
2018-06-06 20:21:58 +00:00
|
|
|
target_include_directories (clickhouse_functions SYSTEM BEFORE PUBLIC ${VECTORCLASS_INCLUDE_DIR})
|
2017-08-03 12:44:39 +00:00
|
|
|
endif ()
|
|
|
|
|
2016-12-01 22:44:59 +00:00
|
|
|
if (ENABLE_TESTS)
|
2017-04-01 07:20:54 +00:00
|
|
|
add_subdirectory (tests)
|
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
|
|
|
llvm_libs_all(REQUIRED_LLVM_LIBRARIES)
|
|
|
|
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()
|