opencv-4.8.1-use-system-opencl.patch 933 B

1234567891011121314151617181920212223242526
  1. From: Paul Zander <negril.nx+gentoo@gmail.com>
  2. Find the system opencl and inject the include dir.
  3. diff --git a/cmake/OpenCVDetectOpenCL.cmake b/cmake/OpenCVDetectOpenCL.cmake
  4. index 100fb0e..ab30bf9 100644
  5. --- a/cmake/OpenCVDetectOpenCL.cmake
  6. +++ b/cmake/OpenCVDetectOpenCL.cmake
  7. @@ -1,3 +1,8 @@
  8. +find_package(OpenCLHeaders REQUIRED)
  9. +if(NOT TARGET OpenCL::Headers)
  10. + message(FATAL_ERROR "OpenCL::Headers not found")
  11. +endif()
  12. +
  13. set(OPENCL_FOUND ON CACHE BOOL "OpenCL library is found")
  14. if(APPLE)
  15. set(OPENCL_LIBRARY "-framework OpenCL" CACHE STRING "OpenCL library")
  16. @@ -5,6 +10,7 @@ if(APPLE)
  17. else()
  18. set(OPENCL_LIBRARY "" CACHE STRING "OpenCL library")
  19. set(OPENCL_INCLUDE_DIR "${OpenCV_SOURCE_DIR}/3rdparty/include/opencl/1.2" CACHE PATH "OpenCL include directory")
  20. + get_target_property(OPENCL_INCLUDE_DIR OpenCL::Headers INTERFACE_INCLUDE_DIRECTORIES)
  21. endif()
  22. mark_as_advanced(OPENCL_INCLUDE_DIR OPENCL_LIBRARY)