Home | History | Annotate | Download | only in gyp
      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': 'native_app_glue',
     23       'type': 'static_library',
     24       'direct_dependent_settings': {
     25         'include_dirs': [
     26           '../third_party/native_app_glue',
     27         ],
     28       },
     29       'sources': [
     30         '../third_party/native_app_glue/android_native_app_glue.c',
     31         '../third_party/native_app_glue/android_native_app_glue.h',
     32       ],
     33       'cflags': [
     34         '-w',
     35       ],
     36     },
     37     {
     38       'target_name': 'cpu_features',
     39       'type': 'static_library',
     40       'direct_dependent_settings': {
     41         'include_dirs': [
     42           '../third_party/cpufeatures',
     43         ],
     44       },
     45       'sources': [
     46         '../third_party/cpufeatures/cpu-features.c',
     47         '../third_party/cpufeatures/cpu-features.h',
     48       ],
     49       'cflags': [
     50         '-w',
     51       ],
     52     },
     53     {
     54       'target_name': 'ashmem',
     55       'type': 'static_library',
     56       'sources': [
     57         '../third_party/ashmem/cutils/ashmem.h',
     58         '../third_party/ashmem/cutils/ashmem-dev.c'
     59       ],
     60       'direct_dependent_settings': {
     61         'include_dirs': [
     62           '../third_party/ashmem',
     63         ]
     64       },
     65     },
     66     {
     67       # This target is a dependency for all console-type Skia applications which
     68       # will run on Android.  Since Android requires us to load native code in
     69       # shared libraries, we need a common entry point to wrap around main().
     70       # Here we also change the type of all would-be executables to be shared
     71       # libraries.  The alternative would be to introduce a condition in every
     72       # executable target which changes to a shared library if the target OS is
     73       # Android.  This is nicer because the switch is in one place.
     74       'target_name': 'Android_EntryPoint',
     75       'type': 'static_library',
     76       'direct_dependent_settings': {
     77         'target_conditions': [
     78           # '_type' is an 'automatic variable' which is defined for any
     79           # target which defines a key-value pair with 'type' as the key (so,
     80           # all of them).  Conditionals inside 'target_conditions' are evaluated
     81           # *after* all other definitions and conditionals are evaluated, so
     82           # we're guaranteed that '_type' will be defined when we get here.
     83           # For more info, see:
     84           # - http://code.google.com/p/gyp/wiki/InputFormatReference#Variables
     85           # - http://codereview.appspot.com/6353065/
     86           ['_type == "executable"', {
     87             'type': 'shared_library',
     88           }],
     89         ],
     90       },
     91     },
     92     {
     93       # This target is a dependency for Skia Sample application which runs on
     94       # Android.  Since Android requires us to load native code in shared
     95       # libraries, we need a common entry point to wrap around main(). Here
     96       # we also change the type of all would-be executables to be shared
     97       # libraries.  The alternative would be to introduce a condition in every
     98       # executable target which changes to a shared library if the target OS is
     99       # Android.  This is nicer because the switch is in one place.
    100       'target_name': 'Android_SampleApp',
    101       'type': 'static_library',
    102       'direct_dependent_settings': {
    103         'target_conditions': [
    104           # '_type' is an 'automatic variable' which is defined for any
    105           # target which defines a key-value pair with 'type' as the key (so,
    106           # all of them).  Conditionals inside 'target_conditions' are evaluated
    107           # *after* all other definitions and conditionals are evaluated, so
    108           # we're guaranteed that '_type' will be defined when we get here.
    109           # For more info, see:
    110           # - http://code.google.com/p/gyp/wiki/InputFormatReference#Variables
    111           # - http://codereview.appspot.com/6353065/
    112           ['_type == "executable"', {
    113             'type': 'shared_library',
    114           }],
    115         ],
    116         'sources': [
    117           '../apps/sample_app/src/main/jni/com_skia_SkiaSampleRenderer.cpp',
    118         ],
    119       },
    120     },
    121     {
    122       # This target is a dependency for VisualBench application which runs on
    123       # Android.  Since Android requires us to load native code in shared
    124       # libraries, we need a common entry point to wrap around main(). Here
    125       # we also change the type of all would-be executables to be shared
    126       # libraries.  The alternative would be to introduce a condition in every
    127       # executable target which changes to a shared library if the target OS is
    128       # Android.  This is nicer because the switch is in one place.
    129       'target_name': 'Android_VisualBench',
    130       'type': 'static_library',
    131       'direct_dependent_settings': {
    132         'target_conditions': [
    133           # '_type' is an 'automatic variable' which is defined for any
    134           # target which defines a key-value pair with 'type' as the key (so,
    135           # all of them).  Conditionals inside 'target_conditions' are evaluated
    136           # *after* all other definitions and conditionals are evaluated, so
    137           # we're guaranteed that '_type' will be defined when we get here.
    138           # For more info, see:
    139           # - http://code.google.com/p/gyp/wiki/InputFormatReference#Variables
    140           # - http://codereview.appspot.com/6353065/
    141           ['_type == "executable"', {
    142             'type': 'shared_library',
    143           }],
    144         ],
    145         'include_dirs': [
    146           '../../../tools/timer/',
    147           '../../../tools/VisualBench/',
    148         ],
    149         'sources': [
    150           '../apps/visualbench/src/main/jni/SkOSWindow_AndroidNative.cpp',
    151           '../apps/visualbench/src/main/jni/main.cpp',
    152         ],
    153       },
    154     },
    155     {
    156       # This target is a dependency for VisualBench application which runs on
    157       # Android.  Since Android requires us to load native code in shared
    158       # libraries, we need a common entry point to wrap around main(). Here
    159       # we also change the type of all would-be executables to be shared
    160       # libraries.  The alternative would be to introduce a condition in every
    161       # executable target which changes to a shared library if the target OS is
    162       # Android.  This is nicer because the switch is in one place.
    163       'target_name': 'Android_VisualBenchSDL',
    164       'type': 'static_library',
    165       'direct_dependent_settings': {
    166         'target_conditions': [
    167           # '_type' is an 'automatic variable' which is defined for any
    168           # target which defines a key-value pair with 'type' as the key (so,
    169           # all of them).  Conditionals inside 'target_conditions' are evaluated
    170           # *after* all other definitions and conditionals are evaluated, so
    171           # we're guaranteed that '_type' will be defined when we get here.
    172           # For more info, see:
    173           # - http://code.google.com/p/gyp/wiki/InputFormatReference#Variables
    174           # - http://codereview.appspot.com/6353065/
    175           ['_type == "executable"', {
    176             'type': 'shared_library',
    177           }],
    178         ],
    179       },
    180     },
    181   ]
    182 }
    183