File tree Expand file tree Collapse file tree 11 files changed +91
-33
lines changed Expand file tree Collapse file tree 11 files changed +91
-33
lines changed Original file line number Diff line number Diff line change @@ -6,22 +6,35 @@ set(the_description "CUDA-accelerated Operations on Matrices")
66
77ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4324 /wd4512 -Wundef -Wmissing-declarations -Wshadow)
88
9- ocv_add_module(cudaarithm opencv_core OPTIONAL opencv_cudev WRAP python)
9+ set (extra_dependencies "" )
10+ set (optional_dependencies "" )
11+ if (ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
12+ 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} )
13+ if (HAVE_CUBLAS)
14+ list (APPEND optional_dependencies CUDA::cublas${CUDA_LIB_EXT} )
15+ if (NOT CUDA_VERSION VERSION_LESS 10.1)
16+ list (APPEND optional_dependencies CUDA::cublasLt${CUDA_LIB_EXT} )
17+ endif ()
18+ endif ()
19+ if (HAVE_CUFFT)
20+ # static version requires seperable compilation which is incompatible with opencv's current library structure
21+ list (APPEND optional_dependencies CUDA::cufft)
22+ endif ()
23+ else ()
24+ if (HAVE_CUBLAS)
25+ list (APPEND optional_dependencies ${CUDA_cublas_LIBRARY} )
26+ endif ()
27+ if (HAVE_CUFFT)
28+ list (APPEND optional_dependencies ${CUDA_cufft_LIBRARY} )
29+ endif ()
30+ endif ()
31+
32+ ocv_add_module(cudaarithm opencv_core ${extra_dependencies} OPTIONAL opencv_cudev ${optional_dependencies} WRAP python)
1033
1134ocv_module_include_directories()
1235ocv_glob_module_sources()
1336
14- set (extra_libs "" )
15-
16- if (HAVE_CUBLAS)
17- list (APPEND extra_libs ${CUDA_cublas_LIBRARY} )
18- endif ()
19-
20- if (HAVE_CUFFT)
21- list (APPEND extra_libs ${CUDA_cufft_LIBRARY} )
22- endif ()
23-
24- ocv_create_module(${extra_libs} )
37+ ocv_create_module()
2538
2639ocv_add_accuracy_tests(DEPENDS_ON opencv_imgproc)
2740ocv_add_perf_tests(DEPENDS_ON opencv_imgproc)
Original file line number Diff line number Diff line change 55set (the_description "CUDA-accelerated Background Segmentation" )
66
77ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4324 /wd4512 -Wundef -Wmissing-declarations -Wshadow)
8-
8+ if (ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
9+ ocv_module_include_directories(${CUDAToolkit_INCLUDE_DIRS} )
10+ endif ()
911ocv_define_module(cudabgsegm opencv_video WRAP python)
Original file line number Diff line number Diff line change 44
55set (the_description "CUDA-accelerated Video Encoding/Decoding" )
66
7- ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4324 /wd4512 -Wundef -Wshadow)
7+ if (WIN32 )
8+ ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4324 /wd4512)
9+ else ()
10+ ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wshadow -Wsign-compare -Wenum-compare)
11+ endif ()
812
913set (required_dependencies opencv_core opencv_videoio opencv_cudaarithm opencv_cudawarping)
1014if (HAVE_NVCUVENC)
@@ -18,10 +22,25 @@ ocv_glob_module_sources()
1822
1923set (extra_libs "" )
2024
25+ if (WITH_NVCUVID AND NOT HAVE_NVCUVID)
26+ message (WARNING "cudacodec::VideoReader requires Nvidia Video Codec SDK. Please resolve dependency or disable WITH_NVCUVID=OFF" )
27+ endif ()
28+
29+ if (WITH_NVCUVENC AND NOT HAVE_NVCUVENC)
30+ message (WARNING "cudacodec::VideoWriter requires Nvidia Video Codec SDK. Please resolve dependency or disable WITH_NVCUVENC=OFF" )
31+ endif ()
32+
2133if (HAVE_NVCUVID OR HAVE_NVCUVENC)
22- list (APPEND extra_libs ${CUDA_CUDA_LIBRARY} )
34+ if (ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
35+ list (APPEND extra_libs CUDA::cuda_driver)
36+ else ()
37+ list (APPEND extra_libs ${CUDA_CUDA_LIBRARY} )
38+ endif ()
2339 if (HAVE_NVCUVID)
2440 list (APPEND extra_libs ${CUDA_nvcuvid_LIBRARY} )
41+ if (ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
42+ list (APPEND extra_libs CUDA::nppicc${CUDA_LIB_EXT} )
43+ endif ()
2544 endif ()
2645 if (HAVE_NVCUVENC)
2746 if (WIN32 )
Original file line number Diff line number Diff line change 55set (the_description "CUDA-accelerated Feature Detection and Description" )
66
77ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4100 /wd4324 /wd4512 /wd4515 -Wundef -Wmissing-declarations -Wshadow -Wunused-parameter -Wshadow)
8-
8+ if (ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
9+ ocv_module_include_directories(${CUDAToolkit_INCLUDE_DIRS} )
10+ endif ()
911ocv_define_module(cudafeatures2d opencv_features2d opencv_cudafilters opencv_cudawarping WRAP python)
Original file line number Diff line number Diff line change 55set (the_description "CUDA-accelerated Image Filtering" )
66
77ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4324 /wd4512 -Wundef -Wmissing-declarations -Wshadow)
8-
9- ocv_define_module(cudafilters opencv_imgproc opencv_cudaarithm WRAP python)
8+ set (extra_libs "" )
9+ if (ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
10+ set (extra_libs CUDA::nppif${CUDA_LIB_EXT} CUDA::nppim${CUDA_LIB_EXT} )
11+ endif ()
12+ ocv_define_module(cudafilters opencv_imgproc opencv_cudaarithm ${extra_libs} WRAP python)
Original file line number Diff line number Diff line change 55set (the_description "CUDA-accelerated Image Processing" )
66
77ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4100 /wd4324 /wd4512 /wd4515 -Wundef -Wmissing-declarations -Wshadow -Wunused-parameter)
8-
9- ocv_define_module(cudaimgproc opencv_imgproc OPTIONAL opencv_cudev opencv_cudaarithm opencv_cudafilters WRAP python)
8+ set (extra_libs "" )
9+ if (ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
10+ set (extra_libs CUDA::nppial${CUDA_LIB_EXT} CUDA::nppist${CUDA_LIB_EXT} CUDA::nppicc${CUDA_LIB_EXT} CUDA::nppidei${CUDA_LIB_EXT} )
11+ endif ()
12+ ocv_define_module(cudaimgproc opencv_imgproc ${extra_libs} OPTIONAL opencv_cudev opencv_cudaarithm opencv_cudafilters WRAP python)
Original file line number Diff line number Diff line change 55set (the_description "CUDA-accelerated Computer Vision (legacy)" )
66
77ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4130 /wd4324 /wd4512 /wd4310 -Wundef -Wmissing-declarations -Wuninitialized -Wshadow -Wdeprecated-declarations -Wstrict-aliasing -Wtautological-compare)
8-
8+ if (ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
9+ ocv_module_include_directories(${CUDAToolkit_INCLUDE_DIRS} )
10+ endif ()
911ocv_define_module(cudalegacy opencv_core opencv_video
1012 OPTIONAL opencv_objdetect opencv_imgproc opencv_calib3d opencv_cudaarithm opencv_cudafilters opencv_cudaimgproc)
Original file line number Diff line number Diff line change 55set (the_description "CUDA-accelerated Stereo Correspondence" )
66
77ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4324 /wd4512 -Wundef -Wmissing-declarations -Wshadow)
8-
8+ if (ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
9+ ocv_module_include_directories(${CUDAToolkit_INCLUDE_DIRS} )
10+ endif ()
911ocv_define_module(cudastereo opencv_calib3d OPTIONAL opencv_cudev WRAP python)
Original file line number Diff line number Diff line change 55set (the_description "CUDA-accelerated Image Warping" )
66
77ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4127 /wd4324 /wd4512 -Wundef -Wmissing-declarations -Wshadow)
8-
9- ocv_define_module(cudawarping opencv_core opencv_imgproc OPTIONAL opencv_cudev WRAP python)
8+ set (extra_libs "" )
9+ if (ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
10+ set (extra_libs CUDA::nppial${CUDA_LIB_EXT} CUDA::nppig${CUDA_LIB_EXT} )
11+ endif ()
12+ ocv_define_module(cudawarping opencv_core opencv_imgproc ${extra_libs} OPTIONAL opencv_cudev WRAP python)
Original file line number Diff line number Diff line change @@ -15,17 +15,23 @@ if(OCV_DEPENDENCIES_FOUND)
1515
1616 ocv_cuda_filter_options()
1717
18- if (CUDA_VERSION VERSION_LESS "11.0" )
19- ocv_update(OPENCV_CUDA_OPTIONS_opencv_test_cudev "-std=c++11" )
18+ set (target_libs ${test_deps} ${OPENCV_LINKER_LIBS} )
19+ if (NOT ENABLE_CUDA_FIRST_CLASS_LANGUAGE)
20+ ocv_check_windows_crt_linkage()
21+ set (target_libs ${target_libs} ${CUDA_LIBRARIES} )
22+ if (CUDA_VERSION VERSION_LESS "11.0" )
23+ ocv_update(OPENCV_CUDA_OPTIONS_opencv_test_cudev "-std=c++11" )
24+ else ()
25+ ocv_update(OPENCV_CUDA_OPTIONS_opencv_test_cudev "-std=c++14" )
26+ ocv_warnings_disable(CMAKE_CXX_FLAGS -Wdeprecated-declarations)
27+ endif ()
28+ CUDA_ADD_EXECUTABLE(${the_target} ${OPENCV_TEST_${the_module} _SOURCES} OPTIONS ${OPENCV_CUDA_OPTIONS_opencv_test_cudev} )
2029 else ()
21- ocv_update(OPENCV_CUDA_OPTIONS_opencv_test_cudev "-std=c++14" )
22- ocv_warnings_disable(CMAKE_CXX_FLAGS -Wdeprecated-declarations)
30+ ocv_add_executable(${the_target} ${OPENCV_TEST_${the_module} _SOURCES})
2331 endif ()
2432
25- CUDA_ADD_EXECUTABLE(${the_target} ${OPENCV_TEST_${the_module} _SOURCES} OPTIONS ${OPENCV_CUDA_OPTIONS_opencv_test_cudev} )
26- ocv_target_link_libraries(${the_target} PRIVATE
27- ${test_deps} ${OPENCV_LINKER_LIBS} ${CUDA_LIBRARIES}
28- )
33+ ocv_target_link_libraries(${the_target} PRIVATE ${target_libs} )
34+
2935 add_dependencies (opencv_tests ${the_target} )
3036
3137 set_target_properties (${the_target} PROPERTIES LABELS "${OPENCV_MODULE_${the_module} _LABEL}" )
You can’t perform that action at this time.
0 commit comments