diff options
-rw-r--r-- | CMakeLists.txt | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 760e0e6f..567ea55b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -328,31 +328,28 @@ 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") -IF(CMAKE_SIZEOF_VOID_P MATCHES "4") - IF(SSE2_SWITCH OR MSVC) - OPTION(ALSOFT_ENABLE_SSE2_CODEGEN "Enable SSE2 code generation instead of x87 for 32-bit targets." TRUE) - ENDIF() - - 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(SSE_FLAGS ${SSE_FLAGS} ${SSE2_SWITCH} -mfpmath=sse) - SET(C_FLAGS ${C_FLAGS} ${SSE_FLAGS}) - SET(FPMATH_SET 2) - ENDIF() - ELSEIF(MSVC) - CHECK_C_COMPILER_FLAG("/arch:SSE2" HAVE_ARCH_SSE2) - IF(HAVE_ARCH_SSE2) - SET(SSE_FLAGS ${SSE_FLAGS} "/arch:SSE2") - SET(C_FLAGS ${C_FLAGS} ${SSE_FLAGS}) - SET(FPMATH_SET 2) - ENDIF() - ENDIF() - ENDIF() -ENDIF() +set(SSE_FLAGS ) +set(FPMATH_SET "0") +if(CMAKE_SIZEOF_VOID_P MATCHES "4" AND (SSE2_SWITCH OR MSVC)) + option(ALSOFT_ENABLE_SSE2_CODEGEN "Enable SSE2 code generation instead of x87 for 32-bit targets." TRUE) + 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(SSE_FLAGS ${SSE_FLAGS} ${SSE2_SWITCH} -mfpmath=sse) + set(C_FLAGS ${C_FLAGS} ${SSE_FLAGS}) + set(FPMATH_SET 2) + endif() + elseif(MSVC) + check_c_compiler_flag("/arch:SSE2" HAVE_ARCH_SSE2) + if(HAVE_ARCH_SSE2) + set(SSE_FLAGS ${SSE_FLAGS} "/arch:SSE2") + set(C_FLAGS ${C_FLAGS} ${SSE_FLAGS}) + set(FPMATH_SET 2) + endif() + endif() + endif() +endif() IF(HAVE_EMMINTRIN_H) SET(OLD_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) |