oh moving things to bh

This commit is contained in:
peterino2 2025-11-09 20:06:12 -08:00
parent fdb23323fe
commit 13d73418f8
9 changed files with 18 additions and 26 deletions

5
lib/bh/build.zig vendored
View File

@ -8,6 +8,11 @@ pub const ModLib = struct {
pub fn install(self: @This()) void { pub fn install(self: @This()) void {
self.b.installArtifact(self.lib); self.b.installArtifact(self.lib);
} }
pub fn addIncludePath(self: @This(), path: []const u8) void {
self.lib.addIncludePath(self.b.path(path));
self.mod.addIncludePath(self.b.path(path));
}
}; };
pub const ModLibOptions = struct { pub const ModLibOptions = struct {

View File

@ -16,9 +16,9 @@ pub fn build(b: *std.Build) void {
cimgui.install(); cimgui.install();
cimgui.mod.addIncludePath(b.path("cimgui/imgui"));
cimgui.mod.addIncludePath(b.path("cimgui/SDL/include")); cimgui.mod.addIncludePath(b.path("cimgui/SDL/include"));
cimgui.mod.addIncludePath(b.path("cimplot")); cimgui.mod.addIncludePath(b.path("cimplot"));
cimgui.mod.addIncludePath(b.path("cimgui/imgui"));
cimgui.mod.addIncludePath(b.path("cimplot/implot")); cimgui.mod.addIncludePath(b.path("cimplot/implot"));
cimgui.lib.linkLibC(); cimgui.lib.linkLibC();

View File

@ -1,5 +1,3 @@
const cimgui = @import("cimgui"); const cimgui = @import("cimgui");
test "huh" { test "huh" {}
cimgui.initialize();
}

6
lib/enet/build.zig vendored
View File

@ -43,8 +43,7 @@ pub fn build(b: *std.Build) void {
}, },
.flags = &.{"-DHAS_OFFSETOF=1"}, .flags = &.{"-DHAS_OFFSETOF=1"},
}); });
enet.addIncludePath("enet-1.3.18/include");
enet.lib.addIncludePath(b.path("enet-1.3.18/include"));
// Platform-specific configuration // Platform-specific configuration
switch (target.result.os.tag) { switch (target.result.os.tag) {
@ -59,8 +58,6 @@ pub fn build(b: *std.Build) void {
else => {}, else => {},
} }
enet.mod.addIncludePath(b.path("enet-1.3.18/include/"));
const test_step = b.step("test", "run unit tests for enet"); const test_step = b.step("test", "run unit tests for enet");
const tests = b.addTest(.{ const tests = b.addTest(.{
.root_module = b.createModule(.{ .root_module = b.createModule(.{
@ -71,6 +68,7 @@ pub fn build(b: *std.Build) void {
}), }),
}); });
tests.linkLibrary(enet.lib);
tests.root_module.addImport("enet", enet.mod); tests.root_module.addImport("enet", enet.mod);
tests.root_module.addIncludePath(b.path("enet-1.3.18/include/")); tests.root_module.addIncludePath(b.path("enet-1.3.18/include/"));
const runArtifact = b.addRunArtifact(tests); const runArtifact = b.addRunArtifact(tests);

8
lib/lua/build.zig vendored
View File

@ -17,15 +17,11 @@ pub fn build(b: *std.Build) void {
lua.install(); lua.install();
// Add include paths to module (for Zig @cImport) // Add include paths to module (for Zig @cImport)
lua.mod.addIncludePath(b.path("lua/src/")); lua.addIncludePath("lua/src/");
lua.mod.addIncludePath(b.path("src/")); lua.addIncludePath("src/");
// Configure library // Configure library
lua.lib.linkLibC(); lua.lib.linkLibC();
lua.lib.addIncludePath(b.path("lua/src/"));
lua.lib.addIncludePath(b.path("src/"));
lua.lib.addCSourceFiles(.{ lua.lib.addCSourceFiles(.{
.root = b.path("lua/src/"), .root = b.path("lua/src/"),
.files = &.{ .files = &.{

View File

@ -17,12 +17,11 @@ pub fn build(b: *std.Build) void {
miniaudio.install(); miniaudio.install();
// Add include paths to module (for Zig @cImport) // Add include paths to module (for Zig @cImport)
miniaudio.mod.addIncludePath(b.path("./include")); miniaudio.addIncludePath("./include");
// Configure library // Configure library
miniaudio.lib.linkLibC(); miniaudio.lib.linkLibC();
miniaudio.lib.addIncludePath(b.path("include"));
miniaudio.lib.addCSourceFile(.{ .file = b.path("src/miniaudio.cpp"), .flags = &.{"-fno-sanitize=all"}, .language = .c }); miniaudio.lib.addCSourceFile(.{ .file = b.path("src/miniaudio.cpp"), .flags = &.{"-fno-sanitize=all"}, .language = .c });
// ======== tests ============ // ======== tests ============

4
lib/nfd/build.zig vendored
View File

@ -17,12 +17,10 @@ pub fn build(b: *std.Build) void {
nfd.install(); nfd.install();
// Add include paths to module (for Zig @cImport) // Add include paths to module (for Zig @cImport)
nfd.mod.addIncludePath(b.path("include")); nfd.addIncludePath("include");
// Configure library // Configure library
nfd.lib.linkLibC(); nfd.lib.linkLibC();
nfd.lib.addIncludePath(b.path("include"));
nfd.lib.addCSourceFile(.{ nfd.lib.addCSourceFile(.{
.file = b.path("src/nfd_common.c"), .file = b.path("src/nfd_common.c"),
.flags = &.{}, .flags = &.{},

2
lib/ozz/build.zig vendored
View File

@ -148,7 +148,7 @@ pub fn build(b: *std.Build) void {
const ozz_cpp = b.addLibrary(.{ const ozz_cpp = b.addLibrary(.{
.linkage = if (static_build) .static else .dynamic, .linkage = if (static_build) .static else .dynamic,
.name = "ozz_cpp", .name = "ozz",
.root_module = b.createModule(.{ .root_module = b.createModule(.{
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,

10
lib/spng/build.zig vendored
View File

@ -17,16 +17,12 @@ pub fn build(b: *std.Build) void {
spng.install(); spng.install();
// Add include paths to module (for Zig @cImport) spng.addIncludePath("spng");
spng.mod.addIncludePath(b.path("spng")); spng.addIncludePath("./");
spng.mod.addIncludePath(b.path("./"));
// Configure library // Configure library
spng.lib.linkLibC(); spng.lib.linkLibC();
spng.lib.addIncludePath(b.path("spng"));
spng.lib.addIncludePath(b.path("./"));
spng.lib.addCSourceFile(.{ .file = b.path("spng/spng.c") }); spng.lib.addCSourceFile(.{ .file = b.path("spng/spng.c") });
spng.lib.addCSourceFile(.{ .file = b.path("miniz.c") }); spng.lib.addCSourceFile(.{ .file = b.path("miniz.c") });
@ -43,8 +39,10 @@ pub fn build(b: *std.Build) void {
}); });
tests.root_module.addImport("spng", spng.mod); tests.root_module.addImport("spng", spng.mod);
tests.root_module.linkLibrary(spng.lib); tests.root_module.linkLibrary(spng.lib);
tests.root_module.addIncludePath(b.path("spng")); tests.root_module.addIncludePath(b.path("spng"));
tests.root_module.addIncludePath(b.path("./")); tests.root_module.addIncludePath(b.path("./"));
const runArtifact = b.addRunArtifact(tests); const runArtifact = b.addRunArtifact(tests);
test_step.dependOn(&runArtifact.step); test_step.dependOn(&runArtifact.step);
} }