aboutsummaryrefslogtreecommitdiff
path: root/std/build.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-02-06 20:21:13 -0500
committerGitHub <noreply@github.com>2019-02-06 20:21:13 -0500
commit8a5d3e2eaf72195993e4932bfda66d08a36c6064 (patch)
tree6a09c68ee70d00e97feeae55b213203fbaddc295 /std/build.zig
parent3abf293a84b4dc052c0d735018db520eade6274b (diff)
parent89ffb5819703c81514e4f29d2cadb5b74ea1f840 (diff)
downloadzig-8a5d3e2eaf72195993e4932bfda66d08a36c6064.tar.gz
zig-8a5d3e2eaf72195993e4932bfda66d08a36c6064.zip
Merge pull request #1924 from ziglang/tls
Implement Thread Local Variables
Diffstat (limited to 'std/build.zig')
-rw-r--r--std/build.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/std/build.zig b/std/build.zig
index 5246d97339..07efcec30d 100644
--- a/std/build.zig
+++ b/std/build.zig
@@ -1686,6 +1686,7 @@ pub const TestStep = struct {
no_rosegment: bool,
output_path: ?[]const u8,
system_linker_hack: bool,
+ override_std_dir: ?[]const u8,
pub fn init(builder: *Builder, root_src: []const u8) TestStep {
const step_name = builder.fmt("test {}", root_src);
@@ -1707,6 +1708,7 @@ pub const TestStep = struct {
.no_rosegment = false,
.output_path = null,
.system_linker_hack = false,
+ .override_std_dir = null,
};
}
@@ -1737,6 +1739,10 @@ pub const TestStep = struct {
self.build_mode = mode;
}
+ pub fn overrideStdDir(self: *TestStep, dir_path: []const u8) void {
+ self.override_std_dir = dir_path;
+ }
+
pub fn setOutputPath(self: *TestStep, file_path: []const u8) void {
self.output_path = file_path;
@@ -1914,6 +1920,10 @@ pub const TestStep = struct {
if (self.system_linker_hack) {
try zig_args.append("--system-linker-hack");
}
+ if (self.override_std_dir) |dir| {
+ try zig_args.append("--override-std-dir");
+ try zig_args.append(builder.pathFromRoot(dir));
+ }
try builder.spawnChild(zig_args.toSliceConst());
}