ClickHouse/contrib/base64-cmake/CMakeLists.txt

59 lines
1.9 KiB
CMake
Raw Normal View History

2018-10-10 01:04:07 +00:00
SET(LIBRARY_DIR ${ClickHouse_SOURCE_DIR}/contrib/base64)
2018-11-02 19:06:05 +00:00
macro(cast_to_bool var instruction)
if (HAVE_${var})
set(base64_${var} 1)
set(base64_${var}_opt ${instruction})
else()
set(base64_${var} 0)
endif()
endmacro()
2018-12-11 16:08:02 +00:00
cast_to_bool(NEON32 "") # TODO flags
cast_to_bool(NEON64 "") # TODO flags
2018-11-02 19:06:05 +00:00
cast_to_bool(SSSE3 "-mssse3")
cast_to_bool(SSE41 "-msse4.1")
cast_to_bool(SSE42 "-msse4.2")
cast_to_bool(AVX "-mavx")
cast_to_bool(AVX2 "-mavx2")
2018-10-11 16:22:50 +00:00
set(HAVE_FAST_UNALIGNED_ACCESS 0)
2018-12-11 16:08:02 +00:00
if(HAVE_SSSE3 OR HAVE_SSE41 OR HAVE_SSE42 OR HAVE_AVX OR HAVE_AVX2)
2018-10-11 16:22:50 +00:00
set(HAVE_FAST_UNALIGNED_ACCESS 1)
endif ()
2018-12-11 16:08:02 +00:00
configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
2018-10-11 16:22:50 +00:00
add_library(base64 ${LINK_MODE}
${LIBRARY_DIR}/lib/lib.c
${LIBRARY_DIR}/lib/codec_choose.c
${LIBRARY_DIR}/lib/arch/avx/codec.c
${LIBRARY_DIR}/lib/arch/avx2/codec.c
${LIBRARY_DIR}/lib/arch/generic/codec.c
${LIBRARY_DIR}/lib/arch/neon32/codec.c
${LIBRARY_DIR}/lib/arch/neon64/codec.c
${LIBRARY_DIR}/lib/arch/sse41/codec.c
${LIBRARY_DIR}/lib/arch/sse42/codec.c
${LIBRARY_DIR}/lib/arch/ssse3/codec.c
${LIBRARY_DIR}/lib/codecs.h
2018-12-11 16:08:02 +00:00
${CMAKE_CURRENT_BINARY_DIR}/config.h)
2018-10-11 16:22:50 +00:00
2019-02-06 14:37:30 +00:00
if(HAVE_AVX)
set_source_files_properties(${LIBRARY_DIR}/lib/arch/avx/codec.c PROPERTIES COMPILE_FLAGS -mavx)
endif()
if(HAVE_AVX2)
set_source_files_properties(${LIBRARY_DIR}/lib/arch/avx2/codec.c PROPERTIES COMPILE_FLAGS -mavx2)
endif()
if(HAVE_SSE41)
set_source_files_properties(${LIBRARY_DIR}/lib/arch/sse41/codec.c PROPERTIES COMPILE_FLAGS -msse4.1)
endif()
if(HAVE_SSE42)
set_source_files_properties(${LIBRARY_DIR}/lib/arch/sse42/codec.c PROPERTIES COMPILE_FLAGS -msse4.2)
endif()
if(HAVE_SSSE3)
set_source_files_properties(${LIBRARY_DIR}/lib/arch/ssse3/codec.c PROPERTIES COMPILE_FLAGS -mssse3)
endif()
2018-12-11 16:08:02 +00:00
target_include_directories(base64 PRIVATE ${LIBRARY_DIR}/include ${CMAKE_CURRENT_BINARY_DIR})