Did anyone found a workaround for the problem that...
# multiplatform
s
Did anyone found a workaround for the problem that currently you can't create XCFrameworks containing macOS X64 & ARM64 with Kotlin 1.5.30? It's an open issue and somewhere in the roadmap. https://youtrack.jetbrains.com/issue/KT-47355 What are my options to work around that limitation? I tried to export it as a separate XCFramework / framework and combine it with the
lipo
command but no success.
k
Reason is different file layout for macos frameworks. Yes, it hasn’t been supported yet
s
Strange. If I build for macOS X64 only it works and macOS ARM64 only also works. If iOS X64 and ARM64 are both selected they go into different folders. So it's not just a matter of adding a "macos-x64" folder here and add an entry to the Info.plist ?
k
yes, because same targets with different architectures must be packed to fat framework
s
This sounds to me like an intermediate step that could be skipped. AFAIK are fat frameworks the old way of doing that. If I know have X frameworks I can directly merge them into a XCFramework or couldn't I?
k
s
... ok... I have a hard time understanding this whole mess apple created there and hope you find a solution to make it work 😄
🍎 1
For a workaround: Can I export my macosX64 separate and try to lipo it together? After discarding my custom fat framework solution in exchange for the official way with
assembleSharedReleaseXCFramework
I fail to see how I can export my
macosX64
framework. My code looks like this:
Copy code
val xcf = XCFramework()

/* App Store */
iosArm64 {
    binaries.framework {
        baseName = "shared"
        embedBitcode("bitcode")
        xcf.add(this)
    }
}

/* iOS Simulator M1 */
iosSimulatorArm64 {
    binaries.framework {
        baseName = "shared"
        xcf.add(this)
    }
}

/* Intel macOS Devices */
macosX64 {
    binaries.framework {
        baseName = "shared"
        // xcf.add(this)
    }
}

/* Apple Silicon macOS Devices */
macosArm64 {
    binaries.framework {
        baseName = "shared"
        xcf.add(this)
    }
}