Don't like ads? PRO users don't see any ads ;-)
Guest

Ogre SDK

By: a guest on Apr 30th, 2012  |  syntax: Bash  |  size: 2.32 KB  |  hits: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.  #!/bin/bash
  2.  
  3. # Build and package the SDK for iOS
  4. # Assumes that you are in the SDK/iOS directory
  5. LIPO=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/lipo
  6.  
  7. START_DIR=`pwd`
  8. echo START_DIR = $START_DIR
  9. cd ../../../build/ios
  10. OGRE_BUILD_DIR=`pwd`
  11. SDK_DIR=$OGRE_BUILD_DIR/sdk
  12. echo OGRE_BUILD_DIR = $OGRE_BUILD_DIR
  13. echo SDK_DIR = $SDK_DIR
  14.  
  15. if [ "$1" = "test" ];then
  16. echo Test ends...
  17.         exit
  18. fi
  19.  
  20. if [ "$1" = "copy" ];then
  21. COPY_DIR=$OGRE_BUILD_DIR/../../sdks/ios/$2
  22. rm -rf $COPY_DIR
  23. echo Copy from $SDK_DIR to $COPY_DIR
  24.         mkdir -p $COPY_DIR
  25.         echo Created dir
  26.         cp -r $SDK_DIR/include $COPY_DIR
  27.         echo Copied headers
  28.         mkdir $COPY_DIR/lib
  29.         cp -r $SDK_DIR/lib/Debug $COPY_DIR/lib
  30.         echo copied Debug libs
  31.         cp -r $SDK_DIR/lib/Release $COPY_DIR/lib
  32.         echo copied Release libs
  33.         echo DONE
  34.         cd $COPY_DIR
  35.         pwd
  36.         exit
  37. fi
  38.  
  39.  
  40. # Clean up files from previous builds
  41. if [ "$1" = "clean" ];then
  42. echo Cleaning previous builds...
  43.         rm -R $SDK_DIR
  44.         exit
  45. fi
  46.  
  47. # Read version number
  48. OGRE_VERSION=`cat version.txt`
  49. echo OGRE_VERSION = $OGRE_VERSION
  50.  
  51. # Invoke Xcode build for device and simulator
  52.  
  53. # Install targets will fail because they can't find libraries.  So we've added a post build phase to copy them to the
  54. # location that the target expects them then copy them to the correct location
  55.  
  56. function build_single_target {
  57.         echo Building for $CONFIG/$TARGET
  58.         LIB_DIR=$SDK_DIR/lib/$CONFIG-$TARGET
  59.         echo LIB_DIR = $LIB_DIR
  60.         #rm lib/$CONFIG/*.a
  61.         rm -R $LIB_DIR
  62.         mkdir -p $LIB_DIR
  63.  
  64.         xcodebuild -project OGRE.xcodeproj -target install -parallelizeTargets -configuration $CONFIG -sdk $TARGET IPHONEOS_DEPLOYMENT_TARGET=4.0
  65.         cp lib/$CONFIG/*.a $LIB_DIR
  66. }
  67.  
  68. function lipo {
  69. mkdir $OGRE_BUILD_DIR/sdk/lib/$CONFIG
  70. for LIBNAME in $OGRE_BUILD_DIR/sdk/lib/$CONFIG-iphoneos/lib*
  71. do
  72.         echo lipo $LIBNAME
  73.         BASELIBNAME=`basename $LIBNAME`
  74.         $LIPO $SDK_DIR/lib/$CONFIG-iphoneos/$BASELIBNAME -arch i386 $SDK_DIR/lib/$CONFIG-iphonesimulator/$BASELIBNAME -create -output $SDK_DIR/lib/$CONFIG/$BASELIBNAME
  75. done
  76. }
  77.  
  78. CONFIG=Release
  79. TARGET=iphoneos
  80. build_single_target
  81.  
  82. TARGET=iphonesimulator
  83. build_single_target
  84.  
  85. CONFIG=Debug
  86. TARGET=iphoneos
  87. build_single_target
  88.  
  89. TARGET=iphonesimulator
  90. build_single_target
  91.  
  92. # Cram them together so we have a 'fat' library for device and simulator
  93. CONFIG=Debug
  94. #lipo
  95. CONFIG=Release
  96. lipo
  97.  
  98. cd $START_DIR