本文主要是介绍XCode6编译opencore,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
将下面脚本拷贝并到build.sh文件中保存到opencore-amr库根目录下,修改build.sh文件权限为可执行,运行./build.sh则可以编译出支持xcode6下模拟器及真机执行库。
其生成的头和库文件在桌面opencore-amr-lib-store目录下. 希望对要移植的朋友有帮助.
然后修改为有可运行chmod 777 build.sh
如果出现编译错误,要下载最新的command line tools
#!/bin/sh
#xcode6.0.1 iOS8
set -xe
VERSION="0.1.3"
SDKVERSION="8.1"
DEVELOPER=`xcode-select -print-path`
#CURRENTDIR =`pwd`
DEST=${HOME}/Desktop/opencore-amr-lib-store
ARCHS="i386 x86_64 armv7 armv7s arm64"
LIBS="libopencore-amrnb.a libopencore-amrwb.a"
for arch in $ARCHS; do
case $arch in
arm*)
echo "Building opencore-amr for iPhone $arch ****************"
PLATFORM="iPhoneOS"
PATH="${DEVELOPER}/usr/bin:$PATH"
SDK="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk"
#FRMWORKS = "${SDK}/System/Library/Frameworks"
#PRVFRMWORKS = "${SDK}/System/Library/PrivateFrameworks"
CC="gcc -arch $arch --sysroot=$SDK -F $FRMWORKS" \
CXX="g++ -arch $arch --sysroot=$SDK" \
LDFLAGS="-Wl,-syslibroot,$SDK" ./configure \
--host=arm-apple-darwin --prefix=$DEST \
--disable-shared
;;
*)
PLATFORM="iPhoneSimulator"
PATH="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/usr/bin:$PATH"
SDK="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk"
echo "Building opencore-amr for iPhoneSimulator $arch*****************"
CC="gcc -arch $arch" CXX="g++ -arch $arch" \
./configure \
--prefix=$DEST \
--disable-shared
;;
esac
make -j3
make install
make clean
for i in $LIBS; do
mv $DEST/lib/$i $DEST/lib/$i.$arch
done
done
for i in $LIBS; do
input=""
for arch in $ARCHS; do
input="$input $DEST/lib/$i.$arch"
done
lipo -create -output $DEST/lib/$i $input
done
这篇关于XCode6编译opencore的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!