use std::{env, path::Path};
fn main() {
let dir = env::var("CARGO_MANIFEST_DIR").unwrap();
std::process::Command::new("cronus_cli")
.arg(&dir)
.output()
.expect("failed to generate API");
#[cfg(target_os = "macos")]
{
let clamshell_dir = "lib/clamshell";
let output = std::process::Command::new("sh")
.arg("-c")
.arg(format!("cd {} && ./build.sh", clamshell_dir))
.output()
.expect("Failed to execute build.sh");
if !output.status.success() {
eprintln!(
"Error running build.sh: {}",
String::from_utf8_lossy(&output.stderr)
);
std::process::exit(1);
}
let lib_path: std::path::PathBuf = Path::new(&dir).join("lib/clamshell/build");
println!("cargo:rustc-link-lib=framework=IOKit");
println!("cargo:rustc-link-lib=framework=Foundation");
println!("cargo:rustc-link-lib=static=StaticClamShell");
println!("cargo:rustc-link-search=native={}", lib_path.display());
println!("cargo:rustc-link-arg=-Wl,-rpath,{}", lib_path.display());
}
}