const std = @import("std"); const raylib = @import("libs/raylib/build.zig"); const raygui = @import("libs/raygui/build.zig"); pub fn build(b: *std.Build) !void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); // TODO: Figure out how to build project for WASM. Tried to do it but standard memory allocators // didn't work. const exe = b.addExecutable(.{ .name = "chip8-zig", .root_source_file = .{ .path = "src/main.zig" }, .optimize = optimize, .target = target }); // Provide filenames of all files in 'src/ROMs' to program as options { var files = std.ArrayList([]const u8).init(b.allocator); defer files.deinit(); var options = b.addOptions(); var dir = try std.fs.cwd().openIterableDir("src/ROMs", .{ }); var it = dir.iterate(); while (try it.next()) |file| { if (file.kind != .file) { continue; } try files.append(b.pathJoin(&.{"ROMs", file.name})); } options.addOption([]const []const u8, "roms", files.items); exe.addOptions("options", options); } raylib.addTo(b, exe, target, optimize, .{ }); raygui.addTo(b, exe, target, optimize); const run_cmd = b.addRunArtifact(exe); const run_step = b.step("run", "Run chip8-zig"); run_step.dependOn(&run_cmd.step); b.installArtifact(exe); }