mirror of
https://github.com/hannobraun/Fornjot
synced 2025-03-09 14:42:18 +00:00
Use proper paths to handle dylib search path
I don't trust the paths with '/' to hold up on Windows.
This commit is contained in:
parent
257d6b0a74
commit
09481147b1
@ -1,17 +1,18 @@
|
||||
use std::env;
|
||||
use std::{env, path::PathBuf};
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
let manifest_dir = env::var("CARGO_MANIFEST_DIR")?;
|
||||
|
||||
let libs_dir_relative = "lib3mf/libs";
|
||||
let libs_dir = format!("{manifest_dir}/{libs_dir_relative}");
|
||||
let mut libs_dir = PathBuf::from(manifest_dir);
|
||||
libs_dir.push("lib3mf");
|
||||
libs_dir.push("libs");
|
||||
|
||||
// This is necessary to link against the dynamic library.
|
||||
println!("cargo:rustc-link-search=native={libs_dir}");
|
||||
println!("cargo:rustc-link-search=native={}", libs_dir.display());
|
||||
println!("cargo:rustc-link-lib=dylib=3mf");
|
||||
|
||||
// And this is necessary, so the linked library is found at runtime.
|
||||
println!("cargo:rustc-link-arg=-Wl,-rpath,{libs_dir}");
|
||||
println!("cargo:rustc-link-arg=-Wl,-rpath,{}", libs_dir.display());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user