srctree

build.zig
23548660  Gregory Mullen const std = @import("std"); 23548660  Gregory Mullen 23548660  Gregory Mullen pub fn build(b: *std.Build) void { 23548660  Gregory Mullen const target = b.standardTargetOptions(.{}); 23548660  Gregory Mullen const optimize = b.standardOptimizeOption(.{}); 23548660  Gregory Mullen 23548660  Gregory Mullen const dep_mqtt = b.dependency("mqtt", .{ .target = target, .optimize = optimize }); 23548660  Gregory Mullen 23548660  Gregory Mullen const exe = b.addExecutable(.{ 4f4e6c1c  Gregory Mullen .name = "gak", 4f4e6c1c  Gregory Mullen .root_source_file = b.path("src/main.zig"), 23548660  Gregory Mullen .target = target, 23548660  Gregory Mullen .optimize = optimize, 23548660  Gregory Mullen }); 23548660  Gregory Mullen exe.root_module.addImport("mqtt", dep_mqtt.module("mqtt")); 23548660  Gregory Mullen 23548660  Gregory Mullen b.installArtifact(exe); 23548660  Gregory Mullen 23548660  Gregory Mullen const run_cmd = b.addRunArtifact(exe); 23548660  Gregory Mullen 23548660  Gregory Mullen run_cmd.step.dependOn(b.getInstallStep()); 23548660  Gregory Mullen 23548660  Gregory Mullen if (b.args) |args| { 23548660  Gregory Mullen run_cmd.addArgs(args); 23548660  Gregory Mullen } 23548660  Gregory Mullen 23548660  Gregory Mullen const run_step = b.step("run", "Run the app"); 23548660  Gregory Mullen run_step.dependOn(&run_cmd.step); 23548660  Gregory Mullen 23548660  Gregory Mullen const exe_unit_tests = b.addTest(.{ 4f4e6c1c  Gregory Mullen .root_source_file = b.path("src/main.zig"), 23548660  Gregory Mullen .target = target, 23548660  Gregory Mullen .optimize = optimize, 23548660  Gregory Mullen }); 10bf70a5  Gregory Mullen exe_unit_tests.root_module.addImport("mqtt", dep_mqtt.module("mqtt")); 23548660  Gregory Mullen 23548660  Gregory Mullen const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests); 23548660  Gregory Mullen 23548660  Gregory Mullen const test_step = b.step("test", "Run unit tests"); 23548660  Gregory Mullen test_step.dependOn(&run_exe_unit_tests.step); 23548660  Gregory Mullen }