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:
- Two blocks, separated by the
elsekeyword. 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. - Plain token tree, for usage on the item level, e.g., for
useimports. 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;
}