-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.rs
30 lines (29 loc) · 911 Bytes
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use nasm_rs;
use std::env;
fn main() {
if env::var("CARGO_CFG_UNIX").is_ok() {
if let Err(e) = nasm_rs::compile_library_args(
"libunix_main.a",
&["src/unix_main.asm"],
&["-Psrc/sprites.inc", "-f elf64"],
) {
// TODO: add better error handling
panic!("{}", e);
}
} else if env::var("CARGO_CFG_WINDOWS").is_ok() {
println!("cargo:rustc-link-lib=static=windows_main");
if let Err(e) = nasm_rs::compile_library_args(
"windows_main.lib",
&["src/windows_main.asm"],
&["-Psrc/sprites.inc", "-f win64"],
) {
// TODO: add better error handling
panic!("{}", e);
}
} else {
panic!(
"hit or miss? i guess {} never miss, huh?",
env::var("CARGO_CFG_TARGET_OS").unwrap_or("they".into())
)
}
}