Creating an xcframework from a Swift Package with binaries

Hey,
I’ desperately trying to create a xcframework from my swift package.
In this package, I already have another xcframework and a c wrapper.

I manage to create a framework without the C part, but the binaryTarget seems so make alot of trouble.

Therefore I would like to know, if it is possible in general to grade an .xcframework from my current package setup.

I have my EasyAlgo, which contains Swift classes and functions.
Those functions use the CAlgorithm for some calculations.
I have the CAlgo which contains headers and wraps the binary CAlgorithm, that contains the actual logic.

I tried several methods to build it, but i always fails because the CAlgo is not included properly.
Any ideas, how I could make it work, so I have a single xcframework from my package?

Thanks in advance

import PackageDescription

let package = Package(

    name: "EasyAlgo",

    platforms: [

        .iOS(.v17)

    ],

    products: [

        .library(

            name: "EasyAlgo",

            targets: ["EasyAlgo"]

        ),
    ],

    targets: [

        .binaryTarget(

            name: "CAlgorithm",

            path: "algo/CAlgorithm/ios/CAlgorithm.xcframework"

        ),

        .target(

            name: "CAlgo",

            dependencies: ["CAlgorithm"],

            path: "Sources/CAlgo",

            sources: ["dummy.c"],

            publicHeadersPath: "include"

        ),

        .target(

            name: "EasyAlgo",

            dependencies: ["CAlgo"],

            path: "Sources/EasyAlgo"

        ),
    ]
)
1 Like