diff options
| author | BratishkaErik <bratishkaerik@landless-city.net> | 2025-01-22 07:29:21 +0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-22 02:29:21 +0000 |
| commit | 941677e08318c2baaabc9d0fc87892d1b63487ae (patch) | |
| tree | 3a6682be6f5063e6d7a27bd90d50a9cf729d5937 /lib/std/zig.zig | |
| parent | 28a259d4a34e544090a76863802e600a4e01fcc2 (diff) | |
| download | zig-941677e08318c2baaabc9d0fc87892d1b63487ae.tar.gz zig-941677e08318c2baaabc9d0fc87892d1b63487ae.zip | |
std.Build: add `addLibrary` function (#22554)
Acts as a replacement for `addSharedLibrary` and `addStaticLibrary`, but
linking mode can be changed more easily in build.zig, for example:
In library:
```zig
const linkage = b.option(std.builtin.LinkMode, "linkage", "Link mode for a foo_bar library") orelse .static; // or other default
const lib = b.addLibrary(.{
.linkage = linkage,
.name = "foo_bar",
.root_module = mod,
});
```
In consumer:
```zig
const dep_foo_bar = b.dependency("foo_bar", .{
.target = target,
.optimize = optimize,
.linkage = .static // or dynamic
});
mod.linkLibrary(dep_foor_bar.artifact("foo_bar"));
```
It also matches nicely with `linkLibrary` name.
Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>
Diffstat (limited to 'lib/std/zig.zig')
0 files changed, 0 insertions, 0 deletions
