diff --git a/modules/core/CMakeLists.txt b/modules/core/CMakeLists.txt index 62bddbb413..a341c6a837 100644 --- a/modules/core/CMakeLists.txt +++ b/modules/core/CMakeLists.txt @@ -165,7 +165,7 @@ if(HAVE_CUDA) message(FATAL_ERROR "CUDA: OpenCV requires enabled 'cudev' module from 'opencv_contrib' repository: https://github.com/opencv/opencv_contrib") endif() if(ENABLE_CUDA_FIRST_CLASS_LANGUAGE) - ocv_module_include_directories(${CUDAToolkit_INCLUDE_DIRS}) + list(APPEND extra_libs CUDA::cudart${CUDA_LIB_EXT}) endif() ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wenum-compare -Wunused-function -Wshadow) endif() @@ -209,7 +209,11 @@ if(HAVE_OPENMP AND DEFINED OpenMP_CXX_LIBRARIES AND OpenMP_CXX_LIBRARIES) ocv_target_link_libraries(${the_module} LINK_PRIVATE "${OpenMP_CXX_LIBRARIES}") endif() -ocv_add_accuracy_tests() +set(test_libs "") +if(HAVE_CUDA AND ENABLE_CUDA_FIRST_CLASS_LANGUAGE) + list(APPEND test_libs CUDA::cudart${CUDA_LIB_EXT}) +endif() +ocv_add_accuracy_tests(${test_libs}) ocv_add_perf_tests() ocv_install_3rdparty_licenses(SoftFloat "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/SoftFloat/COPYING.txt") diff --git a/modules/dnn/CMakeLists.txt b/modules/dnn/CMakeLists.txt index cd83684f77..a2d8c957d6 100644 --- a/modules/dnn/CMakeLists.txt +++ b/modules/dnn/CMakeLists.txt @@ -179,7 +179,7 @@ if(OPENCV_DNN_CUDA AND HAVE_CUDA AND HAVE_CUBLAS AND HAVE_CUDNN) endforeach() unset(CC_LIST) if(ENABLE_CUDA_FIRST_CLASS_LANGUAGE) - list(APPEND libs ${CUDNN_LIBRARIES} CUDA::cublas${CUDA_LIB_EXT}) + list(APPEND libs CUDA::cudart${CUDA_LIB_EXT} ${CUDNN_LIBRARIES} CUDA::cublas${CUDA_LIB_EXT}) if(NOT CUDA_VERSION VERSION_LESS 10.1) list(APPEND libs CUDA::cublasLt${CUDA_LIB_EXT}) endif() diff --git a/modules/photo/CMakeLists.txt b/modules/photo/CMakeLists.txt index f65cf9e678..1d970f28f4 100644 --- a/modules/photo/CMakeLists.txt +++ b/modules/photo/CMakeLists.txt @@ -6,6 +6,6 @@ endif() ocv_define_module(photo opencv_imgproc OPTIONAL opencv_cudaarithm opencv_cudaimgproc WRAP java objc python js) -if(HAVE_CUDA AND ENABLE_CUDA_FIRST_CLASS_LANGUAGE AND HAVE_OPENCV_CUDAARITHM AND HAVE_OPENCV_CUDAIMGPROC) - ocv_target_link_libraries(${the_module} PUBLIC "CUDA::cudart${CUDA_LIB_EXT}") +if(HAVE_CUDA AND ENABLE_CUDA_FIRST_CLASS_LANGUAGE AND HAVE_opencv_cudaarithm AND HAVE_opencv_cudaimgproc) + ocv_target_link_libraries(${the_module} PRIVATE CUDA::cudart${CUDA_LIB_EXT}) endif() diff --git a/modules/photo/src/denoising.cuda.cpp b/modules/photo/src/denoising.cuda.cpp index d9e265cda9..12735dfbf6 100644 --- a/modules/photo/src/denoising.cuda.cpp +++ b/modules/photo/src/denoising.cuda.cpp @@ -46,6 +46,12 @@ #include "opencv2/opencv_modules.hpp" +#if !defined (HAVE_CUDA) || !defined(HAVE_OPENCV_CUDAARITHM) || !defined(HAVE_OPENCV_CUDAIMGPROC) +#include "opencv2/core/private/cuda_stubs.hpp" +#else +#include "opencv2/core/private.cuda.hpp" +#endif + #ifdef HAVE_OPENCV_CUDAARITHM # include "opencv2/cudaarithm.hpp" #endif @@ -59,15 +65,12 @@ using namespace cv::cuda; #if !defined (HAVE_CUDA) || !defined(HAVE_OPENCV_CUDAARITHM) || !defined(HAVE_OPENCV_CUDAIMGPROC) -#include "opencv2/core/private/cuda_stubs.hpp" void cv::cuda::nonLocalMeans(InputArray, OutputArray, float, int, int, int, Stream&) { throw_no_cuda(); } void cv::cuda::fastNlMeansDenoising(InputArray, OutputArray, float, int, int, Stream&) { throw_no_cuda(); } void cv::cuda::fastNlMeansDenoisingColored(InputArray, OutputArray, float, float, int, int, Stream&) { throw_no_cuda(); } #else -#include "opencv2/core/private.cuda.hpp" - ////////////////////////////////////////////////////////////////////////////////// //// Non Local Means Denosing (brute force)