Post

Replies

Boosts

Views

Activity

XCFramework Headers overwrite eachother when consumed by Swift Package Manager
Lets say I have 2 packages Foo1 and Foo2, each with a .binaryTarget (Foo1.xcframework and Foo2.xcframework) containing a static library and headers. I also have a package Bar which consumes Foo1 and Foo2 as dependencies.  When Xcode builds Bar, it copies all the headers from Foo1.xcframework/ios-arm64_armv7/Headers to the include subdirectory in the build products (ex.  Debug-iphoneos/include/). It also does the same for Foo2. Their headers are all put in the same directory, potentially overwriting eachother. For example, if each has a modulemap at Headers/module.modulemap, then only one of those will end up in include/. I can wrap all the Headers in a subdirectory, so instead of having the headers in Foo1.xcframework/ios-arm64_armv7/Headers, I could have them all in Foo1.xcframework/ios-arm64_armv7/Headers/Foo1. Then, when building Bar, the headers will end up in Debug-iphoneos/include/Foo1 and Debug-iphoneos/include/Foo2, which avoids conflicts. Unfortunately, now the modulemap is in Debug-iphoneos/include/Foo1/module.modulemap and Xcode doesn't know to look there for module maps, so it fails to import. I can fix this on the command line by modifying the search paths, but I can't modify search paths when opening Bar's Package.swift in Xcode. Where can I put the modulemap and other headers so that Xcode can find them without them conflicting with eachother?
3
0
1.6k
Jun ’21
Do transitive binary dependencies work?
Using Xcode 12, I set up a package which creates a binary target C. Now I have another package B which consumes C, and a package A which consumes B. A -> B -> C (binary) When I try to build A in Xcode, it never attempts to build C. When it attempts to build B, B fails saying that “module C not found”. Is this just an Xcode 12 beta bug? Or is are transitive binary dependencies not supported?
1
0
785
Jul ’20
How to build an XCFramework from a Swift Package (with Resources)
I have some code that is currently built using Swift Package Manager. It does not have an Xcode project. I want to build an XCFramework from my package, but when I build the package it creates a .o, and xcodebuild -create-xcframework does not seem to support .o files. Also, I have added resources, and now I see there is a .bundle, but I don’t see any way to add the .bundle to an XCFramework. I have tried changing my Package.swift library product to be .dynamic (even though I prefer it to be .static), and that produces a .framework, which I can then convert to an XCFramework, but it does not appear to have my resources (they appear to still be in the .bundle file next to my .o). I have also tried making an Xcode project to wrap my Swift package. It imports my package and links against it and produces a Framework that I can make an XCFramework from, but it also does not have my Resources. All of this was done using Xcode 12 beta.
7
0
9.2k
Jun ’20