I'm trying to build a Swift package containing multiple binary xcframeworks (each of which wrap a different static C library). The .xcframework contains multiple versions of the same library (one per arch type - x86\_64, aarch64). I first build the static library for each arch, and then, create the .xcframework with

```
xcodebuild create-xcframwork -library /path/to/lib_for_arch1 -headers /path/to/headers -library /path/to/lib_for_arch2 -headers /path/to/headers -output MyXcFramework.xcframework

```

The headers folder above contains the header and a module.modulemap file.

When adding two such binary frameworks to a single Swift package, I get a build error

```

Showing All Messages
duplicate output file ‘/Path/To/Xcode/DerivedData/MySwiftPackage-djghajsghjsgsjdgh/Build/Products/Debug/include/module.modulemap' on task: ProcessXCFramework /Path/to/BinaryFramework1.xcframework /Path/to/Xcode/DerivedData/MySwiftPackage-djghajsghjsgsjdgh/Build/Products/Debug/include/module.modulemap macos

Showing All Messages
Multiple commands produce '/Path/To/Xcode/DerivedData/MySwiftPackage-djghajsghjsgsjdgh/Build/Products/Debug/include/module.modulemap':
1) Command: ProcessXCFramework /Path/To/Xcode/DerivedData/MySwiftPackage-djghajsghjsgsjdgh/SourcePackages/artifacts/MySwiftPackage/Framework1.xcframework /Path/To/Xcode/DerivedData/MySwiftPackage-djghajsghjsgsjdgh//Build/Products/Debug/include/module.modulemap macos
2) Command: ProcessXCFramework /Path/to/BinaryFramework1.xcframework /Path/To/Xcode/DerivedData/MySwiftPackage-djghajsghjsgsjdgh/Build/Products/Debug/include/module.modulemap macos

```

As best as I can tell, while processing each binary xcframework, it's copying the contents of each xcframework's `Headers` folder into the `include` folder of the package. When it's copying the second module.modulemap, it errors out because one already exists (from the first binary xcframework).

I've tried wrapping each binary xcframework inside a Swift package of it's own, and making my primary Swift package depend on these wrapper packages instead. But, I still get the same error.

Any ideas on what the best way forward would be? Thanks

P.S. Using Xcode 12.5.1 and Swift 5.4.2

Edit: Using a Xcode project (that embed two binary xcframeworks similar to the above setup) instead of Swift package, results in the same error as well.