#[cfg(feature = "vendored")]
fn emit_dylibs() -> Vec<&'static str> {
if cfg!(target_os = "windows") {
return vec!["user32", "crypt32"];
}
if cfg!(any(target_os = "linux")) {
return vec!["stdc++"];
}
vec!["c++"]
}
fn botan_lib_major_version() -> i32 {
if cfg!(any(feature = "vendored", feature = "botan3")) {
3
} else {
2
}
}
fn botan_library_name() -> String {
let major_version = botan_lib_major_version();
if cfg!(target_os = "windows") && major_version == 2 {
"botan".to_string()
} else {
format!("botan-{major_version}")
}
}
fn main() {
#[cfg(feature = "vendored")]
{
let (lib_dir, _) = botan_src::build();
println!("cargo:vendored=1");
println!("cargo:rustc-link-search=native={}", &lib_dir);
println!("cargo:rustc-link-lib=static={}", botan_library_name(),);
for dylib in emit_dylibs() {
println!("cargo:rustc-flags=-l dylib={}", dylib);
}
}
#[cfg(not(feature = "vendored"))]
{
println!("cargo:rustc-link-lib={}", botan_library_name());
}
}