Skip to content

Commit

Permalink
Add Windows support to Export Validator
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Oct 17, 2022
1 parent 587cdaa commit 385f0eb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tools/export-validator/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use std::{env, path::PathBuf};
use std::{
env, fs,
path::{Path, PathBuf},
};

fn main() -> anyhow::Result<()> {
let manifest_dir = env::var("CARGO_MANIFEST_DIR")?;
Expand All @@ -7,6 +10,9 @@ fn main() -> anyhow::Result<()> {
libs_dir.push("lib3mf");
libs_dir.push("libs");

let out_dir = env::var("OUT_DIR")?;
let out_dir = Path::new(&out_dir);

// This is necessary to link against the dynamic library.
println!("cargo:rustc-link-search=native={}", libs_dir.display());
println!("cargo:rustc-link-lib=dylib=3mf");
Expand All @@ -15,6 +21,12 @@ fn main() -> anyhow::Result<()> {
if cfg!(target_family = "unix") {
println!("cargo:rustc-link-arg=-Wl,-rpath,{}", libs_dir.display());
}
if cfg!(target_family = "windows") {
fs::copy(
libs_dir.join("3mf.dll"),
out_dir.join("../../../deps/3mf.dll"),
)?;
}

Ok(())
}
Binary file added tools/export-validator/lib3mf/libs/3mf.dll
Binary file not shown.
Binary file added tools/export-validator/lib3mf/libs/3mf.lib
Binary file not shown.

0 comments on commit 385f0eb

Please sign in to comment.