opencv_has_inherent_feature_opencl

Macro opencv_has_inherent_feature_opencl 

Source
macro_rules! opencv_has_inherent_feature_opencl {
    ($bl_pos:block else $bl_neg:block) => { ... };
    ($($tt:tt)*) => { ... };
}
Expand description

Conditional compilation macro based on whether OpenCV was built with or without the opencl feature

The macro has two forms:

  1. Two blocks, separated by the else keyword. The first block will be compiled if the OpenCV feature is enabled, the second one — if it’s not. Note that both blocks must have the same return type.
  2. Plain token tree, for usage on the item level, e.g., for use imports. The code inside will be compiled if the OpenCV feature is enabled and completely skipped if it’s not.

§Examples

Two blocks with else:

let cuda_available = opencv::opencv_has_inherent_feature_cuda! {
    {
        true
    } else {
        false
    }
};

Plain token tree:

opencv::opencv_has_inherent_feature_cuda! {
   use opencv::core::GpuMat;
}