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# NOTE: We tried adding the gyp file to the android/ directory at the root of 11# the Skia repo, but that resulted in the generated makefiles being created 12# outside of the out directory. We may be able to move the bulk of this gyp 13# to the /android directory and put a simple shim here, but that has yet to be 14# tested. 15 16{ 17 'variables': { 18 'skia_warnings_as_errors': 0, 19 }, 20 'targets': [ 21 { 22 'target_name': 'cpu_features', 23 'type': 'static_library', 24 'direct_dependent_settings': { 25 'include_dirs': [ 26 '../third_party/cpufeatures', 27 ], 28 }, 29 'sources': [ 30 '../third_party/cpufeatures/cpu-features.c', 31 '../third_party/cpufeatures/cpu-features.h', 32 ], 33 'cflags': [ 34 '-w', 35 ], 36 }, 37 { 38 'target_name': 'ashmem', 39 'type': 'static_library', 40 'sources': [ 41 '../third_party/ashmem/cutils/ashmem.h', 42 '../third_party/ashmem/cutils/ashmem-dev.c' 43 ], 44 'direct_dependent_settings': { 45 'include_dirs': [ 46 '../third_party/ashmem', 47 ] 48 }, 49 }, 50 { 51 'target_name': 'expat', 52 'type': 'static_library', 53 'sources': [ 54 '../third_party/externals/expat/lib/xmlparse.c', 55 '../third_party/externals/expat/lib/xmlrole.c', 56 '../third_party/externals/expat/lib/xmltok.c', 57 ], 58 'include_dirs': [ 59 '../third_party/externals/expat', 60 '../third_party/externals/expat/lib', 61 ], 62 'cflags': [ 63 '-w', 64 '-fexceptions', 65 ], 66 'defines': [ 67 'HAVE_EXPAT_CONFIG_H', 68 ], 69 'direct_dependent_settings': { 70 'include_dirs': [ 71 '../third_party/externals/expat/lib', # For expat.h 72 ], 73 } 74 }, 75 { 76 'target_name': 'png', 77 'type': 'static_library', 78 'sources': [ 79 '../third_party/externals/png/png.c', 80 '../third_party/externals/png/pngerror.c', 81 '../third_party/externals/png/pnggccrd.c', 82 '../third_party/externals/png/pngget.c', 83 '../third_party/externals/png/pngmem.c', 84 '../third_party/externals/png/pngpread.c', 85 '../third_party/externals/png/pngread.c', 86 '../third_party/externals/png/pngrio.c', 87 '../third_party/externals/png/pngrtran.c', 88 '../third_party/externals/png/pngrutil.c', 89 '../third_party/externals/png/pngset.c', 90 '../third_party/externals/png/pngtrans.c', 91 '../third_party/externals/png/pngvcrd.c', 92 '../third_party/externals/png/pngwio.c', 93 '../third_party/externals/png/pngwrite.c', 94 '../third_party/externals/png/pngwtran.c', 95 '../third_party/externals/png/pngwutil.c', 96 ], 97 'include_dirs': [ 98 '../third_party/externals/png', 99 ], 100 'cflags': [ 101 '-w', 102 '-fvisibility=hidden', 103 ], 104 'link_settings': { 105 'libraries': [ 106 '-lz', 107 ], 108 }, 109 'direct_dependent_settings': { 110 'include_dirs': [ 111 '../third_party/externals/png', 112 ], 113 } 114 }, 115 { 116 'target_name': 'jpeg', 117 'type': 'static_library', 118 'dependencies': [ 119 'ashmem' 120 ], 121 'sources': [ 122 '../third_party/externals/jpeg/jcapimin.c', 123 '../third_party/externals/jpeg/jcapistd.c', 124 '../third_party/externals/jpeg/jccoefct.c', 125 '../third_party/externals/jpeg/jccolor.c', 126 '../third_party/externals/jpeg/jcdctmgr.c', 127 '../third_party/externals/jpeg/jchuff.c', 128 '../third_party/externals/jpeg/jcinit.c', 129 '../third_party/externals/jpeg/jcmainct.c', 130 '../third_party/externals/jpeg/jcmarker.c', 131 '../third_party/externals/jpeg/jcmaster.c', 132 '../third_party/externals/jpeg/jcomapi.c', 133 '../third_party/externals/jpeg/jcparam.c', 134 '../third_party/externals/jpeg/jcphuff.c', 135 '../third_party/externals/jpeg/jcprepct.c', 136 '../third_party/externals/jpeg/jcsample.c', 137 '../third_party/externals/jpeg/jctrans.c', 138 '../third_party/externals/jpeg/jdapimin.c', 139 '../third_party/externals/jpeg/jdapistd.c', 140 '../third_party/externals/jpeg/jdatadst.c', 141 '../third_party/externals/jpeg/jdatasrc.c', 142 '../third_party/externals/jpeg/jdcoefct.c', 143 '../third_party/externals/jpeg/jdcolor.c', 144 '../third_party/externals/jpeg/jddctmgr.c', 145 '../third_party/externals/jpeg/jdhuff.c', 146 '../third_party/externals/jpeg/jdinput.c', 147 '../third_party/externals/jpeg/jdmainct.c', 148 '../third_party/externals/jpeg/jdmarker.c', 149 '../third_party/externals/jpeg/jdmaster.c', 150 '../third_party/externals/jpeg/jdmerge.c', 151 '../third_party/externals/jpeg/jdphuff.c', 152 '../third_party/externals/jpeg/jdpostct.c', 153 '../third_party/externals/jpeg/jdsample.c', 154 '../third_party/externals/jpeg/jdtrans.c', 155 '../third_party/externals/jpeg/jerror.c', 156 '../third_party/externals/jpeg/jfdctflt.c', 157 '../third_party/externals/jpeg/jfdctfst.c', 158 '../third_party/externals/jpeg/jfdctint.c', 159 '../third_party/externals/jpeg/jidctflt.c', 160 '../third_party/externals/jpeg/jidctfst.c', 161 '../third_party/externals/jpeg/jidctint.c', 162 '../third_party/externals/jpeg/jidctred.c', 163 '../third_party/externals/jpeg/jmem-ashmem.c', 164 '../third_party/externals/jpeg/jmemmgr.c', 165 '../third_party/externals/jpeg/jquant1.c', 166 '../third_party/externals/jpeg/jquant2.c', 167 '../third_party/externals/jpeg/jutils.c', 168 ], 169 'conditions': [ 170 [ 'arm_neon == 1 and skia_clang_build == 0', 171 { 172 'sources' : [ 173 '../third_party/externals/jpeg/armv6_idct.S', 174 '../third_party/externals/jpeg/jsimd_arm_neon.S', 175 '../third_party/externals/jpeg/jsimd_neon.c', 176 ], 177 'defines' : [ 178 'NV_ARM_NEON', 179 ], 180 }, 181 ], 182 [ 'skia_arch_type == "mips" and mips_dsp == 2', 183 { 184 'sources' : [ 185 '../third_party/externals/jpeg/mips_jidctfst.c', 186 '../third_party/externals/jpeg/mips_idct_le.S', 187 ], 188 'defines' : [ 189 'ANDROID_MIPS_IDCT', 190 ], 191 }, 192 ], 193 [ '"x86" in skia_arch_type', 194 { 195 'sources' : [ 196 '../third_party/externals/jpeg/jidctintelsse.c', 197 ], 198 'defines' : [ 199 'ANDROID_INTELSSE2_IDCT', 200 ], 201 }, 202 ], 203 ], 204 'include_dirs': [ 205 '../third_party/externals/jpeg', 206 ], 207 'cflags': [ 208 '-w', 209 '-fvisibility=hidden', 210 '-DAVOID_TABLES', 211 '-DUSE_ANDROID_ASHMEM', 212 '-O3', 213 '-fstrict-aliasing', 214 '-fprefetch-loop-arrays', 215 '-DANDROID_TILE_BASED_DECODE', 216 ], 217 'direct_dependent_settings': { 218 'include_dirs': [ 219 '../third_party/externals/jpeg', 220 ], 221 } 222 }, 223 { 224 # This target is a dependency for all console-type Skia applications which 225 # will run on Android. Since Android requires us to load native code in 226 # shared libraries, we need a common entry point to wrap around main(). 227 # Here we also change the type of all would-be executables to be shared 228 # libraries. The alternative would be to introduce a condition in every 229 # executable target which changes to a shared library if the target OS is 230 # Android. This is nicer because the switch is in one place. 231 'target_name': 'Android_EntryPoint', 232 'type': 'static_library', 233 'direct_dependent_settings': { 234 'target_conditions': [ 235 # '_type' is an 'automatic variable' which is defined for any 236 # target which defines a key-value pair with 'type' as the key (so, 237 # all of them). Conditionals inside 'target_conditions' are evaluated 238 # *after* all other definitions and conditionals are evaluated, so 239 # we're guaranteed that '_type' will be defined when we get here. 240 # For more info, see: 241 # - http://code.google.com/p/gyp/wiki/InputFormatReference#Variables 242 # - http://codereview.appspot.com/6353065/ 243 ['_type == "executable"', { 244 'type': 'shared_library', 245 }], 246 ], 247 }, 248 }, 249 { 250 # This target is a dependency for Skia Sample application which runs on 251 # Android. Since Android requires us to load native code in shared 252 # libraries, we need a common entry point to wrap around main(). Here 253 # we also change the type of all would-be executables to be shared 254 # libraries. The alternative would be to introduce a condition in every 255 # executable target which changes to a shared library if the target OS is 256 # Android. This is nicer because the switch is in one place. 257 'target_name': 'Android_SampleApp', 258 'type': 'static_library', 259 'direct_dependent_settings': { 260 'target_conditions': [ 261 # '_type' is an 'automatic variable' which is defined for any 262 # target which defines a key-value pair with 'type' as the key (so, 263 # all of them). Conditionals inside 'target_conditions' are evaluated 264 # *after* all other definitions and conditionals are evaluated, so 265 # we're guaranteed that '_type' will be defined when we get here. 266 # For more info, see: 267 # - http://code.google.com/p/gyp/wiki/InputFormatReference#Variables 268 # - http://codereview.appspot.com/6353065/ 269 ['_type == "executable"', { 270 'type': 'shared_library', 271 }], 272 ], 273 'sources': [ 274 '../app/jni/com_skia_SkiaSampleRenderer.cpp', 275 ], 276 }, 277 278 }, 279 ] 280} 281