Home | History | Annotate | Download | only in gyp
      1 # Copyright 2012 The Android Open Source Project
      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 {
      7   # Get ready for the ugly...
      8   #
      9   # - We have to nest our variables dictionaries multiple levels deep, so that
     10   #   this and other gyp files can rely on previously-set variable values in
     11   #   their 'variables': { 'conditions': [] } clauses.
     12   #
     13   #   Example 1:
     14   #   Within this file, we use the value of variable 'skia_os' to set the
     15   #   value of variable 'os_posix', so 'skia_os' must be defined within a
     16   #   "more inner" (enclosed) scope than 'os_posix'.
     17   #
     18   #   Example 2:
     19   #   http://src.chromium.org/viewvc/chrome/trunk/src/third_party/libjpeg/libjpeg.gyp?revision=102306 ,
     20   #   which we currently import into our build, uses the value of 'os_posix'
     21   #   within the 'conditions' list in its 'variables' dict.
     22   #   In order for that to work, it needs the value of 'os_posix' to have been
     23   #   set within a "more inner" (enclosed) scope than its own 'variables' dict.
     24   #
     25   # - On the other hand, key/value pairs of a given 'variable' dict are only
     26   #   inherited by:
     27   #   1. directly enclosing 'variable' dicts, and
     28   #   2. "sibling" 'variable' dicts (which, I guess, are combined into a single
     29   #      'variable' dict during gyp processing)
     30   #   and NOT inherited by "uncles" (siblings of directly enclosing 'variable'
     31   #   dicts), so we have to re-define every variable at every enclosure level
     32   #   within our ridiculous matryoshka doll of 'variable' dicts.  That's why
     33   #   we have variable definitions like this:  'skia_os%': '<(skia_os)',
     34   #
     35   # See http://src.chromium.org/viewvc/chrome/trunk/src/build/common.gypi?revision=127004 ,
     36   # which deals with these same constraints in a similar manner.
     37   #
     38   'variables': {  # level 1
     39     'variables': {  # level 2
     40 
     41       # Variables needed by conditions list within the level-2 variables dict.
     42       'variables': {  # level 3
     43         # We use 'skia_os' instead of 'OS' throughout our gyp files, to allow
     44         # for cross-compilation (e.g. building for either MacOS or iOS on Mac).
     45         # We set it automatically based on 'OS' (the host OS), but allow the
     46         # user to override it via GYP_DEFINES if they like.
     47         'skia_os%': '<(OS)',
     48       },
     49 
     50       # Re-define all variables defined within the level-3 'variables' dict,
     51       # so that siblings of the level-2 'variables' dict can see them.
     52       'skia_os%': '<(skia_os)',
     53 
     54       'conditions': [
     55         [ 'skia_os == "win"', {
     56           'os_posix%': 0,
     57         }, {
     58           'os_posix%': 1,
     59         }],
     60         [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris"]', {
     61           'skia_arch_width%': 64,
     62         }, {
     63           'skia_arch_width%': 32,
     64         }],
     65         [ 'skia_os == "android"', {
     66           'skia_static_initializers%': 0,
     67         }, {
     68           'skia_static_initializers%': 1,
     69         }],
     70         [ 'skia_os == "ios"', {
     71           'skia_arch_type%': 'arm',
     72           'arm_version%': 7,
     73           'arm_neon%': 0, # neon asm files known not to work with the ios build
     74         },{ # skia_os is not ios
     75           'skia_arch_type%': 'x86',
     76           'arm_version%': 0,
     77           'arm_neon%': 0,
     78         }],
     79       ],
     80 
     81       'skia_sanitizer%': '',
     82       'skia_scalar%': 'float',
     83       'skia_mesa%': 0,
     84       'skia_nv_path_rendering%': 0,
     85       'skia_stroke_path_rendering%': 0,
     86       'skia_android_path_rendering%': 0,
     87       'skia_resource_cache_mb_limit%': 0,
     88       'skia_resource_cache_count_limit%': 0,
     89       'skia_angle%': 0,
     90       'skia_chrome_utils%': 1,
     91       'skia_directwrite%': 0,
     92       'skia_gpu%': 1,
     93       'skia_osx_sdkroot%': '',
     94       'skia_profile_enabled%': 0,
     95       'skia_win_debuggers_path%': '',
     96       'skia_shared_lib%': 0,
     97       'skia_opencl%': 0,
     98       'skia_distancefield_fonts%': 0,
     99 
    100       # These variables determine the default optimization level for different
    101       # compilers.
    102       'skia_default_vs_optimization_level': 3, # full (/Ox)
    103       'skia_default_gcc_optimization_level': 3, # -O3
    104     },
    105 
    106     'conditions': [
    107       [ 'skia_os == "win" and skia_arch_width == 32 or '
    108         'skia_os in ["linux", "freebsd", "openbsd", "solaris", "android"] or '
    109         'skia_os == "mac" and skia_arch_width == 32', {
    110         'skia_warnings_as_errors%': 1,
    111       }, {
    112         'skia_warnings_as_errors%': 0,
    113       }],
    114 
    115       # This variable allows the user to customize the optimization level used
    116       # by the compiler.  The user should be aware that this has different
    117       # meanings for different compilers and should exercise caution when
    118       # overriding it.
    119       [ 'skia_os == "win"', {
    120         'skia_release_optimization_level%': '<(skia_default_vs_optimization_level)',
    121       }, {
    122         'skia_release_optimization_level%': '<(skia_default_gcc_optimization_level)',
    123       }],
    124       [ 'skia_sanitizer', {
    125         'skia_clang_build': 1,
    126         'skia_keep_frame_pointer': 1,
    127       }, {
    128         'skia_clang_build%': 0,
    129         'skia_keep_frame_pointer%': 0,
    130       }],
    131     ],
    132 
    133     # Re-define all variables defined within the level-2 'variables' dict,
    134     # so that siblings of the level-1 'variables' dict can see them.
    135     'arm_version%': '<(arm_version)',
    136     'arm_neon%': '<(arm_neon)',
    137     'arm_neon_optional%': 0,
    138     'skia_os%': '<(skia_os)',
    139     'os_posix%': '<(os_posix)',
    140     'skia_sanitizer%': '<(skia_sanitizer)',
    141     'skia_scalar%': '<(skia_scalar)',
    142     'skia_mesa%': '<(skia_mesa)',
    143     'skia_nv_path_rendering%': '<(skia_nv_path_rendering)',
    144     'skia_stroke_path_rendering%': '<(skia_stroke_path_rendering)',
    145     'skia_android_path_rendering%': '<(skia_android_path_rendering)',
    146     'skia_resource_cache_mb_limit%': '<(skia_resource_cache_mb_limit)',
    147     'skia_resource_cache_count_limit%': '<(skia_resource_cache_count_limit)',
    148     'skia_angle%': '<(skia_angle)',
    149     'skia_arch_width%': '<(skia_arch_width)',
    150     'skia_arch_type%': '<(skia_arch_type)',
    151     'skia_chrome_utils%': '<(skia_chrome_utils)',
    152     'skia_directwrite%': '<(skia_directwrite)',
    153     'skia_gpu%': '<(skia_gpu)',
    154     'skia_win_exceptions%': 0,
    155     'skia_osx_sdkroot%': '<(skia_osx_sdkroot)',
    156     'skia_profile_enabled%': '<(skia_profile_enabled)',
    157     'skia_shared_lib%': '<(skia_shared_lib)',
    158     'skia_opencl%': '<(skia_opencl)',
    159     'skia_distancefield_fonts%': '<(skia_distancefield_fonts)',
    160     'skia_static_initializers%': '<(skia_static_initializers)',
    161     'ios_sdk_version%': '6.0',
    162     'skia_win_debuggers_path%': '<(skia_win_debuggers_path)',
    163     'skia_run_pdfviewer_in_gm%': 0,
    164 
    165     # These are referenced by our .gypi files that list files (e.g. core.gypi)
    166     #
    167     'skia_src_path%': '../src',
    168     'skia_include_path%': '../include',
    169   },
    170 }
    171