Skip to content

Commit ab0a398

Browse files
committed
integrate ada-url dependency to build system
1 parent 66f82fd commit ab0a398

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
@@ -382,6 +382,7 @@ fn addDependencies(b: *Build, mod: *Build.Module, opts: *Build.Step.Options) !vo
382382
try buildMbedtls(b, mod);
383383
try buildNghttp2(b, mod);
384384
try buildCurl(b, mod);
385+
try buildAda(b, mod);
385386

386387
switch (target.result.os.tag) {
387388
.macos => {
@@ -823,3 +824,27 @@ fn buildCurl(b: *Build, m: *Build.Module) !void {
823824
},
824825
});
825826
}
827+
828+
pub fn buildAda(b: *Build, m: *Build.Module) !void {
829+
const ada_dep = b.dependency("ada-singleheader", .{});
830+
const ada = b.addLibrary(.{
831+
.name = "ada",
832+
.linkage = .static,
833+
.root_module = b.createModule(.{
834+
.target = m.resolved_target,
835+
.optimize = m.optimize,
836+
.link_libcpp = true,
837+
}),
838+
});
839+
840+
// Expose "ada_c.h".
841+
ada.installHeader(ada_dep.path("ada_c.h"), "ada_c.h");
842+
843+
ada.root_module.addCSourceFiles(.{
844+
.root = ada_dep.path(""),
845+
.files = &.{"ada.cpp"},
846+
.flags = &.{"-std=c++20"},
847+
});
848+
849+
m.linkLibrary(ada);
850+
}

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-xddH6_PFAwAqwLMWbF7S0rAZzRbN8zmf2GhLH_ThdMSR",
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)