build.rs instead of frontend crate features

This commit is contained in:
Martin Kavík 2024-06-01 23:29:56 +02:00
parent e034a2bb14
commit be5d33e5c1
7 changed files with 43 additions and 26 deletions

22
frontend/build.rs Normal file
View file

@ -0,0 +1,22 @@
use std::env;
// https://doc.rust-lang.org/cargo/reference/build-scripts.html
macro_rules! instruction {
($($arg: tt)*) => {
println!($($arg)*)
}
}
// https://github.com/rust-lang/cargo/issues/985
// macro_rules! warning {
// ($($arg: tt)*) => {
// instruction!("cargo:warning={}", format!($($arg)*))
// }
// }
fn main() {
let default_platform = "BROWSER";
let platform = env::var("FASTWAVE_PLATFORM").unwrap_or_else(|_| default_platform.to_owned());
instruction!("cargo:rustc-cfg=FASTWAVE_PLATFORM=\"{platform}\"");
}