move rust-cpp prelude to lib
MODIFY
build.rs
build.rs
@@ -309,15 +309,9 @@ fn build_wrapper(opencv: pkg_config::Library) -> Result<(), Box<dyn Error>> {
{
let mut types = File::create(module_dir.join("types.rs"))?;
- writeln!(&mut types, "use libc::{{c_void, c_char, size_t}};")?;
+ writeln!(&mut types, "use std::os::raw::{{c_char, c_void}};")?;
+ writeln!(&mut types, "use libc::size_t;")?;
writeln!(&mut types, "use crate::{{core, types}};")?;
- writeln!(&mut types, "cpp!{{{{")?;
- writeln!(&mut types, " #include \"../common_opencv.h\"")?;
- writeln!(&mut types, " using namespace cv;")?;
- writeln!(&mut types, " #include \"common.h\"")?;
- writeln!(&mut types, " #include \"../types.h\"")?;
- writeln!(&mut types, " #include \"../return_types.h\"")?;
- writeln!(&mut types, "}}}}")?;
writeln!(&mut types, "")?;
for entry in glob(&format!("{}/*.type.rs", out_dir_as_str))? {
let entry = entry?;

MODIFY
src/lib.rs
src/lib.rs
@@ -27,3 +27,11 @@ pub mod prelude {
#[cfg(test)]
mod test;
+
+cpp! {{
+ #include "../common_opencv.h"
+ using namespace cv;
+ #include "common.h"
+ #include "../types.h"
+ #include "../return_types.h"
+}}

move rust-cpp prelude to lib