Skip to content

Commit fe83262

Browse files
committed
first successful library build
1 parent fec2f96 commit fe83262

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

bindings/zig/build.zig

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ pub fn build(b: *std.Build) void {
1717
// set a preferred release mode, allowing the user to decide how to optimize.
1818
const optimize = b.standardOptimizeOption(.{});
1919

20-
const libzmq = b.dependency("libzmq", .{
20+
const libzmq_dep = b.dependency("libzmq", .{
2121
.optimize = optimize,
2222
.target = target,
2323
});
24+
const libzmq = libzmq_dep.artifact("zmq");
2425
const config_header = if (!target.isWindows()) b.addConfigHeader(.{
2526
.style = .blank,
2627
.include_path = "platform.h",
@@ -55,13 +56,14 @@ pub fn build(b: *std.Build) void {
5556
lib.linkSystemLibraryName("rpcrt4");
5657
lib.linkSystemLibraryName("iphlpapi");
5758
}
58-
lib.linkLibrary(libzmq.artifact("zmq"));
59-
//lib.linkSystemLibrary("zmq");
59+
lib.linkLibrary(libzmq);
6060
lib.linkLibC();
6161
// This declares intent for the library to be installed into the standard
6262
// location when the user invokes the "install" step (the default step when
6363
// running `zig build`).
6464
lib.install();
65+
lib.installHeadersDirectory("../../include", "");
66+
lib.installLibraryHeaders(libzmq);
6567

6668
// Creates a step for unit testing.
6769
const libtest = b.addTest(.{
@@ -78,9 +80,8 @@ pub fn build(b: *std.Build) void {
7880
libtest.linkSystemLibraryName("rpcrt4");
7981
libtest.linkSystemLibraryName("iphlpapi");
8082
}
81-
libtest.linkSystemLibrary("zmq");
83+
libtest.linkLibrary(libzmq);
8284
libtest.linkLibC();
83-
8485
// This creates a build step. It will be visible in the `zig build --help` menu,
8586
// and can be selected like this: `zig build test`
8687
// This will evaluate the `test` step rather than the default, which is "install".
@@ -91,8 +92,7 @@ pub fn build(b: *std.Build) void {
9192
const lib_flags: []const []const u8 = &.{
9293
"-std=gnu99",
9394
"-O3",
94-
// "-Wall",
95-
"-fno-sanitize=all", // disable undefined sanitizer (default on zig/clang wrapper)
95+
"-Wall",
9696
};
9797
const lib_src: []const []const u8 = &.{
9898
"../../src/zactor.c",

bindings/zig/build.zig.zon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
.dependencies = .{
66
.libzmq = .{
7-
.url = "https://github.com/kassane/libzmq/archive/89416003587ea21f36b8538791c4825fad012fba.tar.gz",
8-
.hash = "122026d048d3a2925e86b3121a98aa8546a6109ff8ecffa75e7d9f2d1aea614f7250",
7+
.url = "https://github.com/kassane/libzmq/archive/a6438dc78d00f3736ede988b0fdc2f6361c442b4.tar.gz",
8+
.hash = "1220fc3abc4aa9fb75c61b00297a2ec1d4f70d7f65f4151f6f7a93f59a265a56bc9e",
99
},
1010
},
1111
}

0 commit comments

Comments
 (0)