How to build Arm64&X86_64 in the same time?(Kotlin Framework architecture problem IOS)

now is support Arm64 or x86_64, not And

Is possible generate 2 frameworks in different folders but using the same build.gradle file?

I did, but I still need to change the configuration to execute the build twice.
Arm64 setBuilddir(“arm64build”) Build
X64 Build
lipo this framework,this ok,But too cumbersome
Did not find a build out at the same time two framework methods

1 Like

Have a look at the FatFrameworkTask, assuming you build a framework Foo, it can be utilized like this (Gradle Kotlin DSL using configuration avoidance API):

kotlin {
    iosArm64 { binaries.framework("Foo") }
    iosX64 { binaries.framework("Foo") }

    sourceSets {  …  }

    tasks {
        register("universalFrameworkDebug", FatFrameworkTask::class) {
            baseName = "Foo"
            from(
                iosArm64().binaries.getFramework("Foo", "Debug"),
                iosX64().binaries.getFramework("Foo", "Debug")
            )
            destinationDir = buildDir.resolve("bin/universal/debug")
            group = "Universal framework"
            description = "Builds a universal (fat) debug framework"
            dependsOn("linkFooDebugFrameworkIosArm64")
            dependsOn("linkFooDebugFrameworkIosX64")
        }
    }
}

The task for the release build would look similar…

1 Like