Merge pull request #242 from Seed-Of-Hate/master

iOS-SDK 7.1 Updated Toolchain
pull/246/head
Kim Kulling 2014-03-21 15:13:33 +01:00
commit 7fc15c3713
11 changed files with 232 additions and 145 deletions

View File

@ -2,11 +2,11 @@ INCLUDE(CMakeForceCompiler)
SET (CMAKE_CROSSCOMPILING TRUE)
SET (CMAKE_SYSTEM_NAME "Darwin")
SET (CMAKE_SYSTEM_PROCESSOR "armv6")
SET (CMAKE_SYSTEM_PROCESSOR "arm64”)
SET (SDKVER "5.0")
SET (DEVROOT "/Developer/Platforms/iPhoneOS.platform/Developer")
SET (SDKROOT "/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVER}.sdk")
SET (SDKVER “7.1”)
SET (DEVROOT "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain")
SET (SDKROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVER}.sdk")
SET (CC "${DEVROOT}/usr/bin/llvm-gcc")
SET (CXX "${DEVROOT}/usr/bin/llvm-g++")

View File

@ -0,0 +1,19 @@
INCLUDE(CMakeForceCompiler)
SET (CMAKE_CROSSCOMPILING TRUE)
SET (CMAKE_SYSTEM_NAME "Darwin")
SET (CMAKE_SYSTEM_PROCESSOR "armv6")
SET (SDKVER “7.1”)
SET (DEVROOT "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain")
SET (SDKROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVER}.sdk")
SET (CC "${DEVROOT}/usr/bin/clang”)
SET (CXX "${DEVROOT}/usr/bin/clang++")
CMAKE_FORCE_C_COMPILER (${CC} LLVM)
CMAKE_FORCE_CXX_COMPILER (${CXX} LLVM)
SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}")
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

View File

@ -0,0 +1,19 @@
INCLUDE(CMakeForceCompiler)
SET (CMAKE_CROSSCOMPILING TRUE)
SET (CMAKE_SYSTEM_NAME "Darwin")
SET (CMAKE_SYSTEM_PROCESSOR "armv7s”)
SET (SDKVER “7.1”)
SET (DEVROOT "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain")
SET (SDKROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVER}.sdk")
SET (CC "${DEVROOT}/usr/bin/clang”)
SET (CXX "${DEVROOT}/usr/bin/clang++")
CMAKE_FORCE_C_COMPILER (${CC} LLVM)
CMAKE_FORCE_CXX_COMPILER (${CXX} LLVM)
SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}")
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

View File

@ -4,11 +4,11 @@ SET (CMAKE_CROSSCOMPILING TRUE)
SET (CMAKE_SYSTEM_NAME "Darwin")
SET (CMAKE_SYSTEM_PROCESSOR "armv7")
SET (SDKVER "5.0")
SET (DEVROOT "/Developer/Platforms/iPhoneOS.platform/Developer")
SET (SDKROOT "/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVER}.sdk")
SET (CC "${DEVROOT}/usr/bin/llvm-gcc")
SET (CXX "${DEVROOT}/usr/bin/llvm-g++")
SET (SDKVER “7.1”)
SET (DEVROOT "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain")
SET (SDKROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVER}.sdk")
SET (CC "${DEVROOT}/usr/bin/clang”)
SET (CXX "${DEVROOT}/usr/bin/clang++")
CMAKE_FORCE_C_COMPILER (${CC} LLVM)
CMAKE_FORCE_CXX_COMPILER (${CXX} LLVM)

View File

@ -0,0 +1,20 @@
INCLUDE(CMakeForceCompiler)
SET (CMAKE_CROSSCOMPILING TRUE)
SET (CMAKE_SYSTEM_NAME "Darwin")
SET (CMAKE_SYSTEM_PROCESSOR “i386”)
SET (SDKVER “7.1”)
SET (DEVROOT "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain")
SET (SDKROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator${SDKVER}.sdk")
SET (CC "${DEVROOT}/usr/bin/clang”)
SET (CXX "${DEVROOT}/usr/bin/clang++")
CMAKE_FORCE_C_COMPILER (${CC} LLVM)
CMAKE_FORCE_CXX_COMPILER (${CXX} LLVM)
SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}")
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

View File

@ -0,0 +1,20 @@
INCLUDE(CMakeForceCompiler)
SET (CMAKE_CROSSCOMPILING TRUE)
SET (CMAKE_SYSTEM_NAME "Darwin")
SET (CMAKE_SYSTEM_PROCESSOR “x86_64”)
SET (SDKVER “7.1”)
SET (DEVROOT "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain")
SET (SDKROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator${SDKVER}.sdk")
SET (CC "${DEVROOT}/usr/bin/clang”)
SET (CXX "${DEVROOT}/usr/bin/clang++")
CMAKE_FORCE_C_COMPILER (${CC} LLVM)
CMAKE_FORCE_CXX_COMPILER (${CXX} LLVM)
SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}")
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

View File

@ -1,19 +0,0 @@
INCLUDE(CMakeForceCompiler)
SET (CMAKE_CROSSCOMPILING TRUE)
SET (CMAKE_SYSTEM_NAME "Darwin")
SET (CMAKE_SYSTEM_PROCESSOR "i386")
SET (SDKVER "5.0")
SET (DEVROOT "/Developer/Platforms/iPhoneOS.platform/Developer")
SET (SDKROOT "/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVER}.sdk")
SET (CC "${DEVROOT}/usr/bin/llvm-gcc")
SET (CXX "${DEVROOT}/usr/bin/llvm-g++")
CMAKE_FORCE_C_COMPILER (${CC} LLVM)
CMAKE_FORCE_CXX_COMPILER (${CXX} LLVM)
SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "${DEVROOT}")
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

30
port/iOS/README.md 100644
View File

@ -0,0 +1,30 @@
# assimp for iOS-SDK 7.1
(deployment target 6.0+, 32/64bit)
Builds assimp libraries for several iOS CPU architectures at once, and outputs a fat binary from the result.
Run the **build.sh** script from the ```./port/iOS/``` directory. See **./build.sh --help** for information about command line options.
```bash
shadeds-Mac:iOS arul$ ./build.sh --help
[!] ./build.sh - assimp iOS build script
- don't build fat library (--no-fat)
- supported architectures(--archs): armv7, armv7s, arm64, i386, x86_64
- supported C++ STD libs.(--stdlib): libc++, libstdc++
```
Example:
```bash
cd ./port/iOS/
./build.sh --stdlib=libc++ --archs="armv7 arm64 i386"
```
Supported architectures/devices:
### Simulator
- i386
- x86_64
### Device
- ~~ARMv6 (dropped after iOS 6.0)~~
- ARMv7
- ARMv7-s
- ARM64

View File

@ -1,13 +0,0 @@
To build for iOS simply execute "./build_ios.sh" from this folder. Currently this script requires the latest SDK (5.0) from Apple in order to build properly. In the future I will add support for specifying the SDK version on the command line.
Once the build is completed you will see a "ios" folder under /lib. This folder has sub folders for each of the following architectures:
* armv6 (Older Devices)
* armv7 (New Devices)
* i386 (Simulator)
Each of these folders contains a single static library for that architecture. In addition the libassimp.a file in the root of this folder is a combined archive (fat binary) library for all of the above architectures.
This port is being maintained by Matt Mathias <mmathias01@gmail.com> please contact him with any questions or comments.

115
port/iOS/build.sh 100755
View File

@ -0,0 +1,115 @@
#!/bin/bash
#
# Written and maintained by the.arul@gmail.com (2014)
#
BUILD_DIR="./lib/iOS"
IOS_SDK_VERSION=7.1
IOS_SDK_TARGET=6.0
#(iPhoneOS iPhoneSimulator) -- determined from arch
IOS_SDK_DEVICE=
XCODE_ROOT_DIR=/Applications/Xcode.app/Contents
TOOLCHAIN=$XCODE_ROOT_DIR//Developer/Toolchains/XcodeDefault.xctoolchain
BUILD_ARCHS_DEVICE="armv7 armv7s arm64"
BUILD_ARCHS_SIMULATOR="i386 x86_64"
BUILD_ARCHS_ALL=(armv7 armv7s arm64 i386 x86_64)
CPP_DEV_TARGET_LIST=(miphoneos-version-min mios-simulator-version-min)
CPP_DEV_TARGET=
CPP_STD_LIB_LIST=(libc++ libstdc++)
CPP_STD_LIB=
function join { local IFS="$1"; shift; echo "$*"; }
build_arch()
{
IOS_SDK_DEVICE=iPhoneOS
CPP_DEV_TARGET=${CPP_DEV_TARGET_LIST[0]}
if [[ "$BUILD_ARCHS_SIMULATOR" =~ "$1" ]]
then
echo '[!] Target SDK set to SIMULATOR.'
IOS_SDK_DEVICE=iPhoneSimulator
CPP_DEV_TARGET=${CPP_DEV_TARGET_LIST[1]}
else
echo '[!] Target SDK set to DEVICE.'
fi
unset DEVROOT SDKROOT CFLAGS LDFLAGS CPPFLAGS CXXFLAGS
export DEVROOT=$XCODE_ROOT_DIR/Developer/Platforms/$IOS_SDK_DEVICE.platform/Developer
export SDKROOT=$DEVROOT/SDKs/$IOS_SDK_DEVICE$IOS_SDK_VERSION.sdk
export CFLAGS="-arch $1 -pipe -no-cpp-precomp -stdlib=$CPP_STD_LIB -isysroot $SDKROOT -$CPP_DEV_TARGET=$IOS_SDK_TARGET -I$SDKROOT/usr/include/"
export LDFLAGS="-L$SDKROOT/usr/lib/"
export CPPFLAGS=$CFLAGS
export CXXFLAGS=$CFLAGS
rm CMakeCache.txt
cmake -G 'Unix Makefiles' -DCMAKE_TOOLCHAIN_FILE=./port/iOS/IPHONEOS_$(echo $1 | tr '[:lower:]' '[:upper:]')_TOOLCHAIN.cmake -DENABLE_BOOST_WORKAROUND=ON -DASSIMP_BUILD_STATIC_LIB=ON
echo "[!] Building $1 library"
$XCODE_ROOT_DIR/Developer/usr/bin/make clean
$XCODE_ROOT_DIR/Developer/usr/bin/make assimp -j 8 -l
echo "[!] Moving built library into: $BUILD_DIR/$1/"
mv ./lib/libassimp.a $BUILD_DIR/$1/
}
echo "[!] $0 - assimp iOS build script"
CPP_STD_LIB=${CPP_STD_LIB_LIST[0]}
DEPLOY_ARCHS=${BUILD_ARCHS_ALL[*]}
DEPLOY_FAT=1
for i in "$@"; do
case $i in
-l=*|--stdlib=*)
CPP_STD_LIB=`echo $i | sed 's/[-a-zA-Z0-9]*=//'`
echo "[!] Selecting c++ std lib: $CPP_STD_LIB"
;;
-a=*|--archs=*)
DEPLOY_ARCHS=`echo $i | sed 's/[-a-zA-Z0-9]*=//'`
echo "[!] Selecting architectures: $DEPLOY_ARCHS"
;;
-n|--no-fat)
DEPLOY_FAT=0
echo "[!] Fat binary will not be created."
;;
-h|--help)
echo " - don't build fat library (--no-fat)."
echo " - supported architectures (--archs): $(echo $(join , ${BUILD_ARCHS_ALL[*]}) | sed 's/,/, /g')"
echo " - supported C++ STD libs. (--stdlib): $(echo $(join , ${CPP_STD_LIB_LIST[*]}) | sed 's/,/, /g')"
exit
;;
*)
;;
esac
done
cd ../../
rm -rf $BUILD_DIR
for ARCH_TARGET in $DEPLOY_ARCHS; do
mkdir -p $BUILD_DIR/$ARCH_TARGET
build_arch $ARCH_TARGET
#rm ./lib/libassimp.a
done
if [[ "$DEPLOY_FAT" -eq 1 ]]; then
echo '[+] Creating fat binary ...'
for ARCH_TARGET in $DEPLOY_ARCHS; do
LIPO_ARGS="$LIPO_ARGS-arch $ARCH_TARGET $BUILD_DIR/$ARCH_TARGET/libassimp.a "
done
LIPO_ARGS="$LIPO_ARGS-create -output $BUILD_DIR/libassimp-fat.a"
lipo $LIPO_ARGS
echo "[!] Done! The fat binary can be found at $BUILD_DIR"
fi

