OCV_OPTION(OPENCV_ENABLE_MEMORY_SANITIZER "Better support for memory/address sanitizers" OFF)
OCV_OPTION(ENABLE_OMIT_FRAME_POINTER "Enable -fomit-frame-pointer for GCC" ON IF CV_GCC )
OCV_OPTION(ENABLE_POWERPC "Enable PowerPC for GCC" ON IF (CV_GCC AND CMAKE_SYSTEM_PROCESSOR MATCHES powerpc.*) )
-OCV_OPTION(ENABLE_FAST_MATH "Enable -ffast-math (not recommended for GCC 4.6.x)" OFF IF (CV_GCC AND (X86 OR X86_64)) )
+OCV_OPTION(ENABLE_FAST_MATH "Enable compiler options for fast math optimizations on FP computations (not recommended)" OFF)
if(NOT IOS) # Use CPU_BASELINE instead
OCV_OPTION(ENABLE_NEON "Enable NEON instructions" (NEON OR ANDROID_ARM_NEON OR AARCH64) IF (CV_GCC OR CV_CLANG) AND (ARM OR AARCH64 OR IOS) )
OCV_OPTION(ENABLE_VFPV3 "Enable VFPv3-D32 instructions" OFF IF (CV_GCC OR CV_CLANG) AND (ARM OR AARCH64 OR IOS) )
if(MSVC)
# Generate Intrinsic Functions
set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /Oi")
-
- if((X86 OR X86_64) AND CMAKE_SIZEOF_VOID_P EQUAL 4 AND ";${CPU_BASELINE_FINAL};" MATCHES ";SSE;")
- set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /fp:fast") # !! important - be on the same wave with x64 compilers
- endif()
endif(MSVC)
endmacro()
add_extra_compiler_option(-fsigned-char)
endif()
-if(CV_ICC AND NOT ENABLE_FAST_MATH)
- if(MSVC)
- add_extra_compiler_option("/fp:precise")
- else()
- add_extra_compiler_option("-fp-model precise")
+if(MSVC)
+ if(NOT " ${CMAKE_CXX_FLAGS} ${OPENCV_EXTRA_FLAGS} ${OPENCV_EXTRA_CXX_FLAGS}" MATCHES " /fp:")
+ if(ENABLE_FAST_MATH)
+ add_extra_compiler_option("/fp:fast")
+ else()
+ add_extra_compiler_option("/fp:precise")
+ endif()
+ endif()
+elseif(CV_ICC)
+ if(NOT " ${CMAKE_CXX_FLAGS} ${OPENCV_EXTRA_FLAGS} ${OPENCV_EXTRA_CXX_FLAGS}" MATCHES " /fp:"
+ AND NOT " ${CMAKE_CXX_FLAGS} ${OPENCV_EXTRA_FLAGS} ${OPENCV_EXTRA_CXX_FLAGS}" MATCHES " -fp-model"
+ )
+ if(NOT ENABLE_FAST_MATH)
+ add_extra_compiler_option("-fp-model precise")
+ endif()
+ endif()
+elseif(CV_GCC OR CV_CLANG)
+ if(ENABLE_FAST_MATH)
+ add_extra_compiler_option(-ffast-math)
endif()
endif()
elseif(DEFINED ENABLE_OMIT_FRAME_POINTER)
add_extra_compiler_option(-fno-omit-frame-pointer)
endif()
- if(ENABLE_FAST_MATH)
- add_extra_compiler_option(-ffast-math)
- endif()
# Profiling?
if(ENABLE_PROFILING)