https://github.com/dasimmet/wabt
WebAssembly Binary Toolkit (wabt) and Binaryen on the zig build system
https://github.com/dasimmet/wabt
wabt wasm wasm2wat zig zig-package
Last synced: 9 months ago
JSON representation
WebAssembly Binary Toolkit (wabt) and Binaryen on the zig build system
- Host: GitHub
- URL: https://github.com/dasimmet/wabt
- Owner: dasimmet
- License: apache-2.0
- Created: 2024-12-22T18:03:06.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-02T21:37:15.000Z (over 1 year ago)
- Last Synced: 2025-02-02T22:26:35.536Z (over 1 year ago)
- Topics: wabt, wasm, wasm2wat, zig, zig-package
- Language: Zig
- Homepage:
- Size: 36.1 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WebAssembly Tools on the zig build system
uses the [Zig](https://ziglang.org/) build system to build WebAssembly's binary
C tools.
## building
```zig build
zig build
```
## add to your zig project
```bash
zig fetch --save git+https://github.com/dasimmet/wabt.git
```
## [WebAssembly Binary Toolkit](https://github.com/WebAssembly/wabt.git)
```
> ./zig-out/bin/wasm2c --help
usage: wasm2c [options] filename
Read a file in the WebAssembly binary format, and convert it to
a C source file and header.
```
## [Binaryen](https://github.com/WebAssembly/binaryen.git)
```
> ./zig-out/bin/wasm-merge --help
================================================================================
wasm-merge INFILE1 NAME1 INFILE2 NAME2 [..]
Merge wasm files into one.
```
## build.zig usage
```zig
const wabt = @import("wabt");
// wasm-opt
const optimized_wasm: LazyPath = wabt.wasm_opt(
b.path("my.wasm"), // source path
"optimized.wasm", // out_basename
.{"--mvp-features", "-Oz", "-c"}, // extra args
);
// wasm2wat
const my_wat: LazyPath = wabt.wasm2wat(
optimized_wasm, // source path
"my.wat", // out_basename
.{}, // extra args
);
```