1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Use fast math for dnn module.

This commit is contained in:
Alexander Smorkalov
2026-04-22 13:05:39 +03:00
parent 0102afa86f
commit 7fcfafff8b
2 changed files with 18 additions and 0 deletions
+11
View File
@@ -1519,6 +1519,17 @@ function(ocv_target_compile_definitions target)
endif()
endfunction()
function(ocv_target_compile_options target)
_ocv_fix_target(target)
if(NOT TARGET ${target})
if(NOT DEFINED OPENCV_MODULE_${target}_LOCATION)
message(FATAL_ERROR "ocv_target_compile_definitions: invalid target: '${target}'")
endif()
set(OPENCV_MODULE_${target}_COMPILE_OPTIONS ${OPENCV_MODULE_${target}_COMPILE_OPTIONS} ${ARGN} CACHE INTERNAL "" FORCE)
else()
target_compile_options(${target} ${ARGN})
endif()
endfunction()
function(_ocv_append_target_includes target)
if(DEFINED OCV_TARGET_INCLUDE_DIRS_${target})
+7
View File
@@ -37,6 +37,13 @@ if(HAVE_CANN)
ocv_target_compile_definitions(${the_module} PRIVATE "HAVE_CANN=1")
endif()
if(MSVC)
ocv_target_compile_options(${the_module} PRIVATE "/fp:fast")
elseif(CV_GCC OR CV_CLANG)
ocv_target_compile_options(${the_module} PRIVATE -ffast-math)
ocv_target_compile_options(${the_module} PRIVATE -fno-finite-math-only)
endif()
ocv_option(OPENCV_DNN_CUDA "Build with CUDA support"
HAVE_CUDA
AND HAVE_CUBLAS