mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-28 13:02:21 +01:00
20 lines
701 B
Rust
20 lines
701 B
Rust
use std::process::Command;
|
|
|
|
fn main() {
|
|
if std::env::var("CARGO_CFG_TARGET_OS").as_deref() != Ok("macos") {
|
|
return;
|
|
}
|
|
println!("cargo:rustc-link-arg=-Wl,-rpath,/usr/lib/swift");
|
|
if let Ok(output) = Command::new("xcode-select").arg("-p").output()
|
|
&& output.status.success()
|
|
&& let Ok(developer_dir) = String::from_utf8(output.stdout)
|
|
{
|
|
for runtime in ["swift-5.5/macosx", "swift/macosx"] {
|
|
let swift_runtime = format!(
|
|
"{}/Toolchains/XcodeDefault.xctoolchain/usr/lib/{runtime}",
|
|
developer_dir.trim()
|
|
);
|
|
println!("cargo:rustc-link-arg=-Wl,-rpath,{swift_runtime}");
|
|
}
|
|
}
|
|
}
|