build libvmx with zig (wip)

This commit is contained in:
2025-10-16 22:50:52 +03:00
parent 3fe7487c5a
commit ef7a396c02

View File

@@ -37,17 +37,25 @@ pub fn build(b: *std.Build) void {
libomt_build.step.dependOn(&libomtnet_build.step); libomt_build.step.dependOn(&libomtnet_build.step);
// TODO: install libomt.so and libomt.h in a more convenient location // TODO: install libomt.so and libomt.h in a more convenient location
// Build libvmx const libvmx_build = b.addLibrary(.{
const libvmx_build = b.addSystemCommand(&.{"bash"}); .root_module //todo
libvmx_build.addFileArg(b.path("3rd/libvmx/build/buildlinuxx64.sh")); .name = "libvmx",
libvmx_build.cwd = b.path("3rd/libvmx/build"); .linkage = .dynamic,
});
libvmx_build.linkLibCpp();
libvmx_build.root_module.addCSourceFiles(.{
.root = b.path("3rd/libvmx/build/"),
.files = .{ "../src/vmxcodec_x86.cpp", "../src/vmxcodec_avx2.cpp", "../src/vmxcodec.cpp" },
.flags = .{ "-O3", "-std=c++17", "-fdeclspec", "-fPIC", "-mlzcnt", "-mavx2", "-mbmi", "-shared", "-Wl,-rpath,'$ORIGIN'" },
.language = null,
});
// Copy libvmx to a place of happiness // Copy libvmx to a place of happiness
// TODO: Runs but doesn't do what I'd expect it to. What's going on? // TODO: Runs but doesn't do what I'd expect it to. What's going on?
const libvmx_copy = b.addSystemCommand(&.{"cp"}); // const libvmx_copy = b.addSystemCommand(&.{"cp"});
libvmx_copy.addFileArg(b.path("3rd/libvmx/build/libvmx.so")); // libvmx_copy.addFileArg(b.path("3rd/libvmx/build/libvmx.so"));
_ = libvmx_copy.addOutputFileArg("3rd/libomt/bin/Release/net8.0/linux-x64/publish/"); // _ = libvmx_copy.addOutputFileArg("3rd/libomt/bin/Release/net8.0/linux-x64/publish/libvmx.so");
libvmx_copy.step.dependOn(&libvmx_build.step); // libvmx_copy.step.dependOn(&libvmx_build.step);
// Define executable // Define executable
const sender_exe = b.addExecutable(.{ const sender_exe = b.addExecutable(.{
@@ -87,7 +95,7 @@ pub fn build(b: *std.Build) void {
// Manual build step for libomt dependencies // Manual build step for libomt dependencies
const build_omt_step = b.step("build-omt", "Build libomt and libomtnet"); const build_omt_step = b.step("build-omt", "Build libomt and libomtnet");
build_omt_step.dependOn(&libomt_build.step); build_omt_step.dependOn(&libomt_build.step);
build_omt_step.dependOn(&libvmx_copy.step); // build_omt_step.dependOn(&libvmx_copy.step);
// Add run step for sender // Add run step for sender
const run_sender_step = b.step("sender-run", "Run the sender client"); const run_sender_step = b.step("sender-run", "Run the sender client");