-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.zig
25 lines (23 loc) · 1.15 KB
/
build.zig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const std = @import("std");
const Builder = std.build.Builder;
pub fn build(b: *Builder) void {
const mode = b.standardReleaseOptions();
const obj = b.addObject("main", "src/main.zig");
obj.setOutputDir("build");
obj.linkLibC();
obj.setLibCFile(std.build.FileSource{ .path = "libc.txt" });
obj.addIncludeDir("vendor/devkitpro/libogc/include");
obj.setBuildMode(mode);
obj.setTarget(.{
.cpu_arch = .powerpc,
.os_tag = .freestanding,
.abi = .eabi,
.cpu_model = .{ .explicit = &std.Target.powerpc.cpu.@"750" },
.cpu_features_add = std.Target.powerpc.featureSet(&.{.hard_float}),
});
const elf = b.addSystemCommand(&[_][]const u8{ "/opt/devkitpro/devkitPPC/bin/powerpc-eabi-gcc", "build/main.o", "-g", "-DGEKKO", "-mrvl", "-mcpu=750", "-meabi", "-mhard-float", "-Wl,-Map,build/.map", "-L/opt/devkitpro/libogc/lib/wii", "-lwiiuse", "-lbte", "-logc", "-lm", "-o", "build/zig-wii.elf" });
const dol = b.addSystemCommand(&[_][]const u8{ "elf2dol", "build/zig-wii.elf", "build/zig-wii.dol" });
b.default_step.dependOn(&dol.step);
dol.step.dependOn(&elf.step);
elf.step.dependOn(&obj.step);
}