diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-07-07 11:31:07 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-07-07 11:31:07 -0400 |
| commit | d39dcd6d9db2faf18287b2ff734ffda0d4080e5a (patch) | |
| tree | 3da1f9e69b9bd4d98c0cb4a63d16c5e40a2b958d /std/build.zig | |
| parent | 38ba4127290d860cadcf078eeda7213094f6c3c7 (diff) | |
| download | zig-d39dcd6d9db2faf18287b2ff734ffda0d4080e5a.tar.gz zig-d39dcd6d9db2faf18287b2ff734ffda0d4080e5a.zip | |
zig build: add setLibCFile API
Diffstat (limited to 'std/build.zig')
| -rw-r--r-- | std/build.zig | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/std/build.zig b/std/build.zig index 4cebfb0436..7387bb11ae 100644 --- a/std/build.zig +++ b/std/build.zig @@ -1053,6 +1053,8 @@ pub const LibExeObjStep = struct { installed_path: ?[]const u8, install_step: ?*InstallArtifactStep, + libc_file: ?[]const u8, + const LinkObject = union(enum) { StaticPath: []const u8, OtherStep: *LibExeObjStep, @@ -1146,6 +1148,7 @@ pub const LibExeObjStep = struct { .single_threaded = false, .installed_path = null, .install_step = null, + .libc_file = null, }; self.computeOutFileNames(); return self; @@ -1321,6 +1324,10 @@ pub const LibExeObjStep = struct { self.disable_gen_h = value; } + pub fn setLibCFile(self: *LibExeObjStep, libc_file: ?[]const u8) void { + self.libc_file = libc_file; + } + /// Unless setOutputDir was called, this function must be called only in /// the make step, from a step that has declared a dependency on this one. /// To run an executable built with zig build, use `run`, or create an install step and invoke it. @@ -1525,6 +1532,11 @@ pub const LibExeObjStep = struct { try zig_args.append("--single-threaded"); } + if (self.libc_file) |libc_file| { + try zig_args.append("--libc"); + try zig_args.append(builder.pathFromRoot(libc_file)); + } + switch (self.build_mode) { builtin.Mode.Debug => {}, builtin.Mode.ReleaseSafe => zig_args.append("--release-safe") catch unreachable, |
