const std = @import("std"); const Module = std.Build.Module; pub fn build(b: *std.Build) !void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); var lib: *Module = undefined; { lib = b.createModule(.{ .root_source_file = b.path("src/root.zig"), .target = target, .optimize = optimize, }); const unit_tests = b.addTest(.{ .root_source_file = b.path("src/root.zig"), .target = target, .optimize = optimize, }); const run_unit_tests = b.addRunArtifact(unit_tests); const test_step = b.step("test", "Run unit tests"); test_step.dependOn(&run_unit_tests.step); } { const raylib_dep = b.dependency("raylib-zig", .{ .target = target, .optimize = optimize, }); const exe = b.addExecutable(.{ .name = "daq-view", .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, }); exe.linkLibrary(raylib_dep.artifact("raylib")); exe.root_module.addImport("raylib", raylib_dep.module("raylib")); const external_compiler_support_dir = try std.process.getEnvVarOwned(b.allocator, "NIEXTCCOMPILERSUPP"); exe.addSystemIncludePath(.{ .cwd_relative = try std.fs.path.join(b.allocator, &.{ external_compiler_support_dir, "include" }) }); const lib_folder_name = if (target.result.ptrBitWidth() == 64) "lib64" else "lib32"; exe.addLibraryPath(.{ .cwd_relative = try std.fs.path.join(b.allocator, &.{ external_compiler_support_dir, lib_folder_name, "msvc" }) }); exe.linkSystemLibrary("nidaqmx"); if (target.result.os.tag == .windows) { exe.subsystem = if (optimize == .Debug) .Console else .Windows; } b.installArtifact(exe); const run_cmd = b.addRunArtifact(exe); run_cmd.step.dependOn(b.getInstallStep()); if (b.args) |args| { run_cmd.addArgs(args); } const run_step = b.step("run", "Run the program"); run_step.dependOn(&run_cmd.step); } }