bdb/build.rs

14 lines
593 B
Rust

use std::process::Command;
fn main() {
let test_prog_exe_path = &format!("{}/prog", std::env::var("OUT_DIR").unwrap());
let test_prog_obj_path = &format!("{}.o", test_prog_exe_path);
Command::new("nasm")
.args(&["-f", "elf64", "src/prog.nasm", "-o", test_prog_obj_path])
.spawn().expect("nasm build failed");
Command::new("ld")
.args(&[test_prog_obj_path, "-o", test_prog_exe_path])
.spawn().expect("linking failed");
println!("cargo:rerun-if-changed=src/prog.nasm");
println!("cargo:rustc-env=TEST_PROG_PATH={}", test_prog_exe_path);
}