diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-12-11 23:34:59 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-12-11 23:34:59 -0500 |
| commit | 23058d8b435266852d4ca69ee89f8c3d27f52e24 (patch) | |
| tree | e36b981713c6436bf3cc45ab64753cd8aa107290 /std/build.zig | |
| parent | ed4d94a5d54bc49b3661d602301a5ec926abef61 (diff) | |
| download | zig-23058d8b435266852d4ca69ee89f8c3d27f52e24.tar.gz zig-23058d8b435266852d4ca69ee89f8c3d27f52e24.zip | |
self-hosted: link with LLVM
Diffstat (limited to 'std/build.zig')
| -rw-r--r-- | std/build.zig | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/std/build.zig b/std/build.zig index 9bdc4b3076..532eca1cc9 100644 --- a/std/build.zig +++ b/std/build.zig @@ -755,6 +755,7 @@ pub const LibExeObjStep = struct { is_zig: bool, cflags: ArrayList([]const u8), include_dirs: ArrayList([]const u8), + lib_paths: ArrayList([]const u8), disable_libc: bool, frameworks: BufSet, @@ -865,6 +866,7 @@ pub const LibExeObjStep = struct { .cflags = ArrayList([]const u8).init(builder.allocator), .source_files = undefined, .include_dirs = ArrayList([]const u8).init(builder.allocator), + .lib_paths = ArrayList([]const u8).init(builder.allocator), .object_src = undefined, .disable_libc = true, }; @@ -888,6 +890,7 @@ pub const LibExeObjStep = struct { .frameworks = BufSet.init(builder.allocator), .full_path_libs = ArrayList([]const u8).init(builder.allocator), .include_dirs = ArrayList([]const u8).init(builder.allocator), + .lib_paths = ArrayList([]const u8).init(builder.allocator), .output_path = null, .out_filename = undefined, .major_only_filename = undefined, @@ -1069,11 +1072,14 @@ pub const LibExeObjStep = struct { %%self.include_dirs.append(self.builder.cache_root); } - // TODO put include_dirs in zig command line pub fn addIncludeDir(self: &LibExeObjStep, path: []const u8) { %%self.include_dirs.append(path); } + pub fn addLibPath(self: &LibExeObjStep, path: []const u8) { + %%self.lib_paths.append(path); + } + pub fn addPackagePath(self: &LibExeObjStep, name: []const u8, pkg_index_path: []const u8) { assert(self.is_zig); @@ -1222,6 +1228,11 @@ pub const LibExeObjStep = struct { %%zig_args.append("--pkg-end"); } + for (self.include_dirs.toSliceConst()) |include_path| { + %%zig_args.append("-isystem"); + %%zig_args.append(self.builder.pathFromRoot(include_path)); + } + for (builder.include_paths.toSliceConst()) |include_path| { %%zig_args.append("-isystem"); %%zig_args.append(builder.pathFromRoot(include_path)); @@ -1232,6 +1243,11 @@ pub const LibExeObjStep = struct { %%zig_args.append(rpath); } + for (self.lib_paths.toSliceConst()) |lib_path| { + %%zig_args.append("--library-path"); + %%zig_args.append(lib_path); + } + for (builder.lib_paths.toSliceConst()) |lib_path| { %%zig_args.append("--library-path"); %%zig_args.append(lib_path); |
