From d69d682d6a95983bd4e48cb2664f6b5cbce28dab Mon Sep 17 00:00:00 2001 From: James Mayclin Date: Tue, 31 Dec 2024 18:34:41 +0000 Subject: [PATCH] fix: run install target during build --- oqs-sys/build.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/oqs-sys/build.rs b/oqs-sys/build.rs index 10445a08e5..85b57a2701 100644 --- a/oqs-sys/build.rs +++ b/oqs-sys/build.rs @@ -113,10 +113,17 @@ fn build_from_source() -> PathBuf { config.define(permit_unsupported, str); } - let outdir = config.build_target("oqs").build(); + // build the default (install) target. + let outdir = config.build(); - // lib is put into $outdir/build/lib - let mut libdir = outdir.join("build").join("lib"); + // remove the build folder + let temp_build = outdir.join("build"); + if let Err(e) = std::fs::remove_dir_all(temp_build) { + println!("cargo:warning=unexpected error while cleaning build files:{}", e); + } + + // lib is installed to $outdir/lib + let mut libdir = outdir.join("lib"); if cfg!(windows) { libdir.push("Release"); // Static linking doesn't work on Windows @@ -132,7 +139,7 @@ fn build_from_source() -> PathBuf { fn includedir_from_source() -> PathBuf { let outdir = build_from_source(); - outdir.join("build").join("include") + outdir.join("include") } fn probe_includedir() -> PathBuf {