2022-01-17 21:07:59 +00:00
|
|
|
if(ARCH_AMD64 AND NOT OS_FREEBSD AND NOT OS_DARWIN)
|
|
|
|
option(ENABLE_FASTOPS "Enable fast vectorized mathematical functions library by Mikhail Parakhin" ${ENABLE_LIBRARIES})
|
|
|
|
elseif(ENABLE_FASTOPS)
|
|
|
|
message (${RECONFIGURE_MESSAGE_LEVEL} "Fastops library is supported on x86_64 only, and not FreeBSD or Darwin")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT ENABLE_FASTOPS)
|
|
|
|
message(STATUS "Not using fast vectorized mathematical functions library by Mikhail Parakhin")
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
2021-04-24 19:47:52 +00:00
|
|
|
set(LIBRARY_DIR "${ClickHouse_SOURCE_DIR}/contrib/fastops")
|
2019-07-22 23:41:06 +00:00
|
|
|
|
|
|
|
set(SRCS "")
|
|
|
|
|
|
|
|
if(HAVE_AVX)
|
2021-04-24 19:47:52 +00:00
|
|
|
set (SRCS ${SRCS} "${LIBRARY_DIR}/fastops/avx/ops_avx.cpp")
|
|
|
|
set_source_files_properties("${LIBRARY_DIR}/fastops/avx/ops_avx.cpp" PROPERTIES COMPILE_FLAGS "-mavx -DNO_AVX2")
|
2019-07-22 23:41:06 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(HAVE_AVX2)
|
2021-04-24 19:47:52 +00:00
|
|
|
set (SRCS ${SRCS} "${LIBRARY_DIR}/fastops/avx2/ops_avx2.cpp")
|
|
|
|
set_source_files_properties("${LIBRARY_DIR}/fastops/avx2/ops_avx2.cpp" PROPERTIES COMPILE_FLAGS "-mavx2 -mfma")
|
2019-07-22 23:41:06 +00:00
|
|
|
endif()
|
|
|
|
|
2021-04-24 19:47:52 +00:00
|
|
|
set (SRCS ${SRCS} "${LIBRARY_DIR}/fastops/plain/ops_plain.cpp" "${LIBRARY_DIR}/fastops/core/avx_id.cpp" "${LIBRARY_DIR}/fastops/fastops.cpp")
|
2019-07-22 23:41:06 +00:00
|
|
|
|
2022-01-20 14:17:06 +00:00
|
|
|
add_library(_fastops ${SRCS})
|
2019-07-22 23:41:06 +00:00
|
|
|
|
2022-01-20 14:17:06 +00:00
|
|
|
target_include_directories(_fastops SYSTEM PUBLIC "${LIBRARY_DIR}")
|
2022-01-17 21:07:59 +00:00
|
|
|
|
2022-01-20 14:17:06 +00:00
|
|
|
add_library(ch_contrib::fastops ALIAS _fastops)
|