I managed to generate a XCFramework with Kotlin 1.5.31 containing targets for ios-arm64
, ios-x86_64-simulator
.
Now I’m trying to add an Apple Silicon target, iOS Simulator Arm64, but I’m failing to figure out how to do it.
With the following build.gradle.kt
, it generates a fat framework for iOS Simulator containing x86_64
and arm64
archs (I checked with lipo
) and the step for creating the XCFramework fails with an error on xcodebuild
: error: the path does not point to a valid framework
kotlin {
val xcf = XCFramework()
ios {
binaries {
framework {
baseName = xcFrameworkName
xcf.add(this)
}
}
}
iosSimulatorArm64 {
binaries.framework {
baseName = xcFrameworkName
xcf.add(this)
}
}
sourceSets {
val iosMain by getting
val iosTest by getting
val iosSimulatorArm64Main by getting
val iosSimulatorArm64Test by getting
iosSimulatorArm64Main.dependsOn(iosMain)
iosSimulatorArm64Test.dependsOn(iosTest)
}
}
I’ve also tried to run lipo -remove
and manually run the xcodebuild
command but it still complained.
It seems to me that by adding the iosSimulatorArm64
block, the compiler generates a fat binary, which is not adequate for XCFrameworks.
Does anyone have suggestions to make a XCFramework with targets iOS, x86 iOS Simulator and Arm64 iOS Simulator? Thanks