move bindings for OpenCV-3.4 into a separate dir
MODIFY
build.rs
build.rs
@@ -86,9 +86,12 @@ fn build_wrapper(opencv_header_dir: &PathBuf) -> Result<(), Box<dyn Error>> {
let out_dir = PathBuf::from(env::var("OUT_DIR")?);
let out_dir_as_str = out_dir.to_str().unwrap();
- let hub_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR")?).join("src");
- let module_dir = hub_dir.join("hub");
+ let mut hub_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR")?).join("src");
let manual_dir = hub_dir.join("manual");
+ if cfg!(feature = "opencv_34") {
+ hub_dir.push("opencv_34");
+ }
+ let module_dir = hub_dir.join("hub");
let opencv_dir = opencv_header_dir.join("opencv2");

MODIFY
src/lib.rs
src/lib.rs
extern crate cpp;
pub use error::{Error, Result};
-
-pub use self::hub::*;
+pub use opencv_34::hub::*;
#[macro_use]
mod templ;
-#[allow(unused_imports, non_snake_case, dead_code)]
-#[allow(non_upper_case_globals, overflowing_literals)]
-#[allow(non_camel_case_types)]
-mod hub;
-
+mod opencv_34;
mod manual;
mod error;

MODIFY
src/manual/core.rs
src/manual/core.rs
@@ -29,11 +29,11 @@ mod vec;
#[inline(always)]
pub const fn MAT_DEPTH(flags: i32) -> i32 {
#![allow(non_snake_case)]
- flags & crate::hub::core::Mat_DEPTH_MASK
+ flags & crate::core::Mat_DEPTH_MASK
}
#[inline(always)]
pub const fn MAKETYPE(depth: i32, cn: i32) -> i32 {
#![allow(non_snake_case)]
- MAT_DEPTH(depth) + ((cn - 1) << crate::hub::core::CV_CN_SHIFT)
+ MAT_DEPTH(depth) + ((cn - 1) << crate::core::CV_CN_SHIFT)
}

MODIFY
src/manual/core/mat.rs
src/manual/core/mat.rs
@@ -4,7 +4,7 @@ use libc::size_t;
use crate::{
Error,
- hub::core::{self, Mat, MatSize, MatStep, Scalar},
+ core::{self, Mat, MatSize, MatStep, Scalar},
Result,
sys,
};
@@ -26,7 +26,7 @@ macro_rules! data_type {
fn channels() -> i32 { $channels }
#[inline(always)]
- fn typ() -> i32 { $crate::hub::core::MAKETYPE($mat_depth, $channels) }
+ fn typ() -> i32 { $crate::core::MAKETYPE($mat_depth, $channels) }
}
impl private::Sealed for $rust_type {}

MODIFY
src/manual/features2d.rs
src/manual/features2d.rs
use crate::{
- hub::features2d::{self, ORB},
+ features2d::{self, ORB},
Result,
types::PtrOfORB,
};

ADD
src/opencv_34/mod.rs
+#[allow(unused_imports, non_snake_case, dead_code)]
+#[allow(non_upper_case_globals, overflowing_literals)]
+#[allow(non_camel_case_types)]
+pub mod hub;

MODIFY
src/test/sys.rs
src/test/sys.rs
use std::{ffi::c_void, mem::size_of};
-use crate::hub::{core::Mat, sys::cv_return_value};
+use crate::{core::Mat, sys::cv_return_value};
#[test]
fn cv_return_type() {

move bindings for OpenCV-3.4 into a separate dir