gentoo-ebuilds/media-libs/opencv/files/opencv-4.8.1-use-system-opencl.patch
Paul Zander 0e9205edb9
media-libs/opencv: add 4.8.1-r1
Closes: https://bugs.gentoo.org/702258
Closes: https://bugs.gentoo.org/830294
Closes: https://bugs.gentoo.org/883375
Closes: https://bugs.gentoo.org/913740
Closes: https://bugs.gentoo.org/914922
Closes: https://bugs.gentoo.org/917121
Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
Signed-off-by: Sam James <sam@gentoo.org>
2024-01-10 12:32:37 +00:00

25 lines
933 B
Diff

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)