From 3d9bc677c8470c0a455c2d0e604cc6000461cb9b Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Thu, 8 Jun 2023 14:52:36 +0200 Subject: [PATCH] OpenCV 2 compat OpenCV 2 (at least in CentOS 7) has the imgproc.hpp header in (opencv2/)imgproc/ subdirectory. Instead of tweaking the location, include opencv.hpp directly if available (as it was before 2db2a73803). --- configure.ac | 3 +++ src/capture_filter/resize_utils.cpp | 6 +++++- src/video_display/conference.cpp | 6 +++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 982a85ab4..91d24601f 100644 --- a/configure.ac +++ b/configure.ac @@ -1319,6 +1319,9 @@ if test "$opencv_req" != no; then fi if test "$opencv" = yes; then + AC_LANG_PUSH(C++) + AC_CHECK_HEADERS([opencv2/opencv.hpp]) + AC_LANG_POP(C++) # opencv_imgproc is commonly needed so make the check here SAVED_LIBS=$LIBS LIBS="$LIBS $OPENCV_LIBS" diff --git a/src/capture_filter/resize_utils.cpp b/src/capture_filter/resize_utils.cpp index 7f5caaee9..1772528ac 100644 --- a/src/capture_filter/resize_utils.cpp +++ b/src/capture_filter/resize_utils.cpp @@ -6,7 +6,7 @@ */ /* * Copyright (c) 2014 Fundació i2CAT, Internet I Innovació Digital a Catalunya - * Copyright (c) 2015-2021 CESNET, z. s. p. o. + * Copyright (c) 2015-2023 CESNET, z. s. p. o. * * Redistribution and use in source and binary forms, with or without * modification, is permitted provided that the following conditions @@ -54,8 +54,12 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wcast-align" #pragma GCC diagnostic ignored "-Wcast-qual" +#ifdef HAVE_OPENCV2_OPENCV_HPP +#include +#else #include #include +#endif #pragma GCC diagnostic pop #include "capture_filter/resize_utils.h" diff --git a/src/video_display/conference.cpp b/src/video_display/conference.cpp index 3a88294f9..b868f163a 100644 --- a/src/video_display/conference.cpp +++ b/src/video_display/conference.cpp @@ -4,7 +4,7 @@ * @author Martin Piatka */ /* - * Copyright (c) 2014-2022 CESNET, z. s. p. o. + * Copyright (c) 2014-2023 CESNET, z. s. p. o. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -64,8 +64,12 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wcast-align" #pragma GCC diagnostic ignored "-Wcast-qual" +#ifdef HAVE_OPENCV2_OPENCV_HPP +#include +#else #include #include +#endif #pragma GCC diagnostic pop #ifdef __SSSE3__