Skip to content

Commit

Permalink
Include additional core headers conditionally
Browse files Browse the repository at this point in the history
  • Loading branch information
twistedfall committed Jan 22, 2025
1 parent af5d857 commit 33f5a9f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
18 changes: 12 additions & 6 deletions src_cpp/core.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
#include "ocvrs_common.hpp"
#include <opencv2/core/affine.hpp>
#include <opencv2/core/directx.hpp>
#include <opencv2/core/ocl.hpp>
#include <opencv2/core/va_intel.hpp>
#include <opencv2/core/cuda.hpp>
#include <opencv2/core/opengl.hpp>
#include <opencv2/core/directx.hpp>
#ifdef HAVE_OPENCL
#include <opencv2/core/ocl.hpp>
// opengl.hpp, va_intel.hpp and directx.hpp unconditionally include ocl.hpp thus it needs to be within ifdef HAVE_OPENCL
#ifdef HAVE_OPENGL
#include <opencv2/core/opengl.hpp>
#endif
#include <opencv2/core/va_intel.hpp>
#include <opencv2/core/directx.hpp>
#endif
#ifdef HAVE_CUDA
#include <opencv2/core/cuda.hpp>
#endif
#if (CV_VERSION_MAJOR == 3 && CV_VERSION_MINOR == 4 && CV_VERSION_REVISION >= 4) /* 3.4.4+ */ \
|| (CV_VERSION_MAJOR == 4) /* 4.0+ */ \
|| (CV_VERSION_MAJOR == 5) /* 5.0+ */
Expand Down
15 changes: 10 additions & 5 deletions src_cpp/ocvrs_common.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#ifndef __OCVRS_COMMON_HPP__
#define __OCVRS_COMMON_HPP__

#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(__TOS_WIN__) || defined(__WINDOWS__) \
|| defined(__CYGWIN__) || defined(__MINGW32__) || defined(__BORLANDC__)
#define OCVRS_TARGET_OS_WINDOWS
#endif
#include <memory>
#include <opencv2/cvconfig.h>
// defining HAVE_VA starts to rely on <va/va.h> for VADisplay and VASurfaceID instead of OpenCV stubs, and we stop generating
// bindings for the functions that use them
#undef HAVE_VA

#define CV_COLLECT_IMPL_DATA
#ifdef OCVRS_PARSING_HEADERS
Expand All @@ -15,9 +16,13 @@
#define OCVRS_FFI_EXPORT_SUFFIX
#endif

#include <memory>
#include <opencv2/core.hpp>

#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(__TOS_WIN__) || defined(__WINDOWS__) \
|| defined(__CYGWIN__) || defined(__MINGW32__) || defined(__BORLANDC__)
#define OCVRS_TARGET_OS_WINDOWS
#endif

#define OCVRS_ONLY_DEPENDENT_TYPES

#define OCVRS_HANDLE(code, msg, return_name) Err(code, msg, return_name)
Expand Down

0 comments on commit 33f5a9f

Please sign in to comment.