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