workaroung missing 3rd party libs
MODIFY
build.rs
build.rs
@@ -27,7 +27,13 @@ fn main() {
let actual_opencv = search_opencv.expect("Could not find opencv2 dir in pkg-config includes");
// add 3rdparty lib dit. pkgconfig forgets it somehow.
- println!("cargo:rustc-link-search=native={}/share/OpenCV/3rdparty/lib", pkg_config::Config::get_variable("opencv", "prefix").unwrap());
+ let third_party_dir = format!("{}/share/OpenCV/3rdparty/lib", pkg_config::Config::get_variable("opencv", "prefix").unwrap());
+ println!("cargo:rustc-link-search=native={}", third_party_dir);
+ let third_party_libs = glob(&(third_party_dir.clone()+"/*.a")).unwrap().map(|f| {
+ let f = f.unwrap();
+ let s = f.file_stem().unwrap().to_str();
+ s.unwrap()[3..].to_string()
+ }).collect::<Vec<String>>();
println!("OpenCV lives in {:?}", actual_opencv);
println!("Generating code in {:?}", out_dir);
@@ -258,8 +264,8 @@ fn main() {
}
writeln!(&mut hub, "}}\n").unwrap();
}
- /*
println!("cargo:rustc-link-lib=ocvrs");
- println!("cargo:rustc-link-lib=stdc++");
- */
+ for lib in third_party_libs {
+ println!("cargo:rustc-link-lib={}", lib);
+ }
}

workaroung missing 3rd party libs