aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-04-19 02:47:11 -0700
committerChris Robinson <[email protected]>2020-04-19 02:47:11 -0700
commit1ca7f22145ffcfc2e06fc834644f43a730089a26 (patch)
tree914cb0d44714b9e31df5443f91795bcb3ed12390
parent0a0478f670970126e3f53a5133c0a941db8407a5 (diff)
Correctly test for SSE switches
-rw-r--r--CMakeLists.txt58
1 files changed, 33 insertions, 25 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 10da4467..e1343798 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -309,33 +309,41 @@ ELSE()
SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS}")
ENDIF()
-SET(SSE2_SWITCH "")
-SET(SSE3_SWITCH "")
-SET(SSE4_1_SWITCH "")
-SET(FPU_NEON_SWITCH "")
-CHECK_C_COMPILER_FLAG(-msse2 HAVE_MSSE2_SWITCH)
-IF(HAVE_MSSE2_SWITCH)
- SET(SSE2_SWITCH "-msse2")
-ENDIF()
-CHECK_C_COMPILER_FLAG(-msse3 HAVE_MSSE3_SWITCH)
-IF(HAVE_MSSE3_SWITCH)
- SET(SSE3_SWITCH "-msse3")
-ENDIF()
-CHECK_C_COMPILER_FLAG(-msse4.1 HAVE_MSSE4_1_SWITCH)
-IF(HAVE_MSSE4_1_SWITCH)
- SET(SSE4_1_SWITCH "-msse4.1")
-ENDIF()
-CHECK_C_COMPILER_FLAG(-mfpu=neon HAVE_MFPU_NEON_SWITCH)
-IF(HAVE_MFPU_NEON_SWITCH)
- SET(FPU_NEON_SWITCH "-mfpu=neon")
-ENDIF()
+set(SSE2_SWITCH "")
+set(SSE3_SWITCH "")
+set(SSE4_1_SWITCH "")
+set(FPU_NEON_SWITCH "")
-CHECK_INCLUDE_FILE(xmmintrin.h HAVE_XMMINTRIN_H "${SSE2_SWITCH}")
-CHECK_INCLUDE_FILE(emmintrin.h HAVE_EMMINTRIN_H "${SSE2_SWITCH}")
-CHECK_INCLUDE_FILE(pmmintrin.h HAVE_PMMINTRIN_H "${SSE3_SWITCH}")
-CHECK_INCLUDE_FILE(smmintrin.h HAVE_SMMINTRIN_H "${SSE4_1_SWITCH}")
-CHECK_INCLUDE_FILE(arm_neon.h HAVE_ARM_NEON_H "${FPU_NEON_SWITCH}")
+set(OLD_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+if(NOT MSVC)
+ # Yes GCC, really don't accept command line options you don't support
+ set(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS} -Werror")
+endif()
+check_c_compiler_flag(-msse2 HAVE_MSSE2_SWITCH)
+if(HAVE_MSSE2_SWITCH)
+ set(SSE2_SWITCH "-msse2")
+ check_c_compiler_flag(-msse3 HAVE_MSSE3_SWITCH)
+ if(HAVE_MSSE3_SWITCH)
+ set(SSE3_SWITCH "-msse3")
+ check_c_compiler_flag(-msse4.1 HAVE_MSSE4_1_SWITCH)
+ if(HAVE_MSSE4_1_SWITCH)
+ set(SSE4_1_SWITCH "-msse4.1")
+ endif()
+ endif()
+endif()
+check_c_compiler_flag(-mfpu=neon HAVE_MFPU_NEON_SWITCH)
+if(HAVE_MFPU_NEON_SWITCH)
+ set(FPU_NEON_SWITCH "-mfpu=neon")
+endif()
+set(CMAKE_REQUIRED_FLAGS ${OLD_REQUIRED_FLAGS})
+unset(OLD_REQUIRED_FLAGS)
+
+check_include_file(xmmintrin.h HAVE_XMMINTRIN_H ${SSE2_SWITCH})
+check_include_file(emmintrin.h HAVE_EMMINTRIN_H ${SSE2_SWITCH})
+check_include_file(pmmintrin.h HAVE_PMMINTRIN_H ${SSE3_SWITCH})
+check_include_file(smmintrin.h HAVE_SMMINTRIN_H ${SSE4_1_SWITCH})
+check_include_file(arm_neon.h HAVE_ARM_NEON_H ${FPU_NEON_SWITCH})
set(SSE_FLAGS )
set(FPMATH_SET "0")