如何使Xcode Run Script x86_64兼容

时间:2016-07-06 15:02:41

标签: xcode static-libraries aggregation titanium-modules lipo

Hello hello community!

所以这是我的问题,并不是真正的问题,但是下面的运行脚本编译我的静态库,它工作得很好!我唯一的问题是它没有为模拟器编译它,我得到x86_64错误。我知道我可以编辑这段代码以使其兼容,有人可以告诉我我需要做什么吗?

# define output folder environment variable
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal

# Step 1. Build Device and Simulator versions
xcodebuild -target ${PROJECT_NAME} ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos  BUILD_DIR="${BUILD_DIR}"
BUILD_ROOT="${BUILD_ROOT}" xcodebuild -target ${PROJECT_NAME} -configuration      ${CONFIGURATION} -sdk iphonesimulator -arch i386 BUILD_DIR="${BUILD_DIR}"      BUILD_ROOT="${BUILD_ROOT}"

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

# Step 2. Create universal binary file using lipo
lipo -create -output "${UNIVERSAL_OUTPUTFOLDER}/lib${PROJECT_NAME}.a"     "${BUILD_DIR}/${CONFIGURATION}-iphoneos/lib${PROJECT_NAME}.a" "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/lib${PROJECT_NAME}.a"

# Last touch. copy the header files. Just for convenience
cp -R "${BUILD_DIR}/${CONFIGURATION}-iphoneos/include" "${UNIVERSAL_OUTPUTFOLDER}"

1 个答案:

答案 0 :(得分:0)

参考完成here的“构建框架”项目。我能够发现只需添加一个额外的“-arch”参数就可以添加其他构建。并只需制作xcodebuild命令

    xcodebuild -target ${PROJECT_NAME} -configuration      ${CONFIGURATION} -sdk iphonesimulator -arch i386 -arch x86_86 BUILD_DIR="${BUILD_DIR}"      BUILD_ROOT="${BUILD_ROOT}"

它解决了我的问题!以防任何人像我一样有一个缓慢的时刻。大声笑