mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 15:13:28 +00:00
change the way ada is linked to the build system
Link the ada library to ada module rather than building alongside main module.
This commit is contained in:
30
build.zig
30
build.zig
@@ -853,23 +853,31 @@ fn buildCurl(b: *Build, m: *Build.Module) !void {
|
|||||||
|
|
||||||
pub fn buildAda(b: *Build, m: *Build.Module) !void {
|
pub fn buildAda(b: *Build, m: *Build.Module) !void {
|
||||||
const ada_dep = b.dependency("ada-singleheader", .{});
|
const ada_dep = b.dependency("ada-singleheader", .{});
|
||||||
const dep_root = ada_dep.path("");
|
|
||||||
|
|
||||||
// Private module that binds ada functions.
|
|
||||||
const ada_mod = b.createModule(.{
|
const ada_mod = b.createModule(.{
|
||||||
.root_source_file = b.path("vendor/ada/root.zig"),
|
.root_source_file = b.path("vendor/ada/root.zig"),
|
||||||
.target = m.resolved_target,
|
|
||||||
.optimize = m.optimize,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Expose headers; note that "ada.h" is a C++ header so no use here.
|
const ada_lib = b.addLibrary(.{
|
||||||
ada_mod.addIncludePath(dep_root);
|
.name = "ada",
|
||||||
|
.root_module = b.createModule(.{
|
||||||
ada_mod.addCSourceFiles(.{
|
.link_libcpp = true,
|
||||||
.root = dep_root,
|
.target = m.resolved_target,
|
||||||
.files = &.{"ada.cpp"},
|
.optimize = m.optimize,
|
||||||
.flags = &.{"-std=c++20"},
|
}),
|
||||||
|
.linkage = .static,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ada_lib.addCSourceFile(.{
|
||||||
|
.file = ada_dep.path("ada.cpp"),
|
||||||
|
.flags = &.{ "-std=c++20", "-O3" },
|
||||||
|
.language = .cpp,
|
||||||
|
});
|
||||||
|
|
||||||
|
ada_lib.installHeader(ada_dep.path("ada_c.h"), "ada_c.h");
|
||||||
|
|
||||||
|
// Link the library to ada module.
|
||||||
|
ada_mod.linkLibrary(ada_lib);
|
||||||
|
// Expose ada module to main module.
|
||||||
m.addImport("ada", ada_mod);
|
m.addImport("ada", ada_mod);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user