The following has been tested on MacOS Yosemite with Xcode version 6.3.
Install XCode.
Install depot tools.
git clone 'https://chromium.googlesource.com/chromium/tools/depot_tools.git' export PATH="${PWD}/depot_tools:${PATH}"
Get Skia.
git clone 'https://skia.googlesource.com/skia' cd skia
Create the project files.
GYP_DEFINES="skia_os='ios' skia_arch_type='arm' armv7=1 arm_neon=0" ./gyp_skia
Build and run SampleApp.
xed out/gyp/SampleApp.xcodeproj # opens the SampleApp project in Xcode
Make sure the following have been installed:
See the instructions here.
We use the open-source gyp tool to generate XCode projects (and analogous build scripts on other platforms) from our multiplatform "gyp" files.
Before building, make sure that gyp knows to create an XCode project or ninja build files. If you leave GYP_GENERATORS undefined it will assume the following default:
GYP_GENERATORS="ninja,xcode"
Or you can set it to xcode
alone, if you like.
You can then generate the Xcode projects by running:
GYP_DEFINES="skia_os='ios' skia_arch_type='arm' armv7=1 arm_neon=0" ./gyp_skia
Alternatively, you can do:
export GYP_DEFINES="skia_os='ios' skia_arch_type='arm' armv7=1 arm_neon=0" ./gyp_skia
The 'dm' test program is wrapped in an app called iOSShell. The project for iOSShell is at out/gyp/iOSShell.xcodeproj. Running this app with the flag '--dm' will run unit tests and golden master images. Other arguments to the standard 'dm' test program can also be passed in.
To launch the iOS app on a device from the command line you can use a tool such as ios-deploy:
xcodebuild -project out/gyp/iOSShell.xcodeproj -configuration Debug ios-deploy --bundle xcodebuild/Debug-iphoneos/iOSShell.app -I -d --args "--dm <dm_args>"
The usual mode you want for testing is Debug mode (SK_DEBUG is defined, and debug symbols are included in the binary). If you would like to build the Release version instead:
xcodebuild -project out/gyp/iOSShell.xcodeproj -configuration Release ios-deploy --bundle xcodebuild/Release-iphoneos/iOSShell.app -I -d --args "--dm <dm_args>"
The 'nanobench' test program is also wrapped in iOSShell.app. Passing in the flag '--nanobench' will run these tests.
Here's an example of running nanobench from the command line. We will build with the "Release" configuration, since we are running performance tests.
xcodebuild --project out/gyp/iOSShell.xcodeproj -configuration Release ios-deploy --bundle xcodebuild/Release-iphoneos/iOSShell.app -I -d --args "--nanobench <nanobench_args>"
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 Launching Your App on Devices for more information.
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 so that the app can read them you can use a tool such as ios-deploy. For example:
ios-deploy --bundle_id 'com.google.SkiaSampleApp' --upload resources/baby_tux.png --to Documents/resources/baby_tux.png
You can use the same tool to download log files and golden master (GM) images:
ios-deploy --bundle_id 'com.google.iOSShell' --download=/Documents --to ./my_download_location
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 .'