blame
const std = @import("std");
// Although this function looks imperative, note that its job is to
// declaratively construct a build graph that will be executed by an external
// runner.
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const lib = b.addSharedLibrary(.{
.name = "obs-sway-focus",
.root_source_file = .{ .path = "src/root.zig" },
.target = target,
.optimize = optimize,
});
const obs = b.dependency("obzig-plugin", .{
.target = target,
.optimize = optimize,
});
lib.root_module.addImport("OBS", obs.module("OBS"));
lib.linkLibrary(obs.artifact("obzig-plugin"));
b.getInstallStep().dependOn(
&b.addInstallArtifact(lib, .{
.dest_dir = .{ .override = std.Build.InstallDir{ .custom = "" } },
.dest_sub_path = "obs-sway-focus/bin/64bit/obs-sway-focus.so",
}).step,
);
const lib_unit_tests = b.addTest(.{
.root_source_file = .{ .path = "src/root.zig" },
.target = target,
.optimize = optimize,
});
lib_unit_tests.linkLibC();
const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests);
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&run_lib_unit_tests.step);
}