authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-07-07 11:31:07-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-07-07 11:31:07-04:00
logd39dcd6d9db2faf18287b2ff734ffda0d4080e5a
tree3da1f9e69b9bd4d98c0cb4a63d16c5e40a2b958d
parent38ba4127290d860cadcf078eeda7213094f6c3c7
signaturelock-open Commit is signed but in an unrecognized format.

zig build: add setLibCFile API


1 files changed, 12 insertions(+), 0 deletions(-)

std/build.zig+12
......@@ -1053,6 +1053,8 @@ pub const LibExeObjStep = struct {
10531053 installed_path: ?[]const u8,
10541054 install_step: ?*InstallArtifactStep,
10551055
1056 libc_file: ?[]const u8,
1057
10561058 const LinkObject = union(enum) {
10571059 StaticPath: []const u8,
10581060 OtherStep: *LibExeObjStep,
......@@ -1146,6 +1148,7 @@ pub const LibExeObjStep = struct {
11461148 .single_threaded = false,
11471149 .installed_path = null,
11481150 .install_step = null,
1151 .libc_file = null,
11491152 };
11501153 self.computeOutFileNames();
11511154 return self;
......@@ -1321,6 +1324,10 @@ pub const LibExeObjStep = struct {
13211324 self.disable_gen_h = value;
13221325 }
13231326
1327 pub fn setLibCFile(self: *LibExeObjStep, libc_file: ?[]const u8) void {
1328 self.libc_file = libc_file;
1329 }
1330
13241331 /// Unless setOutputDir was called, this function must be called only in
13251332 /// the make step, from a step that has declared a dependency on this one.
13261333 /// 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 {
15251532 try zig_args.append("--single-threaded");
15261533 }
15271534
1535 if (self.libc_file) |libc_file| {
1536 try zig_args.append("--libc");
1537 try zig_args.append(builder.pathFromRoot(libc_file));
1538 }
1539
15281540 switch (self.build_mode) {
15291541 builtin.Mode.Debug => {},
15301542 builtin.Mode.ReleaseSafe => zig_args.append("--release-safe") catch unreachable,