| ... | ... | @@ -1735,7 +1735,6 @@ pub const LibExeObjStep = struct { |
| 1735 | 1735 | } |
| 1736 | 1736 | |
| 1737 | 1737 | pub fn linkFramework(self: *LibExeObjStep, framework_name: []const u8) void { |
| 1738 | | assert(self.target.isDarwin()); |
| 1739 | 1738 | // Note: No need to dupe because frameworks dupes internally. |
| 1740 | 1739 | self.frameworks.insert(framework_name) catch unreachable; |
| 1741 | 1740 | } |
| ... | ... | @@ -2247,28 +2246,6 @@ pub const LibExeObjStep = struct { |
| 2247 | 2246 | self.step.dependOn(&other.step); |
| 2248 | 2247 | self.link_objects.append(.{ .other_step = other }) catch unreachable; |
| 2249 | 2248 | self.include_dirs.append(.{ .other_step = other }) catch unreachable; |
| 2250 | | |
| 2251 | | // BUG: The following code introduces a order-of-call dependency: |
| 2252 | | // var lib = addSharedLibrary(...); |
| 2253 | | // var exe = addExecutable(...); |
| 2254 | | // exe.linkLibrary(lib); |
| 2255 | | // lib.linkSystemLibrary("foobar"); // this will be ignored for exe! |
| 2256 | | |
| 2257 | | // Inherit dependency on system libraries |
| 2258 | | for (other.link_objects.items) |link_object| { |
| 2259 | | switch (link_object) { |
| 2260 | | .system_lib => |name| self.linkSystemLibrary(name), |
| 2261 | | else => continue, |
| 2262 | | } |
| 2263 | | } |
| 2264 | | |
| 2265 | | // Inherit dependencies on darwin frameworks |
| 2266 | | if (self.target.isDarwin() and !other.isDynamicLibrary()) { |
| 2267 | | var it = other.frameworks.iterator(); |
| 2268 | | while (it.next()) |framework| { |
| 2269 | | self.frameworks.insert(framework.*) catch unreachable; |
| 2270 | | } |
| 2271 | | } |
| 2272 | 2249 | } |
| 2273 | 2250 | |
| 2274 | 2251 | fn makePackageCmd(self: *LibExeObjStep, pkg: Pkg, zig_args: *ArrayList([]const u8)) error{OutOfMemory}!void { |
| ... | ... | @@ -2322,6 +2299,31 @@ pub const LibExeObjStep = struct { |
| 2322 | 2299 | if (self.root_src) |root_src| try zig_args.append(root_src.getPath(builder)); |
| 2323 | 2300 | |
| 2324 | 2301 | var prev_has_extra_flags = false; |
| 2302 | |
| 2303 | // Resolve transitive dependencies |
| 2304 | for (self.link_objects.items) |link_object| { |
| 2305 | switch (link_object) { |
| 2306 | .other_step => |other| { |
| 2307 | // Inherit dependency on system libraries |
| 2308 | for (other.link_objects.items) |other_link_object| { |
| 2309 | switch (other_link_object) { |
| 2310 | .system_lib => |name| self.linkSystemLibrary(name), |
| 2311 | else => continue, |
| 2312 | } |
| 2313 | } |
| 2314 | |
| 2315 | // Inherit dependencies on darwin frameworks |
| 2316 | if (!other.isDynamicLibrary()) { |
| 2317 | var it = other.frameworks.iterator(); |
| 2318 | while (it.next()) |framework| { |
| 2319 | self.frameworks.insert(framework.*) catch unreachable; |
| 2320 | } |
| 2321 | } |
| 2322 | }, |
| 2323 | else => continue, |
| 2324 | } |
| 2325 | } |
| 2326 | |
| 2325 | 2327 | for (self.link_objects.items) |link_object| { |
| 2326 | 2328 | switch (link_object) { |
| 2327 | 2329 | .static_path => |static_path| try zig_args.append(static_path.getPath(builder)), |
| ... | ... | @@ -2719,6 +2721,14 @@ pub const LibExeObjStep = struct { |
| 2719 | 2721 | zig_args.append("-framework") catch unreachable; |
| 2720 | 2722 | zig_args.append(framework.*) catch unreachable; |
| 2721 | 2723 | } |
| 2724 | } else { |
| 2725 | if (self.framework_dirs.items.len > 0) { |
| 2726 | warn("Framework directories have been added for a non-darwin target, this will have no affect on the build\n", .{}); |
| 2727 | } |
| 2728 | |
| 2729 | if (self.frameworks.count() > 0) { |
| 2730 | warn("Frameworks have been added for a non-darwin target, this will have no affect on the build\n", .{}); |
| 2731 | } |
| 2722 | 2732 | } |
| 2723 | 2733 | |
| 2724 | 2734 | if (builder.sysroot) |sysroot| { |