From a6144b8e1a3bfdba87882dab4443d8ea2623e6f0 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sat, 25 May 2019 10:18:34 +0100 Subject: [PATCH] OpenBSD build fix --- modules/videoio/src/backend_plugin.cpp | 10 +++++----- modules/videoio/src/cap_v4l.cpp | 4 ++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/videoio/src/backend_plugin.cpp b/modules/videoio/src/backend_plugin.cpp index e1d8f3835b..12e934b8c3 100644 --- a/modules/videoio/src/backend_plugin.cpp +++ b/modules/videoio/src/backend_plugin.cpp @@ -21,7 +21,7 @@ using namespace std; #if defined(_WIN32) #include -#elif defined(__linux__) || defined(__APPLE__) +#elif defined(__linux__) || defined(__APPLE__) || defined(__OpenBSD__) #include #endif @@ -29,7 +29,7 @@ namespace cv { namespace impl { #if defined(_WIN32) typedef HMODULE LibHandle_t; -#elif defined(__linux__) || defined(__APPLE__) +#elif defined(__linux__) || defined(__APPLE__) || defined(__OpenBSD__) typedef void* LibHandle_t; #endif @@ -44,7 +44,7 @@ void* getSymbol_(LibHandle_t h, const char* symbolName) { #if defined(_WIN32) return (void*)GetProcAddress(h, symbolName); -#elif defined(__linux__) || defined(__APPLE__) +#elif defined(__linux__) || defined(__APPLE__) || defined(__OpenBSD__) return dlsym(h, symbolName); #endif } @@ -54,7 +54,7 @@ LibHandle_t libraryLoad_(const char* filename) { #if defined(_WIN32) return LoadLibraryA(filename); -#elif defined(__linux__) || defined(__APPLE__) +#elif defined(__linux__) || defined(__APPLE__) || defined(__OpenBSD__) return dlopen(filename, RTLD_LAZY); #endif } @@ -64,7 +64,7 @@ void libraryRelease_(LibHandle_t h) { #if defined(_WIN32) FreeLibrary(h); -#elif defined(__linux__) || defined(__APPLE__) +#elif defined(__linux__) || defined(__APPLE__) || defined(__OpenBSD__) dlclose(h); #endif } diff --git a/modules/videoio/src/cap_v4l.cpp b/modules/videoio/src/cap_v4l.cpp index 5e44fb14d4..943cc6ee7b 100644 --- a/modules/videoio/src/cap_v4l.cpp +++ b/modules/videoio/src/cap_v4l.cpp @@ -238,6 +238,10 @@ make & enjoy! #include #endif +#ifdef __OpenBSD__ +typedef uint32_t __u32; +#endif + // https://github.com/opencv/opencv/issues/13335 #ifndef V4L2_CID_ISO_SENSITIVITY #define V4L2_CID_ISO_SENSITIVITY (V4L2_CID_CAMERA_CLASS_BASE+23)