Home | History | Annotate | Download | only in quick
      1 iOS
      2 ===
      3 
      4 The following has been tested on MacOS Yosemite with Xcode version 6.3.
      5 
      6 Quickstart
      7 ----------
      8 
      9 First, install [XCode](https://developer.apple.com/xcode/).
     10 
     11 <!--?prettify lang=sh?-->
     12 
     13     # Install depot tools.
     14     git clone 'https://chromium.googlesource.com/chromium/tools/depot_tools.git'
     15     export PATH="${PWD}/depot_tools:${PATH}"
     16 
     17     # Get Skia.
     18     git clone 'https://skia.googlesource.com/skia'
     19     cd skia
     20 
     21     # Create the project files.
     22     GYP_DEFINES="skia_os='ios' skia_arch_type='arm' armv7=1 arm_neon=0" python bin/sync-and-gyp
     23     # Build and run SampleApp.
     24     xed out/gyp/SampleApp.xcodeproj # opens the SampleApp project in Xcode
     25 
     26 Prerequisites
     27 -------------
     28 
     29 Make sure the following have been installed:
     30 
     31   * XCode (Apple's development environment): required
     32     * publicly available at http://developer.apple.com/xcode/
     33     * add the optional Unix Tools to the install so you get the make command line tool.
     34   * Chromium depot_tools: required to download the source and dependencies
     35     * http://www.chromium.org/developers/how-tos/depottools
     36   * You will need an Apple developer account if you wish to run on an iOS device.
     37   * A tool such as [ios-deploy](https://github.com/phonegap/ios-deploy) is also useful for pulling output from an iOS device.
     38 
     39 Check out the source code
     40 -------------------------
     41 
     42 See the instructions [here](../download).
     43 
     44 Generate XCode projects
     45 -----------------------
     46 
     47 We use the open-source gyp tool to generate XCode projects (and analogous
     48 build scripts on other platforms) from our multiplatform "gyp" files.
     49 
     50 Before building, make sure that gyp knows to create an XCode project or ninja
     51 build files. If you leave GYP_GENERATORS undefined it will assume the
     52 following default:
     53 
     54     GYP_GENERATORS="ninja,xcode"
     55 
     56 Or you can set it to `xcode` alone, if you like.
     57 
     58 You can then generate the Xcode projects by running:
     59 
     60     GYP_DEFINES="skia_os='ios' skia_arch_type='arm' armv7=1 arm_neon=0" python bin/sync-and-gyp
     61 
     62 Alternatively, you can do:
     63 
     64     export GYP_DEFINES="skia_os='ios' skia_arch_type='arm' armv7=1 arm_neon=0"
     65     python bin/sync-and-gyp
     66 
     67 Build and run tests
     68 -------------------
     69 
     70 The 'dm' test program is wrapped in an app called iOSShell. The project for iOSShell is at out/gyp/iOSShell.xcodeproj. 
     71 Running this app with the flag '--dm' will run unit tests and golden master images. Other arguments to the standard 'dm'
     72 test program can also be passed in.
     73 
     74 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):
     75 
     76     xcodebuild -project out/gyp/iOSShell.xcodeproj -configuration Debug
     77     ios-deploy --bundle xcodebuild/Debug-iphoneos/iOSShell.app -I -d --args "--dm <dm_args>"
     78 
     79 The usual mode you want for testing is Debug mode (SK_DEBUG is defined, and
     80 debug symbols are included in the binary). If you would like to build the
     81 Release version instead:
     82 
     83     xcodebuild -project out/gyp/iOSShell.xcodeproj -configuration Release
     84     ios-deploy --bundle xcodebuild/Release-iphoneos/iOSShell.app -I -d --args "--dm <dm_args>"
     85 
     86 Build and run nanobench (performance tests)
     87 -------------------------------------------
     88 
     89 The 'nanobench' test program is also wrapped in iOSShell.app. Passing in the flag '--nanobench' will run these tests.
     90 
     91 Here's an example of running nanobench from the command line. We will build with the "Release" configuration, since we are running performance tests.
     92 
     93     xcodebuild --project out/gyp/iOSShell.xcodeproj -configuration Release
     94     ios-deploy --bundle xcodebuild/Release-iphoneos/iOSShell.app -I -d --args "--nanobench <nanobench_args>"
     95 
     96 Build and run SampleApp in the XCode IDE
     97 ----------------------------------------
     98 
     99   * Run `sync-and-gyp` as described above.
    100   * In the Finder, navigate to $SKIA_INSTALLDIR/trunk/out/gyp
    101   * Double-click SampleApp.xcodeproj ; this will launch XCode and open the SampleApp project
    102   * Make sure the SampleApp target is selected, and choose an iOS device to run on
    103   * Click the Build and Run button in the top toolbar
    104   * Once the build is complete, launching the app will display a window with lots of shaded text examples. On the upper left there is a drop down
    105 menu that allows you to cycle through different test pages. On the upper right there is a dialog with a set of options, including different
    106 rendering methods for each test page.
    107 
    108 Provisioning
    109 ------------
    110 
    111 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
    112 [Launching Your App on Devices](https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/LaunchingYourApponDevices/LaunchingYourApponDevices.html) for more information.
    113 
    114 Managing App Data
    115 -----------------
    116 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
    117 so that the app can read them you can use a tool such as [ios-deploy](https://github.com/phonegap/ios-deploy). For example:
    118 
    119     ios-deploy --bundle_id 'com.google.SkiaSampleApp' --upload resources/baby_tux.png --to Documents/resources/baby_tux.png
    120 
    121 You can use the same tool to download log files and golden master (GM) images:
    122 
    123     ios-deploy --bundle_id 'com.google.iOSShell' --download=/Documents --to ./my_download_location
    124 
    125 Alternatively, you can put resources and other files in the bundle of the application. In this case, you'll need to run the app with the option '--resourcePath .'
    126