zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 846f72b57cb56f67cedaa2113c3ff7b8c548d979 (tree)
parent a5b47bc2c2de54ea853ac48e745c75c499d5c9bb
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Fri,  5 Apr 2019 14:54:37 -0400

zig build: support single-threaded builds

and fix the zig test suite not setting the --single-threaded flag

Diffstat:
Mstd/build.zig | 8+++++++-
Mtest/tests.zig | 1+
2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/std/build.zig b/std/build.zig @@ -943,6 +943,7 @@ pub const LibExeObjStep = struct { exec_cmd_args: ?[]const ?[]const u8, name_prefix: []const u8, filter: ?[]const u8, + single_threaded: bool, root_src: ?[]const u8, out_h_filename: []const u8, @@ -1045,6 +1046,7 @@ pub const LibExeObjStep = struct { .disable_gen_h = false, .output_dir = null, .need_system_paths = false, + .single_threaded = false, }; self.computeOutFileNames(); return self; @@ -1206,7 +1208,7 @@ pub const LibExeObjStep = struct { pub fn setMainPkgPath(self: *LibExeObjStep, dir_path: []const u8) void { self.main_pkg_path = dir_path; } - + pub fn setDisableGenH(self: *LibExeObjStep, value: bool) void { self.disable_gen_h = value; } @@ -1411,6 +1413,10 @@ pub const LibExeObjStep = struct { zig_args.append("--strip") catch unreachable; } + if (self.single_threaded) { + try zig_args.append("--single-threaded"); + } + switch (self.build_mode) { builtin.Mode.Debug => {}, builtin.Mode.ReleaseSafe => zig_args.append("--release-safe") catch unreachable, diff --git a/test/tests.zig b/test/tests.zig @@ -186,6 +186,7 @@ pub fn addPkgTests(b: *build.Builder, test_filter: ?[]const u8, root_src: []cons if (link_libc) "c" else "bare", if (single_threaded) "single" else "multi", )); + these_tests.single_threaded = single_threaded; these_tests.setFilter(test_filter); these_tests.setBuildMode(mode); if (!is_native) {