Rewrite build.rs

master
WangRunji 7 years ago
parent 8c7ca612e7
commit 06d85a5ce9

@ -1,16 +1,11 @@
extern crate cc; extern crate cc;
use std::process::Command;
fn main() { fn main() {
let output = Command::new("uname").output() let mut build = cc::Build::new();
.expect("failed to get uname");
let compiler = match output.stdout.as_slice() { let compiler = if build.get_compiler().is_like_clang()
b"Darwin\n" => "x86_64-elf-gcc", { "x86_64-elf-gcc" } else {"gcc"};
b"Linux\n" => "gcc", build.compiler(compiler)
_ => panic!("unknown os") .file("src/test.c")
}; .compile("cobj");
cc::Build::new()
.compiler(compiler)
.file("src/test.c")
.compile("cobj");
} }
Loading…
Cancel
Save