为包含依赖项cocoapods的动态库构建聚合目标,可以按照以下步骤进行:
pod init
命令,生成Podfile文件。pod install
命令,根据Podfile文件安装依赖库。# Set the target folders and the final framework product.
FMK_NAME="YourFrameworkName"
FMK_VERSION="1.0.0"
FMK_DIR="${BUILD_DIR}/${CONFIGURATION}-universal"
FMK_FILE="${FMK_DIR}/${FMK_NAME}.framework"
# Clean any existing framework that might be there.
if [ -d "${FMK_DIR}" ]; then
rm -rf "${FMK_DIR}"
fi
# Build the framework for device and for simulator (using all needed architectures).
xcodebuild -target "${FMK_NAME}" -configuration "${CONFIGURATION}" -arch arm64 -arch armv7 -arch armv7s only_active_arch=no defines_module=yes -sdk iphoneos BUILD_DIR="${BUILD_DIR}" OBJROOT="${OBJROOT}/DependentBuilds" BUILD_ROOT="${BUILD_ROOT}" SYMROOT="${SYMROOT}" $ACTION
xcodebuild -target "${FMK_NAME}" -configuration "${CONFIGURATION}" -arch x86_64 -arch i386 only_active_arch=no defines_module=yes -sdk iphonesimulator BUILD_DIR="${BUILD_DIR}" OBJROOT="${OBJROOT}/DependentBuilds" BUILD_ROOT="${BUILD_ROOT}" SYMROOT="${SYMROOT}" $ACTION
# Create the universal framework folder structure.
mkdir -p "${FMK_DIR}"
mkdir -p "${FMK_DIR}/Versions"
mkdir -p "${FMK_DIR}/Versions/${FMK_VERSION}"
mkdir -p "${FMK_DIR}/Versions/${FMK_VERSION}/Resources"
mkdir -p "${FMK_DIR}/Versions/${FMK_VERSION}/Headers"
# Copy the framework files over.
cp -R "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${FMK_NAME}.framework/." "${FMK_DIR}/Versions/${FMK_VERSION}"
cp -R "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${FMK_NAME}.framework/." "${FMK_DIR}/Versions/${FMK_VERSION}"
# Create the universal binary file using lipo.
lipo -create -output "${FMK_DIR}/Versions/${FMK_VERSION}/${FMK_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${FMK_NAME}.framework/${FMK_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${FMK_NAME}.framework/${FMK_NAME}"
# Create the symlinks for the current version.
ln -s "${FMK_VERSION}" "${FMK_DIR}/Versions/Current"
ln -s "Versions/Current/Headers" "${FMK_DIR}/Headers"
ln -s "Versions/Current/Resources" "${FMK_DIR}/Resources"
ln -s "Versions/Current/${FMK_NAME}" "${FMK_DIR}/${FMK_NAME}"
# Copy the framework to the project's directory.
cp -R "${FMK_DIR}" "${PROJECT_DIR}"
# Remove the temporary build directory.
rm -rf "${FMK_DIR}"
完成上述步骤后,你将得到一个包含依赖项cocoapods的动态库的聚合目标。你可以将该目标用于其他项目中,并且可以使用腾讯云的相关产品来部署和管理该聚合目标。
领取专属 10元无门槛券
手把手带您无忧上云