合并 cordovaLib库:
lipo -create 'Release-iphoneos/libCordova.a' "Release-iphonesimulator/libCordova.a" -output "libCordova.a"
查看:
lipo -info libCordova.a
合并cordova脚本:
define static library target name
LIB_NAME="Cordova"
# define output folder environment variable
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
DEVICE_DIR=${BUILD_DIR}/${CONFIGURATION}-iphoneos
SIMULATOR_DIR=${BUILD_DIR}/${CONFIGURATION}-iphonesimulator
# Step 1. Build Device and Simulator versions
# insert such -arch i386 before BUILD_DIR assign arch
xcodebuild -target "${LIB_NAME}"ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}"BUILD_ROOT="${BUILD_ROOT}"
xcodebuild -target "${LIB_NAME}"-configuration ${CONFIGURATION} -sdk iphonesimulator BUILD_DIR="${BUILD_DIR}"BUILD_ROOT="${BUILD_ROOT}"
# Cleaning the oldest and make sure the output directory exists
if [ -d "${UNIVERSAL_OUTPUTFOLDER}"]
then
rm -rf "${UNIVERSAL_OUTPUTFOLDER}"
fi
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
# Step 2. Create universal binary file using lipo
lipo -create "${DEVICE_DIR}/lib${LIB_NAME}.a""${SIMULATOR_DIR}/lib${LIB_NAME}.a"-output "${UNIVERSAL_OUTPUTFOLDER}/lib${LIB_NAME}.a"
# Last touch. copy the header files. Just for convenience
cp -R "${DEVICE_DIR}/include""${UNIVERSAL_OUTPUTFOLDER}/"
#open the universal dir
open "${UNIVERSAL_OUTPUTFOLDER}/"
#delete DEVICE and SIMULATOR build file
#rm -rf "${DEVICE_DIR}"
#rm -rf "${SIMULATOR_DIR}"