View File

@ -1,104 +0,0 @@
#!/bin/sh
# build.sh
#######################
# BUILD ASSIMP for iOS and iOS Simulator
#######################
BUILD_DIR="./lib/ios"
IOS_BASE_SDK="5.0"
IOS_DEPLOY_TGT="3.2"
setenv_all()
{
# Add internal libs
export CFLAGS="$CFLAGS"
export CPP="$DEVROOT/usr/bin/llvm-cpp-4.2"
export CXX="$DEVROOT/usr/bin/llvm-g++-4.2"
export CXXCPP="$DEVROOT/usr/bin/llvm-cpp-4.2"
export CC="$DEVROOT/usr/bin/llvm-gcc-4.2"
export LD=$DEVROOT/usr/bin/ld
export AR=$DEVROOT/usr/bin/ar
export AS=$DEVROOT/usr/bin/as
export NM=$DEVROOT/usr/bin/nm
export RANLIB=$DEVROOT/usr/bin/ranlib
export LDFLAGS="-L$SDKROOT/usr/lib/"
export CPPFLAGS=$CFLAGS
export CXXFLAGS=$CFLAGS
}
setenv_arm6()
{
unset DEVROOT SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS
export DEVROOT=/Developer/Platforms/iPhoneOS.platform/Developer
export SDKROOT=$DEVROOT/SDKs/iPhoneOS$IOS_BASE_SDK.sdk
export CFLAGS="-arch armv6 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=$IOS_DEPLOY_TGT -I$SDKROOT/usr/include/"
setenv_all
rm CMakeCache.txt
cmake -G 'Unix Makefiles' -DCMAKE_TOOLCHAIN_FILE=./port/iOS/IPHONEOS_ARM6_TOOLCHAIN.cmake -DENABLE_BOOST_WORKAROUND=ON -DBUILD_STATIC_LIB=ON
}
setenv_arm7()
{
unset DEVROOT SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS
export DEVROOT=/Developer/Platforms/iPhoneOS.platform/Developer
export SDKROOT=$DEVROOT/SDKs/iPhoneOS$IOS_BASE_SDK.sdk
export CFLAGS="-arch armv7 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=$IOS_DEPLOY_TGT -I$SDKROOT/usr/include/"
setenv_all
rm CMakeCache.txt
cmake -G 'Unix Makefiles' -DCMAKE_TOOLCHAIN_FILE=./port/iOS/IPHONEOS_ARM7_TOOLCHAIN.cmake -DENABLE_BOOST_WORKAROUND=ON -DBUILD_STATIC_LIB=ON
}
setenv_i386()
{
unset DEVROOT SDKROOT CFLAGS CC LD CPP CXX AR AS NM CXXCPP RANLIB LDFLAGS CPPFLAGS CXXFLAGS
export DEVROOT=/Developer/Platforms/iPhoneSimulator.platform/Developer
export SDKROOT=$DEVROOT/SDKs/iPhoneSimulator$IOS_BASE_SDK.sdk
export CFLAGS="-arch i386 -pipe -no-cpp-precomp -isysroot $SDKROOT -miphoneos-version-min=$IOS_DEPLOY_TGT"
setenv_all
rm CMakeCache.txt
cmake -G 'Unix Makefiles' -DCMAKE_TOOLCHAIN_FILE=./port/iOS/IPHONEOS_i386_TOOLCHAIN.cmake -DENABLE_BOOST_WORKAROUND=ON -DBUILD_STATIC_LIB=ON
}
create_outdir()
{
for lib_i386 in `find $BUILD_DIR/i386 -name "lib*\.a"`; do
lib_arm6=`echo $lib_i386 | sed "s/i386/arm6/g"`
lib_arm7=`echo $lib_i386 | sed "s/i386/arm7/g"`
lib=`echo $lib_i386 | sed "s/i386\///g"`
echo 'Creating fat binary...'
lipo -arch armv6 $lib_arm6 -arch armv7 $lib_arm7 -arch i386 $lib_i386 -create -output $lib
done
echo 'Done! You will find the libaries and fat binary library in /lib/ios'
}
cd ../../
rm -rf $BUILD_DIR
mkdir -p $BUILD_DIR/arm6 $BUILD_DIR/arm7 $BUILD_DIR/i386
setenv_arm6
echo 'Building armv6 library'
make clean
make assimp -j 8 -l
cp ./lib/libassimp.a $BUILD_DIR/arm6/
setenv_arm7
echo 'Building armv7 library'
make clean
make assimp -j 8 -l
cp ./lib/libassimp.a $BUILD_DIR/arm7/
setenv_i386
echo 'Building i386 library'
make clean
make assimp -j 8 -l
cp ./lib/libassimp.a $BUILD_DIR/i386/
rm ./lib/libassimp.a
create_outdir