Disable snappy if the lib can't be found

main
Thijs Cadier 1 year ago
parent d176ca1cf6
commit 81b452d429

@ -10,13 +10,6 @@ fn main() {
.next() .next()
.expect("Crate version is not valid"); .expect("Crate version is not valid");
let pkg = pkg_config::Config::new();
pkg.probe("zlib").expect("Cannot find zlib");
#[cfg(target_os = "linux")] pkg.probe("icu-i18n").expect("Cannot find icu");
match pkg.probe("snappy") {
Ok(_) => (),
Err(e) => println!("Snappy not found: {}", e)
}
let out_dir_var = env::var("OUT_DIR").expect("No out dir"); let out_dir_var = env::var("OUT_DIR").expect("No out dir");
let out_dir = Path::new(&out_dir_var); let out_dir = Path::new(&out_dir_var);
@ -55,6 +48,19 @@ fn main() {
let mut cmake = Command::new("cmake"); let mut cmake = Command::new("cmake");
cmake.current_dir(&driver_src_path); cmake.current_dir(&driver_src_path);
let pkg = pkg_config::Config::new();
pkg.probe("zlib").expect("Cannot find zlib");
#[cfg(target_os = "linux")] pkg.probe("icu-i18n").expect("Cannot find icu");
match pkg.probe("snappy") {
Ok(_) => {
cmake.arg("-DENABLE_SNAPPY=ON");
},
Err(e) => {
println!("Snappy not found: {}", e);
cmake.arg("-DENABLE_SNAPPY=OFF");
}
}
cmake.arg("-DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF"); cmake.arg("-DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF");
cmake.arg("-DENABLE_SSL=OPENSSL"); cmake.arg("-DENABLE_SSL=OPENSSL");
cmake.arg("-DENABLE_SASL=OFF"); cmake.arg("-DENABLE_SASL=OFF");

Loading…
Cancel
Save