-
-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1226 from hannobraun/export
Run export validation on all platforms
- Loading branch information
Showing
4 changed files
with
18 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,20 @@ | ||
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. | ||
// | ||
// The relative path used here is designed to work when the validator is | ||
// executed within the repository using `cargo run`, which is the intended | ||
// use case. | ||
let executable_to_libs = | ||
format!("../../tools/export-validator/{libs_dir_relative}"); | ||
println!("cargo:rustc-link-arg=-Wl,-rpath,$ORIGIN/{executable_to_libs}"); | ||
if cfg!(target_family = "unix") { | ||
println!("cargo:rustc-link-arg=-Wl,-rpath,{}", libs_dir.display()); | ||
} | ||
|
||
Ok(()) | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
lib3mf.2.dylib |