diff --git a/CMakeLists.txt b/CMakeLists.txt index 56f8a6b9..58a5938d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,17 +26,28 @@ include_directories(lib/gemmi) add_subdirectory(lib/corrosion) -if (X64 OR X86) - if (HAVE_AVX2_EXTENSIONS) - set(RUST_FEATURE simd_avx2) - elseif (HAVE_SSE2_EXTENSIONS) - set(RUST_FEATURE simd_sse2) - else() - message(FATAL_ERROR "No SIMD support for this architecture") - endif() -elseif (ARM) +set(RUST_FEATURE "") +if(HAVE_AVX2) + set(RUST_FEATURE simd_avx2) +elseif(HAVE_SSE4_1 OR HAVE_SSE2) + set(RUST_FEATURE simd_sse2) +elseif(HAVE_ARM8) set(RUST_FEATURE simd_neon) -else() +endif() + +if (NATIVE_ARCH AND (RUST_FEATURE STREQUAL "")) + if(ARM) + set(RUST_FEATURE simd_neon) + elseif(X86 OR X64) + if (HAVE_AVX2_EXTENSIONS) + set(RUST_FEATURE simd_avx2) + elseif (HAVE_SSE2_EXTENSIONS) + set(RUST_FEATURE simd_sse2) + endif() + endif() +endif() + +if(RUST_FEATURE STREQUAL "") message(FATAL_ERROR "No SIMD support for this architecture") endif() message("-- Rust Feature: ${RUST_FEATURE}")