Add avx2 support

This commit is contained in:
momo5502
2025-03-22 17:23:53 +01:00
parent 49a27eafff
commit f42005ce5d
2 changed files with 20 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
include_guard()
include(CheckCXXCompilerFlag)
##########################################
# System identification
@@ -114,6 +115,24 @@ endif()
##########################################
if(MOMO_ENABLE_AVX2)
set(CMAKE_REQUIRED_FLAGS -Werror)
check_cxx_compiler_flag(-mavx2 COMPILER_SUPPORTS_MAVX2)
set(CMAKE_REQUIRED_FLAGS "")
check_cxx_compiler_flag(/arch:AVX2 COMPILER_SUPPORTS_ARCH_AVX2)
if(COMPILER_SUPPORTS_MAVX2)
momo_add_c_and_cxx_compile_options(-mavx2)
endif()
if (COMPILER_SUPPORTS_ARCH_AVX2)
momo_add_c_and_cxx_compile_options(/arch:AVX2)
endif()
endif()
##########################################
if(MOMO_ENABLE_SANITIZER)
momo_add_c_and_cxx_compile_options(-fsanitize=address)
add_link_options(-fsanitize=address)