Reputation: 162
i am using opencv with another library. So i would like to compile a class if OpenCV has CUDA. i need to acheive this in Cmake file. But i cannot find any variable that tells whether OpenCV has CUDA or not.
FindOpenCV.cmake defines these variables
OpenCV_FOUND OpenCV_LIBS OpenCV_INCLUDE_DIR OpenCV_VERSION
now how can i find out if OpenCV is compiled with CUDA or not from this cmake file?
Upvotes: 1
Views: 2957
Reputation: 6420
Here is the list of CMake variables, that can help you:
OpenCV_COMPUTE_CAPABILITIES
- compute capability from which OpenCV has been compiled, can be added to nvcc flags.
list(APPEND CUDA_NVCC_FLAGS ${OpenCV_COMPUTE_CAPABILITIES})
OpenCV_CUDA_VERSION
- CUDA toolkit version which was used to build OpenCV, if OpenCV was built without CUDA support, the variable is empty. You can check this variable:
if(OpenCV_CUDA_VERSION)
# Have CUDA support
endif()
OpenCV_USE_CUBLAS
- true if OpenCV was built with CUBLAS support
OpenCV_USE_CUFFT
- true if OpenCV was built with CUFFT support
OpenCV_USE_NVCUVID
- true if OpenCV was built with NVCUVID support
Upvotes: 6