aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-08-31 13:01:03 -0700
committerChris Robinson <[email protected]>2018-08-31 13:22:21 -0700
commit01cc0cd7871477adcb405ea5a416ab569b25ffda (patch)
tree9dcf2fcb411c6c0ca5c325da8b2923488a21ac7e
parent0d4b68239a1d296a8e2f95042cf1893531655bb8 (diff)
Pass the appropriate /arch switch for x86 MSVC
-rw-r--r--CMakeLists.txt42
1 files changed, 30 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a6ed6d42..884006fd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -433,24 +433,42 @@ IF(HAVE_MFPU_NEON_SWITCH)
ENDIF()
SET(FPMATH_SET "0")
-IF(HAVE_MSSE_SWITCH AND CMAKE_SIZEOF_VOID_P MATCHES "4")
- OPTION(ALSOFT_ENABLE_SSE_CODEGEN "Enable SSE code generation instead of x87 for 32-bit targets." TRUE)
- IF(HAVE_MSSE2_SWITCH)
+IF(CMAKE_SIZEOF_VOID_P MATCHES "4")
+ IF(SSE_SWITCH OR MSVC)
+ OPTION(ALSOFT_ENABLE_SSE_CODEGEN "Enable SSE code generation instead of x87 for 32-bit targets." TRUE)
+ ENDIF()
+ IF(SSE2_SWITCH OR MSVC)
OPTION(ALSOFT_ENABLE_SSE2_CODEGEN "Enable SSE2 code generation instead of x87 for 32-bit targets." TRUE)
ENDIF()
- IF(HAVE_MSSE2_SWITCH AND ALSOFT_ENABLE_SSE2_CODEGEN)
- CHECK_C_COMPILER_FLAG("${SSE2_SWITCH} -mfpmath=sse" HAVE_MFPMATH_SSE_2)
- IF(ALSOFT_ENABLE_SSE2_CODEGEN AND HAVE_MFPMATH_SSE_2)
- SET(C_FLAGS ${C_FLAGS} ${SSE2_SWITCH} -mfpmath=sse)
- SET(FPMATH_SET 2)
+ IF(ALSOFT_ENABLE_SSE2_CODEGEN)
+ IF(SSE2_SWITCH)
+ CHECK_C_COMPILER_FLAG("${SSE2_SWITCH} -mfpmath=sse" HAVE_MFPMATH_SSE_2)
+ IF(HAVE_MFPMATH_SSE_2)
+ SET(C_FLAGS ${C_FLAGS} ${SSE2_SWITCH} -mfpmath=sse)
+ SET(FPMATH_SET 2)
+ ENDIF()
+ ELSEIF(MSVC)
+ CHECK_C_COMPILER_FLAG("/arch:SSE2" HAVE_ARCH_SSE2)
+ IF(HAVE_ARCH_SSE2)
+ SET(C_FLAGS ${C_FLAGS} "/arch:SSE2")
+ SET(FPMATH_SET 2)
+ ENDIF()
ENDIF()
ENDIF()
IF(ALSOFT_ENABLE_SSE_CODEGEN AND NOT FPMATH_SET)
- CHECK_C_COMPILER_FLAG("${SSE_SWITCH} -mfpmath=sse" HAVE_MFPMATH_SSE)
- IF(ALSOFT_ENABLE_SSE_CODEGEN AND HAVE_MFPMATH_SSE)
- SET(C_FLAGS ${C_FLAGS} ${SSE_SWITCH} -mfpmath=sse)
- SET(FPMATH_SET 1)
+ IF(SSE_SWITCH)
+ CHECK_C_COMPILER_FLAG("${SSE_SWITCH} -mfpmath=sse" HAVE_MFPMATH_SSE)
+ IF(HAVE_MFPMATH_SSE)
+ SET(C_FLAGS ${C_FLAGS} ${SSE_SWITCH} -mfpmath=sse)
+ SET(FPMATH_SET 1)
+ ENDIF()
+ ELSEIF(MSVC)
+ CHECK_C_COMPILER_FLAG("/arch:SSE" HAVE_ARCH_SSE)
+ IF(HAVE_ARCH_SSE)
+ SET(C_FLAGS ${C_FLAGS} "/arch:SSE")
+ SET(FPMATH_SET 1)
+ ENDIF()
ENDIF()
ENDIF()
ENDIF()