Andrew Kelley 36e2d992dd combine std.build and std.build.Builder into std.Build
I've been wanting to do this for along time.
2023-01-31 15:09:35 -07:00

31 lines
931 B
Zig

const builtin = @import("builtin");
const std = @import("std");
const CheckFileStep = std.Build.CheckFileStep;
pub fn build(b: *std.Build) void {
const target = .{
.cpu_arch = .thumb,
.cpu_model = .{ .explicit = &std.Target.arm.cpu.cortex_m4 },
.os_tag = .freestanding,
.abi = .gnueabihf,
};
const optimize = b.standardOptimizeOption(.{});
const elf = b.addExecutable(.{
.name = "zig-nrf52-blink.elf",
.root_source_file = .{ .path = "main.zig" },
.target = target,
.optimize = optimize,
});
const test_step = b.step("test", "Test the program");
b.default_step.dependOn(test_step);
const hex_step = b.addInstallRaw(elf, "hello.hex", .{});
test_step.dependOn(&hex_step.step);
const explicit_format_hex_step = b.addInstallRaw(elf, "hello.foo", .{ .format = .hex });
test_step.dependOn(&explicit_format_hex_step.step);
}