Skip to content

Commit c2e98dc

Browse files
authored
fix: run install target during build (#273)
* fix: run install target during build Signed-off-by: James Mayclin <maycj@amazon.com> * try ci fix I think it's no longer necessary to append the "Release" path? But that's more of a guess Signed-off-by: James Mayclin <maycj@amazon.com> * cargo fmt Signed-off-by: James Mayclin <maycj@amazon.com> --------- Signed-off-by: James Mayclin <maycj@amazon.com>
1 parent 6ecb2cb commit c2e98dc

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

oqs-sys/build.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,21 @@ fn build_from_source() -> PathBuf {
113113
config.define(permit_unsupported, str);
114114
}
115115

116-
let outdir = config.build_target("oqs").build();
116+
// build the default (install) target.
117+
let outdir = config.build();
118+
119+
// remove the build folder
120+
let temp_build = outdir.join("build");
121+
if let Err(e) = std::fs::remove_dir_all(temp_build) {
122+
println!(
123+
"cargo:warning=unexpected error while cleaning build files:{}",
124+
e
125+
);
126+
}
117127

118-
// lib is put into $outdir/build/lib
119-
let mut libdir = outdir.join("build").join("lib");
128+
// lib is installed to $outdir/lib
129+
let libdir = outdir.join("lib");
120130
if cfg!(windows) {
121-
libdir.push("Release");
122131
// Static linking doesn't work on Windows
123132
println!("cargo:rustc-link-lib=oqs");
124133
} else {
@@ -132,7 +141,7 @@ fn build_from_source() -> PathBuf {
132141

133142
fn includedir_from_source() -> PathBuf {
134143
let outdir = build_from_source();
135-
outdir.join("build").join("include")
144+
outdir.join("include")
136145
}
137146

138147
fn probe_includedir() -> PathBuf {

0 commit comments

Comments
 (0)