Skip to content

Commit

Permalink
Another try to correctly implement the rust simd flag settings
Browse files Browse the repository at this point in the history
  • Loading branch information
milot-mirdita committed Apr 13, 2023
1 parent ff372b5 commit 29979fb
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down

0 comments on commit 29979fb

Please sign in to comment.