yaes/build.zig
torque 011f300f0a
windows: hatred rising
The lib files are of course stubs and not actually static libraries,
which means we have to distribute the DLL as well. Unfortunately.
Incredibly bad operating system. If this doesn't work, I quit.
2024-07-10 22:28:49 -07:00

55 lines
1.7 KiB
Zig

const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const use_udev = b.option(
bool,
"use_udev",
"link and use udev (Linux only. Default: false)",
) orelse false;
const exe = b.addExecutable(.{
.name = "yaes",
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
if (target.result.os.tag == .windows) {
if (target.result.cpu.arch == .x86) {
exe.addObjectFile(b.path("deps/labjack/windows/ljackuw32.lib"));
b.getInstallStep().dependOn(
&b.addInstallBinFile(
b.path("deps/labjack/windows/ljackuw32.dll"),
"ljackuw.dll",
).step,
);
} else if (target.result.cpu.arch == .x86_64) {
exe.addObjectFile(b.path("deps/labjack/windows/ljackuw64.lib"));
b.getInstallStep().dependOn(
&b.addInstallBinFile(
b.path("deps/labjack/windows/ljackuw64.dll"),
"ljackuw.dll",
).step,
);
} else @panic("Unsupported CPU arch for Windows build (must be x86 or x86_64).");
} else {
const ljacklm_dep = b.dependency(
"ljacklm",
.{ .target = target, .optimize = optimize, .use_udev = use_udev },
);
exe.linkLibrary(ljacklm_dep.artifact("ljacklm"));
}
exe.root_module.addImport(
"udev_rules",
b.addModule("udev_rules", .{
.root_source_file = b.path("deps/labjack/exodriver/udev_rules.zig"),
}),
);
b.installArtifact(exe);
}