egui/build.sh

32 lines
626 B
Bash
Raw Normal View History

#!/bin/bash
set -eu
# Pre-requisites:
rustup target add wasm32-unknown-unknown
if ! [[ $(wasm-bindgen --version) ]]; then
2019-02-09 21:49:35 +00:00
cargo update -p wasm-bindgen
cargo install -f wasm-bindgen-cli
cargo update
2018-12-30 10:01:14 +00:00
fi
BUILD=debug
# BUILD=release
# Clear output from old stuff:
rm -rf docs/*.wasm
2018-12-23 23:15:18 +00:00
function build_rust
{
echo "Build rust:"
cargo build --target wasm32-unknown-unknown
echo "Generate JS bindings for wasm:"
FOLDER_NAME=${PWD##*/}
2019-02-09 22:00:07 +00:00
TARGET_NAME="example.wasm"
2018-12-23 23:15:18 +00:00
wasm-bindgen "target/wasm32-unknown-unknown/$BUILD/$TARGET_NAME" \
--out-dir docs --no-modules --no-typescript
2018-12-23 23:15:18 +00:00
# --no-modules-global hoboho
}
2018-12-23 23:15:18 +00:00
build_rust