atagen

matrix-rust-sdk

public
Star0
Watch0
ssh://brewery@pls.lobotomise.me:33/atagen/matrix-rust-sdk.git
crates/matrix-sdk-common/build.rsRust19 lines1.0 KB
1
use std::{env, process};
2
3
fn main() {
4
    // Prevent unnecessary rerunning of this build script
5
    println!("cargo:rerun-if-changed=build.rs");
6
7
    let is_wasm = env::var_os("CARGO_CFG_TARGET_ARCH").is_some_and(|arch| arch == "wasm32");
8
    if is_wasm && env::var_os("CARGO_FEATURE_JS").is_none() {
9
        eprintln!(
10
            "\n\
11
            ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n\
12
            ┃ error: matrix-sdk currently requires a JavaScript environment for WASM. ┃\n\
13
            ┃        Please activate the `js` Cargo feature if this is what you want. ┃\n\
14
            ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\n\
15
            ",
16
        );
17
        process::exit(1);
18
    }
19
}