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
31
32
33
use std::process::Command;
pub const WASABI_SPECIFIC_ARGS: [&str; 4] =
["--gen=web", "--gen=node", "--gen=wasmer", "--gen=wasmlite"];
pub fn get_clang_wasm_flags() -> Vec<String> {
vec![
String::from("-nostartfiles"),
String::from("-Wl,--entry=main,--export=main,--no-threads"),
]
}
pub fn get_clangxx_wasm_flags() -> Vec<String> {
vec![
String::from("-nostartfiles"),
String::from("-Wl,--entry=main,--export=main,--no-threads"),
String::from("-fno-exceptions"),
]
}
pub fn call_clang(command: String, clang_args: Vec<String>) {
let mut child = Command::new(&command)
.args(clang_args)
.spawn()
.unwrap_or_else(|_| panic!("Failed to invoke {}", command));
child.wait().expect("Failed to wait on child");
}