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")
6
6
7
7
ocv_warnings_disable (CMAKE_CXX_FLAGS /wd4127 /wd4324 /wd4512 -Wundef -Wmissing-declarations -Wshadow )
8
8
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 )
10
33
11
34
ocv_module_include_directories ()
12
35
ocv_glob_module_sources ()
13
36
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 ()
25
38
26
39
ocv_add_accuracy_tests (DEPENDS_ON opencv_imgproc )
27
40
ocv_add_perf_tests (DEPENDS_ON opencv_imgproc )
Original file line number Diff line number Diff line change 5
5
set (the_description "CUDA-accelerated Background Segmentation" )
6
6
7
7
ocv_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 ()
9
11
ocv_define_module (cudabgsegm opencv_video WRAP python )
Original file line number Diff line number Diff line change 4
4
5
5
set (the_description "CUDA-accelerated Video Encoding/Decoding" )
6
6
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 ()
8
12
9
13
set (required_dependencies opencv_core opencv_videoio opencv_cudaarithm opencv_cudawarping )
10
14
if (HAVE_NVCUVENC )
@@ -18,10 +22,25 @@ ocv_glob_module_sources()
18
22
19
23
set (extra_libs "" )
20
24
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
+
21
33
if (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 ()
23
39
if (HAVE_NVCUVID )
24
40
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 ()
25
44
endif ()
26
45
if (HAVE_NVCUVENC )
27
46
if (WIN32 )
Original file line number Diff line number Diff line change 5
5
set (the_description "CUDA-accelerated Feature Detection and Description" )
6
6
7
7
ocv_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 ()
9
11
ocv_define_module (cudafeatures2d opencv_features2d opencv_cudafilters opencv_cudawarping WRAP python )
Original file line number Diff line number Diff line change 5
5
set (the_description "CUDA-accelerated Image Filtering" )
6
6
7
7
ocv_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 5
5
set (the_description "CUDA-accelerated Image Processing" )
6
6
7
7
ocv_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 5
5
set (the_description "CUDA-accelerated Computer Vision (legacy)" )
6
6
7
7
ocv_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 ()
9
11
ocv_define_module (cudalegacy opencv_core opencv_video
10
12
OPTIONAL opencv_objdetect opencv_imgproc opencv_calib3d opencv_cudaarithm opencv_cudafilters opencv_cudaimgproc )
Original file line number Diff line number Diff line change 5
5
set (the_description "CUDA-accelerated Stereo Correspondence" )
6
6
7
7
ocv_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 ()
9
11
ocv_define_module (cudastereo opencv_calib3d OPTIONAL opencv_cudev WRAP python )
Original file line number Diff line number Diff line change 5
5
set (the_description "CUDA-accelerated Image Warping" )
6
6
7
7
ocv_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)
15
15
16
16
ocv_cuda_filter_options ()
17
17
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} )
20
29
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} )
23
31
endif ()
24
32
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
+
29
35
add_dependencies (opencv_tests ${the_target} )
30
36
31
37
set_target_properties (${the_target} PROPERTIES LABELS "${OPENCV_MODULE_${the_module} _LABEL}" )
Original file line number Diff line number Diff line change 1
1
if (HAVE_CUDA )
2
2
add_definitions (-D_HFS_CUDA_ON_ )
3
3
ocv_warnings_disable (CMAKE_CXX_FLAGS -Wundef )
4
+ if (ENABLE_CUDA_FIRST_CLASS_LANGUAGE )
5
+ ocv_module_include_directories (${CUDAToolkit_INCLUDE_DIRS} )
6
+ endif ()
4
7
endif ()
5
8
6
9
set (the_description "Hierarchical Feature Selection for Efficient Image Segmentation" )
7
- ocv_define_module (hfs opencv_core opencv_imgproc WRAP python )
10
+ ocv_define_module (hfs opencv_core opencv_imgproc OPTIONAL WRAP python )
You can’t perform that action at this time.
0 commit comments