Skip to content

Commit

Permalink
Do zig style deps for libuv & mbedtls
Browse files Browse the repository at this point in the history
  • Loading branch information
plajjan committed Aug 27, 2024
1 parent 133acd8 commit 5a811cc
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
15 changes: 15 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ pub fn build(b: *std.Build) void {
const optimize = b.standardOptimizeOption(.{});
const target = b.standardTargetOptions(.{});

const dep_libmbedtls = b.dependency("libmbedtls", .{
.target = target,
.optimize = optimize,
});

const dep_libuv = b.dependency("libuv", .{
.target = target,
.optimize = optimize,
});

const lib = b.addStaticLibrary(.{
.name = "tlsuv",
.target = target,
Expand Down Expand Up @@ -78,6 +88,11 @@ pub fn build(b: *std.Build) void {
lib.addIncludePath(b.path("../../depsout/include"));
lib.installHeader(b.path("deps/uv_link_t/include/uv_link_t.h"), "uv_link_t.h");
lib.installHeadersDirectory(b.path("include/tlsuv"), "tlsuv", .{});

lib.linkLibrary(dep_libmbedtls.artifact("mbedcrypto"));
lib.linkLibrary(dep_libmbedtls.artifact("mbedtls"));
lib.linkLibrary(dep_libmbedtls.artifact("mbedx509"));
lib.linkLibrary(dep_libuv.artifact("uv"));
lib.linkLibC();

b.installArtifact(lib);
Expand Down
13 changes: 13 additions & 0 deletions build.zig.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.{
.name = "tlsuv",
.version = "0.0.0",
.dependencies = .{
.libmbedtls = .{
.path = "../mbedtls/",
},
.libuv = .{
.path = "../libuv/",
},
},
.paths = .{""},
}

0 comments on commit 5a811cc

Please sign in to comment.