This is completely experimental, but since the API is the same, it's a drop-in replacement. The Windows driver is not apparently open source, so I am vendoring the static libraries provided. In theory, this will obviate the need to replace the HID driver on Windows and will thus require no initial setup, but I cannot currently test it beyond making sure it compiles.
44 lines
1.3 KiB
Zig
44 lines
1.3 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"))
|
|
else if (target.result.cpu.arch == .x86_64)
|
|
exe.addObjectFile(b.path("deps/labjack/windows/ljackuw64.lib"))
|
|
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);
|
|
}
|