Skip to content

Commit

Permalink
fix(build.rs): don't recompile build script if features change
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Kröning <[email protected]>
  • Loading branch information
mkroening committed Sep 25, 2023
1 parent 435d287 commit d962cf1
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ use std::env;
fn main() -> Result<(), String> {
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
let fc = env::var_os("CARGO_FEATURE_FC").is_some();

if target_arch == "x86_64" && target_os == "none" {
let mut nasm = nasm_rs::Build::new();

#[cfg(feature = "fc")]
nasm.file("src/arch/x86_64/entry_fc.asm");
#[cfg(not(feature = "fc"))]
nasm.file("src/arch/x86_64/entry.asm");
let entry = if fc {
"src/arch/x86_64/entry_fc.asm"
} else {
"src/arch/x86_64/entry.asm"
};
nasm.file(entry);
let objects = nasm.compile_objects()?;

let mut cc = cc::Build::new();
Expand Down

0 comments on commit d962cf1

Please sign in to comment.