summaryrefslogtreecommitdiff
path: root/media-libs/opencv/files/opencv-4.8.1-use-system-opencl.patch
diff options
context:
space:
mode:
Diffstat (limited to 'media-libs/opencv/files/opencv-4.8.1-use-system-opencl.patch')
-rw-r--r--media-libs/opencv/files/opencv-4.8.1-use-system-opencl.patch25
1 files changed, 25 insertions, 0 deletions
diff --git a/media-libs/opencv/files/opencv-4.8.1-use-system-opencl.patch b/media-libs/opencv/files/opencv-4.8.1-use-system-opencl.patch
new file mode 100644
index 000000000000..f4efd06897df
--- /dev/null
+++ b/media-libs/opencv/files/opencv-4.8.1-use-system-opencl.patch
@@ -0,0 +1,25 @@
+From: Paul Zander <negril.nx+gentoo@gmail.com>
+
+Find the system opencl and inject the include dir.
+
+diff --git a/cmake/OpenCVDetectOpenCL.cmake b/cmake/OpenCVDetectOpenCL.cmake
+index 100fb0e..ab30bf9 100644
+--- a/cmake/OpenCVDetectOpenCL.cmake
++++ b/cmake/OpenCVDetectOpenCL.cmake
+@@ -1,3 +1,8 @@
++find_package(OpenCLHeaders REQUIRED)
++if(NOT TARGET OpenCL::Headers)
++ message(FATAL_ERROR "OpenCL::Headers not found")
++endif()
++
+ set(OPENCL_FOUND ON CACHE BOOL "OpenCL library is found")
+ if(APPLE)
+ set(OPENCL_LIBRARY "-framework OpenCL" CACHE STRING "OpenCL library")
+@@ -5,6 +10,7 @@ if(APPLE)
+ else()
+ set(OPENCL_LIBRARY "" CACHE STRING "OpenCL library")
+ set(OPENCL_INCLUDE_DIR "${OpenCV_SOURCE_DIR}/3rdparty/include/opencl/1.2" CACHE PATH "OpenCL include directory")
++ get_target_property(OPENCL_INCLUDE_DIR OpenCL::Headers INTERFACE_INCLUDE_DIRECTORIES)
+ endif()
+ mark_as_advanced(OPENCL_INCLUDE_DIR OPENCL_LIBRARY)
+