| author | |
| committer | |
| log | 015a5e198246f782415586235e0da7085867eb22 |
| tree | 2622778ba47d3299438d510f0f1dd41572463788 |
| parent | d0d5ca2b6c8253c27e945ed8d973a90c28a3cbf5 |
2 files changed, 12 insertions(+), 7 deletions(-)
build.zig+5-6| ... | ... | @@ -16,12 +16,11 @@ const stack_size = 46 * 1024 * 1024; |
| 16 | 16 | |
| 17 | 17 | pub fn build(b: *std.Build) !void { |
| 18 | 18 | const only_c = b.option(bool, "only-c", "Translate the Zig compiler to C code, with only the C backend enabled") orelse false; |
| 19 | const target = t: { | |
| 20 | var default_target: std.Target.Query = .{}; | |
| 21 | default_target.ofmt = b.option(std.Target.ObjectFormat, "ofmt", "Object format to target") orelse if (only_c) .c else null; | |
| 22 | break :t b.standardTargetOptions(.{ .default_target = default_target }); | |
| 23 | }; | |
| 24 | ||
| 19 | const target = b.standardTargetOptions(.{ | |
| 20 | .default_target = .{ | |
| 21 | .ofmt = if (only_c) .c else null, | |
| 22 | }, | |
| 23 | }); | |
| 25 | 24 | const optimize = b.standardOptimizeOption(.{}); |
| 26 | 25 | |
| 27 | 26 | 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; |
lib/std/Build.zig+7-1| ... | ... | @@ -1635,13 +1635,18 @@ pub fn standardTargetOptionsQueryOnly(b: *Build, args: StandardTargetOptionsArgs |
| 1635 | 1635 | "cpu", |
| 1636 | 1636 | "Target CPU features to add or subtract", |
| 1637 | 1637 | ); |
| 1638 | const ofmt = b.option( | |
| 1639 | []const u8, | |
| 1640 | "ofmt", | |
| 1641 | "Target object format", | |
| 1642 | ); | |
| 1638 | 1643 | const dynamic_linker = b.option( |
| 1639 | 1644 | []const u8, |
| 1640 | 1645 | "dynamic-linker", |
| 1641 | 1646 | "Path to interpreter on the target system", |
| 1642 | 1647 | ); |
| 1643 | 1648 | |
| 1644 | if (maybe_triple == null and mcpu == null and dynamic_linker == null) | |
| 1649 | if (maybe_triple == null and mcpu == null and ofmt == null and dynamic_linker == null) | |
| 1645 | 1650 | return args.default_target; |
| 1646 | 1651 | |
| 1647 | 1652 | const triple = maybe_triple orelse "native"; |
| ... | ... | @@ -1649,6 +1654,7 @@ pub fn standardTargetOptionsQueryOnly(b: *Build, args: StandardTargetOptionsArgs |
| 1649 | 1654 | const selected_target = parseTargetQuery(.{ |
| 1650 | 1655 | .arch_os_abi = triple, |
| 1651 | 1656 | .cpu_features = mcpu, |
| 1657 | .object_format = ofmt, | |
| 1652 | 1658 | .dynamic_linker = dynamic_linker, |
| 1653 | 1659 | }) catch |err| switch (err) { |
| 1654 | 1660 | error.ParseFailed => { |