Skip to content

Commit c68dccb

Browse files
committed
Only emit SIMD compiler flags on x86-based platforms
Enabling the SSE4.2 or AVX SIMD flags on non-x86 based platforms will result in a compilation error stating that the -msse4.2 and -mavx flags cannot be found. This patch causes the flags to only be emitted on x86-based platforms. Signed-off-by: jmather-sesi <54645798+jmather-sesi@users.noreply.github.com>
1 parent f81d1aa commit c68dccb

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,12 +386,16 @@ endif()
386386
# Configure SIMD. AVX implies SSE 4.2.
387387

388388
if(OPENVDB_SIMD STREQUAL "AVX")
389-
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-mavx>")
390-
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-msse4.2>")
389+
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
390+
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-mavx>")
391+
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-msse4.2>")
392+
endif()
391393
add_compile_definitions("$<$<COMPILE_LANGUAGE:CXX>:OPENVDB_USE_AVX>")
392394
add_compile_definitions("$<$<COMPILE_LANGUAGE:CXX>:OPENVDB_USE_SSE42>")
393395
elseif(OPENVDB_SIMD STREQUAL "SSE42")
394-
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-msse4.2>")
396+
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
397+
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-msse4.2>")
398+
endif()
395399
add_compile_definitions("$<$<COMPILE_LANGUAGE:CXX>:OPENVDB_USE_SSE42>")
396400
endif()
397401

0 commit comments

Comments
 (0)