/* ============================================================
 *
 * This file is a part of digiKam project
 * http://www.digikam.org
 *
 * Date        : 2010-06-16
 * Description : Wrapper for OpenCV header files
 *
 * Copyright (C) 2012-2018 by Gilles Caulier <caulier dot gilles at gmail dot com>
 *
 * This program is free software; you can redistribute it
 * and/or modify it under the terms of the GNU General
 * Public License as published by the Free Software Foundation;
 * either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * ============================================================ */

#ifndef LIB_OPEN_CV_H
#define LIB_OPEN_CV_H

// Pragma directives to reduce warnings from OpenCV header files.
#if !defined(__APPLE__) && defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
#endif

#if defined(__APPLE__) && defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnon-virtual-dtor"
#pragma clang diagnostic ignored "-Woverloaded-virtual"
#pragma clang diagnostic ignored "-Wcast-align"
#endif

// Used to find shared Haar Cascade files.
#define OPENCV_ROOT_PATH "${OpenCV_DIR}"

// OpenCV includes

#include <opencv2/core/version.hpp>

#define OPENCV_MAKE_VERSION(major,minor,patch) (((major) << 16) | ((minor) << 8) | (patch))
#define OPENCV_VERSION                         OPENCV_MAKE_VERSION(CV_MAJOR_VERSION,CV_MINOR_VERSION,CV_SUBMINOR_VERSION)
#define OPENCV_TEST_VERSION(major,minor,patch) ( OPENCV_VERSION < OPENCV_MAKE_VERSION(major,minor,patch) )

#if OPENCV_TEST_VERSION(2,5,0)
#   include <opencv2/opencv.hpp>
#   include <opencv2/legacy/compat.hpp>
#   include <opencv/cvaux.h>
#   include <opencv2/imgproc/imgproc.hpp>
#else
#   include <opencv/cv.h>
#   include <opencv/cvaux.h>
#   include <opencv/cxcore.h>
#   include <opencv2/imgproc.hpp>
#endif

#if OPENCV_TEST_VERSION(3,0,0)
#   include <opencv2/core/core.hpp>
#   include <opencv2/core/internal.hpp>
#   include <opencv2/contrib/contrib.hpp>
#else
#   include <opencv2/objdetect.hpp>
#   include <opencv2/core.hpp>
#   include <opencv2/core/utility.hpp>
#   include <opencv2/core/persistence.hpp>
#   include <opencv2/imgcodecs.hpp>
#   include <opencv2/imgcodecs/imgcodecs_c.h>
#endif

// for old-style code
#if OPENCV_VERSION <= OPENCV_MAKE_VERSION(2,4,99)
#   include <opencv2/legacy/compat.hpp>
#endif

// Restore warnings
#if !defined(__APPLE__) && defined(__GNUC__)
#pragma GCC diagnostic pop
#endif

#if defined(__APPLE__) && defined(__clang__)
#pragma clang diagnostic pop
#endif

#endif // LIB_OPEN_CV_H
