Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions modules/cudaarithm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,41 @@ set(the_description "CUDA-accelerated Operations on Matrices")
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4324 /wd4512 -Wundef -Wmissing-declarations -Wshadow)

set(extra_dependencies "")
set(optional_dependencies "")
if(ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
if(UNIX AND NOT BUILD_SHARED_LIBS AND CUDA_VERSION_STRING VERSION_GREATER_EQUAL 9.2 AND CUDA_VERSION_STRING VERSION_LESS 13.0 AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.23)
set(CUDA_FFT_LIB_EXT "_static_nocallback")
endif()
list(APPEND extra_dependencies CUDA::cudart_static CUDA::nppial${CUDA_LIB_EXT} CUDA::nppc${CUDA_LIB_EXT} CUDA::nppitc${CUDA_LIB_EXT} CUDA::nppig${CUDA_LIB_EXT} CUDA::nppist${CUDA_LIB_EXT} CUDA::nppidei${CUDA_LIB_EXT})
list(APPEND extra_dependencies CUDA::cudart${CUDA_LIB_EXT} CUDA::nppial${CUDA_LIB_EXT} CUDA::nppc${CUDA_LIB_EXT} CUDA::nppitc${CUDA_LIB_EXT} CUDA::nppig${CUDA_LIB_EXT} CUDA::nppist${CUDA_LIB_EXT} CUDA::nppidei${CUDA_LIB_EXT})
if(HAVE_CUBLAS)
list(APPEND optional_dependencies CUDA::cublas${CUDA_LIB_EXT})
list(APPEND extra_dependencies CUDA::cublas${CUDA_LIB_EXT})
if(NOT CUDA_VERSION VERSION_LESS 10.1)
list(APPEND optional_dependencies CUDA::cublasLt${CUDA_LIB_EXT})
list(APPEND extra_dependencies CUDA::cublasLt${CUDA_LIB_EXT})
endif()
endif()
if(HAVE_CUFFT)
# static version requires seperable compilation which is incompatible with opencv's current library structure
# the cufft_static_nocallback variant does not requires seperable compilation. callbacks are currently not used.
list(APPEND optional_dependencies CUDA::cufft${CUDA_FFT_LIB_EXT})
list(APPEND extra_dependencies CUDA::cufft${CUDA_FFT_LIB_EXT})
endif()
else()
if(HAVE_CUBLAS)
list(APPEND optional_dependencies ${CUDA_cublas_LIBRARY})
list(APPEND extra_dependencies ${CUDA_cublas_LIBRARY})
endif()
if(HAVE_CUFFT)
list(APPEND optional_dependencies ${CUDA_cufft_LIBRARY})
list(APPEND extra_dependencies ${CUDA_cufft_LIBRARY})
endif()
endif()

ocv_add_module(cudaarithm opencv_core ${extra_dependencies} OPTIONAL opencv_cudev ${optional_dependencies} WRAP python)
ocv_add_module(cudaarithm opencv_core OPTIONAL opencv_cudev WRAP python)

ocv_module_include_directories()
ocv_glob_module_sources()

ocv_create_module()
ocv_create_module(${extra_dependencies})

ocv_add_accuracy_tests(DEPENDS_ON opencv_imgproc)
set(test_libs "")
if(ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
list(APPEND test_libs CUDA::cudart${CUDA_LIB_EXT})
endif()
ocv_add_accuracy_tests(${test_libs} DEPENDS_ON opencv_imgproc)
ocv_add_perf_tests(DEPENDS_ON opencv_imgproc)
6 changes: 4 additions & 2 deletions modules/cudabgsegm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ endif()
set(the_description "CUDA-accelerated Background Segmentation")

ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4324 /wd4512 -Wundef -Wmissing-declarations -Wshadow)

ocv_define_module(cudabgsegm opencv_video WRAP python)

if(ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
ocv_module_include_directories(${CUDAToolkit_INCLUDE_DIRS})
ocv_target_link_libraries(${the_module} PRIVATE CUDA::cudart${CUDA_LIB_EXT})
endif()
ocv_define_module(cudabgsegm opencv_video WRAP python)
2 changes: 1 addition & 1 deletion modules/cudacodec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ endif()

if(HAVE_NVCUVID OR HAVE_NVCUVENC)
if(ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
list(APPEND extra_libs CUDA::cuda_driver)
list(APPEND extra_libs CUDA::cuda_driver CUDA::cudart${CUDA_LIB_EXT})
else()
list(APPEND extra_libs ${CUDA_CUDA_LIBRARY})
endif()
Expand Down
14 changes: 12 additions & 2 deletions modules/cudafeatures2d/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@ endif()
set(the_description "CUDA-accelerated Feature Detection and Description")

ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4100 /wd4324 /wd4512 /wd4515 -Wundef -Wmissing-declarations -Wshadow -Wunused-parameter -Wshadow)

ocv_add_module(cudafeatures2d opencv_features2d opencv_cudafilters opencv_cudawarping WRAP python)

ocv_module_include_directories()
ocv_glob_module_sources()

set(extra_libs "")
if(ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
ocv_module_include_directories(${CUDAToolkit_INCLUDE_DIRS})
list(APPEND extra_libs CUDA::cudart${CUDA_LIB_EXT})
endif()
ocv_define_module(cudafeatures2d opencv_features2d opencv_cudafilters opencv_cudawarping WRAP python)
ocv_create_module(${extra_libs})

ocv_add_accuracy_tests(${extra_libs})
ocv_add_perf_tests(${extra_libs})
19 changes: 16 additions & 3 deletions modules/cudafilters/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,21 @@ endif()
set(the_description "CUDA-accelerated Image Filtering")

ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4324 /wd4512 -Wundef -Wmissing-declarations -Wshadow)
set(extra_libs "")

ocv_add_module(cudafilters opencv_imgproc opencv_cudaarithm WRAP python)

ocv_module_include_directories()
ocv_glob_module_sources()

set(build_libs "")
if(ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
list(APPEND build_libs CUDA::cudart${CUDA_LIB_EXT} CUDA::nppif${CUDA_LIB_EXT} CUDA::nppim${CUDA_LIB_EXT})
endif()
ocv_create_module(${build_libs})

set(test_libs "")
if(ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
set(extra_libs CUDA::nppif${CUDA_LIB_EXT} CUDA::nppim${CUDA_LIB_EXT})
list(APPEND test_libs CUDA::cudart${CUDA_LIB_EXT})
endif()
ocv_define_module(cudafilters opencv_imgproc opencv_cudaarithm ${extra_libs} WRAP python)
ocv_add_accuracy_tests(${test_libs})
ocv_add_perf_tests()
7 changes: 4 additions & 3 deletions modules/cudaimgproc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ endif()
set(the_description "CUDA-accelerated Image Processing")

ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4100 /wd4324 /wd4512 /wd4515 -Wundef -Wmissing-declarations -Wshadow -Wunused-parameter)
set(extra_libs "")

ocv_define_module(cudaimgproc opencv_imgproc OPTIONAL opencv_cudev opencv_cudaarithm opencv_cudafilters WRAP python)

if(ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
set(extra_libs CUDA::nppial${CUDA_LIB_EXT} CUDA::nppist${CUDA_LIB_EXT} CUDA::nppicc${CUDA_LIB_EXT} CUDA::nppidei${CUDA_LIB_EXT})
ocv_target_link_libraries(${the_module} PRIVATE CUDA::cudart${CUDA_LIB_EXT} CUDA::nppial${CUDA_LIB_EXT} CUDA::nppist${CUDA_LIB_EXT} CUDA::nppicc${CUDA_LIB_EXT} CUDA::nppidei${CUDA_LIB_EXT})
endif()
ocv_define_module(cudaimgproc opencv_imgproc ${extra_libs} OPTIONAL opencv_cudev opencv_cudaarithm opencv_cudafilters WRAP python)
15 changes: 12 additions & 3 deletions modules/cudalegacy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,17 @@ endif()
set(the_description "CUDA-accelerated Computer Vision (legacy)")

ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4130 /wd4324 /wd4512 /wd4310 -Wundef -Wmissing-declarations -Wuninitialized -Wshadow -Wdeprecated-declarations -Wstrict-aliasing -Wtautological-compare)

ocv_add_module(cudalegacy opencv_core opencv_video OPTIONAL opencv_objdetect opencv_imgproc opencv_calib3d opencv_cudaarithm opencv_cudafilters opencv_cudaimgproc)

ocv_module_include_directories()
ocv_glob_module_sources()

set(extra_libs "")
if(ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
ocv_module_include_directories(${CUDAToolkit_INCLUDE_DIRS})
list(APPEND extra_libs CUDA::cudart${CUDA_LIB_EXT})
endif()
ocv_define_module(cudalegacy opencv_core opencv_video
OPTIONAL opencv_objdetect opencv_imgproc opencv_calib3d opencv_cudaarithm opencv_cudafilters opencv_cudaimgproc)
ocv_create_module(${extra_libs})

ocv_add_accuracy_tests(${extra_libs})
ocv_add_perf_tests(${extra_libs})
4 changes: 4 additions & 0 deletions modules/cudaobjdetect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ set(the_description "CUDA-accelerated Object Detection")
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4324 /wd4512 -Wundef -Wmissing-declarations -Wshadow -Wstrict-aliasing)

ocv_define_module(cudaobjdetect opencv_objdetect opencv_cudaarithm opencv_cudawarping OPTIONAL opencv_cudalegacy WRAP python)

if(ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
ocv_target_link_libraries(${the_module} PRIVATE CUDA::cudart${CUDA_LIB_EXT})
endif()
4 changes: 4 additions & 0 deletions modules/cudaoptflow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4324 /wd4512 -Wundef -Wmissing-d

ocv_define_module(cudaoptflow opencv_video opencv_optflow opencv_cudaarithm opencv_cudawarping opencv_cudaimgproc OPTIONAL opencv_cudalegacy WRAP python)

if(ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
ocv_target_link_libraries(${the_module} PRIVATE CUDA::cudart${CUDA_LIB_EXT})
endif()

if(NOT CUDA_VERSION VERSION_LESS "10.0")
set(NVIDIA_OPTICAL_FLOW_2_0_HEADERS_COMMIT "edb50da3cf849840d680249aa6dbef248ebce2ca")
set(NVIDIA_OPTICAL_FLOW_2_0_HEADERS_MD5 "a73cd48b18dcc0cc8933b30796074191")
Expand Down
6 changes: 4 additions & 2 deletions modules/cudastereo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ endif()
set(the_description "CUDA-accelerated Stereo Correspondence")

ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4324 /wd4512 -Wundef -Wmissing-declarations -Wshadow)

ocv_define_module(cudastereo opencv_calib3d OPTIONAL opencv_cudev WRAP python)

if(ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
ocv_module_include_directories(${CUDAToolkit_INCLUDE_DIRS})
ocv_target_link_libraries(${the_module} PRIVATE CUDA::cudart${CUDA_LIB_EXT})
endif()
ocv_define_module(cudastereo opencv_calib3d OPTIONAL opencv_cudev WRAP python)
20 changes: 17 additions & 3 deletions modules/cudawarping/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,22 @@ endif()
set(the_description "CUDA-accelerated Image Warping")

ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4324 /wd4512 -Wundef -Wmissing-declarations -Wshadow)
set(extra_libs "")

set(build_libs "")
if(ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
list(APPEND build_libs CUDA::cudart${CUDA_LIB_EXT} CUDA::nppial${CUDA_LIB_EXT} CUDA::nppig${CUDA_LIB_EXT})
endif()

ocv_add_module(cudawarping opencv_core opencv_imgproc OPTIONAL opencv_cudev WRAP python)

ocv_module_include_directories()
ocv_glob_module_sources()

ocv_create_module(${build_libs})

set(test_libs "")
if(ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
set(extra_libs CUDA::nppial${CUDA_LIB_EXT} CUDA::nppig${CUDA_LIB_EXT})
list(APPEND test_libs CUDA::cudart${CUDA_LIB_EXT})
endif()
ocv_define_module(cudawarping opencv_core opencv_imgproc ${extra_libs} OPTIONAL opencv_cudev WRAP python)
ocv_add_accuracy_tests(${test_libs})
ocv_add_perf_tests()
4 changes: 4 additions & 0 deletions modules/superres/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ endif()
ocv_define_module(superres opencv_imgproc opencv_video opencv_optflow
OPTIONAL opencv_videoio opencv_cudaarithm opencv_cudafilters opencv_cudawarping opencv_cudaimgproc opencv_cudaoptflow opencv_cudacodec
WRAP python)

if(HAVE_CUDA AND ENABLE_CUDA_FIRST_CLASS_LANGUAGE AND HAVE_opencv_cudaarithm AND HAVE_opencv_cudawarping AND HAVE_opencv_cudafilters)
ocv_target_link_libraries(${the_module} PRIVATE CUDA::cudart${CUDA_LIB_EXT})
endif()
7 changes: 5 additions & 2 deletions modules/superres/src/precomp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,12 @@
#include "opencv2/imgproc.hpp"
#include "opencv2/video/tracking.hpp"
#include "opencv2/core/private.hpp"

#include "opencv2/core/private.cuda.hpp"
#include "opencv2/core/ocl.hpp"
#if !defined(HAVE_CUDA) || !defined(HAVE_OPENCV_CUDAARITHM) || !defined(HAVE_OPENCV_CUDAWARPING) || !defined(HAVE_OPENCV_CUDAFILTERS)
#include "opencv2/core/private/cuda_stubs.hpp"
#else
#include "opencv2/core/private.cuda.hpp"
#endif

#ifdef HAVE_OPENCV_CUDAARITHM
# include "opencv2/cudaarithm.hpp"
Expand Down
4 changes: 4 additions & 0 deletions modules/videostab/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ endif()

ocv_define_module(videostab opencv_imgproc opencv_features2d opencv_video opencv_photo opencv_calib3d
OPTIONAL opencv_cudawarping opencv_cudaoptflow opencv_videoio WRAP python)

if(HAVE_CUDA AND ENABLE_CUDA_FIRST_CLASS_LANGUAGE AND ((HAVE_opencv_cudaimgproc AND HAVE_opencv_cudaoptflow) OR HAVE_opencv_cudawarping))
ocv_target_link_libraries(${the_module} PRIVATE CUDA::cudart${CUDA_LIB_EXT})
endif()
6 changes: 6 additions & 0 deletions modules/videostab/src/global_motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,13 @@
#include "opencv2/opencv_modules.hpp"
#include "clp.hpp"

#if defined(HAVE_OPENCV_CUDAIMGPROC) && defined(HAVE_OPENCV_CUDAOPTFLOW)
#if !defined HAVE_CUDA || defined(CUDA_DISABLER)
#include "opencv2/core/private/cuda_stubs.hpp"
#else
#include "opencv2/core/private.cuda.hpp"
#endif
#endif

#if defined(HAVE_OPENCV_CUDAIMGPROC) && defined(HAVE_OPENCV_CUDAOPTFLOW)
#if !defined HAVE_CUDA || defined(CUDA_DISABLER)
Expand Down
9 changes: 6 additions & 3 deletions modules/videostab/src/wobble_suppression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,13 @@
#include "opencv2/videostab/wobble_suppression.hpp"
#include "opencv2/videostab/ring_buffer.hpp"

#include "opencv2/core/private.cuda.hpp"

#ifdef HAVE_OPENCV_CUDAWARPING
# include "opencv2/cudawarping.hpp"
#include "opencv2/cudawarping.hpp"
#if !defined HAVE_CUDA || defined(CUDA_DISABLER)
#include "opencv2/core/private/cuda_stubs.hpp"
#else
#include "opencv2/core/private.cuda.hpp"
#endif
#endif

#if defined(HAVE_OPENCV_CUDAWARPING)
Expand Down
4 changes: 4 additions & 0 deletions modules/xfeatures2d/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ if(HAVE_CUDA)
endif()
ocv_define_module(xfeatures2d opencv_core opencv_imgproc opencv_features2d opencv_calib3d OPTIONAL opencv_shape opencv_ml opencv_cudaarithm WRAP python java objc)

if(HAVE_CUDA AND ENABLE_CUDA_FIRST_CLASS_LANGUAGE AND HAVE_opencv_cudaarithm)
ocv_target_link_libraries(${the_module} PRIVATE CUDA::cudart${CUDA_LIB_EXT})
endif()

if(NOT OPENCV_SKIP_FEATURES2D_DOWNLOADING)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/download_vgg.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/download_boostdesc.cmake)
Expand Down
4 changes: 4 additions & 0 deletions modules/xfeatures2d/src/precomp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@

#include "opencv2/core/utility.hpp"
#include "opencv2/core/private.hpp"
#if !defined(HAVE_CUDA) || !defined(HAVE_OPENCV_CUDAARITHM)
#include "opencv2/core/private/cuda_stubs.hpp"
#else
#include "opencv2/core/private.cuda.hpp"
#endif
#include "opencv2/core/ocl.hpp"

#include "opencv2/opencv_modules.hpp"
Expand Down