built receiver, they did not come

This commit is contained in:
2025-10-13 23:13:08 +03:00
parent cc109157eb
commit 12ea31cc7f
3 changed files with 114 additions and 31 deletions

View File

@@ -26,48 +26,80 @@ pub fn build(b: *std.Build) void {
libomt_build.step.dependOn(&libomtnet_build.step);
// Define executable
const exe = b.addExecutable(.{
.name = "omtoy",
const sender_exe = b.addExecutable(.{
.name = "omtoy-sender",
.root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.root_source_file = b.path("src/sender.zig"),
.target = target,
.optimize = optimize,
}),
});
// Link libomt with the build
const receiver_exe = b.addExecutable(.{
.name = "omtoy-receiver",
.root_module = b.createModule(.{
.root_source_file = b.path("src/receiver.zig"),
.target = target,
.optimize = optimize,
}),
});
// Link libomt with the sender and receiver
{
const omt_output_dir = b.path("3rd/libomt/bin/Release/net8.0/linux-x64/publish");
sender_exe.addIncludePath(omt_output_dir);
sender_exe.addLibraryPath(omt_output_dir);
sender_exe.linkSystemLibrary("omt");
sender_exe.linkLibC();
receiver_exe.addIncludePath(omt_output_dir);
receiver_exe.addLibraryPath(omt_output_dir);
receiver_exe.linkSystemLibrary("omt");
receiver_exe.linkLibC();
}
b.installArtifact(sender_exe);
b.installArtifact(receiver_exe);
// Link libomt with the receiver
{
const omt_output_dir = b.path("3rd/libomt/bin/Release/net8.0/linux-x64/publish");
// exe.step.dependOn(&libomt_build.step);
exe.addIncludePath(omt_output_dir);
exe.addLibraryPath(omt_output_dir);
exe.linkSystemLibrary("omt");
exe.linkLibC();
sender_exe.addIncludePath(omt_output_dir);
sender_exe.addLibraryPath(omt_output_dir);
sender_exe.linkSystemLibrary("omt");
sender_exe.linkLibC();
}
b.installArtifact(exe);
// Manual build step for libomt dependencies
const build_omt_step = b.step("build-omt", "Build libomt and libomtnet");
build_omt_step.dependOn(&libomt_build.step);
// Add run step
const run_step = b.step("run", "Run the app");
const run_cmd = b.addRunArtifact(exe);
run_step.dependOn(&run_cmd.step);
// Add run step for sender
const run_sender_step = b.step("sender-run", "Run the sender client");
const run_sender_cmd = b.addRunArtifact(sender_exe);
run_sender_step.dependOn(&run_sender_cmd.step);
run_cmd.step.dependOn(b.getInstallStep());
const run_receiver_step = b.step("receiver-run", "Run the receiver client");
const run_receiver_cmd = b.addRunArtifact(receiver_exe);
run_receiver_step.dependOn(&run_receiver_cmd.step);
// Add run step for receiver
run_sender_cmd.step.dependOn(b.getInstallStep());
run_receiver_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
run_sender_cmd.addArgs(args);
run_receiver_cmd.addArgs(args);
}
const exe_tests = b.addTest(.{
.root_module = exe.root_module,
});
// TODO: write tests and stuff
// const exe_tests = b.addTest(.{
// .root_module = sender_exe.root_module,
// });
const run_exe_tests = b.addRunArtifact(exe_tests);
// const run_exe_tests = b.addRunArtifact(exe_tests);
const test_step = b.step("test", "Run tests");
test_step.dependOn(&run_exe_tests.step);
// const test_step = b.step("test", "Run tests");
// test_step.dependOn(&run_exe_tests.step);
}