alec
09/10/2018, 7:37 PMlipo
to do this manually after generating all the required architectures but would be nice as a potential output format for K/Nthevery
09/10/2018, 8:08 PMalec
09/10/2018, 8:27 PMthevery
09/11/2018, 7:41 AMthevery
09/11/2018, 7:42 AMDavid
09/12/2018, 12:52 PMPROJECT_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}"