Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: site/user/quick/ios.md

Issue 1399533005: Update iOS docs (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Add testing info Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 iOS 1 iOS
2 === 2 ===
3 3
4 The following has been tested on MacOS Yosemite with Xcode version 6.3.
5
6 Quickstart
7 ----------
8
9 1. Install [XCode](http://developer.apple.com/xcode/).
10
11 2. Install depot tools.
12
13 <!--?prettify lang=sh?-->
14
15 git clone 'https://chromium.googlesource.com/chromium/tools/depot_tools. git'
16 export PATH="${PWD}/depot_tools:${PATH}"
17
18 3. Get Skia.
19
20 <!--?prettify lang=sh?-->
21
22 git clone 'https://skia.googlesource.com/skia'
23 cd skia
24
25 4. Create the project files.
26
27 <!--?prettify lang=sh?-->
28
29 GYP_DEFINES="skia_os='ios' skia_arch_type='arm' armv7=1 arm_neon=0" ./gy p_skia
30
31 5. Build and run SampleApp.
32
33 <!--?prettify lang=sh?-->
34
35 xed out/gyp/SampleApp.xcodeproj # opens the SampleApp project in Xcode
36
4 Prerequisites 37 Prerequisites
5 ------------- 38 -------------
6 39
7 _These steps should closely follow building on Mac OS X. Those steps seem slight ly out of date._ 40 Make sure the following have been installed:
41
42 * XCode (Apple's development environment): required
43 * publicly available at http://developer.apple.com/xcode/
44 * add the optional Unix Tools to the install so you get the make command lin e tool.
45 * Chromium depot_tools: required to download the source and dependencies
46 * http://www.chromium.org/developers/how-tos/depottools
47 * You will need an Apple developer account if you wish to run on an iOS device .
48 * A tool such as [ios-deploy](https://github.com/phonegap/ios-deploy) is also useful for pulling output from an iOS device.
49
50 Check out the source code
51 -------------------------
52
53 See the instructions [here](../download).
54
55 Generate XCode projects
56 -----------------------
57
58 We use the open-source gyp tool to generate XCode projects (and analogous
59 build scripts on other platforms) from our multiplatform "gyp" files.
60
61 Before building, make sure that gyp knows to create an XCode project or ninja
62 build files. If you leave GYP_GENERATORS undefined it will assume the
63 following default:
64
65 GYP_GENERATORS="ninja,xcode"
66
67 Or you can set it to `xcode` alone, if you like.
68
69 You can then generate the Xcode projects by running:
70
71 GYP_DEFINES="skia_os='ios' skia_arch_type='arm' armv7=1 arm_neon=0" ./gyp_sk ia
72
73 Alternatively, you can do:
74
75 export GYP_DEFINES="skia_os='ios' skia_arch_type='arm' armv7=1 arm_neon=0"
76 ./gyp_skia
77
78 Build and run tests
79 -------------------
80
81 The 'dm' test program is wrapped in an app called iOSShell. The project for iOSS hell is at out/gyp/iOSShell.xcodeproj.
82 Running this app with the flag '--dm' will run unit tests and golden master imag es. Other arguments to the standard 'dm'
83 test program can also be passed in.
84
85 To launch the iOS app on a device from the command line you can use a tool such as [ios-deploy](https://github.com/phonegap/ios-deploy):
86
87 xcodebuild -project out/gyp/iOSShell.xcodeproj -configuration Debug
88 ios-deploy --bundle xcodebuild/Debug-iphoneos/iOSShell.app -I -d --args "--d m <dm_args>"
89
90 The usual mode you want for testing is Debug mode (SK_DEBUG is defined, and
91 debug symbols are included in the binary). If you would like to build the
92 Release version instead:
93
94 xcodebuild -project out/gyp/iOSShell.xcodeproj -configuration Release
95 ios-deploy --bundle xcodebuild/Release-iphoneos/iOSShell.app -I -d --args "- -dm <dm_args>"
96
97 Build and run nanobench (performance tests)
98 -------------------------------------------
99
100 The 'nanobench' test program is also wrapped in iOSShell.app. Passing in the fla g '--nanobench' will run these tests.
101
102 Here's an example of running nanobench from the command line. We will build with the "Release" configuration, since we are running performance tests.
103
104 xcodebuild --project out/gyp/iOSShell.xcodeproj -configuration Release
105 ios-deploy --bundle xcodebuild/Release-iphoneos/iOSShell.app -I -d --args "- -nanobench <nanobench_args>"
8 106
9 Build and run SampleApp in the XCode IDE 107 Build and run SampleApp in the XCode IDE
10 ---------------------------------------- 108 ----------------------------------------
11 109
12 ### XCode 4.5 110 * Run gyp_skia as described above.
111 * In the Finder, navigate to $SKIA_INSTALLDIR/trunk/out/gyp
112 * Double-click SampleApp.xcodeproj ; this will launch XCode and open the Sampl eApp project
113 * Make sure the SampleApp target is selected, and choose an iOS device to run on
114 * Click the “Build and Run” button in the top toolbar
115 * Once the build is complete, launching the app will display a window with lot s of shaded text examples. On the upper left there is a drop down
116 menu that allows you to cycle through different test pages. On the upper right t here is a dialog with a set of options, including different
117 rendering methods for each test page.
13 118
119 Provisioning
120 ------------
14 121
15 To build SampleApp on XCode 4.5 using the IDE these steps should work: 122 To run the Skia apps on an iOS device rather than using the simulator, you will need a developer account and a provisioning profile. See
123 [Launching Your App on Devices](https://developer.apple.com/library/ios/document ation/IDEs/Conceptual/AppDistributionGuide/LaunchingYourApponDevices/LaunchingYo urApponDevices.html) for more information.
16 124
17 GYP_DEFINES="skia_os='ios' skia_arch_type='arm' armv7=1 arm_neon=0" ./gyp_sk ia 125 Managing App Data
18 xed out/gyp/SampleApp.xcodeproj # opens the SampleApp project in the IDE 126 -----------------
127 By default, the iOS apps will look for resource files in the Documents/resources folder of the app and write any output files to Documents/. To upload resources
128 so that the app can read them you can use a tool such as [ios-deploy](https://gi thub.com/phonegap/ios-deploy). For example:
19 129
20 Note that if you run make at the command line the gyp\_skia script will rerun 130 ios-deploy --bundle_id 'com.google.SkiaSampleApp' --upload resources/baby_tu x.png --to Documents/resources/baby_tux.png
21 and you'll lose the effect of the GYP\_DEFINES. To avoid this do:
22 131
23 export GYP_DEFINES="skia_os='ios' skia_arch_type='arm' armv7=1 arm_neon=0" 132 You can use the same tool to download log files and golden master (GM) images:
24 133
25 ### XCode 3 134 ios-deploy --bundle_id 'com.google.iOSShell' --download=/Documents --to ./my _download_location
26 135
27 Use GYP\_DEFINES to tell gyp\_skia how to build for iOS. Here's a bash shell 136 Alternatively, you can put resources and other files in the bundle of the applic ation. In this case, you'll need to run the app with the option '--resourcePath .'
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698