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?