From cd27fcdb763635d5234035464c9a7f83d15c9a89 Mon Sep 17 00:00:00 2001 From: peterino2 Date: Wed, 15 Oct 2025 01:20:01 -0700 Subject: [PATCH] platform, sys, assets, audio compiling --- engine/assets/build.zig | 8 +++++--- engine/audio/build.zig | 8 +++++--- engine/platform/build.zig | 8 +++++--- engine/platform/tests/tests.zig | 7 +++++-- engine/rend/build.zig | 9 +++++---- engine/sys/build.zig | 8 +++++--- engine/sys/build.zig.zon | 5 ----- engine/sys/src/systemProc.zig | 2 +- engine/sys/tests/tests.zig | 3 ++- 9 files changed, 33 insertions(+), 25 deletions(-) diff --git a/engine/assets/build.zig b/engine/assets/build.zig index ea8790f..d8d0d7c 100644 --- a/engine/assets/build.zig +++ b/engine/assets/build.zig @@ -26,9 +26,11 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "run unit tests for assets"); const tests = b.addTest(.{ - .target = target, - .optimize = optimize, - .root_source_file = b.path("tests/test.zig"), + .root_module = b.createModule(.{ + .target = target, + .optimize = optimize, + .root_source_file = b.path("tests/test.zig"), + }), }); tests.root_module.addImport("assets", mod); diff --git a/engine/audio/build.zig b/engine/audio/build.zig index eacaa60..d28f4f8 100644 --- a/engine/audio/build.zig +++ b/engine/audio/build.zig @@ -25,9 +25,11 @@ pub fn build(b: *std.Build) void { const test_step = b.step("test", "run unit tests for audio"); const tests = b.addTest(.{ - .target = target, - .optimize = optimize, - .root_source_file = b.path("tests/tests.zig"), + .root_module = b.createModule(.{ + .target = target, + .optimize = optimize, + .root_source_file = b.path("tests/tests.zig"), + }), }); tests.root_module.addImport("audio", mod); diff --git a/engine/platform/build.zig b/engine/platform/build.zig index 7c2debd..55443d7 100644 --- a/engine/platform/build.zig +++ b/engine/platform/build.zig @@ -19,9 +19,11 @@ pub fn build(b: *std.Build) void { }); const tests = b.addTest(.{ - .target = target, - .optimize = optimize, - .root_source_file = b.path("tests/tests.zig"), + .root_module = b.createModule(.{ + .target = target, + .optimize = optimize, + .root_source_file = b.path("tests/tests.zig"), + }), }); for (dependencyList) |depName| { diff --git a/engine/platform/tests/tests.zig b/engine/platform/tests/tests.zig index d841dd8..e5a7151 100644 --- a/engine/platform/tests/tests.zig +++ b/engine/platform/tests/tests.zig @@ -4,8 +4,11 @@ const platform = @import("platform"); const std = @import("std"); test "test platform integration" { - try core.start_module(.{}, .{}, std.testing.allocator); + var specMap = core.SpecVariantMap.init(std.testing.allocator); + defer specMap.deinit(); + try specMap.put("name", .{ .string = "testName" }); + try core.start_module(&specMap, .{}, std.testing.allocator); defer core.shutdown_module(std.testing.allocator); - try platform.start_module(.{}, .{}, std.testing.allocator); + try platform.start_module(&specMap, .{}, std.testing.allocator); defer platform.shutdown_module(std.testing.allocator); } diff --git a/engine/rend/build.zig b/engine/rend/build.zig index e3c7c87..01b28d7 100644 --- a/engine/rend/build.zig +++ b/engine/rend/build.zig @@ -53,13 +53,14 @@ pub fn build(b: *std.Build) void { // ========== tests ========== const tests = b.addTest(.{ - .target = target, - .optimize = optimize, - .root_source_file = b.path("tests/tests.zig"), + .root_module = b.createModule(.{ + .target = target, + .optimize = optimize, + .root_source_file = b.path("tests/tests.zig"), + }), }); const test_step = b.step("test", "run unit tests for rend"); - tests.root_module.addImport("platform", mod); const runArtifact = b.addRunArtifact(tests); test_step.dependOn(&runArtifact.step); b.installArtifact(tests); diff --git a/engine/sys/build.zig b/engine/sys/build.zig index 49f679b..e4254d7 100644 --- a/engine/sys/build.zig +++ b/engine/sys/build.zig @@ -24,9 +24,11 @@ pub fn build(b: *std.Build) void { // ========== tests ========== const tests = b.addTest(.{ - .target = target, - .optimize = optimize, - .root_source_file = b.path("tests/tests.zig"), + .root_module = b.createModule(.{ + .target = target, + .optimize = optimize, + .root_source_file = b.path("tests/tests.zig"), + }), }); const test_step = b.step("test", "run unit tests for ui"); diff --git a/engine/sys/build.zig.zon b/engine/sys/build.zig.zon index 507859a..af1f98a 100644 --- a/engine/sys/build.zig.zon +++ b/engine/sys/build.zig.zon @@ -3,11 +3,6 @@ .version = "0.0.0", .dependencies = .{ .core = .{ .path = "../core" }, - .platform = .{ .path = "../platform" }, - .papyrus = .{ .path = "../papyrus" }, - .rend = .{ .path = "../rend" }, - .sdl3 = .{ .path = "../../lib/sdl3" }, - .shaderTypes = .{ .path = "../../lib/sdl3/shaderTypes" }, }, .paths = .{ "", diff --git a/engine/sys/src/systemProc.zig b/engine/sys/src/systemProc.zig index da7904f..276a3ae 100644 --- a/engine/sys/src/systemProc.zig +++ b/engine/sys/src/systemProc.zig @@ -42,7 +42,7 @@ pub const SubprocessTask = struct { self.stderr = .{}; self.stdout = .{}; core.engine_log("running task", .{}); - core.engine_log("cwd = {s}", .{self.workingDir.?}); + core.engine_log("cwd = {?s}", .{self.workingDir}); self.child = std.process.Child.init(self.argsOwned.items, self.allocator); self.child.?.stdout_behavior = .Inherit; self.child.?.stderr_behavior = .Inherit; diff --git a/engine/sys/tests/tests.zig b/engine/sys/tests/tests.zig index 79278ca..c8b747f 100644 --- a/engine/sys/tests/tests.zig +++ b/engine/sys/tests/tests.zig @@ -16,11 +16,12 @@ test "testing threadrunner" { const task = try sys.SubprocessTask.create(std.testing.allocator, &.{ "echo", "this is an echo: hello world\n" }); defer task.destroy(); - std.debug.print("beginning destroy\n", .{}); + std.debug.print("task1 finished\n", .{}); try task.run(); task.wait(); const task2 = try sys.runCommand(std.testing.allocator, &.{ "echo", "sup homies" }, null); defer task2.destroy(); + std.debug.print("task2 finished\n", .{}); task2.wait(); }