OLD | NEW |
(Empty) | |
| 1 iOS |
| 2 === |
| 3 |
| 4 Prerequisites |
| 5 ------------- |
| 6 |
| 7 _These steps should closely follow building on Mac OS X. Those steps seem slight
ly out of date._ |
| 8 |
| 9 Build and run SampleApp in the XCode IDE |
| 10 ---------------------------------------- |
| 11 |
| 12 ### XCode 4.5 |
| 13 |
| 14 |
| 15 To build SampleApp on XCode 4.5 using the IDE these steps should work: |
| 16 |
| 17 GYP_DEFINES="skia_os='ios' skia_arch_type='arm' armv7=1 arm_neon=0" ./gyp_sk
ia |
| 18 xed out/gyp/SampleApp.xcodeproj # opens the SampleApp project in the IDE |
| 19 |
| 20 Note that if you run make at the command line the gyp\_skia script will rerun |
| 21 and you'll lose the effect of the GYP\_DEFINES. To avoid this do: |
| 22 |
| 23 export GYP_DEFINES="skia_os='ios' skia_arch_type='arm' armv7=1 arm_neon=0" |
| 24 |
| 25 ### XCode 3 |
| 26 |
| 27 Use GYP\_DEFINES to tell gyp\_skia how to build for iOS. Here's a bash shell |
| 28 snippet that sets the world up to build SampleApp with XCode 3: |
| 29 |
| 30 function buildSampleApp() |
| 31 { |
| 32 sdkVersion="4.3" |
| 33 if [[ "$1" == "sim" ]] ; then |
| 34 export GYP_DEFINES="skia_os='ios' skia_arch_type='x86' \ |
| 35 ios_sdk_dir='/Developer/Platforms/iPhoneSimulator.platform/Developer/S
DKs/iPhoneSimulator' \ |
| 36 ios_sdk_version='$sdkVersion'" |
| 37 elif [[ "$1" == "iphone" ]] ; then |
| 38 export GYP_DEFINES="skia_os='ios' skia_arch_type='arm' armv7='1' arm_neo
n='0' \ |
| 39 ios_sdk_dir='/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPh
oneOS' \ |
| 40 ios_sdk_version='$sdkVersion'" |
| 41 elif [[ "$1" == "mac" ]] ; then |
| 42 export GYP_DEFINES="" |
| 43 else |
| 44 echo "buildSampleApp expects 'sim', 'iphone', or 'mac'" |
| 45 fi |
| 46 if [[ "$1" == "sim" ]] || [[ "$1" == "iphone" ]] || [[ "$1" == "mac" ]] ;
then |
| 47 save=`pwd` |
| 48 cd /chrome/nih/skia/trunk |
| 49 echo "$GYP_DEFINES ./gyp_skia gyp/SampleApp.gyp" |
| 50 ./gyp_skia gyp/SampleApp.gyp |
| 51 cd $save |
| 52 fi |
| 53 if [[ "$1" == "sim" ]] ; then |
| 54 setiossdk iphonesimulator$sdkVersion |
| 55 elif [[ "$1" == "iphone" ]] ; then |
| 56 setiossdk iphoneos$sdkVersion |
| 57 fi |
| 58 } |
| 59 |
| 60 The script function setiossdk called by buildSampleApp is a |
| 61 not-completely-working hackery. When gyp builds an iOS-targeted project, it is |
| 62 hard-coded for the iOS simulator. To point the project at either the iOS |
| 63 simulator, or an iOS device, the project file must be opened to create a |
| 64 custom pbxuser file. |
| 65 |
| 66 This is accomplished by: |
| 67 |
| 68 function setiossdk() |
| 69 { |
| 70 osascript -e 'tell app "Xcode" to quit' |
| 71 osascript -e 'repeat until appIsRunning("Xcode") is false' -e \ |
| 72 'do shell script "sleep 1"' -e 'end repeat' |
| 73 save=`pwd` |
| 74 skia |
| 75 cd out/gyp |
| 76 for project in *.xcodeproj; do |
| 77 open $project |
| 78 done |
| 79 osascript -e 'tell app "Xcode" to quit' |
| 80 osascript -e 'repeat until appIsRunning("Xcode") is false' -e \ |
| 81 'do shell script "sleep 1"' -e 'end repeat' |
| 82 for project in *.xcodeproj; do |
| 83 lsave=`pwd` |
| 84 cd $project |
| 85 filename=`eval whoami`.pbxuser |
| 86 while [[ ! -s $filename ]] ; do |
| 87 sleep 1 |
| 88 echo -n "." |
| 89 done |
| 90 sed -e '/activeSDKPreference/ d' <$filename | sed -e '/activeTarget/ i\ |
| 91 \ activeSDKPreference = '$1';' >x$filename |
| 92 if [[ -s x$filename ]] ; then |
| 93 mv x$filename $filename |
| 94 else |
| 95 echo "mv x$filename $project/$filename failed" |
| 96 fi |
| 97 cd $lsave |
| 98 done |
| 99 open SampleApp.xcodeproj |
| 100 cd $save |
| 101 } |
| 102 |
| 103 In particular, the calls to osascript to wait for Xcode to quit use faulty synta
x. |
| 104 |
OLD | NEW |