-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrustcwrap.rs
38 lines (37 loc) · 1.41 KB
/
rustcwrap.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
31
32
33
34
35
36
37
38
use std::env;
use std::process::Command;
use std::collections::VecDeque;
fn main() {
let mut args: VecDeque<_> = env::args().skip(1).collect();
let cmd = args.pop_front().expect("a rustc command");
// eprintln!("=============================");
if &args[0] == "--crate-name" {
// eprintln!("CRATE: {}", &args[1]);
match args[1].as_str() {
"hyper"|"reqwest"|"idna"|"ipnet"|"mime"|"native_tls"|"winreg"|
"url"|"tokio_util"|"tokio_native_tls"|"httpdate"|
"encoding_rs" => {},
"boot"|"synth"|"video"|"video128"|"video_plus"|"z80emu"|
"spectrusty"|"spectrusty_core"|"spectrusty_formats"|
"spectrusty_peripherals"|"spectrusty_utils"|
"zxspectrum_common"|"web_zxspectrum"|"sdl2_zxspectrum" => {
args.push_back("-Zmir-opt-level=4".into());
args.push_back("-Zinline-mir=yes".into());
args.push_back("-Zinline-mir-threshold=500".into());
args.push_back("-Zinline-mir-hint-threshold=1000".into());
args.push_back(format!("-Zprint-fuel={}", &args[1]));
}
_ => {
args.push_back("-Zmir-opt-level=4".into());
args.push_back("-Zinline-mir=yes".into());
args.push_back(format!("-Zprint-fuel={}", &args[1]));
}
}
}
// eprintln!("{:?}", args);
// eprintln!("=============================");
Command::new(cmd)
.args(args)
.spawn()
.expect("failed to execute process");
}