2022-01-17 19:29:50 +00:00
|
|
|
option (ENABLE_SIMDJSON "Use simdjson" ${ENABLE_LIBRARIES})
|
|
|
|
|
|
|
|
if (NOT ENABLE_SIMDJSON)
|
|
|
|
message(STATUS "Not using simdjson")
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
2019-05-15 17:19:39 +00:00
|
|
|
set(SIMDJSON_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/simdjson/include")
|
2020-07-11 21:03:30 +00:00
|
|
|
set(SIMDJSON_SRC_DIR "${ClickHouse_SOURCE_DIR}/contrib/simdjson/src")
|
2021-04-24 19:47:52 +00:00
|
|
|
set(SIMDJSON_SRC "${SIMDJSON_SRC_DIR}/simdjson.cpp")
|
2019-05-07 23:31:35 +00:00
|
|
|
|
2022-01-17 19:29:50 +00:00
|
|
|
add_library(_simdjson ${SIMDJSON_SRC})
|
|
|
|
target_include_directories(_simdjson SYSTEM PUBLIC "${SIMDJSON_INCLUDE_DIR}" PRIVATE "${SIMDJSON_SRC_DIR}")
|
2021-08-10 00:46:03 +00:00
|
|
|
|
|
|
|
# simdjson is using its own CPU dispatching and get confused if we enable AVX/AVX2 flags.
|
2021-11-26 23:07:24 +00:00
|
|
|
if(ARCH_AMD64)
|
2022-01-17 19:29:50 +00:00
|
|
|
target_compile_options(_simdjson PRIVATE -mno-avx -mno-avx2)
|
2021-11-26 23:07:24 +00:00
|
|
|
endif()
|
2022-01-17 19:29:50 +00:00
|
|
|
|
|
|
|
add_library(ch_contrib::simdjson ALIAS _simdjson)
|