1# Copyright 2015 Google Inc. 2# 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6# This GYP file stores the dependencies necessary to build Skia on the Android 7# platform. The OS doesn't provide many stable libraries as part of the 8# distribution so we have to build a few of them ourselves. 9# 10{ 11 'variables': { 12 'conditions': [ 13 [ 'skia_arch_type == "arm" and arm_version != 7', { 14 'android_arch%': "armeabi", 15 'android_variant%': "arm", 16 }], 17 [ 'skia_arch_type == "arm" and arm_version == 7', { 18 'android_arch%': "armeabi-v7a", 19 'android_variant%': "arm", 20 }], 21 [ 'skia_arch_type == "arm64"', { 22 'android_arch%': "arm64-v8a", 23 'android_variant%': "arm64", 24 }], 25 [ 'skia_arch_type == "x86"', { 26 'android_arch%': "x86", 27 'android_variant%': "x86", 28 }], 29 [ 'skia_arch_type == "x86_64"', { 30 'android_arch%': "x86_64", 31 'android_variant%': "x86_64", 32 }], 33 [ 'skia_arch_type == "mips32"', { 34 'android_arch%': "mips", 35 'android_variant%': "mips", 36 }], 37 [ 'skia_arch_type == "mips64"', { 38 'android_arch%': "mips64", 39 'android_variant%': "mips64", 40 }], 41 [ 'android_buildtype == "Release"', { 42 'android_apk_suffix': "release.apk", 43 }, { 44 'android_apk_suffix': "debug.apk", 45 }], 46 ], 47 }, 48 'includes' : [ 'canvasproof.gypi', ], 49 'targets': [ 50 { 51 'target_name': 'CopySampleAppDeps', 52 'type': 'none', 53 'dependencies': [ 54 'skia_lib.gyp:skia_lib', 55 'SampleApp.gyp:SampleApp', 56 ], 57 'copies': [ 58 # Copy all shared libraries into the Android app's libs folder. Note 59 # that this copy requires us to build SkiaAndroidApp after those 60 # libraries, so that they exist by the time it occurs. If there are no 61 # libraries to copy, this will cause an error in Make, but the app will 62 # still build. 63 { 64 'destination': '<(android_base)/apps/sample_app/src/main/libs/<(android_arch)', 65 'conditions': [ 66 [ 'skia_shared_lib', { 67 'files': [ 68 '<(SHARED_LIB_DIR)/libSampleApp.so', 69 '<(SHARED_LIB_DIR)/libskia_android.so', 70 ]}, { 71 'files': [ 72 '<(SHARED_LIB_DIR)/libSampleApp.so', 73 ]} 74 ], 75 ], 76 }, 77 ], 78 }, 79 { 80 'target_name': 'SampleApp_APK', 81 'type': 'none', 82 'dependencies': [ 83 'CopySampleAppDeps', 84 ], 85 'actions': [ 86 { 87 'action_name': 'SampleApp_apk', 88 'inputs': [ 89 '<(android_base)/apps/sample_app/src/main/AndroidManifest.xml', 90 '<(android_base)/apps/sample_app/src/main/jni/com_skia_SkiaSampleRenderer.h', 91 '<(android_base)/apps/sample_app/src/main/jni/com_skia_SkiaSampleRenderer.cpp', 92 '<(android_base)/apps/sample_app/src/main/java/com/skia/SkiaSampleActivity.java', 93 '<(android_base)/apps/sample_app/src/main/java/com/skia/SkiaSampleRenderer.java', 94 '<(android_base)/apps/sample_app/src/main/java/com/skia/SkiaSampleView.java', 95 '<(android_base)/apps/sample_app/src/main/libs/<(android_arch)/libSampleApp.so', 96 ], 97 'conditions': [ 98 [ 'skia_shared_lib', { 99 'inputs': [ 100 '<(android_base)/apps/sample_app/src/main/libs/<(android_arch)/libskia_android.so', 101 ], 102 }], 103 ], 104 'outputs': [ 105 '<(android_base)/apps/sample_app/build/outputs/apk/sample_app-<(android_variant)-<(android_apk_suffix)', 106 ], 107 'action': [ 108 '<(android_base)/apps/gradlew', 109 ':sample_app:assemble<(android_variant)<(android_buildtype)', 110 '-p<(android_base)/apps/sample_app', 111 '-PsuppressNativeBuild', 112 ], 113 }, 114 ], 115 }, 116 { 117 'target_name': 'CopyVisualBenchDeps', 118 'type': 'none', 119 'dependencies': [ 120 'skia_lib.gyp:skia_lib', 121 'visualbench.gyp:visualbench', 122 ], 123 124 'copies': [ 125 # Copy all shared libraries into the Android app's libs folder. Note 126 # that this copy requires us to build SkiaAndroidApp after those 127 # libraries, so that they exist by the time it occurs. If there are no 128 # libraries to copy, this will cause an error in Make, but the app will 129 # still build. 130 { 131 'destination': '<(android_base)/apps/visualbench/src/main/libs/<(android_arch)', 132 'conditions': [ 133 [ 'skia_shared_lib', { 134 'files': [ 135 '<(SHARED_LIB_DIR)/libskia_android.so', 136 '<(SHARED_LIB_DIR)/libvisualbench.so', 137 ]}, { 138 'files': [ 139 '<(SHARED_LIB_DIR)/libvisualbench.so', 140 ]} 141 ], 142 ], 143 }, 144 ], 145 }, 146 { 147 'target_name': 'VisualBench_APK', 148 'type': 'none', 149 'dependencies': [ 150 'CopyVisualBenchDeps', 151 ], 152 'actions': [ 153 { 154 'action_name': 'SkiaVisualBench_apk', 155 'inputs': [ 156 '<(android_base)/apps/visualbench/src/main/AndroidManifest.xml', 157 '<(android_base)/apps/visualbench/src/main/java/com/skia/VisualBenchActivity.java', 158 '<(android_base)/apps/visualbench/src/main/libs/<(android_arch)/libvisualbench.so', 159 ], 160 'conditions': [ 161 [ 'skia_shared_lib', { 162 'inputs': [ 163 '<(android_base)/apps/visualbench/src/main/libs/<(android_arch)/libskia_android.so', 164 ], 165 }], 166 ], 167 'outputs': [ 168 '<(android_base)/apps/visualbench/build/outputs/apk/visualbench-<(android_variant)-<(android_apk_suffix)', 169 ], 170 'action': [ 171 '<(android_base)/apps/gradlew', 172 ':visualbench:assemble<(android_variant)<(android_buildtype)', 173 '-p<(android_base)/apps/visualbench', 174 '-PsuppressNativeBuild', 175 ], 176 }, 177 ], 178 }, 179 { 180 'target_name': 'VisualBenchTest_APK', 181 'type': 'none', 182 'dependencies': [ 183 'VisualBench_APK', 184 ], 185 'actions': [ 186 { 187 'action_name': 'SkiaVisualBench_apk', 188 'inputs': [ 189 '<(android_base)/apps/visualbench/src/main/AndroidManifest.xml', 190 '<(android_base)/apps/visualbench/src/main/java/com/skia/VisualBenchActivity.java', 191 '<(android_base)/apps/visualbench/src/main/java/com/skia/VisualBenchTestActivity.java', 192 '<(android_base)/apps/visualbench/src/main/libs/<(android_arch)/libvisualbench.so', 193 ], 194 'conditions': [ 195 [ 'skia_shared_lib', { 196 'inputs': [ 197 '<(android_base)/apps/visualbench/src/main/libs/<(android_arch)/libskia_android.so', 198 ], 199 }], 200 ], 201 'outputs': [ 202 '<(android_base)/apps/visualbench/build/outputs/apk/visualbench-<(android_variant)-debug-androidTest-unaligned.apk', 203 ], 204 'action': [ 205 '<(android_base)/apps/gradlew', 206 ':visualbench:assemble<(android_variant)DebugAndroidTest', 207 '-p<(android_base)/apps/visualbench', 208 '-PsuppressNativeBuild', 209 ], 210 }, 211 ], 212 }, 213 # TODO all of this duplicated code can be removed when SDL becomes the default 214 # Currently, to use this you have to override skia_use_sdl 215 { 216 'target_name': 'CopyVisualBenchSDLDeps', 217 'type': 'none', 218 'dependencies': [ 219 'skia_lib.gyp:skia_lib', 220 'visualbench.gyp:visualbench', 221 ], 222 223 'copies': [ 224 # Copy all shared libraries into the Android app's libs folder. Note 225 # that this copy requires us to build SkiaAndroidApp after those 226 # libraries, so that they exist by the time it occurs. If there are no 227 # libraries to copy, this will cause an error in Make, but the app will 228 # still build. 229 { 230 'destination': '<(android_base)/apps/visualbenchsdl/src/main/libs/<(android_arch)', 231 'conditions': [ 232 [ 'skia_shared_lib', { 233 'files': [ 234 '<(SHARED_LIB_DIR)/libskia_android.so', 235 '<(SHARED_LIB_DIR)/libvisualbench.so', 236 ]}, { 237 'files': [ 238 '<(SHARED_LIB_DIR)/libvisualbench.so', 239 ]} 240 ], 241 ], 242 }, 243 ], 244 }, 245 { 246 'target_name': 'VisualBenchSDL_APK', 247 'type': 'none', 248 'dependencies': [ 249 'CopyVisualBenchSDLDeps', 250 ], 251 'actions': [ 252 { 253 'action_name': 'SkiaVisualBenchSDL_apk', 254 'inputs': [ 255 '<(android_base)/apps/visualbenchsdl/src/main/AndroidManifest.xml', 256 '<(android_base)/apps/visualbenchsdl/src/main/java/org/libsdl/app/SDLActivity.java', 257 '<(android_base)/apps/visualbenchsdl/src/main/java/com/skia/VisualBenchActivity.java', 258 '<(android_base)/apps/visualbenchsdl/src/main/libs/<(android_arch)/libvisualbench.so', 259 ], 260 'conditions': [ 261 [ 'skia_shared_lib', { 262 'inputs': [ 263 '<(android_base)/apps/visualbenchsdl/src/main/libs/<(android_arch)/libskia_android.so', 264 ], 265 }], 266 ], 267 'outputs': [ 268 '<(android_base)/apps/visualbenchsdl/build/outputs/apk/visualbench-<(android_variant)-<(android_apk_suffix)', 269 ], 270 'action': [ 271 '<(android_base)/apps/gradlew', 272 ':visualbenchsdl:assemble<(android_variant)<(android_buildtype)', 273 '-p<(android_base)/apps/visualbenchsdl', 274 '-PsuppressNativeBuild', 275 ], 276 }, 277 ], 278 }, 279 ], 280} 281