How to make Xcode Run Script x86_64 compatible

2019-09-14 19:46发布

Hello hello community!

So here is my issue, welll not really an issue but the following Run Script compiles my static library and it works great! my only issue is that it doesnt compile it for the simulator and i get a x86_64 error. I know that i could just edit this code to make it compatible can someone tell me what i need to do??

# 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条回答
倾城 Initia
2楼-- · 2019-09-14 20:01

In referencing to a "build a framework" project done here. I was able to find that i can add additional builds just by adding an additional "-arch" parameter. and just make the xcodebuild command

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

and it solved my problem! just in case anyone had a slow moment like i did. lol

查看更多
登录 后发表回答