An open API service indexing awesome lists of open source software.

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

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
);
```