Skip to content

Instantly share code, notes, and snippets.

@postspectacular
Created October 4, 2022 11:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save postspectacular/a58e409234e8291827b643650b979715 to your computer and use it in GitHub Desktop.
Save postspectacular/a58e409234e8291827b643650b979715 to your computer and use it in GitHub Desktop.
Zig command to build a WASM library, can't figure out equivalent using `build.zig` - help?
#!/bin/sh
zig build-lib -O ReleaseSmall -target wasm32-freestanding -dynamic --strip \
--pkg-begin wasmapi ../../node_modules/@thi.ng/wasm-api/include/wasmapi.zig --pkg-end \
--pkg-begin dom ../../node_modules/@thi.ng/wasm-api-dom/include/dom.zig --pkg-end \
src/main.zig
# optional post processing & optimization
wasm-opt main.wasm -o main.wasm -O3
wasm-dis -o main.wast main.wasm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment