2022-03-17 10:57:16 +03:00
|
|
|
use std::{
|
|
|
|
env,
|
|
|
|
fs::File,
|
|
|
|
io::{BufWriter, Write},
|
|
|
|
path::Path,
|
|
|
|
};
|
|
|
|
|
2020-08-30 09:29:42 +03:00
|
|
|
extern crate napi_build;
|
2020-05-22 14:36:39 +03:00
|
|
|
|
2021-12-21 10:10:30 +03:00
|
|
|
#[cfg(all(not(feature = "swc_v1"), not(feature = "swc_v2")))]
|
|
|
|
compile_error!("Please enable swc_v1 or swc_v2 feature");
|
|
|
|
|
|
|
|
#[cfg(all(feature = "swc_v1", feature = "swc_v2"))]
|
|
|
|
compile_error!("Features swc_v1 and swc_v2 are incompatible");
|
|
|
|
|
2020-05-22 14:36:39 +03:00
|
|
|
fn main() {
|
2022-03-17 10:57:16 +03:00
|
|
|
let out_dir = env::var("OUT_DIR").expect("Outdir should exist");
|
|
|
|
let dest_path = Path::new(&out_dir).join("triple.txt");
|
|
|
|
let mut f =
|
|
|
|
BufWriter::new(File::create(&dest_path).expect("Failed to create target triple text"));
|
|
|
|
write!(
|
|
|
|
f,
|
|
|
|
"{}",
|
|
|
|
env::var("TARGET").expect("Target should be specified")
|
|
|
|
)
|
|
|
|
.expect("Failed to write target triple text");
|
|
|
|
|
2020-08-30 09:29:42 +03:00
|
|
|
napi_build::setup();
|
2020-05-22 14:36:39 +03:00
|
|
|
}
|