forked from wendigojaeger/ZigGBA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.zig
33 lines (26 loc) · 1.03 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
26
27
28
29
30
31
32
33
const Builder = @import("std").build.Builder;
const builtin = @import("std").builtin;
const std = @import("std");
pub fn build(b: *Builder) void {
const exe = b.addExecutable("GBAHelloWorld", "src/main.zig");
exe.setTheTarget(std.Target {
.Cross = std.Target.Cross {
.arch = std.Target.Arch {
.thumb = std.Target.Arch.Arm32.v4t
},
.os = .freestanding,
.abi = .none
}
});
exe.setOutputDir("zig-cache/raw");
exe.setLinkerScriptPath("gba.ld");
exe.setBuildMode(builtin.Mode.ReleaseFast);
const objCopyCommand = if (builtin.os == builtin.Os.windows) "C:\\Programmation\\Zig\\llvm+clang-9.0.0-win64-msvc-mt\\bin\\llvm-objcopy.exe" else "llvm-objcopy";
const buildGBARomCommand = b.addSystemCommand(&[_][]const u8 {
objCopyCommand, exe.getOutputPath(),
"-O", "binary",
"zig-cache/bin/GBAHelloWorld.gba",
});
buildGBARomCommand.step.dependOn(&exe.step);
b.default_step.dependOn(&buildGBARomCommand.step);
}