mirror of
https://github.com/ziglang/zig.git
synced 2025-12-18 20:23:07 +00:00
* introduce LazyPath.cwd_relative variant and use it for --zig-lib-dir. closes #12685 * move overrideZigLibDir and setMainPkgPath to options fields set once and then never mutated. * avoid introducing Build/util.zig * use doc comments for deprecation notices so that they show up in generated documentation. * introduce InstallArtifact.Options, accept it as a parameter to addInstallArtifact, and move override_dest_dir into it. Instead of configuring the installation via Compile step, configure the installation via the InstallArtifact step. In retrospect this is obvious. * remove calls to pushInstalledFile in InstallArtifact. See #14943 * rewrite InstallArtifact to not incorrectly observe whether a Compile step has any generated outputs. InstallArtifact is meant to trigger output generation. * fix child process evaluation code handling of `-fno-emit-bin`. * don't store out_h_filename, out_ll_filename, etc., pointlessly. these are all just simple extensions appended to the root name. * make emit_directory optional. It's possible to have nothing outputted, for example, if you're just type-checking. * avoid passing -femit-foo/-fno-emit-foo when it is the default * rename ConfigHeader.getTemplate to getOutput * deprecate addOptionArtifact * update the random number seed of Options step caching. * avoid using `inline for` pointlessly * avoid using `override_Dest_dir` pointlessly * avoid emitting an executable pointlessly in test cases Removes forceBuild and forceEmit. Let's consider these additions separately. Nearly all of the usage sites were suspicious.
30 lines
752 B
Zig
30 lines
752 B
Zig
const std = @import("std");
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const test_step = b.step("test", "Test it");
|
|
b.default_step = test_step;
|
|
|
|
const bootloader = b.addExecutable(.{
|
|
.name = "bootloader",
|
|
.root_source_file = .{ .path = "bootloader.zig" },
|
|
.target = .{
|
|
.cpu_arch = .x86,
|
|
.os_tag = .freestanding,
|
|
},
|
|
.optimize = .ReleaseSmall,
|
|
});
|
|
|
|
const exe = b.addTest(.{
|
|
.root_source_file = .{ .path = "main.zig" },
|
|
.optimize = .Debug,
|
|
});
|
|
exe.addAnonymousModule("bootloader.elf", .{
|
|
.source_file = bootloader.getEmittedBin(),
|
|
});
|
|
|
|
// TODO: actually check the output
|
|
_ = exe.getEmittedBin();
|
|
|
|
test_step.dependOn(&exe.step);
|
|
}
|