authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-02-25 14:27:03-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-02-25 14:27:03-05:00
log33cbb29def181ee758b1f8bb93d8d81a4e377ce1
treef6e9ea25cfa8ed5312c864f8075aae5a0d58aa46
parent6003b1ea7018fe6a7aa87622d1178e444e6d8abb
signaturelock-open Commit is signed but in an unrecognized format.

zig build: 2 improvements

* `linkLibrary` will make the target depend on libc if the source does * when building C source file(s), don't try to generate .h files

1 files changed, 5 insertions(+), 1 deletions(-)

std/build.zig+5-1
...@@ -1011,6 +1011,10 @@ pub const LibExeObjStep = struct {...@@ -1011,6 +1011,10 @@ pub const LibExeObjStep = struct {
1011 self.full_path_libs.append(lib.getOutputPath()) catch unreachable;1011 self.full_path_libs.append(lib.getOutputPath()) catch unreachable;
1012 }1012 }
10131013
1014 if (lib.link_libs.exists("c")) {
1015 self.link_libs.put("c") catch unreachable;
1016 }
1017
1014 // TODO should be some kind of isolated directory that only has this header in it1018 // TODO should be some kind of isolated directory that only has this header in it
1015 self.include_dirs.append(self.builder.cache_root) catch unreachable;1019 self.include_dirs.append(self.builder.cache_root) catch unreachable;
1016 self.need_flat_namespace_hack = true;1020 self.need_flat_namespace_hack = true;
...@@ -1266,7 +1270,7 @@ pub const LibExeObjStep = struct {...@@ -1266,7 +1270,7 @@ pub const LibExeObjStep = struct {
1266 zig_args.append(output_lib_path) catch unreachable;1270 zig_args.append(output_lib_path) catch unreachable;
1267 }1271 }
12681272
1269 if (self.kind != Kind.Exe) {1273 if (self.kind != Kind.Exe and self.root_src != null) {
1270 const output_h_path = self.getOutputHPath();1274 const output_h_path = self.getOutputHPath();
1271 zig_args.append("--output-h") catch unreachable;1275 zig_args.append("--output-h") catch unreachable;
1272 zig_args.append(builder.pathFromRoot(output_h_path)) catch unreachable;1276 zig_args.append(builder.pathFromRoot(output_h_path)) catch unreachable;