use /arch:AVX2 for MSVC when USE_NATIVE_ARCH is on

This commit is contained in:
Mike Oliphant
2025-02-20 12:31:49 -08:00
parent fcb5963f05
commit b4144b9027
2 changed files with 9 additions and 3 deletions
+7 -1
View File
@@ -18,8 +18,14 @@ if (CMAKE_SYSTEM_PROCESSOR MATCHES "(amd64)|(AMD64)|(x86_64)")
option(USE_NATIVE_ARCH "Enable architecture-specific optimizations" OFF)
if (USE_NATIVE_ARCH)
if (MSVC)
add_compile_options(/arch:AVX2)
message(STATUS "Enabling /arch:AVX2")
else()
add_compile_options(-march=x86-64-v3)
message("Enabling -march=x86-64-v3")
message(STATUS "Enabling -march=x86-64-v3")
endif()
endif (USE_NATIVE_ARCH)
endif ()