From f74c6cc6c2c1bf13712be573455259fab731fd3c Mon Sep 17 00:00:00 2001 From: Peterino2 Date: Fri, 20 Nov 2026 18:19:38 -0700 Subject: [PATCH] removing more cruft from p2 --- engine/lib/bh/build.zig | 155 ------------------------------------ engine/lib/bh/build.zig.zon | 10 --- engine/lib/bh/src/bh.zig | 0 engine/lib/bh/src/tests.zig | 0 engine/lib/bh/stubc.zig | 0 engine/lib/p2/build.zig | 24 ++---- engine/lib/p2/build.zig.zon | 4 +- 7 files changed, 7 insertions(+), 186 deletions(-) delete mode 100644 engine/lib/bh/build.zig delete mode 100644 engine/lib/bh/build.zig.zon delete mode 100644 engine/lib/bh/src/bh.zig delete mode 100644 engine/lib/bh/src/tests.zig delete mode 100644 engine/lib/bh/stubc.zig diff --git a/engine/lib/bh/build.zig b/engine/lib/bh/build.zig deleted file mode 100644 index 656fd90..0000000 --- a/engine/lib/bh/build.zig +++ /dev/null @@ -1,155 +0,0 @@ -const std = @import("std"); - -pub const ModLib = struct { - b: *std.Build, - lib: *std.Build.Step.Compile, - mod: *std.Build.Module, - - pub fn install(self: @This()) void { - self.b.installArtifact(self.lib); - } -}; - -pub const ModLibOptions = struct { - name: []const u8, - target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, - monolithic: bool, - allow_dynamic: bool = false, - link_libc: bool = false, - link_libcpp: bool = false, - root: ?std.Build.LazyPath = null, - stub: ?std.Build.LazyPath = null, -}; - -pub fn MakeModlib(b: *std.Build, o: ModLibOptions) ModLib { - const mod = b.addModule(o.name, .{ - .target = o.target, - .optimize = o.optimize, - .root_source_file = if (o.root != null) o.root.? else b.path(b.fmt("src/{s}", .{o.name})), - }); - - const empty_file = b.addWriteFile("stubs", ""); - - const lib = b.addLibrary(.{ - .name = o.name, - .linkage = if (o.allow_dynamic and !o.monolithic) .dynamic else .static, - .root_module = b.createModule(.{ - .root_source_file = empty_file.add("stubc.zig", ""), - .target = o.target, - .optimize = o.optimize, - }), - }); - - return .{ - .b = b, - .lib = lib, - .mod = mod, - }; -} - -pub const Options = struct { - target: std.Build.ResolvedTarget, - optimize: std.builtin.OptimizeMode, - monolithic: bool, - tracy: bool, - renderer: []const u8, - box3d_validate: ?bool = null, -}; - -// standard set of options that all riblab modules and dependenices shall use. -pub fn declareOptions(b: *std.Build) Options { - return .{ - .target = b.standardTargetOptions(.{}), - .optimize = b.standardOptimizeOption(.{}), - .monolithic = b.option(bool, "monolithic", "builds RibLab dependencies for static linking") orelse false, - .tracy = b.option(bool, "tracy", "builds with tracy support") orelse false, - .renderer = b.option([]const u8, "renderer", "renderer backend: sgpu_main, gl_low_spec, headless") orelse "sgpu_main", - .box3d_validate = b.option(bool, "box3d-validate", "enable heavy Box3D validation"), - }; -} - -pub fn dependency(b: *std.Build, name: []const u8, opts: Options) *std.Build.Dependency { - if (std.mem.eql(u8, name, "physics")) { - return b.dependency(name, .{ - .target = opts.target, - .optimize = opts.optimize, - .monolithic = opts.monolithic, - .tracy = opts.tracy, - .renderer = opts.renderer, - .@"box3d-validate" = opts.box3d_validate, - }); - } - - if (isEngineDependency(name)) { - return b.dependency(name, .{ - .target = opts.target, - .optimize = opts.optimize, - .monolithic = opts.monolithic, - .tracy = opts.tracy, - .renderer = opts.renderer, - }); - } - - return b.dependency(name, .{ - .target = opts.target, - .optimize = opts.optimize, - .monolithic = opts.monolithic, - .tracy = opts.tracy, - }); -} - -pub fn isEngineDependency(name: []const u8) bool { - const engine_deps = [_][]const u8{ - "assets", - "audio", - "cook", - "core", - "desktopKit", - "devkit", - "editorkit", - "net", - "netgame", - "nav", - "bsp", - "papyrus", - "platform", - "rend", - "ui", - "physics", - "sys", - }; - - for (engine_deps) |dep_name| { - if (std.mem.eql(u8, dep_name, name)) return true; - } - return false; -} - -pub fn build(b: *std.Build) void { - const target = b.standardTargetOptions(.{}); - const optimize = b.standardOptimizeOption(.{}); - const monolithic = b.option(bool, "monolithic", "builds RibLab dependencies for static linking") orelse false; - - const r = MakeModlib(b, .{ - .name = "bh", - .target = target, - .optimize = optimize, - .monolithic = monolithic, - }); - - b.installArtifact(r.lib); - - const test_step = b.step("test", "run unit tests for enet"); - const tests = b.addTest(.{ - .root_module = b.createModule(.{ - .link_libc = true, - .target = target, - .optimize = optimize, - .root_source_file = b.path("src/tests.zig"), - }), - }); - - const runArtifact = b.addRunArtifact(tests); - test_step.dependOn(&runArtifact.step); -} diff --git a/engine/lib/bh/build.zig.zon b/engine/lib/bh/build.zig.zon deleted file mode 100644 index c47162d..0000000 --- a/engine/lib/bh/build.zig.zon +++ /dev/null @@ -1,10 +0,0 @@ -.{ - .name = .bh, - .version = "0.0.0", - .dependencies = .{ - }, - .paths = .{ - "", - }, - .fingerprint = 0x557bf2b094ba1492, -} diff --git a/engine/lib/bh/src/bh.zig b/engine/lib/bh/src/bh.zig deleted file mode 100644 index e69de29..0000000 diff --git a/engine/lib/bh/src/tests.zig b/engine/lib/bh/src/tests.zig deleted file mode 100644 index e69de29..0000000 diff --git a/engine/lib/bh/stubc.zig b/engine/lib/bh/stubc.zig deleted file mode 100644 index e69de29..0000000 diff --git a/engine/lib/p2/build.zig b/engine/lib/p2/build.zig index 13c2623..455d86d 100644 --- a/engine/lib/p2/build.zig +++ b/engine/lib/p2/build.zig @@ -1,12 +1,12 @@ const std = @import("std"); -const bh = @import("bh"); pub fn build(b: *std.Build) void { - const opts = bh.declareOptions(b); + const target = b.standardTargetOptions(.{}); + const optimize = b.standardOptimizeOption(.{}); const mod = b.addModule("p2", .{ - .target = opts.target, - .optimize = opts.optimize, + .target = target, + .optimize = optimize, .root_source_file = b.path("src/p2.zig"), }); @@ -15,8 +15,8 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "test p2"); const tests = b.addTest(.{ .root_module = b.createModule(.{ - .target = opts.target, - .optimize = opts.optimize, + .target = target, + .optimize = optimize, .root_source_file = b.path("src/p2.zig"), }), .use_llvm = b.option(bool, "llvm", "compiles the tests with llvm "), @@ -30,16 +30,4 @@ pub fn build(b: *std.Build) void { test_step.dependOn(&runArtifact.step); runArtifact.addPassthruArgs(); b.installArtifact(tests); - - const benchmark = b.addExecutable(.{ - .name = "queue-benchmark", - .root_module = b.createModule(.{ - .target = opts.target, - .optimize = opts.optimize, - .root_source_file = b.path("src/queue-benchmark.zig"), - }), - }); - const runBenchmark = b.addRunArtifact(benchmark); - runBenchmark.addPassthruArgs(); - b.step("bench-queues", "Compare one-producer/many-consumer queue throughput").dependOn(&runBenchmark.step); } diff --git a/engine/lib/p2/build.zig.zon b/engine/lib/p2/build.zig.zon index 0b25598..5e0a16c 100644 --- a/engine/lib/p2/build.zig.zon +++ b/engine/lib/p2/build.zig.zon @@ -1,9 +1,7 @@ .{ .name = .p2, .version = "0.0.0", - .dependencies = .{ - .bh = .{ .path = "../bh" }, - }, + .dependencies = .{}, .paths = .{ "", },