diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e7a6e0c02..132eedd94 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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' }} diff --git a/tools/export-validator/build.rs b/tools/export-validator/build.rs index 0b4332fd1..62256964e 100644 --- a/tools/export-validator/build.rs +++ b/tools/export-validator/build.rs @@ -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(()) } diff --git a/tools/export-validator/lib3mf/libs/3mf.lib b/tools/export-validator/lib3mf/libs/3mf.lib new file mode 100644 index 000000000..7285b5c3c Binary files /dev/null and b/tools/export-validator/lib3mf/libs/3mf.lib differ diff --git a/tools/export-validator/lib3mf/libs/lib3mf.dll b/tools/export-validator/lib3mf/libs/lib3mf.dll new file mode 100644 index 000000000..1e45f095f Binary files /dev/null and b/tools/export-validator/lib3mf/libs/lib3mf.dll differ