OpenCVConfig-CUDA.cmake.in 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # Version Compute Capability from which OpenCV has been compiled is remembered
  2. set(OpenCV_COMPUTE_CAPABILITIES "@OpenCV_CUDA_CC@")
  3. set(OpenCV_CUDA_VERSION "@CUDA_VERSION_STRING@")
  4. set(OpenCV_USE_CUBLAS "@HAVE_CUBLAS@")
  5. set(OpenCV_USE_CUFFT "@HAVE_CUFFT@")
  6. set(OpenCV_USE_NVCUVID "@HAVE_NVCUVID@")
  7. set(OpenCV_CUDNN_VERSION "@CUDNN_VERSION@")
  8. set(OpenCV_USE_CUDNN "@HAVE_CUDNN@")
  9. if(NOT CUDA_FOUND)
  10. find_host_package(CUDA ${OpenCV_CUDA_VERSION} EXACT REQUIRED)
  11. else()
  12. if(NOT CUDA_VERSION_STRING VERSION_EQUAL OpenCV_CUDA_VERSION)
  13. message(FATAL_ERROR "OpenCV static library was compiled with CUDA ${OpenCV_CUDA_VERSION} support. Please, use the same version or rebuild OpenCV with CUDA ${CUDA_VERSION_STRING}")
  14. endif()
  15. endif()
  16. set(OpenCV_CUDA_LIBS_ABSPATH ${CUDA_LIBRARIES})
  17. if(CUDA_VERSION VERSION_LESS "5.5")
  18. list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_npp_LIBRARY})
  19. else()
  20. find_cuda_helper_libs(nppc)
  21. find_cuda_helper_libs(nppi)
  22. find_cuda_helper_libs(npps)
  23. list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nppc_LIBRARY} ${CUDA_nppi_LIBRARY} ${CUDA_npps_LIBRARY})
  24. endif()
  25. if(OpenCV_USE_CUBLAS)
  26. list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_CUBLAS_LIBRARIES})
  27. endif()
  28. if(OpenCV_USE_CUFFT)
  29. list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_CUFFT_LIBRARIES})
  30. endif()
  31. if(OpenCV_USE_NVCUVID)
  32. list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nvcuvid_LIBRARIES})
  33. endif()
  34. if(WIN32)
  35. list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nvcuvenc_LIBRARIES})
  36. endif()
  37. set(OpenCV_CUDA_LIBS_RELPATH "")
  38. foreach(l ${OpenCV_CUDA_LIBS_ABSPATH})
  39. get_filename_component(_tmp ${l} PATH)
  40. if(NOT ${_tmp} MATCHES "-Wl.*")
  41. list(APPEND OpenCV_CUDA_LIBS_RELPATH ${_tmp})
  42. endif()
  43. endforeach()
  44. list(REMOVE_DUPLICATES OpenCV_CUDA_LIBS_RELPATH)
  45. link_directories(${OpenCV_CUDA_LIBS_RELPATH})