Closed
Description
Extracted from #14265.
Terminology clarification: #14307
Something like this:
build.zig.zon
.{
.name = "clap",
.url = "...",
.hash = "...",
}
build.zig
// "clap" here references the dependency.name field of the build.zig.zon file.
const clap_pkg = b.dependency("clap", .{});
const exe = b.addExecutable("app", "src/main.zig");
// "clap" here is the string used when calling b.addModule (see code snippet below)
const clap_module = clap_pkg.module("clap");
// "clap" here is the name used for `@import` within src/main.zig
exe.addModule("clap", clap_module);
The build.zig file for clap:
const module = b.addModule("clap", ".", "clap.zig");
const example = b.addExecutable("simple", "example/simple.zig");
example.addModule("clap", module);
example.setBuildMode(mode);
example.setTarget(target);
example.install();
See #14282 for depending on pure zig modules without executing build.zig logic.
See #14286 for running build.zig logic in a sandbox.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Urgent Enhancements