authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-04-05 14:54:37-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-04-05 14:54:37-04:00
log846f72b57cb56f67cedaa2113c3ff7b8c548d979
tree23d5b1884904b13ca2b5b56adfe21765f41af8ac
parenta5b47bc2c2de54ea853ac48e745c75c499d5c9bb
signaturelock-open Commit is signed but in an unrecognized format.

zig build: support single-threaded builds

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

2 files changed, 8 insertions(+), 1 deletions(-)

std/build.zig+7-1
...@@ -943,6 +943,7 @@ pub const LibExeObjStep = struct {...@@ -943,6 +943,7 @@ pub const LibExeObjStep = struct {
943 exec_cmd_args: ?[]const ?[]const u8,943 exec_cmd_args: ?[]const ?[]const u8,
944 name_prefix: []const u8,944 name_prefix: []const u8,
945 filter: ?[]const u8,945 filter: ?[]const u8,
946 single_threaded: bool,
946947
947 root_src: ?[]const u8,948 root_src: ?[]const u8,
948 out_h_filename: []const u8,949 out_h_filename: []const u8,
...@@ -1045,6 +1046,7 @@ pub const LibExeObjStep = struct {...@@ -1045,6 +1046,7 @@ pub const LibExeObjStep = struct {
1045 .disable_gen_h = false,1046 .disable_gen_h = false,
1046 .output_dir = null,1047 .output_dir = null,
1047 .need_system_paths = false,1048 .need_system_paths = false,
1049 .single_threaded = false,
1048 };1050 };
1049 self.computeOutFileNames();1051 self.computeOutFileNames();
1050 return self;1052 return self;
...@@ -1206,7 +1208,7 @@ pub const LibExeObjStep = struct {...@@ -1206,7 +1208,7 @@ pub const LibExeObjStep = struct {
1206 pub fn setMainPkgPath(self: *LibExeObjStep, dir_path: []const u8) void {1208 pub fn setMainPkgPath(self: *LibExeObjStep, dir_path: []const u8) void {
1207 self.main_pkg_path = dir_path;1209 self.main_pkg_path = dir_path;
1208 }1210 }
1209 1211
1210 pub fn setDisableGenH(self: *LibExeObjStep, value: bool) void {1212 pub fn setDisableGenH(self: *LibExeObjStep, value: bool) void {
1211 self.disable_gen_h = value;1213 self.disable_gen_h = value;
1212 }1214 }
...@@ -1411,6 +1413,10 @@ pub const LibExeObjStep = struct {...@@ -1411,6 +1413,10 @@ pub const LibExeObjStep = struct {
1411 zig_args.append("--strip") catch unreachable;1413 zig_args.append("--strip") catch unreachable;
1412 }1414 }
14131415
1416 if (self.single_threaded) {
1417 try zig_args.append("--single-threaded");
1418 }
1419
1414 switch (self.build_mode) {1420 switch (self.build_mode) {
1415 builtin.Mode.Debug => {},1421 builtin.Mode.Debug => {},
1416 builtin.Mode.ReleaseSafe => zig_args.append("--release-safe") catch unreachable,1422 builtin.Mode.ReleaseSafe => zig_args.append("--release-safe") catch unreachable,
test/tests.zig+1
...@@ -186,6 +186,7 @@ pub fn addPkgTests(b: *build.Builder, test_filter: ?[]const u8, root_src: []cons...@@ -186,6 +186,7 @@ pub fn addPkgTests(b: *build.Builder, test_filter: ?[]const u8, root_src: []cons
186 if (link_libc) "c" else "bare",186 if (link_libc) "c" else "bare",
187 if (single_threaded) "single" else "multi",187 if (single_threaded) "single" else "multi",
188 ));188 ));
189 these_tests.single_threaded = single_threaded;
189 these_tests.setFilter(test_filter);190 these_tests.setFilter(test_filter);
190 these_tests.setBuildMode(mode);191 these_tests.setBuildMode(mode);
191 if (!is_native) {192 if (!is_native) {