core: Match IRRT compile flavor with build profile
This commit is contained in:
parent
b26cb2b360
commit
ddb608e967
|
@ -14,25 +14,40 @@ fn main() {
|
||||||
* HACK: Sadly, clang doesn't let us emit generic LLVM bitcode.
|
* HACK: Sadly, clang doesn't let us emit generic LLVM bitcode.
|
||||||
* Compiling for WASM32 and filtering the output with regex is the closest we can get.
|
* Compiling for WASM32 and filtering the output with regex is the closest we can get.
|
||||||
*/
|
*/
|
||||||
const FLAG: &[&str] = &[
|
let flags: &[&str] = match env::var("PROFILE").unwrap().as_str() {
|
||||||
"--target=wasm32",
|
"debug" => &[
|
||||||
FILE,
|
"--target=wasm32",
|
||||||
"-fno-discard-value-names",
|
FILE,
|
||||||
"-O3",
|
"-fno-discard-value-names",
|
||||||
"-emit-llvm",
|
"-O0",
|
||||||
"-S",
|
"-emit-llvm",
|
||||||
"-Wall",
|
"-S",
|
||||||
"-Wextra",
|
"-Wall",
|
||||||
"-o",
|
"-Wextra",
|
||||||
"-",
|
"-o",
|
||||||
];
|
"-",
|
||||||
|
],
|
||||||
|
"release" => &[
|
||||||
|
"--target=wasm32",
|
||||||
|
FILE,
|
||||||
|
"-fno-discard-value-names",
|
||||||
|
"-O3",
|
||||||
|
"-emit-llvm",
|
||||||
|
"-S",
|
||||||
|
"-Wall",
|
||||||
|
"-Wextra",
|
||||||
|
"-o",
|
||||||
|
"-",
|
||||||
|
],
|
||||||
|
_ => unreachable!(),
|
||||||
|
};
|
||||||
|
|
||||||
println!("cargo:rerun-if-changed={FILE}");
|
println!("cargo:rerun-if-changed={FILE}");
|
||||||
let out_dir = env::var("OUT_DIR").unwrap();
|
let out_dir = env::var("OUT_DIR").unwrap();
|
||||||
let out_path = Path::new(&out_dir);
|
let out_path = Path::new(&out_dir);
|
||||||
|
|
||||||
let output = Command::new("clang-irrt")
|
let output = Command::new("clang-irrt")
|
||||||
.args(FLAG)
|
.args(flags)
|
||||||
.output()
|
.output()
|
||||||
.map(|o| {
|
.map(|o| {
|
||||||
assert!(o.status.success(), "{}", std::str::from_utf8(&o.stderr).unwrap());
|
assert!(o.status.success(), "{}", std::str::from_utf8(&o.stderr).unwrap());
|
||||||
|
|
Loading…
Reference in New Issue