This is an example macro built using Wacro. You're encouraged to go through the Wacro README for context.
This step is necessary if you update the ExampleRaw target; you must update ExampleRaw.wasm.dylib in tandem.
- Install a WASM-compatible toolchain from swift.org/download. A recent
main
snapshot should definitely work, and the 6.0 snapshots might also work (untested). - Install a WASI SDK: see https://book.swiftwasm.org/getting-started/setup.html#experimental-swift-sdk
- Run
make wasm
.
You should see that the file /ExampleRaw.wasm.dylib
has been changed after running these steps. This is a bona-fide WebAssembly module; the dylib
extension is merely to pacify the macOS sandbox.
(You can switch back to a production toolchain for this)
- Run
make client
. If you're on macOS and want to use the WebKit runner (faster), usemake client WK=1
. - That's all! You can now run the produced executable at
.build/debug/ExampleClient
.
Since compiling the host follows standard procedure, you can build and run with Xcode as well. Just open Package.swift
in Xcode and build ExampleClient
.