ajkachnic / nectar

A cross-platform audio plugin framework for Zig.
https://nectaraudio.vercel.app
MIT License
9 stars 0 forks source link

Streamline build setup #3

Open ajkachnic opened 2 years ago

ajkachnic commented 2 years ago

Currently setting up the build system is a chore. Adding nectar as a package looks like this:

pub fn build(b: *std.build.Builder) void {
    const mode = b.standardReleaseOptions();

    const nectar = std.build.Pkg{
        .name = "nectar",
        .path = .{ .path = "libs/nectar/src/main.zig" },
        .dependencies = &.{
            .{ .name = "nectar:core", .path = .{ .path = "libs/nectar/core/src/main.zig" } },
            .{ .name = "nectar:midi", .path = .{ .path = "libs/nectar/midi/src/main.zig" } },
            .{ .name = "nectar:vst2", .path = .{ .path = "libs/nectar/vst2/src/main.zig" } },
        },
    };

    // snip
}

And as we add more packages, it will only get more complex. It would be nice to simplify this package import to something like

const nectarBuild = @import("libs/nectar/build.zig");

pub fn build(b: *std.build.Builder) void {
  const nectar = nectarBuild.generatePackage("libs/nectar/");
}