revert back to old approach

This commit is contained in:
2025-10-27 22:35:22 +02:00
parent bc222b77b7
commit bd3a49dc5a
5 changed files with 82 additions and 57 deletions

View File

@@ -27,7 +27,6 @@ pub fn build(b: *std.Build) void {
return;
}
{
// This comes from the libomt build scripts
const omt_out_path = "3rd/libomt/bin/Release/net8.0/linux-x64/publish/";
@@ -74,7 +73,6 @@ pub fn build(b: *std.Build) void {
build_omt_step.dependOn(&install_omt_so.step);
build_omt_step.dependOn(&install_vmx_so.step);
}
}
// The output lib and header directories
const lib_output_path: std.Build.LazyPath = .{
@@ -85,27 +83,45 @@ pub fn build(b: *std.Build) void {
};
// Zig omt module
const omt_module = b.addModule("omt", .{
const omt_mod = b.addModule("omt", .{
.root_source_file = b.path("src/omt.zig"),
.target = target,
.optimize = optimize,
});
omt_module.linkSystemLibrary("omt", .{});
omt_module.addLibraryPath(lib_output_path);
omt_module.addIncludePath(include_output_path);
omt_mod.linkSystemLibrary("omt", .{});
omt_mod.addLibraryPath(lib_output_path);
omt_mod.addIncludePath(include_output_path);
{
// Define executables
const sender_exe = b.addExecutable(.{
.name = "omtoy-sender",
// Main executable
const omtoy_exe = b.addExecutable(.{
.name = "omtoy",
.root_module = b.createModule(.{
.root_source_file = b.path("src/sender.zig"),
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
}),
});
sender_exe.root_module.addImport("omt", omt_module);
b.installArtifact(omtoy_exe);
const omtoy_run_step = b.step("run", "Run omtoy");
const omtoy_run = b.addRunArtifact(omtoy_exe);
omtoy_run_step.dependOn(&omtoy_run);
omtoy_run.step.dependOn(b.getInstallStep());
// Util executables
{
// Define executables
const sender_exe = b.addExecutable(.{
.name = "sender",
.root_module = b.createModule(.{
.root_source_file = b.path("utils/sender.zig"),
.target = target,
.optimize = optimize,
}),
});
sender_exe.root_module.addImport("omt", omt_mod);
sender_exe.root_module.addLibraryPath(lib_output_path);
sender_exe.root_module.addIncludePath(include_output_path);
@@ -128,14 +144,14 @@ pub fn build(b: *std.Build) void {
{
const receiver_exe = b.addExecutable(.{
.name = "omtoy-receiver",
.name = "receiver",
.root_module = b.createModule(.{
.root_source_file = b.path("src/receiver.zig"),
.root_source_file = b.path("utils/receiver.zig"),
.target = target,
.optimize = optimize,
}),
});
receiver_exe.root_module.addImport("omt", omt_module);
receiver_exe.root_module.addImport("omt", omt_mod);
receiver_exe.root_module.addLibraryPath(lib_output_path);
receiver_exe.root_module.addIncludePath(include_output_path);
@@ -154,7 +170,6 @@ pub fn build(b: *std.Build) void {
run_receiver_cmd.addArgs(args);
}
}
// TODO: write tests and stuff
// const exe_tests = b.addTest(.{
// .root_module = sender_exe.root_module,

6
src/main.zig Normal file
View File

@@ -0,0 +1,6 @@
const std = @import("std");
const omt = @import("omt.zig");
pub fn main() void {
std.log.info("Starting omtoy...", .{});
}

View File

@@ -25,3 +25,7 @@ pub fn colorSpaceToString(cs: c.OMTColorSpace) []const u8 {
else => "Invalid",
};
}
pub fn whaaat() void {
std.log.info("Whaaaat", .{});
}