Setup
You need Zig 0.18.0-dev.1005+75d48dfff. Zig changes fast, so match it exactly.
Start a project
Section titled “Start a project”mkdir my_plugincd my_pluginzig init --minimalzig fetch --save git+https://github.com/ratatoskr/wraithzig init --minimal makes just build.zig.zon and a stub build.zig, and zig fetch adds Wraith to the first. Everything Wraith needs comes along with it. Add #<tag> to the URL to pin a release.
Then fill in these files.
build.zig
const std = @import("std");const wraith = @import("wraith");
pub fn build(b: *std.Build) void { const plugin: wraith.Plugin = .init(b, .{ .name = "my_plugin", .root_source_file = b.path("src/root.zig"), .target = b.standardTargetOptions(.{}), .optimize = b.standardOptimizeOption(.{}), }); plugin.install(b);}wraith.json
{ "$schema": "https://hub.wraith.io/schema/v1/wraith.json", "id": "my_plugin", "kind": "plugin", "version": "0.1.0", "title": "My Plugin"}See the manifest for the other fields.
src/root.zig is your code. See Plugin structure.
Build and load
Section titled “Build and load”zig buildwraith dev add zig-outzig-out gets a DLL for each arch and wraith.json. Rescan in the overlay’s Plugins window. After that, zig build and Reload there.
-Dtarget=x86_64-windows builds just one arch, which is quicker while you’re working.
Editor
Section titled “Editor”Any editor with Zig support works. The Wraith extension for VS Code is optional, but useful. It highlights your .sal schemas and has snippets for them.
Made with ♥ by Asgard
