authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-11-05 14:32:17-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-11-05 14:32:17-05:00
log9bc4f8ea77df395b9f2407ddfa4734bb4a1c4139
tree044ddd23f3c3babd92460ae0642b25e618b55dcc
parentcb8af1c6d48d5fdb26484a070b8af069c4152049
signaturelock-open Commit is signed but in an unrecognized format.

zig build: addIncludeDir does -I instead of -isystem


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

lib/std/build.zig+11-2
...@@ -1084,6 +1084,7 @@ pub const LibExeObjStep = struct {...@@ -1084,6 +1084,7 @@ pub const LibExeObjStep = struct {
10841084
1085 const IncludeDir = union(enum) {1085 const IncludeDir = union(enum) {
1086 RawPath: []const u8,1086 RawPath: []const u8,
1087 RawPathSystem: []const u8,
1087 OtherStep: *LibExeObjStep,1088 OtherStep: *LibExeObjStep,
1088 };1089 };
10891090
...@@ -1545,6 +1546,10 @@ pub const LibExeObjStep = struct {...@@ -1545,6 +1546,10 @@ pub const LibExeObjStep = struct {
1545 out.print("pub const {} = {};\n", name, value) catch unreachable;1546 out.print("pub const {} = {};\n", name, value) catch unreachable;
1546 }1547 }
15471548
1549 pub fn addSystemIncludeDir(self: *LibExeObjStep, path: []const u8) void {
1550 self.include_dirs.append(IncludeDir{ .RawPathSystem = self.builder.dupe(path) }) catch unreachable;
1551 }
1552
1548 pub fn addIncludeDir(self: *LibExeObjStep, path: []const u8) void {1553 pub fn addIncludeDir(self: *LibExeObjStep, path: []const u8) void {
1549 self.include_dirs.append(IncludeDir{ .RawPath = self.builder.dupe(path) }) catch unreachable;1554 self.include_dirs.append(IncludeDir{ .RawPath = self.builder.dupe(path) }) catch unreachable;
1550 }1555 }
...@@ -1823,11 +1828,15 @@ pub const LibExeObjStep = struct {...@@ -1823,11 +1828,15 @@ pub const LibExeObjStep = struct {
18231828
1824 for (self.include_dirs.toSliceConst()) |include_dir| {1829 for (self.include_dirs.toSliceConst()) |include_dir| {
1825 switch (include_dir) {1830 switch (include_dir) {
1826 IncludeDir.RawPath => |include_path| {1831 .RawPath => |include_path| {
1832 try zig_args.append("-I");
1833 try zig_args.append(self.builder.pathFromRoot(include_path));
1834 },
1835 .RawPathSystem => |include_path| {
1827 try zig_args.append("-isystem");1836 try zig_args.append("-isystem");
1828 try zig_args.append(self.builder.pathFromRoot(include_path));1837 try zig_args.append(self.builder.pathFromRoot(include_path));
1829 },1838 },
1830 IncludeDir.OtherStep => |other| {1839 .OtherStep => |other| {
1831 const h_path = other.getOutputHPath();1840 const h_path = other.getOutputHPath();
1832 try zig_args.append("-isystem");1841 try zig_args.append("-isystem");
1833 try zig_args.append(fs.path.dirname(h_path).?);1842 try zig_args.append(fs.path.dirname(h_path).?);