2026-01-19 20:13:25 +01:00
|
|
|
fn main() {
|
2026-01-20 02:55:17 +01:00
|
|
|
#[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()
|
|
|
|
|
);
|
2026-01-19 20:13:25 +01:00
|
|
|
|
2026-01-21 00:48:17 +01:00
|
|
|
if let Ok(libsodium_install_dir) = env::var("LIBSODIUM_INSTALL_DIR") {
|
2026-01-22 01:21:23 +01:00
|
|
|
let libsodium_install_dir =
|
|
|
|
|
PathBuf::from(libsodium_install_dir).canonicalize().unwrap();
|
2026-01-21 00:48:17 +01:00
|
|
|
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 {
|
2026-02-08 21:04:28 +01:00
|
|
|
panic!("Environment variable `LIBSODIUM_INSTALL_DIR` missing!");
|
2026-01-21 00:48:17 +01:00
|
|
|
}
|
2026-01-20 02:55:17 +01:00
|
|
|
}
|
2026-01-19 20:13:25 +01:00
|
|
|
}
|