mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
opencv: Fix build with OpenCV < 3
We only need the opencv2/bgsegm.hpp header for OpenCV >= 3 and have compat code for older versions.
This commit is contained in:
parent
9539edd1b5
commit
47847a4d5d
2 changed files with 23 additions and 5 deletions
|
@ -2730,8 +2730,13 @@ AG_GST_CHECK_FEATURE(OPENCV, [opencv plugins], opencv, [
|
|||
opencv2/imgproc/imgproc_c.h \
|
||||
opencv2/objdetect/objdetect.hpp \
|
||||
opencv2/video/background_segm.hpp], [], [something_not_found=yes])
|
||||
dnl check opencv_contrib headers (not always present in opencv distributions)
|
||||
AC_CHECK_HEADERS([opencv2/bgsegm.hpp], [], [something_not_found=yes])
|
||||
|
||||
dnl Only required for OpenCV >= 3, we have compat code for older versions
|
||||
PKG_CHECK_MODULES(OPENCV_3, opencv >= 3, [
|
||||
dnl check opencv_contrib headers (not always present in opencv distributions)
|
||||
AC_CHECK_HEADERS([opencv2/bgsegm.hpp], [], [something_not_found=yes])],
|
||||
[NOT_A_PROBLEM=yes])
|
||||
|
||||
CPPFLAGS=$OLD_CPPFLAGS
|
||||
AC_LANG([C])
|
||||
|
||||
|
|
|
@ -32,6 +32,9 @@ libopencv2_headers = [
|
|||
'opencv2/imgproc/imgproc_c.h',
|
||||
'opencv2/objdetect/objdetect.hpp',
|
||||
'opencv2/video/background_segm.hpp',
|
||||
]
|
||||
|
||||
libopencv3_headers = [
|
||||
'opencv2/bgsegm.hpp',
|
||||
]
|
||||
|
||||
|
@ -39,13 +42,14 @@ gstopencv_cargs = ['-DGST_HAAR_CASCADES_DIR="@0@"']
|
|||
|
||||
# First, check for the upper version limit and ensure it isn't found
|
||||
# FIXME: When 0.37.0 is released, change this to use many-version-conditions
|
||||
opencv3_dep = dependency('opencv', version : '>3.1.0', required : false)
|
||||
opencv3_1_dep = dependency('opencv', version : '>3.1.0', required : false)
|
||||
# Then, check if the lower version limit is found
|
||||
opencv2_dep = dependency('opencv', version : '>=2.3.0', required : false)
|
||||
opencv3_dep = dependency('opencv', version : '>= 3.0 ', required : false)
|
||||
|
||||
opencv2_found = false
|
||||
if opencv3_dep.found()
|
||||
message('OpenCV version is too new: \'' + opencv3_dep.version() + '\' (need <= 3.1.0)')
|
||||
if opencv3_1_dep.found()
|
||||
message('OpenCV version is too new: \'' + opencv3_1_dep.version() + '\' (need <= 3.1.0)')
|
||||
elif opencv2_dep.found()
|
||||
message('OpenCV found, version is \'' + opencv2_dep.version() + '\'')
|
||||
opencv2_found = true
|
||||
|
@ -55,6 +59,15 @@ elif opencv2_dep.found()
|
|||
opencv2_found = false
|
||||
endif
|
||||
endforeach
|
||||
|
||||
if opencv3_dep.found()
|
||||
foreach h : libopencv3_headers
|
||||
if not cxx.has_header(h)
|
||||
message('Needed header "' + h + '" not found')
|
||||
opencv2_found = false
|
||||
endif
|
||||
endforeach
|
||||
endif
|
||||
endif
|
||||
|
||||
if opencv2_found
|
||||
|
|
Loading…
Reference in a new issue