2021-04-24 19:47:52 +00:00
|
|
|
SET(LIBRARY_DIR "${ClickHouse_SOURCE_DIR}/contrib/base64")
|
2018-10-10 01:04:07 +00:00
|
|
|
|
2021-04-24 19:47:52 +00:00
|
|
|
add_library(base64_scalar OBJECT "${LIBRARY_DIR}/turbob64c.c" "${LIBRARY_DIR}/turbob64d.c")
|
|
|
|
add_library(base64_ssse3 OBJECT "${LIBRARY_DIR}/turbob64sse.c") # This file also contains code for ARM NEON
|
2019-12-31 03:14:57 +00:00
|
|
|
|
|
|
|
if (ARCH_AMD64)
|
2021-04-24 19:47:52 +00:00
|
|
|
add_library(base64_avx OBJECT "${LIBRARY_DIR}/turbob64sse.c") # This is not a mistake. One file is compiled twice.
|
|
|
|
add_library(base64_avx2 OBJECT "${LIBRARY_DIR}/turbob64avx2.c")
|
2019-12-31 03:14:57 +00:00
|
|
|
endif ()
|
2018-11-02 19:06:05 +00:00
|
|
|
|
2019-12-25 19:44:00 +00:00
|
|
|
target_compile_options(base64_scalar PRIVATE -falign-loops)
|
2018-10-11 16:22:50 +00:00
|
|
|
|
2019-12-31 03:14:57 +00:00
|
|
|
if (ARCH_AMD64)
|
2021-02-03 08:00:20 +00:00
|
|
|
target_compile_options(base64_ssse3 PRIVATE -mno-avx -mno-avx2 -mssse3 -falign-loops)
|
2019-12-31 03:14:57 +00:00
|
|
|
target_compile_options(base64_avx PRIVATE -falign-loops -mavx)
|
|
|
|
target_compile_options(base64_avx2 PRIVATE -falign-loops -mavx2)
|
2020-01-01 22:55:59 +00:00
|
|
|
else ()
|
|
|
|
target_compile_options(base64_ssse3 PRIVATE -falign-loops)
|
2019-12-31 03:14:57 +00:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (ARCH_AMD64)
|
|
|
|
add_library(base64
|
|
|
|
$<TARGET_OBJECTS:base64_scalar>
|
|
|
|
$<TARGET_OBJECTS:base64_ssse3>
|
|
|
|
$<TARGET_OBJECTS:base64_avx>
|
|
|
|
$<TARGET_OBJECTS:base64_avx2>)
|
|
|
|
else ()
|
|
|
|
add_library(base64
|
2020-01-01 22:55:59 +00:00
|
|
|
$<TARGET_OBJECTS:base64_scalar>
|
|
|
|
$<TARGET_OBJECTS:base64_ssse3>)
|
2019-12-31 03:14:57 +00:00
|
|
|
endif ()
|
2019-02-05 14:05:48 +00:00
|
|
|
|
2020-01-11 13:17:10 +00:00
|
|
|
target_include_directories(base64 SYSTEM PUBLIC ${LIBRARY_DIR})
|
2020-04-27 17:48:01 +00:00
|
|
|
|
|
|
|
if (XCODE OR XCODE_VERSION)
|
|
|
|
# https://gitlab.kitware.com/cmake/cmake/issues/17457
|
|
|
|
# Some native build systems may not like targets that have only object files, so consider adding at least one real source file
|
|
|
|
# This applies to Xcode.
|
|
|
|
if (NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/dummy.c")
|
|
|
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummy.c" "")
|
|
|
|
endif ()
|
|
|
|
target_sources(base64 PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/dummy.c")
|
|
|
|
endif ()
|