std.Build: Make ofmt part of standardTargetOptions().

This commit is contained in:
Alex Rønne Petersen
2025-01-24 08:11:16 +01:00
parent d0d5ca2b6c
commit 015a5e1982
2 changed files with 12 additions and 7 deletions

View File

@@ -16,12 +16,11 @@ const stack_size = 46 * 1024 * 1024;
pub fn build(b: *std.Build) !void {
const only_c = b.option(bool, "only-c", "Translate the Zig compiler to C code, with only the C backend enabled") orelse false;
const target = t: {
var default_target: std.Target.Query = .{};
default_target.ofmt = b.option(std.Target.ObjectFormat, "ofmt", "Object format to target") orelse if (only_c) .c else null;
break :t b.standardTargetOptions(.{ .default_target = default_target });
};
const target = b.standardTargetOptions(.{
.default_target = .{
.ofmt = if (only_c) .c else null,
},
});
const optimize = b.standardOptimizeOption(.{});
const flat = b.option(bool, "flat", "Put files into the installation prefix in a manner suited for upstream distribution rather than a posix file system hierarchy standard") orelse false;