# SSE3 and further should be disabled under MingW because it generates compiler errors
# SSE3 and further should be disabled under MingW because it generates compiler errors
if(NOT MINGW)
if(NOT MINGW)
if(ENABLE_SSE3)
if(ENABLE_AVX)
add_extra_compiler_option(-msse3)
add_extra_compiler_option(-mavx)
endif()
endif()
if(${CMAKE_OPENCV_GCC_VERSION_NUM} GREATER 402)
# GCC depresses SSEx instructions when -mavx is used. Instead, it generates new AVX instructions or AVX equivalence for all SSEx instructions when needed.
set(HAVE_GCC43_OR_NEWER 1)
if(NOT OPENCV_EXTRA_CXX_FLAGS MATCHES "-mavx")
endif()
if(ENABLE_SSE3)
if(${CMAKE_OPENCV_GCC_VERSION_NUM} GREATER 401)
add_extra_compiler_option(-msse3)
set(HAVE_GCC42_OR_NEWER 1)
endif()
endif()
if(HAVE_GCC42_OR_NEWER OR APPLE)
if(ENABLE_SSSE3)
if(ENABLE_SSSE3)
add_extra_compiler_option(-mssse3)
add_extra_compiler_option(-mssse3)
endif()
endif()
if(HAVE_GCC43_OR_NEWER OR APPLE)
if(ENABLE_SSE41)
if(ENABLE_SSE41)
add_extra_compiler_option(-msse4.1)
add_extra_compiler_option(-msse4.1)
endif()
endif()
if(ENABLE_SSE42)
add_extra_compiler_option(-msse4.2)
if(ENABLE_SSE42)
endif()
add_extra_compiler_option(-msse4.2)
endif()
endif()
endif()
endif()
endif(NOT MINGW)
endif(NOT MINGW)
if(X86 OR X86_64)
if(X86 OR X86_64)
if(NOT APPLE AND CMAKE_SIZEOF_VOID_P EQUAL 4)
if(NOT APPLE AND CMAKE_SIZEOF_VOID_P EQUAL 4)
if(ENABLE_SSE2)
if(OPENCV_EXTRA_CXX_FLAGS MATCHES "-m(sse2|avx)")
add_extra_compiler_option(-mfpmath=sse)# !! important - be on the same wave with x64 compilers
add_extra_compiler_option(-mfpmath=sse)# !! important - be on the same wave with x64 compilers