-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,28 @@ | ||
# zig-wasm-test | ||
A minimal Web Assembly example built from Zig's init-lib. | ||
|
||
I expanded on this great gist from @josephg. | ||
|
||
https://gist.github.com/josephg/873a21d4558fd69aeccea19c3df96672 | ||
|
||
To build this project you need to follow the steps there to get a wasm enabled version of LLVM setup. | ||
|
||
## Building | ||
|
||
To build this project with a working Zig and TypeScript install at the project root just type. | ||
|
||
``` | ||
zig build -Drelease-small | ||
``` | ||
|
||
You need to move the resulting wasmtest.wasm file from /zig-cache/ to /www/. One has been committed if you're happy omitting this step. | ||
|
||
For good measure you can then build the TypeScript file: | ||
|
||
``` | ||
cd www | ||
tsc wasmtest.ts | ||
``` | ||
|
||
## Running | ||
Start the web server of your choice serving the www folder and navigate to wasmtest.html in your browser of choice. The value 7 should be output in the console. |