Skip to content

Commit 27cadde

Browse files
committed
integrate ada-url dependency to build system
1 parent dc85c65 commit 27cadde

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

build.zig

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ fn addDependencies(b: *Build, mod: *Build.Module, opts: *Build.Step.Options) !vo
384384
try buildMbedtls(b, mod);
385385
try buildNghttp2(b, mod);
386386
try buildCurl(b, mod);
387+
try buildAda(b, mod);
387388

388389
switch (target.result.os.tag) {
389390
.macos => {
@@ -849,3 +850,27 @@ fn buildCurl(b: *Build, m: *Build.Module) !void {
849850
},
850851
});
851852
}
853+
854+
pub fn buildAda(b: *Build, m: *Build.Module) !void {
855+
const ada_dep = b.dependency("ada-singleheader", .{});
856+
const ada = b.addLibrary(.{
857+
.name = "ada",
858+
.linkage = .static,
859+
.root_module = b.createModule(.{
860+
.target = m.resolved_target,
861+
.optimize = m.optimize,
862+
.link_libcpp = true,
863+
}),
864+
});
865+
866+
// Expose "ada_c.h".
867+
ada.installHeader(ada_dep.path("ada_c.h"), "ada_c.h");
868+
869+
ada.root_module.addCSourceFiles(.{
870+
.root = ada_dep.path(""),
871+
.files = &.{"ada.cpp"},
872+
.flags = &.{"-std=c++20"},
873+
});
874+
875+
m.linkLibrary(ada);
876+
}

build.zig.zon

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,9 @@
99
.hash = "v8-0.0.0-xddH6yTGAwA__kfiDozsVXL2_jnycrtDUfR8kIADQFUz",
1010
},
1111
//.v8 = .{ .path = "../zig-v8-fork" }
12+
.@"ada-singleheader" = .{
13+
.url = "https://github.com/ada-url/ada/releases/download/v3.3.0/singleheader.zip",
14+
.hash = "N-V-__8AAPmhFAAw64ALjlzd5YMtzpSrmZ6KymsT84BKfB4s",
15+
},
1216
},
1317
}

0 commit comments

Comments
 (0)