Skip to content

Commit 546343c

Browse files
committed
update readme
1 parent d1749ee commit 546343c

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,20 @@ This branch shows the minimal setup needed for providing and using a zig library
66
In your zig project folder (where `build.zig` is located), run:
77

88
```sh
9-
zig fetch --save "git+https://github.com/42LM/zig-package-manager-example#3198f56a617c66ac6077da8c991a2f31a1fefbea"
9+
zig fetch --save "git+https://github.com/42LM/zig-package-manager-example#minimal"
1010
```
1111

1212
Then, in your `build.zig`'s `build` function, add the following before
1313
`b.installArtifact(exe)`:
1414

1515
```zig
16-
const hello = b.dependency("hello", .{
16+
const hello = b.dependency("zig_package_manager_example", .{
1717
.target = target,
1818
.optimize = optimize,
1919
});
2020
```
2121

22+
exe
2223
```zig
2324
const exe = b.addExecutable(.{
2425
.name = "foo",
@@ -32,3 +33,21 @@ Then, in your `build.zig`'s `build` function, add the following before
3233
}),
3334
});
3435
```
36+
37+
lib
38+
```zig
39+
const foo_lib = b.addModule("foo_lib", .{
40+
.root_source_file = b.path("src/foo_lib.zig"),
41+
.target = target,
42+
.optimize = optimize,
43+
.imports = &.{
44+
.{ .name = "hello", .module = hello.module("hello") },
45+
},
46+
});
47+
48+
const lib = b.addLibrary(.{
49+
.linkage = .static,
50+
.name = "foo_lib",
51+
.root_module = foo_lib,
52+
});
53+
```

0 commit comments

Comments
 (0)