Run export-validator on Windows

This commit is contained in:
Martin Kavík 2022-11-13 06:25:58 +01:00
parent 35a02544ad
commit a7d96de6ed
4 changed files with 14 additions and 4 deletions

View File

@ -61,6 +61,3 @@ jobs:
run: cargo test --all-features
- name: Run `export-validator`
run: cargo run --package export-validator
# Export Validator doesn't support Windows yet. Issue:
# https://github.com/hannobraun/Fornjot/issues/920
if: ${{ matrix.os != 'windows-latest' }}

View File

@ -1,4 +1,8 @@
use std::{env, path::PathBuf};
use anyhow::bail;
use std::{
env, fs,
path::{Path, PathBuf},
};
fn main() -> anyhow::Result<()> {
let manifest_dir = env::var("CARGO_MANIFEST_DIR")?;
@ -15,6 +19,15 @@ fn main() -> anyhow::Result<()> {
if cfg!(target_family = "unix") {
println!("cargo:rustc-link-arg=-Wl,-rpath,{}", libs_dir.display());
}
if cfg!(target_family = "windows") {
let out_dir = env::var("OUT_DIR")?;
// TODO: Refactor once possible: https://github.com/rust-lang/cargo/issues/9661
let Some(bin_dir) = Path::new(&out_dir).ancestors().nth(3) else {
bail!("Failed to get bin_dir from this out_dir: {out_dir}");
};
// Note: Other rpath alternatives: https://ibob.bg/blog/2018/12/16/windows-rpath/
fs::copy(libs_dir.join("lib3mf.dll"), bin_dir.join("lib3mf.dll"))?;
}
Ok(())
}

Binary file not shown.

Binary file not shown.