diff --git a/README.md b/README.md index 6fec260..f708490 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/build.zig b/build.zig index 4ada8ff..400418a 100644 --- a/build.zig +++ b/build.zig @@ -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);