Skip to content

Commit 5ad42b2

Browse files
committed
Refactor nasm-rs usage
1 parent d1a6071 commit 5ad42b2

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

build.rs

+11-14
Original file line numberDiff line numberDiff line change
@@ -135,20 +135,17 @@ fn build_nasm_files() {
135135
if let Some((hash, hash_path)) =
136136
hash_changed(asm_files, &out_dir, &dest_path)
137137
{
138-
let mut config_include_arg = String::from("-I");
139-
config_include_arg.push_str(&out_dir);
140-
config_include_arg.push('/');
141-
let mut nasm = nasm_rs::Build::new();
142-
nasm.min_version(2, 15, 0);
143-
for file in asm_files {
144-
nasm.file(file);
145-
}
146-
nasm.flag(&config_include_arg);
147-
nasm.flag("-Isrc/");
148-
let obj = nasm.compile_objects().unwrap_or_else(|e| {
149-
println!("cargo:warning={e}");
150-
panic!("NASM build failed. Make sure you have nasm installed or disable the \"asm\" feature.\n\
151-
You can get NASM from https://nasm.us or your system's package manager.\n\nerror: {e}");
138+
let obj = nasm_rs::Build::new()
139+
.min_version(2, 15, 0)
140+
.include(&out_dir)
141+
.include("src")
142+
.files(asm_files)
143+
.compile_objects()
144+
.unwrap_or_else(|e| {
145+
panic!("NASM build failed. Make sure you have nasm installed or disable the \"asm\" feature.\n\
146+
You can get NASM from https://nasm.us or your system's package manager.\n\
147+
\n\
148+
error: {e}");
152149
});
153150

154151
// cc is better at finding the correct archiver

0 commit comments

Comments
 (0)