| author | |
| committer | |
| log | 757db665a79d7885d1c8f83df65a25adc7af9a69 |
| tree | 402a2b41204af488a1b68e97123452ac881531bb |
| parent | 93d60d0de76e5dca666682e51589c0819eed2507 |
3 files changed, 9 insertions(+), 8 deletions(-)
build.zig+5-5| ... | ... | @@ -17,7 +17,7 @@ pub fn build(b: *Builder) !void { |
| 17 | 17 | b.setPreferredReleaseMode(.ReleaseFast); |
| 18 | 18 | const test_step = b.step("test", "Run all the tests"); |
| 19 | 19 | const mode = b.standardReleaseOptions(); |
| 20 | const target = b.standardTargetOptions(.{}); | |
| 20 | var target = b.standardTargetOptions(.{}); | |
| 21 | 21 | const single_threaded = b.option(bool, "single-threaded", "Build artifacts that run in single threaded mode"); |
| 22 | 22 | const use_zig_libcxx = b.option(bool, "use-zig-libcxx", "If libc++ is needed, use zig's bundled version, don't try to integrate with the system") orelse false; |
| 23 | 23 | |
| ... | ... | @@ -141,6 +141,10 @@ pub fn build(b: *Builder) !void { |
| 141 | 141 | break :blk 4; |
| 142 | 142 | }; |
| 143 | 143 | |
| 144 | if (only_c) { | |
| 145 | target.ofmt = .c; | |
| 146 | } | |
| 147 | ||
| 144 | 148 | const main_file: ?[]const u8 = mf: { |
| 145 | 149 | if (!have_stage1) break :mf "src/main.zig"; |
| 146 | 150 | if (use_zig0) break :mf null; |
| ... | ... | @@ -172,10 +176,6 @@ pub fn build(b: *Builder) !void { |
| 172 | 176 | test_cases.want_lto = false; |
| 173 | 177 | } |
| 174 | 178 | |
| 175 | if (only_c) { | |
| 176 | exe.ofmt = .c; | |
| 177 | } | |
| 178 | ||
| 179 | 179 | const exe_options = b.addOptions(); |
| 180 | 180 | exe.addOptions("build_options", exe_options); |
| 181 | 181 |
lib/std/build.zig+1-2| ... | ... | @@ -1622,7 +1622,6 @@ pub const LibExeObjStep = struct { |
| 1622 | 1622 | use_stage1: ?bool = null, |
| 1623 | 1623 | use_llvm: ?bool = null, |
| 1624 | 1624 | use_lld: ?bool = null, |
| 1625 | ofmt: ?std.Target.ObjectFormat = null, | |
| 1626 | 1625 | |
| 1627 | 1626 | output_path_source: GeneratedFile, |
| 1628 | 1627 | output_lib_path_source: GeneratedFile, |
| ... | ... | @@ -2490,7 +2489,7 @@ pub const LibExeObjStep = struct { |
| 2490 | 2489 | } |
| 2491 | 2490 | } |
| 2492 | 2491 | |
| 2493 | if (self.ofmt) |ofmt| { | |
| 2492 | if (self.target.ofmt) |ofmt| { | |
| 2494 | 2493 | try zig_args.append(try std.fmt.allocPrint(builder.allocator, "-ofmt={s}", .{@tagName(ofmt)})); |
| 2495 | 2494 | } |
| 2496 | 2495 |
test/tests.zig+3-1| ... | ... | @@ -52,6 +52,9 @@ const test_targets = blk: { |
| 52 | 52 | }, |
| 53 | 53 | |
| 54 | 54 | .{ |
| 55 | .target = .{ | |
| 56 | .ofmt = .c, | |
| 57 | }, | |
| 55 | 58 | .link_libc = true, |
| 56 | 59 | .backend = .stage2_c, |
| 57 | 60 | }, |
| ... | ... | @@ -720,7 +723,6 @@ pub fn addPkgTests( |
| 720 | 723 | .stage2_c => { |
| 721 | 724 | these_tests.use_stage1 = false; |
| 722 | 725 | these_tests.use_llvm = false; |
| 723 | these_tests.ofmt = .c; | |
| 724 | 726 | }, |
| 725 | 727 | else => { |
| 726 | 728 | these_tests.use_stage1 = false; |