detect_aravis.cmake 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. # --- Aravis SDK ---
  2. if(NOT HAVE_ARAVIS_API AND PKG_CONFIG_FOUND)
  3. ocv_check_modules(ARAVIS aravis-0.8 QUIET)
  4. if(ARAVIS_FOUND)
  5. set(HAVE_ARAVIS_API TRUE)
  6. endif()
  7. endif()
  8. if(NOT HAVE_ARAVIS_API)
  9. find_path(ARAVIS_INCLUDE "arv.h"
  10. PATHS "${ARAVIS_ROOT}" ENV ARAVIS_ROOT
  11. PATH_SUFFIXES "include/aravis-0.8"
  12. NO_DEFAULT_PATH)
  13. find_library(ARAVIS_LIBRARY "aravis-0.8"
  14. PATHS "${ARAVIS_ROOT}" ENV ARAVIS_ROOT
  15. PATH_SUFFIXES "lib"
  16. NO_DEFAULT_PATH)
  17. if(ARAVIS_INCLUDE AND ARAVIS_LIBRARY)
  18. set(HAVE_ARAVIS_API TRUE)
  19. file(STRINGS "${ARAVIS_INCLUDE}/arvversion.h" ver_strings REGEX "#define +ARAVIS_(MAJOR|MINOR|MICRO)_VERSION.*")
  20. string(REGEX REPLACE ".*ARAVIS_MAJOR_VERSION[^0-9]+([0-9]+).*" "\\1" ver_major "${ver_strings}")
  21. string(REGEX REPLACE ".*ARAVIS_MINOR_VERSION[^0-9]+([0-9]+).*" "\\1" ver_minor "${ver_strings}")
  22. string(REGEX REPLACE ".*ARAVIS_MICRO_VERSION[^0-9]+([0-9]+).*" "\\1" ver_micro "${ver_strings}")
  23. set(ARAVIS_VERSION "${ver_major}.${ver_minor}.${ver_micro}") # informational
  24. set(ARAVIS_INCLUDE_DIRS "${ARAVIS_INCLUDE}")
  25. set(ARAVIS_LIBRARIES "${ARAVIS_LIBRARY}")
  26. endif()
  27. endif()
  28. if(HAVE_ARAVIS_API)
  29. ocv_add_external_target(aravis "${ARAVIS_INCLUDE_DIRS}" "${ARAVIS_LIBRARIES}" "HAVE_ARAVIS_API")
  30. endif()