use std::env;
#[cfg(target_os = "macos")]
fn config_macos() {
println!("cargo:rustc-link-lib=framework=Phidget22");
println!(r"cargo:rustc-link-search=framework=/Library/Frameworks");
let fw_path = if cfg!(target_arch = "x86_64") {
"/usr/local"
}
else {
"/opt/homebrew"
};
println!(r"cargo:rustc-link-search=framework={}/Frameworks", fw_path);
}
fn main() {
let tgt = env::var("TARGET").unwrap();
println!("debug: Building for target: '{}'", tgt);
#[cfg(target_os = "windows")]
let phidget_libs = match env::var("PHIDGET_ROOT") {
Err(std::env::VarError::NotPresent) => {
Ok(r"C:\Program Files\Phidgets\Phidget22".to_string())
}
res => res,
};
#[cfg(not(target_os = "windows"))]
let phidget_libs = env::var("PHIDGET_ROOT");
if let Ok(libs) = phidget_libs {
println!("cargo:rustc-link-search={}", libs);
}
#[cfg(target_os = "macos")]
config_macos();
#[cfg(not(target_os = "macos"))]
println!("cargo:rustc-link-lib=phidget22");
}