Move clang-cl detection to cmake and allow it when setting flags

This commit is contained in:
2022-05-16 23:41:42 -07:00
parent 7ba2225644
commit 04fece2771
4 changed files with 27 additions and 7 deletions

View File

@ -42,20 +42,32 @@ function(set_simd_flags target_name)
if (highway_mode STREQUAL "AUTO")
# setting -march=native on an M1 causes Clang to freak out
if (MSVC)
#MSVC has no -march=native equivalent. womp
message(WARNING "Compiling using MSVC without settig an explicit QUICKTEX_HWY_MODE defaults to serial operations. Please compile with Clang if you need vectorization")
if (CLANG_CL)
target_compile_options(${target_name} PUBLIC /clang:-march=native)
else()
#MSVC has no -march=native equivalent. womp
message(WARNING "Compiling using cl.exe without settig an explicit QUICKTEX_HWY_MODE defaults to serial operations. Please compile with clang-cl if you need vectorization")
endif()
elseif (!ARM)
target_compile_options(${target_name} PUBLIC -march=native)
endif ()
elseif (highway_mode STREQUAL "SSSE3")
if (MSVC)
message(SEND_ERROR "Compiling using SSSE3 is not supported with the MSVC compiler. Please use AVX or compile withClang")
if (CLANG_CL)
target_compile_options(${target_name} PUBLIC /clang:-mssse3)
else()
message(SEND_ERROR "Compiling using SSSE3 is not supported with the cl.exe compiler. Please use AVX or compile with clang-cl")
endif()
else ()
target_compile_options(${target_name} PUBLIC -mssse3)
endif ()
elseif (highway_mode STREQUAL "SSE4")
if (MSVC)
message(SEND_ERROR "Compiling using SSE4 is not supported with the MSVC compiler. Please use AVX or compile with Clang")
if (CLANG_CL)
target_compile_options(${target_name} PUBLIC /clang:-msse4)
else()
message(SEND_ERROR "Compiling using SSE4 is not supported with the MSVC compiler. Please use AVX or compile with Clang")
endif()
else ()
target_compile_options(${target_name} PUBLIC -msse4)
endif ()