mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 06:40:06 -04:00
Make cfg=web_sys_unstable_apis optional, fixing cargo check
This commit is contained in:
@@ -3,20 +3,23 @@ set -eu
|
||||
|
||||
CRATE_NAME="egui_demo"
|
||||
|
||||
export RUSTFLAGS=--cfg=web_sys_unstable_apis # required for the clipboard API
|
||||
# This is required to enable the web_sys clipboard API which egui_web uses
|
||||
# https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Clipboard.html
|
||||
# https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html
|
||||
export RUSTFLAGS=--cfg=web_sys_unstable_apis
|
||||
|
||||
# Clear output from old stuff:
|
||||
rm -rf docs/$CRATE_NAME.wasm
|
||||
rm -f docs/${CRATE_NAME}_bg.wasm
|
||||
|
||||
echo "Building rust…"
|
||||
BUILD=release
|
||||
cargo build --release -p $CRATE_NAME --lib --target wasm32-unknown-unknown
|
||||
cargo build --release -p ${CRATE_NAME} --lib --target wasm32-unknown-unknown
|
||||
|
||||
echo "Generating JS bindings for wasm…"
|
||||
TARGET_NAME="$CRATE_NAME.wasm"
|
||||
TARGET_NAME="${CRATE_NAME}.wasm"
|
||||
wasm-bindgen "target/wasm32-unknown-unknown/$BUILD/$TARGET_NAME" \
|
||||
--out-dir docs --no-modules --no-typescript
|
||||
|
||||
echo "Finished: docs/$CRATE_NAME.wasm"
|
||||
echo "Finished: docs/${CRATE_NAME}.wasm"
|
||||
|
||||
open http://localhost:8888/index.html
|
||||
|
||||
Reference in New Issue
Block a user