36 lines
1.2 KiB
Rust
36 lines
1.2 KiB
Rust
fn main() {
|
|
#[cfg(feature = "cmd")]
|
|
{
|
|
use std::{env, path::PathBuf};
|
|
|
|
let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
|
|
println!(
|
|
"cargo:rustc-link-search=native={}",
|
|
manifest_dir.join("../spectre-api-c/build-host").display()
|
|
);
|
|
println!("cargo:rustc-link-lib=static=spectre");
|
|
println!(
|
|
"cargo:rerun-if-changed={}",
|
|
manifest_dir
|
|
.join("../spectre-api-c/build-host/libspectre.a")
|
|
.display()
|
|
);
|
|
|
|
if let Ok(libsodium_install_dir) = env::var("LIBSODIUM_INSTALL_DIR") {
|
|
let libsodium_install_dir =
|
|
PathBuf::from(libsodium_install_dir).canonicalize().unwrap();
|
|
println!(
|
|
"cargo:rustc-link-search=native={}",
|
|
libsodium_install_dir.join("lib").display()
|
|
);
|
|
println!("cargo:rustc-link-lib=static=sodium");
|
|
println!(
|
|
"cargo:rerun-if-changed={}",
|
|
libsodium_install_dir.join("lib/libsodium.a").display()
|
|
);
|
|
} else {
|
|
panic!("Environment variable `LIBSODIUM_INSTALL_DIR` missing!");
|
|
}
|
|
}
|
|
}
|