Merge pull request #261 from ew1abz/dev

cmake: Avoid try_run when cross-compiling
This commit is contained in:
wb2osz 2020-11-14 10:54:43 -05:00 committed by GitHub
commit 791982a5e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -354,7 +354,12 @@ elseif(ARCHITECTURE_ARM)
if(C_MSVC)
try_run(RUN_NEON COMPILE_NEON "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_arm_neon.cxx" COMPILE_DEFINITIONS /O0)
else()
try_run(RUN_NEON COMPILE_NEON "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_arm_neon.cxx" COMPILE_DEFINITIONS -mfpu=neon -O0)
if(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL ${CMAKE_SYSTEM_PROCESSOR})
try_run(RUN_NEON COMPILE_NEON "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_arm_neon.cxx" COMPILE_DEFINITIONS -mfpu=neon -O0)
else()
try_compile(COMPILE_NEON "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_arm_neon.cxx" COMPILE_DEFINITIONS -mfpu=neon -O0)
set(RUN_NEON 0)
endif()
endif()
if(COMPILE_NEON AND RUN_NEON EQUAL 0)
set(HAS_NEON ON CACHE BOOL "Architecture has NEON SIMD enabled")