FindOpenVX.cmake 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. ocv_clear_vars(HAVE_OPENVX)
  2. set(OPENVX_ROOT "" CACHE PATH "OpenVX install directory")
  3. set(OPENVX_LIB_CANDIDATES "openvx;vxu" CACHE STRING "OpenVX library candidates list")
  4. function(find_openvx_libs _found)
  5. foreach(one ${OPENVX_LIB_CANDIDATES})
  6. find_library(OPENVX_${one}_LIBRARY ${one} PATHS "${OPENVX_ROOT}/lib" "${OPENVX_ROOT}/bin")
  7. if(OPENVX_${one}_LIBRARY)
  8. list(APPEND _list ${OPENVX_${one}_LIBRARY})
  9. endif()
  10. endforeach()
  11. set(${_found} ${_list} PARENT_SCOPE)
  12. endfunction()
  13. if(OPENVX_ROOT)
  14. find_path(OPENVX_INCLUDE_DIR "VX/vx.h" PATHS "${OPENVX_ROOT}/include" DOC "OpenVX include path")
  15. if(NOT DEFINED OPENVX_LIBRARIES)
  16. find_openvx_libs(found)
  17. if(found)
  18. set(OPENVX_LIBRARIES "${found}" CACHE STRING "OpenVX libraries")
  19. endif()
  20. endif()
  21. endif()
  22. if(OPENVX_INCLUDE_DIR AND OPENVX_LIBRARIES)
  23. set(HAVE_OPENVX TRUE)
  24. try_compile(OPENVX_RENAMED_REF
  25. "${OpenCV_BINARY_DIR}"
  26. "${OpenCV_SOURCE_DIR}/cmake/checks/openvx_refenum_test.cpp"
  27. CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${OPENVX_INCLUDE_DIR}"
  28. LINK_LIBRARIES ${OPENVX_LIBRARIES}
  29. OUTPUT_VARIABLE OUTPUT
  30. )
  31. if(OPENVX_RENAMED_REF)
  32. add_definitions(-DIVX_RENAMED_REFS=1)
  33. message(STATUS "OpenVX: Checking reference attribute name convention... New")
  34. else()
  35. message(STATUS "OpenVX: Checking reference attribute name convention... Old")
  36. endif()
  37. endif()
  38. if(NOT HAVE_OPENVX)
  39. ocv_clear_vars(HAVE_OPENVX OPENVX_LIBRARIES OPENVX_INCLUDE_DIR)
  40. endif()