try and fix build on travis
MODIFY
Cargo.toml
Cargo.toml
@@ -30,6 +30,6 @@ path = "examples/video_to_gray.rs"
libc = "0.2"
[build-dependencies]
-pkg-config = "0.3"
+pkg-config = "0.3.14"
cc = "1.0"
glob = "0.2"

MODIFY
build.rs
build.rs
@@ -13,7 +13,7 @@ use std::process::Command;
fn main() {
let out_dir = std::env::var("OUT_DIR").unwrap();
- let opencv = pkg_config::Config::new().find("opencv").unwrap();
+ let opencv = pkg_config::Config::new().cargo_metadata(false).probe("opencv").unwrap();
let mut search_paths = opencv.include_paths.clone();
search_paths.push(PathBuf::from("/usr/include"));
let search_opencv = search_paths
@@ -31,6 +31,16 @@ fn main() {
println!("cargo:rerun-if-changed=gen_rust.py");
println!("cargo:rerun-if-changed=hdr_parser.py");
+ for path in opencv.link_paths {
+ println!("cargo:rustc-link-search=native={}", path.to_str().unwrap());
+ }
+
+ for lib in opencv.libs {
+ if lib != "stdc++" {
+ println!("cargo:rustc-link-lib={}", lib);
+ }
+ }
+
let mut gcc = cc::Build::new();
gcc.cpp(true);
gcc.flag("-std=c++0x");
@@ -142,8 +152,6 @@ fn main() {
.include(&out_dir)
.flag("-Wno-c++11-extensions");
- gcc.compile("libocvrs.a");
-
for ref module in &modules {
let e = Command::new("sh")
.current_dir(&out_dir)
@@ -164,6 +172,8 @@ fn main() {
assert!(e.success());
}
+ gcc.compile("ocvrs");
+
let mut hub_filename = PathBuf::from(&out_dir);
hub_filename.push("hub.rs");
{
@@ -202,5 +212,8 @@ fn main() {
}
writeln!(&mut hub, "}}\n").unwrap();
}
+ /*
println!("cargo:rustc-link-lib=ocvrs");
+ println!("cargo:rustc-link-lib=stdc++");
+ */
}

try and fix build on travis