my plan right now is to use `lipo` to do this manu...
# kotlin-native
a
my plan right now is to use
lipo
to do this manually after generating all the required architectures but would be nice as a potential output format for K/N
t
We do exactly the same
a
currently do??? mind sharing? 😄
t
Actually done couple month ago
Copy arm32 and then lipo arm64 and x64 into that folder
d
Here is my script if you want to test:
Copy code
PROJECT_NAME="MyFramework"
BUILD_DIR="build/konan/bin"

UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/ios_universal

IOS_ARCHS=( "ios_arm64" "ios_arm32" "ios_x64" )

./gradlew compileKonan

# make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"

INPUT_DIRS_IOS=( "${IOS_ARCHS[@]/#/$BUILD_DIR/}" )

# Copy the framework structure (from iphoneos build) to the universal folder
cp -R "${INPUT_DIRS_IOS[0]}/${PROJECT_NAME}.framework" "${UNIVERSAL_OUTPUTFOLDER}/"

# Create universal binary file using lipo and place the combined executable in the copied framework directory
INPUT_BINS_IOS=$(printf "%s/${PROJECT_NAME}.framework/${PROJECT_NAME} " "${INPUT_DIRS_IOS[@]}")

lipo -create ${INPUT_BINS_IOS} -output "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework/${PROJECT_NAME}"

echo "Universal binary built:"
lipo -detailed_info "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework/${PROJECT_NAME}"