Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion openvaf/linker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ fn get_linker<'a>(
let path = path.unwrap_or_else(|| {
if is_msys2_environment() {
"gcc".into()
} else if cfg!(target_os = "macos") {
"clang".into()
} else {
"ld".into()
}
Expand Down Expand Up @@ -251,7 +253,8 @@ impl<'a> LdLinker<'a> {
fn build_dylib(&mut self) {
// On mac we need to tell the linker to let this library be rpathed
if self.target.options.is_like_osx {
self.linker_arg("-dylib");
self.linker_arg("-dynamiclib");
// clang automatically handles -lSystem
} else {
self.linker_arg("-shared");
}
Expand Down
17 changes: 17 additions & 0 deletions openvaf/openvaf-driver/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// build.rs for openvaf-driver

fn main() {
// Add rpath for LLVM on macOS
#[cfg(target_os = "macos")]
{
if let Ok(output) = std::process::Command::new("llvm-config")
.arg("--libdir")
.output()
{
if output.status.success() {
let libdir = String::from_utf8_lossy(&output.stdout).trim().to_string();
println!("cargo:rustc-link-arg=-Wl,-rpath,{}", libdir);
}
}
}
}