Skip to content

Commit

Permalink
two libs
Browse files Browse the repository at this point in the history
  • Loading branch information
jackalcooper committed Feb 20, 2024
1 parent 38b8e91 commit d9505bc
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions native/mlir-zig-proj/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,26 @@ pub fn build(b: *std.build.Builder) void {
// Standard release options allow the person running `zig build` to select
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
const target: std.zig.CrossTarget = .{};
const s = b.addStaticLibrary(.{
.name = lib_name,
.root_source_file = .{ .path = "mlir-c/lib/CAPI/Beaver.cpp" },
.optimize = .Debug,
.target = target,
});
const lib = b.addSharedLibrary(.{
.name = lib_name,
.root_source_file = .{ .path = "src/main.zig" },
.optimize = .ReleaseSmall,
.optimize = .Debug,
.target = target,
});
const cflags = [_][]const u8{ "-std=gnu++17", "-fno-sanitize=undefined", "-D_GLIBCXX_USE_CXX11_ABI=1" } ++ libs.flags;
lib.linkLibCpp();
const cppFiles = .{"mlir-c/lib/CAPI/Beaver.cpp"};
s.linkLibCpp();
const cppFiles = .{};
inline for (cppFiles) |f| {
lib.addCSourceFile(.{ .file = std.Build.FileSource.relative(f), .flags = &cflags });
s.addCSourceFile(.{ .file = std.Build.FileSource.relative(f), .flags = &cflags });
}
lib.linkLibrary(s);
const kinda = b.dependency("kinda", .{});
lib.addModule("kinda", kinda.module("kinda"));
lib.addModule("erl_nif", kinda.module("erl_nif"));
Expand Down

0 comments on commit d9505bc

Please sign in to comment.