fn main() {
#[cfg(target_os = "macos")]
{
if let Ok(output) = std::process::Command::new("brew")
.args(["--prefix", "libomp"])
.output()
{
if output.status.success() {
let prefix = String::from_utf8_lossy(&output.stdout).trim().to_string();
println!("cargo:rustc-link-search=native={prefix}/lib");
println!("cargo:rustc-link-lib=omp");
}
} else {
for path in &[
"/opt/homebrew/lib", "/usr/local/lib", ] {
if std::path::Path::new(&format!("{path}/libomp.dylib")).exists() {
println!("cargo:rustc-link-search=native={path}");
println!("cargo:rustc-link-lib=omp");
break;
}
}
}
}
#[cfg(target_os = "linux")]
{
println!("cargo:rustc-link-lib=gomp");
}
}