Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 Android | |
| 2 ======= | |
| 3 | |
| 4 Prerequisites | |
| 5 ------------- | |
| 6 | |
| 7 _Currently we only support building Skia for Android on a Linux or Mac host!_ | |
| 8 | |
| 9 The following libraries/utilities are required in addition to those needed for a standard skia checkout: | |
| 10 | |
| 11 * Apache Ant | |
| 12 * The Android SDK: http://developer.android.com/sdk/ | |
| 13 | |
| 14 $ sudo apt-get install ant git | |
|
jcgregorio
2015/01/07 13:53:23
~~~~
$ sudo apt-get install ant git
~~~~
| |
| 15 | |
| 16 Check out the source code | |
| 17 ------------------------- | |
| 18 | |
| 19 Follow the instructions [here](../download) for downloading the Skia source. Mod ify .gclient to add the following line to | |
| 20 the bottom, and then run gclient sync again: | |
| 21 | |
| 22 target_os = ["android"] | |
| 23 | |
| 24 Inside your Skia checkout, `platform_tools/android` contains the Android setup | |
| 25 scripts, Android specific dependencies, and the Android Sample App. | |
| 26 | |
| 27 Setup the Android SDK | |
| 28 --------------------- | |
| 29 | |
| 30 To finish setting up the Android SDK you need to download use the SDK to | |
| 31 download the appropriate API level. To do this simply go to the directory | |
| 32 where you installed the SDK and run the following commands | |
| 33 | |
| 34 # You may want to add this export to your shell's .bash_profile or .profile | |
| 35 export ANDROID_SDK_ROOT=/path/to/android/sdk | |
| 36 | |
| 37 $ANDROID_SDK_ROOT/tools/android update sdk --no-ui --filter android-19 | |
|
jcgregorio
2015/01/07 13:53:23
space after $
| |
| 38 | |
| 39 From here you will need to type 'y' to approve the license agreement and that | |
| 40 is all. You will then have downloaded the SDK for API level 19 (Android 4.4 | |
| 41 KitKat) which will be used to build the Skia SampleApp. You can download as | |
| 42 many other Android add-ons or APIs as you want, but you only are required to | |
| 43 have this one in order to complete the Skia build process. | |
| 44 | |
| 45 Setup Environment for Android | |
| 46 ----------------------------- | |
| 47 | |
| 48 The Android build needs to set up some specific variables needed by both GYP | |
| 49 and Make. We make this setup easy for developers by encapsulating all the | |
| 50 details into a custom script that acts as a replacement for make. | |
| 51 | |
| 52 Custom Android Build Script | |
| 53 --------------------------- | |
| 54 | |
| 55 The android_ninja script is a wrapper for the ninja command (provided by | |
| 56 depot_tools) and is specifically designed to work with the Skia's build | |
| 57 system. To use the script you need to call it from Skia's trunk directory with | |
| 58 the -d option plus any of the options or arguments you would normally pass to | |
| 59 ninja (see descriptions of some of the other flags here). | |
| 60 | |
| 61 export ANDROID_SDK_ROOT=/path/to/android/sdk | |
| 62 export PATH=$PATH:/path/to/depot_tools | |
| 63 | |
| 64 cd skia | |
| 65 ./platform_tools/android/bin/android_ninja -d nexus_10 # or nexus_7, galaxy_ nexus, etc... | |
| 66 | |
| 67 The -d option enables the build system to target the build to a specific | |
| 68 architecture such as MIPS (generic), x86 (generic) and ARM (generic and device | |
| 69 specific flavors for Nexus devices). This in turn allows Skia to take | |
| 70 advantage of specific device optimizations (e.g. NEON instructions). | |
| 71 | |
| 72 Generate build file from GYP | |
| 73 ---------------------------- | |
| 74 | |
| 75 We use the open-source gyp tool to generate build files from our multiplatform | |
| 76 "gyp" files. While most other platforms enable you to regenerate these files | |
| 77 using `./gyp_skia` it is recommend that you do NOT do this for Android. Instead | |
| 78 you can rely on it being run automatically by android_ninja. | |
| 79 | |
| 80 Faster rebuilds | |
| 81 --------------- | |
| 82 | |
| 83 You can use ccache to improve the speed of rebuilding: | |
| 84 | |
| 85 # You may want to add this export to your shell's .bash_profile or .profile | |
| 86 export ANDROID_MAKE_CCACHE=[ccache] | |
| 87 | |
| 88 Build and run executables on the device | |
| 89 --------------------------------------- | |
| 90 | |
| 91 The build system packages the Skia executables as shared libraries. As such, | |
| 92 in order to run any executable on the device you must install the library and | |
| 93 a launcher executable on your device. To assist in this process there is a | |
| 94 script called `android_run_skia` that is located in the | |
| 95 `platform_tools/android/bin` directory. | |
| 96 | |
| 97 Run correctness tests | |
| 98 --------------------- | |
| 99 | |
| 100 First build the app and then run it on an attached device: | |
| 101 | |
| 102 ./platform_tools/android/bin/android_ninja [-d device_id] dm | |
| 103 ./platform_tools/android/bin/android_run_skia dm # uploads and runs the dm b inary on the attached device | |
| 104 | |
| 105 Run performance tests | |
| 106 --------------------- | |
| 107 | |
| 108 Since nanobench tests performance, it usually makes more sense to run it in | |
| 109 Release mode. | |
| 110 | |
| 111 BUILDTYPE=Release ./platform_tools/android/bin/android_ninja [-d device_id] nanobench | |
| 112 | |
| 113 # uploads and runs the nanobench binary on the attached device | |
| 114 ./platform_tools/android/bin/android_run_skia --release nanobench | |
| 115 | |
| 116 If you pass nanobench SKP files, it will benchmark them too. | |
| 117 | |
| 118 ./platform_tools/android/bin/[linux/mac]/adb push ../skp <dst> # <dst> is di r on device | |
| 119 | |
| 120 Finally to run the executable there are two approaches. The simplest of the | |
| 121 two run the app on the device like you would do for gm or tests, however this | |
| 122 approach will also produce the noisiest results. | |
| 123 | |
| 124 # <input> is file/dir on device | |
| 125 ./platform_tools/android/bin/android_run_skia --release nanobench --skps <in put> | |
| 126 | |
| 127 Build and run SampleApp | |
| 128 ----------------------- | |
| 129 | |
| 130 The SampleApp on Android provides a simple UI for viewing sample slides and gm i mages. | |
| 131 | |
| 132 BUILDTYPE=Debug ./platform_tools/android/bin/android_ninja -d $TARGET_DEVICE | |
| 133 | |
| 134 Then, install the app onto the device: | |
| 135 | |
| 136 ./platform_tools/android/bin/android_install_apk | |
| 137 | |
| 138 Finally to run the application you must navigate to the Skia Samples | |
| 139 application using the application launcher on your device. | |
| 140 | |
| 141 Build tools | |
| 142 ----------- | |
| 143 | |
| 144 The Android platform does not support skdiff at this time. | |
| 145 | |
| 146 Clean up all generated files | |
| 147 ---------------------------- | |
| 148 | |
| 149 make clean | |
| 150 | |
| 151 Debugging on Android | |
| 152 -------------------- | |
| 153 | |
| 154 We support debugging on using a GDB wrapper script. The script loads the app | |
| 155 onto the device, starts a gdbserver instance with that app, and then enters a | |
| 156 GDB client shell on the host. Necessary symbol files are pulled from the | |
| 157 device and placed into a temporary folder. The script does not build the app - | |
| 158 you'll have to do that first. | |
| 159 | |
| 160 # you can include additional arguments in quotes (e.g. "dm --nopdf") | |
| 161 ./platform_tools/android/bin/android_gdb_exe dm | |
| 162 | |
| 163 When the gdb client is ready, insert a breakpoint, and continue to let the | |
| 164 program resume execution. | |
| 165 | |
| OLD | NEW |