aboutsummaryrefslogtreecommitdiff
path: root/lib/std/build
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-01-10 20:21:58 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-01-11 15:39:49 -0800
commitcfcf9771c1bde357ad64d81cda9d61ba72d80b15 (patch)
tree143a7434666e186bc79989c9108fdc3ab1c16741 /lib/std/build
parenta0f2e6a29f4d5c084a248d24b25fae9f30707001 (diff)
downloadzig-cfcf9771c1bde357ad64d81cda9d61ba72d80b15.tar.gz
zig-cfcf9771c1bde357ad64d81cda9d61ba72d80b15.zip
zig build: support dependencies
The `zig build` command now makes `@import("@dependencies")` available to the build runner package. It contains all the dependencies in a generated file that looks something like this: ```zig pub const imports = struct { pub const foo = @import("foo"); pub const @"bar.baz" = @import("bar.baz"); }; pub const build_root = struct { pub const foo = "<path>"; pub const @"bar.baz" = "<path>"; }; ``` The build runner exports this import so that `std.build.Builder` can access it. `std.build.Builder` uses it to implement the new `dependency` function which can be used like so: ```zig const libz_dep = b.dependency("libz", .{}); const libmp3lame_dep = b.dependency("libmp3lame", .{}); // ... lib.linkLibrary(libz_dep.artifact("z")); lib.linkLibrary(libmp3lame_dep.artifact("mp3lame")); ``` The `dependency` function calls the build.zig file of the dependency as a child Builder, and then can be ransacked for its build steps via the `artifact` function. This commit also renames `dependency.id` to `dependency.name` in the `build.zig.ini` file.
Diffstat (limited to 'lib/std/build')
0 files changed, 0 insertions, 0 deletions