diff --git a/wgpu/microui/Makefile b/wgpu/microui/Makefile deleted file mode 100644 index 646515f..0000000 --- a/wgpu/microui/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -FILES := $(wildcard *) - -# NOTE: changing this requires changing the same values in the `web/index.html`. -INITIAL_MEMORY_PAGES := 2000 -MAX_MEMORY_PAGES := 65536 - -PAGE_SIZE := 65536 -INITIAL_MEMORY_BYTES := $(shell expr $(INITIAL_MEMORY_PAGES) \* $(PAGE_SIZE)) -MAX_MEMORY_BYTES := $(shell expr $(MAX_MEMORY_PAGES) \* $(PAGE_SIZE)) - -WGPU_JS := $(shell odin root)/vendor/wgpu/wgpu.js -ODIN_JS := $(shell odin root)/core/sys/wasm/js/odin.js - -web/microui.wasm: $(FILES) $(WGPU_JS) $(RUNTIME_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 $(WGPU_JS) web/wgpu.js - cp $(ODIN_JS) web/odin.js diff --git a/wgpu/microui/build.bat b/wgpu/microui/build_web.bat similarity index 100% rename from wgpu/microui/build.bat rename to wgpu/microui/build_web.bat diff --git a/wgpu/microui/build_web.sh b/wgpu/microui/build_web.sh new file mode 100755 index 0000000..d20c735 --- /dev/null +++ b/wgpu/microui/build_web.sh @@ -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