File tree Expand file tree Collapse file tree 7 files changed +32
-11
lines changed Expand file tree Collapse file tree 7 files changed +32
-11
lines changed Original file line number Diff line number Diff line change @@ -38,11 +38,30 @@ if(CUDA_FOUND)
38
38
endif ()
39
39
40
40
if (WITH_NVCUVID )
41
+ macro (SEARCH_NVCUVID_HEADER _filename _result )
42
+ # place header file under CUDA_TOOLKIT_TARGET_DIR or CUDA_TOOLKIT_ROOT_DIR
43
+ find_path (_header_result
44
+ ${_filename}
45
+ PATHS "${CUDA_TOOLKIT_TARGET_DIR} " "${CUDA_TOOLKIT_ROOT_DIR} "
46
+ ENV CUDA_PATH
47
+ ENV CUDA_INC_PATH
48
+ PATH_SUFFIXES include
49
+ NO_DEFAULT_PATH
50
+ )
51
+ if ("x${_header_result} " STREQUAL "x_header_result-NOTFOUND" )
52
+ set (${_result} 0 )
53
+ else ()
54
+ set (${_result} 1 )
55
+ endif ()
56
+ endmacro ()
57
+ SEARCH_NVCUVID_HEADER ("nvcuvid.h" HAVE_NVCUVID_HEADER )
58
+ SEARCH_NVCUVID_HEADER ("dynlink_nvcuvid.h" HAVE_DYNLINK_NVCUVID_HEADER )
41
59
find_cuda_helper_libs (nvcuvid )
42
60
if (WIN32 )
43
61
find_cuda_helper_libs (nvcuvenc )
44
62
endif ()
45
- if (CUDA_nvcuvid_LIBRARY )
63
+ if (CUDA_nvcuvid_LIBRARY AND (${HAVE_NVCUVID_HEADER} OR ${HAVE_DYNLINK_NVCUVID_HEADER} ))
64
+ # make sure to have both header and library before enabling
46
65
set (HAVE_NVCUVID 1 )
47
66
endif ()
48
67
if (CUDA_nvcuvenc_LIBRARY )
Original file line number Diff line number Diff line change 127
127
128
128
/* NVIDIA Video Decoding API*/
129
129
#cmakedefine HAVE_NVCUVID
130
+ #cmakedefine HAVE_NVCUVID_HEADER
131
+ #cmakedefine HAVE_DYNLINK_NVCUVID_HEADER
130
132
131
133
/* NVIDIA Video Encoding API*/
132
134
#cmakedefine HAVE_NVCUVENC
Original file line number Diff line number Diff line change 44
44
#ifndef __CUVID_VIDEO_SOURCE_HPP__
45
45
#define __CUVID_VIDEO_SOURCE_HPP__
46
46
47
- #if CUDA_VERSION >= 9000 && CUDA_VERSION < 10000
47
+ #if defined(HAVE_DYNLINK_NVCUVID_HEADER)
48
48
#include < dynlink_nvcuvid.h>
49
- #else
49
+ #elif defined(HAVE_NVCUVID_HEADER)
50
50
#include < nvcuvid.h>
51
51
#endif
52
52
#include " opencv2/core/private.cuda.hpp"
Original file line number Diff line number Diff line change 47
47
#include " opencv2/core/utility.hpp"
48
48
#include " opencv2/core/private.cuda.hpp"
49
49
50
- #if CUDA_VERSION >= 9000 && CUDA_VERSION < 10000
50
+ #if defined(HAVE_DYNLINK_NVCUVID_HEADER)
51
51
#include < dynlink_nvcuvid.h>
52
- #else
52
+ #elif defined(HAVE_NVCUVID_HEADER)
53
53
#include < nvcuvid.h>
54
54
#endif
55
55
Original file line number Diff line number Diff line change 56
56
#include " opencv2/core/private.cuda.hpp"
57
57
58
58
#ifdef HAVE_NVCUVID
59
- #if CUDA_VERSION >= 9000 && CUDA_VERSION < 10000
59
+ #if defined(HAVE_DYNLINK_NVCUVID_HEADER)
60
60
#include < dynlink_nvcuvid.h>
61
- #else
61
+ #elif defined(HAVE_NVCUVID_HEADER)
62
62
#include < nvcuvid.h>
63
63
#endif
64
64
Original file line number Diff line number Diff line change 44
44
#ifndef __VIDEO_DECODER_HPP__
45
45
#define __VIDEO_DECODER_HPP__
46
46
47
- #if CUDA_VERSION >= 9000 && CUDA_VERSION < 10000
47
+ #if defined(HAVE_DYNLINK_NVCUVID_HEADER)
48
48
#include < dynlink_nvcuvid.h>
49
- #else
49
+ #elif defined(HAVE_NVCUVID_HEADER)
50
50
#include < nvcuvid.h>
51
51
#endif
52
52
Original file line number Diff line number Diff line change 44
44
#ifndef __VIDEO_PARSER_HPP__
45
45
#define __VIDEO_PARSER_HPP__
46
46
47
- #if CUDA_VERSION >= 9000 && CUDA_VERSION < 10000
47
+ #if defined(HAVE_DYNLINK_NVCUVID_HEADER)
48
48
#include < dynlink_nvcuvid.h>
49
- #else
49
+ #elif defined(HAVE_NVCUVID_HEADER)
50
50
#include < nvcuvid.h>
51
51
#endif
52
52
You can’t perform that action at this time.
0 commit comments