| author | |
| committer | |
| log | 0fe28855c5a32b16dc092ab1d70efde38ef89a7b |
| tree | 2fa44bb189ada171ff0666bb77fd609da4e584b0 |
| parent | 0c4d47c6d5a7d27ce54e8584da84613751df7dac |
| signature |
5 files changed, 30 insertions(+), 2 deletions(-)
src/all_types.hpp+1| ... | ... | @@ -2003,6 +2003,7 @@ struct CodeGen { |
| 2003 | 2003 | ZigList<Buf *> assembly_files; |
| 2004 | 2004 | ZigList<CFile *> c_source_files; |
| 2005 | 2005 | ZigList<const char *> lib_dirs; |
| 2006 | ZigList<const char *> framework_dirs; | |
| 2006 | 2007 | |
| 2007 | 2008 | ZigLibCInstallation *libc; |
| 2008 | 2009 |
src/codegen.cpp+1| ... | ... | @@ -9803,6 +9803,7 @@ static Error check_cache(CodeGen *g, Buf *manifest_dir, Buf *digest) { |
| 9803 | 9803 | cache_list_of_str(ch, g->llvm_argv, g->llvm_argv_len); |
| 9804 | 9804 | cache_list_of_str(ch, g->clang_argv, g->clang_argv_len); |
| 9805 | 9805 | cache_list_of_str(ch, g->lib_dirs.items, g->lib_dirs.length); |
| 9806 | cache_list_of_str(ch, g->framework_dirs.items, g->framework_dirs.length); | |
| 9806 | 9807 | if (g->libc) { |
| 9807 | 9808 | cache_buf(ch, &g->libc->include_dir); |
| 9808 | 9809 | cache_buf(ch, &g->libc->sys_include_dir); |
src/link.cpp+6| ... | ... | @@ -2510,6 +2510,12 @@ static void construct_linker_job_macho(LinkJob *lj) { |
| 2510 | 2510 | lj->args.append("dynamic_lookup"); |
| 2511 | 2511 | } |
| 2512 | 2512 | |
| 2513 | for (size_t i = 0; i < g->framework_dirs.length; i += 1) { | |
| 2514 | const char *framework_dir = g->framework_dirs.at(i); | |
| 2515 | lj->args.append("-F"); | |
| 2516 | lj->args.append(framework_dir); | |
| 2517 | } | |
| 2518 | ||
| 2513 | 2519 | for (size_t i = 0; i < g->darwin_frameworks.length; i += 1) { |
| 2514 | 2520 | lj->args.append("-framework"); |
| 2515 | 2521 | lj->args.append(buf_ptr(g->darwin_frameworks.at(i))); |
src/main.cpp+9| ... | ... | @@ -104,6 +104,7 @@ static int print_full_usage(const char *arg0, FILE *file, int return_code) { |
| 104 | 104 | " -rdynamic add all symbols to the dynamic symbol table\n" |
| 105 | 105 | " -rpath [path] add directory to the runtime library search path\n" |
| 106 | 106 | " --subsystem [subsystem] (windows) /SUBSYSTEM:<subsystem> to the linker\n" |
| 107 | " -F[dir] (darwin) add search path for frameworks\n" | |
| 107 | 108 | " -framework [name] (darwin) link against framework\n" |
| 108 | 109 | " -mios-version-min [ver] (darwin) set iOS deployment target\n" |
| 109 | 110 | " -mmacosx-version-min [ver] (darwin) set Mac OS X deployment target\n" |
| ... | ... | @@ -454,6 +455,7 @@ int main(int argc, char **argv) { |
| 454 | 455 | ZigList<const char *> lib_dirs = {0}; |
| 455 | 456 | ZigList<const char *> link_libs = {0}; |
| 456 | 457 | ZigList<const char *> forbidden_link_libs = {0}; |
| 458 | ZigList<const char *> framework_dirs = {0}; | |
| 457 | 459 | ZigList<const char *> frameworks = {0}; |
| 458 | 460 | bool have_libc = false; |
| 459 | 461 | const char *target_string = nullptr; |
| ... | ... | @@ -686,6 +688,8 @@ int main(int argc, char **argv) { |
| 686 | 688 | } else if (arg[1] == 'L' && arg[2] != 0) { |
| 687 | 689 | // alias for --library-path |
| 688 | 690 | lib_dirs.append(&arg[2]); |
| 691 | } else if (arg[1] == 'F' && arg[2] != 0) { | |
| 692 | framework_dirs.append(&arg[2]); | |
| 689 | 693 | } else if (strcmp(arg, "--pkg-begin") == 0) { |
| 690 | 694 | if (i + 2 >= argc) { |
| 691 | 695 | fprintf(stderr, "Expected 2 arguments after --pkg-begin\n"); |
| ... | ... | @@ -772,6 +776,8 @@ int main(int argc, char **argv) { |
| 772 | 776 | main_pkg_path = buf_create_from_str(argv[i]); |
| 773 | 777 | } else if (strcmp(arg, "--library-path") == 0 || strcmp(arg, "-L") == 0) { |
| 774 | 778 | lib_dirs.append(argv[i]); |
| 779 | } else if (strcmp(arg, "-F") == 0) { | |
| 780 | framework_dirs.append(argv[i]); | |
| 775 | 781 | } else if (strcmp(arg, "--library") == 0) { |
| 776 | 782 | if (strcmp(argv[i], "c") == 0) |
| 777 | 783 | have_libc = true; |
| ... | ... | @@ -1153,6 +1159,9 @@ int main(int argc, char **argv) { |
| 1153 | 1159 | for (size_t i = 0; i < lib_dirs.length; i += 1) { |
| 1154 | 1160 | codegen_add_lib_dir(g, lib_dirs.at(i)); |
| 1155 | 1161 | } |
| 1162 | for (size_t i = 0; i < framework_dirs.length; i += 1) { | |
| 1163 | g->framework_dirs.append(framework_dirs.at(i)); | |
| 1164 | } | |
| 1156 | 1165 | for (size_t i = 0; i < link_libs.length; i += 1) { |
| 1157 | 1166 | LinkLib *link_lib = codegen_add_link_lib(g, buf_create_from_str(link_libs.at(i))); |
| 1158 | 1167 | link_lib->provided_explicitly = true; |
std/build.zig+13-2| ... | ... | @@ -1228,6 +1228,7 @@ pub const LibExeObjStep = struct { |
| 1228 | 1228 | name_only_filename: []const u8, |
| 1229 | 1229 | strip: bool, |
| 1230 | 1230 | lib_paths: ArrayList([]const u8), |
| 1231 | framework_dirs: ArrayList([]const u8), | |
| 1231 | 1232 | frameworks: BufSet, |
| 1232 | 1233 | verbose_link: bool, |
| 1233 | 1234 | verbose_cc: bool, |
| ... | ... | @@ -1341,6 +1342,7 @@ pub const LibExeObjStep = struct { |
| 1341 | 1342 | .include_dirs = ArrayList(IncludeDir).init(builder.allocator), |
| 1342 | 1343 | .link_objects = ArrayList(LinkObject).init(builder.allocator), |
| 1343 | 1344 | .lib_paths = ArrayList([]const u8).init(builder.allocator), |
| 1345 | .framework_dirs = ArrayList([]const u8).init(builder.allocator), | |
| 1344 | 1346 | .object_src = undefined, |
| 1345 | 1347 | .build_options_contents = std.Buffer.initSize(builder.allocator, 0) catch unreachable, |
| 1346 | 1348 | .c_std = Builder.CStd.C99, |
| ... | ... | @@ -1614,6 +1616,10 @@ pub const LibExeObjStep = struct { |
| 1614 | 1616 | self.lib_paths.append(path) catch unreachable; |
| 1615 | 1617 | } |
| 1616 | 1618 | |
| 1619 | pub fn addFrameworkDir(self: *LibExeObjStep, dir_path: []const u8) void { | |
| 1620 | self.framework_dirs.append(dir_path) catch unreachable; | |
| 1621 | } | |
| 1622 | ||
| 1617 | 1623 | pub fn addPackagePath(self: *LibExeObjStep, name: []const u8, pkg_index_path: []const u8) void { |
| 1618 | 1624 | self.packages.append(Pkg{ |
| 1619 | 1625 | .name = name, |
| ... | ... | @@ -1860,8 +1866,8 @@ pub const LibExeObjStep = struct { |
| 1860 | 1866 | } |
| 1861 | 1867 | |
| 1862 | 1868 | for (self.lib_paths.toSliceConst()) |lib_path| { |
| 1863 | zig_args.append("--library-path") catch unreachable; | |
| 1864 | zig_args.append(lib_path) catch unreachable; | |
| 1869 | try zig_args.append("-L"); | |
| 1870 | try zig_args.append(lib_path); | |
| 1865 | 1871 | } |
| 1866 | 1872 | |
| 1867 | 1873 | if (self.need_system_paths and self.target == Target.Native) { |
| ... | ... | @@ -1882,6 +1888,11 @@ pub const LibExeObjStep = struct { |
| 1882 | 1888 | } |
| 1883 | 1889 | |
| 1884 | 1890 | if (self.target.isDarwin()) { |
| 1891 | for (self.framework_dirs.toSliceConst()) |dir| { | |
| 1892 | try zig_args.append("-F"); | |
| 1893 | try zig_args.append(dir); | |
| 1894 | } | |
| 1895 | ||
| 1885 | 1896 | var it = self.frameworks.iterator(); |
| 1886 | 1897 | while (it.next()) |entry| { |
| 1887 | 1898 | zig_args.append("-framework") catch unreachable; |