Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ A shape exports `pub fn layout(ctx: ?*anyopaque, f: *Layout) !dvui.App.Result` a
pointer with its own GPU program (`core.programs`). It also builds alone as a dylib
(`cd plugins/shader && zig build`).

`build.zig` hands both to fizzy with `fizzy.buildApp`; they are linked in and registered like
fizzy's own.
`build.zig` hands both to fizzy with `fizzy.buildApp`, in one list with the fizzy plugins the app
links (`fizzy.plugins.text`, or `fizzy.plugins.all`), and every one is linked in and registered
the same way. The minimal shape links only workbench and text; the others link all of fizzy's.
workbench is required for now.

## Your own app

`build.zig` is the whole recipe: depend on fizzy (`build.zig.zon`), call `b.dependency("fizzy",
…)` with your app's name, display name, bundle id, `.@"defer-app" = true` and your shape as
`app-layout`, then `fizzy.buildApp` with the plugins you bundle. Pin fizzy by commit, as this
`app-layout`, then `fizzy.buildApp` with every plugin you link, fizzy's among them. Pin fizzy by commit, as this
repo does.
10 changes: 8 additions & 2 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,16 @@ pub fn build(b: *std.Build) !void {
});
const hello = b.dependency("hello", .{ .target = target, .optimize = optimize });
const shader = b.dependency("shader", .{ .target = target, .optimize = optimize });
try fizzy.buildApp(fizzy_dep, &.{
// Fizzy's own plugins are entries in the list like any other. The minimal shape's one
// region takes documents, so it links the two that open them; the others link all of fizzy's.
const fizzys: []const fizzy.BundledPlugin = switch (shape) {
.minimal => &.{ fizzy.plugins.workbench, fizzy.plugins.text },
.studio, .endless => &fizzy.plugins.all,
};
try fizzy.buildApp(fizzy_dep, try std.mem.concat(b.allocator, fizzy.BundledPlugin, &.{ fizzys, &.{
.{ .name = "hello", .module = hello.module("plugin") },
.{ .name = "shader", .module = shader.module("plugin") },
});
} }));

const exe = fizzy_dep.artifact(name);
b.installArtifact(exe);
Expand Down
4 changes: 2 additions & 2 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
// by commit; fizzy's CI builds this repo against each of its pull requests, so a change
// there that breaks an outside app fails before it lands.
.fizzy = .{
.url = "https://github.com/fizzyedit/fizzy/archive/75fd7f0ed1440432893238f75664e9680a56a123.tar.gz",
.hash = "fizzy-0.2.0-c46aVj4MkABq503RNbfyqugEU7A-BkJreTBFDhNbl6uF",
.url = "https://github.com/fizzyedit/fizzy/archive/b9ba48af5941aa59fdcd4b61e829c2085cf5f3d2.tar.gz",
.hash = "fizzy-0.2.0-c46aVnoclwBr5ucQF97TLn-JtdXSE9jSljrZHmz7Fia0",
},
// The plugins this app bundles beyond fizzy's own: fizzyedit/example-plugin, as any
// plugin from its own repo, and this app's own, which also builds alone as a dylib
Expand Down
Loading