diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e73c965 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +zig-cache/ +zig-out/ diff --git a/build.zig b/build.zig new file mode 100644 index 0000000..ebf0782 --- /dev/null +++ b/build.zig @@ -0,0 +1,34 @@ +const std = @import("std"); + +pub fn build(b: *std.Build) !void { + const target = b.standardTargetOptions(.{}); + const optimize = b.standardOptimizeOption(.{}); + + const rgbds = b.dependency("rgbds", .{ + .target = target, + .optimize = optimize, + }); + + const assemble = b.addRunArtifact(rgbds.artifact("rgbasm")); + assemble.addArg("-L"); + assemble.addArg("-o"); + const main_obj = assemble.addOutputFileArg("main.o"); + assemble.addFileArg(.{ .path = "main.asm" }); + + const link = b.addRunArtifact(rgbds.artifact("rgblink")); + link.addArg("-o"); + const rom = link.addOutputFileArg("3dp.gb"); + link.addFileArg(main_obj); + + const fix = b.addRunArtifact(rgbds.artifact("rgbfix")); + fix.addArg("-v"); + fix.addArg("-p"); + fix.addArg("0xFF"); + fix.addFileArg(rom); + + const install_file = b.addInstallFile(rom, "3dp.gb"); + install_file.step.dependOn(&fix.step); + + const install = b.getInstallStep(); + install.dependOn(&install_file.step); +} diff --git a/build.zig.zon b/build.zig.zon new file mode 100644 index 0000000..e3e3f7b --- /dev/null +++ b/build.zig.zon @@ -0,0 +1,12 @@ +.{ + .name = "gb3dplatformer", + .version = "0.0.0", + .dependencies = .{ + .rgbds = .{ + .url = "https://github.com/desttinghim/rgbds/archive/466d72960959bacc949cdc32dd0a7bef81033c93.tar.gz", + .hash = "12208b3722dda87fccc706f8a3fd83b1f9c8cb92a85484c72e1644849d1f4a1cbfc4", }, + }, + .paths = .{ + "", + }, +}