Skip to content

Commit

Permalink
build_demo_web.sh: fix opening link on windows and linux
Browse files Browse the repository at this point in the history
Co-authored with @DrOptix with code from
#246
  • Loading branch information
emilk committed Apr 5, 2021
1 parent 3803d0f commit 49ef94d
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions build_demo_web.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,21 @@ TARGET_NAME="${CRATE_NAME}.wasm"
wasm-bindgen "target/wasm32-unknown-unknown/$BUILD/$TARGET_NAME" \
--out-dir docs --no-modules --no-typescript

# brew install wabt # to get wasm-strip
# to get wasm-strip: apt/brew/dnf install wabt
# wasm-strip docs/${CRATE_NAME}_bg.wasm

echo "Optimizing wasm…"
# brew install binaryen # to get wasm-opt
# to get wasm-opt: apt/brew/dnf install binaryen
wasm-opt docs/egui_demo_app_bg.wasm -O2 --fast-math -o docs/egui_demo_app_bg.wasm # add -g to get debug symbols
echo "Finished docs/${CRATE_NAME}_bg.wasm"

open http://localhost:8888/index.html
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
# Linux, ex: Fedora
xdg-open http://localhost:8888/index.html
elif [[ "$OSTYPE" == "msys" ]]; then
# Windows
start http://localhost:8888/index.html
else
# Darwin/MacOS, or something else
open http://localhost:8888/index.html
fi

0 comments on commit 49ef94d

Please sign in to comment.