mirror of
https://github.com/opencv/opencv.git
synced 2025-01-19 06:53:50 +08:00
Merge pull request #14679 from alalek:cmake_update_option_enable_fast_math
This commit is contained in:
commit
738435b1dd
@ -473,7 +473,7 @@ OCV_OPTION(ENABLE_COVERAGE "Enable coverage collection with GCov"
|
||||
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) )
|
||||
|
@ -635,10 +635,6 @@ macro(ocv_compiler_optimization_options_finalize)
|
||||
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()
|
||||
|
||||
|
@ -75,11 +75,25 @@ if(NOT MSVC)
|
||||
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()
|
||||
|
||||
@ -165,9 +179,6 @@ if(CV_GCC OR CV_CLANG)
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user