Skip to content

Commit

Permalink
Merge pull request #112 from laytan/wgpu-microui-bash-instead-of-make
Browse files Browse the repository at this point in the history
wgpu/microui: move to bash for web build script like other examples
  • Loading branch information
laytan authored Mar 3, 2025
2 parents 26c3af5 + 24276e3 commit da650a1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
20 changes: 0 additions & 20 deletions wgpu/microui/Makefile

This file was deleted.

File renamed without changes.
20 changes: 20 additions & 0 deletions wgpu/microui/build_web.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

set -euxo pipefail

# NOTE: changing this requires changing the same values in the `web/index.html`.
INITIAL_MEMORY_PAGES=2000
MAX_MEMORY_PAGES=65536

INITIAL_MEMORY_BYTES=$(expr $INITIAL_MEMORY_PAGES \* $MAX_MEMORY_PAGES)
MAX_MEMORY_BYTES=$(expr $MAX_MEMORY_PAGES \* $MAX_MEMORY_PAGES)

ODIN_ROOT=$(odin root)
ODIN_JS="$ODIN_ROOT/core/sys/wasm/js/odin.js"
WGPU_JS="$ODIN_ROOT/vendor/wgpu/wgpu.js"

odin build . -target:js_wasm32 -out:web/microui.wasm -o:size \
-extra-linker-flags:"--export-table --import-memory --initial-memory=$INITIAL_MEMORY_BYTES --max-memory=$MAX_MEMORY_BYTES"

cp $ODIN_JS web/odin.js
cp $WGPU_JS web/wgpu.js

0 comments on commit da650a1

Please sign in to comment.