place libomt to a proper install location

This commit is contained in:
2025-10-19 13:31:55 +03:00
parent dd190b5b65
commit 4881332c8c

View File

@@ -42,17 +42,20 @@ pub fn build(b: *std.Build) void {
// b.installArtifact(libvmx_build);
const omt_out_path = "3rd/libomt/bin/Release/net8.0/linux-x64/publish/";
const lib_dir = b.getInstallPath(.lib, "");
const copy_omt_h = b.addInstallFile(
const copy_omt_h = b.addInstallFileWithDir(
b.path(b.pathJoin(&.{ omt_out_path, "libomt.h" })),
b.pathJoin(&.{ lib_dir, "libomt.h" }),
.header,
"libomt.h",
);
copy_omt_h.step.dependOn(&libomt_build_script.step);
const copy_omt_so = b.addInstallFile(
const copy_omt_so = b.addInstallFileWithDir(
b.path(b.pathJoin(&.{ omt_out_path, "libomt.so" })),
b.pathJoin(&.{ lib_dir, "libomt.so" }),
.lib,
"libomt.so",
);
copy_omt_so.step.dependOn(&libomt_build_script.step);
// Define executable
const sender_exe = b.addExecutable(.{
@@ -66,8 +69,6 @@ pub fn build(b: *std.Build) void {
sender_exe.linkSystemLibrary("omt");
sender_exe.linkLibC();
sender_exe.step.dependOn(&copy_omt_h.step);
sender_exe.step.dependOn(&copy_omt_so.step);
const receiver_exe = b.addExecutable(.{
.name = "omtoy-receiver",
@@ -80,15 +81,14 @@ pub fn build(b: *std.Build) void {
receiver_exe.linkSystemLibrary("omt");
receiver_exe.linkLibC();
receiver_exe.step.dependOn(&copy_omt_h.step);
receiver_exe.step.dependOn(&copy_omt_so.step);
b.installArtifact(sender_exe);
b.installArtifact(receiver_exe);
// Manual build step for libomt dependencies
const build_omt_step = b.step("build-omt", "Build libomtnet, libomt and libvmx");
build_omt_step.dependOn(&libomt_build_script.step);
const build_omt_step = b.step("omt", "Build libomtnet, libomt and libvmx");
build_omt_step.dependOn(&copy_omt_h.step);
build_omt_step.dependOn(&copy_omt_so.step);
// Add run step for sender
const run_sender_step = b.step("sender-run", "Run the sender client");