blob: eb58de0c88635ddc6451e68eb9cc58b991878f30 [file] [log] [blame]
epoger@google.com573e8ba2012-03-16 18:28:24 +00001# 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 ],
61
62 'skia_scalar%': 'float',
63 'skia_mesa%': 0,
64 'skia_target_arch%': 'x86',
65 },
66
67 # Re-define all variables defined within the level-2 'variables' dict,
68 # so that siblings of the level-1 'variables' dict can see them.
69 'skia_os%': '<(skia_os)',
70 'os_posix%': '<(os_posix)',
71 'skia_scalar%': '<(skia_scalar)',
72 'skia_mesa%': '<(skia_mesa)',
73 'skia_target_arch%': '<(skia_target_arch)',
74 },
75}
76# Local Variables:
77# tab-width:2
78# indent-tabs-mode:nil
79# End:
80# vim: set expandtab tabstop=2 shiftwidth=2: