diff --git a/common/core/desktop/build.sh b/common/core/desktop/build.sh index 760631810d..2940034500 100755 --- a/common/core/desktop/build.sh +++ b/common/core/desktop/build.sh @@ -209,7 +209,7 @@ build_test_rust() { # Built library path for multi-arch (Windows) vs single (*nix) - cargo build --target-dir="$TARGET_PATH/rust/$TARGETBASE" $TARGET_FLAG $CARGO_TARGET + cargo build --target-dir="$TARGET_PATH/rust/$TARGETBASE" $TARGET_FLAG $CARGO_TARGET --features=$PLATFORM # On Windows, final output path is ./build/rust///debug|release/ # WASM is similar: ./build/rust/wasm/wasm_unknown_unknown/debug|release/ diff --git a/common/core/desktop/src/rust/Cargo.toml b/common/core/desktop/src/rust/Cargo.toml index ca154a51e4..9b0299e550 100644 --- a/common/core/desktop/src/rust/Cargo.toml +++ b/common/core/desktop/src/rust/Cargo.toml @@ -4,12 +4,18 @@ version = "0.1.0" # This is required for 2018 support of Rust edition = "2018" +[features] +# We only need to enable wasm dependencies for the +# wasm target +wasm = ["wasm-bindgen"] +native = [] + [lib] name = "rust_mock_processor" crate-type = ["staticlib", "cdylib"] [dependencies] -wasm-bindgen = "0.2.63" +wasm-bindgen = { version = "0.2.63", optional = true } [profile.release] # Tell `rustc` to optimize for small code size.