blob: 4567b6c0567b4178a4951dcf38c42b3a096eb11c [file] [log] [blame]
Alex Crichton53548482018-08-11 21:54:05 -07001use std::env;
2
3fn main() {
4 println!("cargo:rerun-if-changed=build.rs");
5
6 let target = env::var("TARGET").unwrap();
7
8 maybe_enable_use_proc_macro(&target);
9}
10
11fn maybe_enable_use_proc_macro(target: &str) {
12 // wasm targets don't have the `proc_macro` crate, disable this feature.
13 if target.contains("wasm32") {
14 return
15 }
16
17 // Otherwise, only enable it if our feature is actually enabled.
18 if cfg!(feature = "proc-macro") {
19 println!("cargo:rustc-cfg=use_proc_macro");
20 }
21}