authorgravatar for spexguy070@gmail.comMartin Wickham <spexguy070@gmail.com> 2021-06-03 12:06:22-05:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2021-08-21 19:41:28+03:00
log27e321628587fd82b431dbbed1e6ba99e6df24a6
treeb9199bacbf30170b9489670c1272fb2066a4dbb7
parente3e6df17ed93db3ca53983d6149249746594e11c

Add a flag to build a single-threaded compiler, for debugging


1 files changed, 10 insertions(+), 5 deletions(-)

build.zig+10-5
......@@ -17,8 +17,10 @@ pub fn build(b: *Builder) !void {
1717 b.setPreferredReleaseMode(.ReleaseFast);
1818 const mode = b.standardReleaseOptions();
1919 const target = b.standardTargetOptions(.{});
20 const single_threaded = b.option(bool, "single-threaded", "Build artifacts that run in single threaded mode") orelse false;
2021
2122 var docgen_exe = b.addExecutable("docgen", "doc/docgen.zig");
23 docgen_exe.single_threaded = single_threaded;
2224
2325 const rel_zig_exe = try fs.path.relative(b.allocator, b.build_root, b.zig_exe);
2426 const langref_out_path = fs.path.join(
......@@ -41,6 +43,7 @@ pub fn build(b: *Builder) !void {
4143 var test_stage2 = b.addTest("src/test.zig");
4244 test_stage2.setBuildMode(mode);
4345 test_stage2.addPackagePath("test_cases", "test/cases.zig");
46 test_stage2.single_threaded = single_threaded;
4447
4548 const fmt_build_zig = b.addFmt(&[_][]const u8{"build.zig"});
4649
......@@ -104,6 +107,7 @@ pub fn build(b: *Builder) !void {
104107 exe.setTarget(target);
105108 toolchain_step.dependOn(&exe.step);
106109 b.default_step.dependOn(&exe.step);
110 exe.single_threaded = single_threaded;
107111
108112 exe.addBuildOption(u32, "mem_leak_frames", mem_leak_frames);
109113 exe.addBuildOption(bool, "skip_non_native", skip_non_native);
......@@ -131,6 +135,7 @@ pub fn build(b: *Builder) !void {
131135 softfloat.addIncludeDir("deps/SoftFloat-3e/source/8086");
132136 softfloat.addIncludeDir("deps/SoftFloat-3e/source/include");
133137 softfloat.addCSourceFiles(&softfloat_sources, &[_][]const u8{ "-std=c99", "-O3" });
138 softfloat.single_threaded = single_threaded;
134139
135140 exe.linkLibrary(softfloat);
136141 test_stage2.linkLibrary(softfloat);
......@@ -296,7 +301,7 @@ pub fn build(b: *Builder) !void {
296301 "behavior",
297302 "Run the behavior tests",
298303 modes,
299 false,
304 false, // skip_single_threaded
300305 skip_non_native,
301306 skip_libc,
302307 is_wine_enabled,
......@@ -313,9 +318,9 @@ pub fn build(b: *Builder) !void {
313318 "compiler-rt",
314319 "Run the compiler_rt tests",
315320 modes,
316 true,
321 true, // skip_single_threaded
317322 skip_non_native,
318 true,
323 true, // skip_libc
319324 is_wine_enabled,
320325 is_qemu_enabled,
321326 is_wasmtime_enabled,
......@@ -330,9 +335,9 @@ pub fn build(b: *Builder) !void {
330335 "minilibc",
331336 "Run the mini libc tests",
332337 modes,
333 true,
338 true, // skip_single_threaded
334339 skip_non_native,
335 true,
340 true, // skip_libc
336341 is_wine_enabled,
337342 is_qemu_enabled,
338343 is_wasmtime_enabled,