From dd6c195582f3fd0e1be3e9651637bd4c5e6ed16a Mon Sep 17 00:00:00 2001 From: piuvas Date: Wed, 13 Nov 2024 18:17:11 -0300 Subject: [PATCH 1/2] fixbuild --- .gitignore | 2 +- build.zig | 24 ++++++++++++------------ src/main.zig | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 9c7a0c7..880cd5d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ zig-out -zig-cache \ No newline at end of file +.zig-cache diff --git a/build.zig b/build.zig index aa7d9a0..bc45978 100644 --- a/build.zig +++ b/build.zig @@ -5,7 +5,7 @@ const emulator = "mgba"; const flags = .{"-lgba"}; const devkitpro = "/opt/devkitpro"; -pub fn build(b: *std.build.Builder) void { +pub fn build(b: *std.Build) void { const target = std.zig.CrossTarget{ .cpu_arch = .thumb, .os_tag = .freestanding, @@ -15,15 +15,15 @@ pub fn build(b: *std.build.Builder) void { const obj = b.addObject(.{ .name = "zig-gba", - .root_source_file = .{ .path = "src/main.zig" }, + .root_source_file = b.path("src/main.zig"), .link_libc = true, - .target = target, + .target = b.resolveTargetQuery(target), .optimize = optimize, }); - obj.setLibCFile(std.build.FileSource{ .path = "libc.txt" }); - obj.addIncludePath(devkitpro ++ "/libgba/include"); - obj.addIncludePath(devkitpro ++ "/portlibs/gba/include"); - obj.addIncludePath(devkitpro ++ "/portlibs/armv4/include"); + obj.setLibCFile(std.Build.LazyPath{ .cwd_relative = "libc.txt" }); + obj.addIncludePath(std.Build.LazyPath{ .cwd_relative = devkitpro ++ "/libgba/include"}); + obj.addIncludePath(std.Build.LazyPath{ .cwd_relative = devkitpro ++ "/portlibs/gba/include"}); + obj.addIncludePath(std.Build.LazyPath{ .cwd_relative = devkitpro ++ "/portlibs/armv4/include"}); const extension = if (builtin.target.os.tag == .windows) ".exe" else ""; const elf = b.addSystemCommand(&.{ @@ -33,8 +33,8 @@ pub fn build(b: *std.build.Builder) void { "-mthumb-interwork", }); _ = elf.addPrefixedOutputFileArg("-Wl,-Map,", "zig-gba.map"); - elf.addPrefixedFileSourceArg("-specs=", .{ .path = devkitpro ++ "/devkitARM/arm-none-eabi/lib/gba.specs" }); - elf.addFileSourceArg(obj.getOutputSource()); + elf.addPrefixedFileArg("-specs=", std.Build.LazyPath{ .cwd_relative = devkitpro ++ "/devkitARM/arm-none-eabi/lib/gba.specs" }); + elf.addFileArg(obj.getEmittedBin()); elf.addArgs(&.{ "-L" ++ devkitpro ++ "/libgba/lib", "-L" ++ devkitpro ++ "/portlibs/gba/lib", @@ -49,11 +49,11 @@ pub fn build(b: *std.build.Builder) void { "-O", "binary", }); - gba.addFileSourceArg(elf_file); + gba.addFileArg(elf_file); const gba_file = gba.addOutputFileArg("zig-gba.gba"); const fix = b.addSystemCommand(&.{devkitpro ++ "/tools/bin/gbafix" ++ extension}); - fix.addFileSourceArg(gba_file); + fix.addFileArg(gba_file); const install = b.addInstallBinFile(gba_file, "zig-gba.gba"); @@ -65,7 +65,7 @@ pub fn build(b: *std.build.Builder) void { const run_step = b.step("run", "Run in mGBA"); const mgba = b.addSystemCommand(&.{emulator}); - mgba.addFileSourceArg(gba_file); + mgba.addFileArg(gba_file); run_step.dependOn(&install.step); run_step.dependOn(&mgba.step); } diff --git a/src/main.zig b/src/main.zig index 6548e7f..944b45a 100644 --- a/src/main.zig +++ b/src/main.zig @@ -6,7 +6,7 @@ export fn main(_: c_int, _: [*]const [*:0]const u8) void { c.irqEnable(c.IRQ_VBLANK); c.consoleDemoInit(); - _ = c.printf("Hello, Zig"); + _ = c.printf("oie lols"); while (true) { system.vblank_intr_wait(); } From 7a41dbff9d5c2f416e4d867bfd6c125977745ec5 Mon Sep 17 00:00:00 2001 From: piuvas Date: Wed, 13 Nov 2024 18:18:34 -0300 Subject: [PATCH 2/2] remove personal changes --- src/main.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.zig b/src/main.zig index 944b45a..6548e7f 100644 --- a/src/main.zig +++ b/src/main.zig @@ -6,7 +6,7 @@ export fn main(_: c_int, _: [*]const [*:0]const u8) void { c.irqEnable(c.IRQ_VBLANK); c.consoleDemoInit(); - _ = c.printf("oie lols"); + _ = c.printf("Hello, Zig"); while (true) { system.vblank_intr_wait(); }