Upstream version 6.35.121.0
[platform/framework/web/crosswalk.git] / src / third_party / skia / gyp / common_variables.gypi
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         'skia_android_framework%': 0,
50       },
51
52       # Re-define all variables defined within the level-3 'variables' dict,
53       # so that siblings of the level-2 'variables' dict can see them.
54       # (skia_os will depend on skia_android_framework.)
55       'skia_android_framework%': '<(skia_android_framework)',
56
57       'conditions': [
58         [ 'skia_android_framework == 1', {
59           'skia_os%': 'android',
60           'skia_chrome_utils%': 0,
61         }, {
62           'skia_os%': '<(skia_os)',
63           'skia_chrome_utils%': 1,
64         }],
65         [ 'skia_os == "win"', {
66           'os_posix%': 0,
67         }, {
68           'os_posix%': 1,
69         }],
70         [ 'skia_os in ["linux", "win"]', {
71           'skia_poppler_enabled%': 1,
72         }, {
73           'skia_poppler_enabled%': 0,
74         }],
75         [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "mac"]', {
76           'skia_arch_width%': 64,
77         }, {
78           'skia_arch_width%': 32,
79         }],
80         [ 'skia_os == "android"', {
81           'skia_static_initializers%': 0,
82         }, {
83           'skia_static_initializers%': 1,
84         }],
85         [ 'skia_os == "ios"', {
86           'skia_arch_type%': 'arm',
87           'arm_version%': 7,
88           'arm_neon%': 0, # neon asm files known not to work with the ios build
89         },{ # skia_os is not ios
90           'skia_arch_type%': 'x86',
91           'arm_version%': 0,
92           'arm_neon%': 0,
93         }],
94         [ 'skia_os in ["android", "nacl"] and not skia_android_framework',
95           # skia_freetype_static - on OS variants that normally would
96           #     dynamically link the system FreeType library, don't do
97           #     that; instead statically link to the version in
98           #     third_party/freetype and third_party/externals/freetype.
99           {
100             'skia_freetype_static%': '1',
101           }, {
102             'skia_freetype_static%': '0',
103           }
104         ],
105       ],
106
107       # skia_giflib_static - on OS variants that normally would link giflib
108       #     with '-lgif' and include the headers from '/usr/include/gif_lib.h',
109       #     don't do that; instead compile and staticlly link the version of
110       #     giflib in third_party/externals/giflib.
111       'skia_giflib_static%': '0',
112
113       # skia_libpng_static - on OS variants that normally would link libpng
114       #     with '-lpng' and include the headers from '/usr/include/png.h',
115       #     don't do that; instead compile and staticlly link the version of
116       #     libpng in third_party/externals/libpng.
117       'skia_libpng_static%': '0',
118
119       # skia_zlib_static - on OS variants that normally would link zlib with
120       #     '-lz' or libz.dylib and include the headers from '<zlib.h>',
121       #     don't do that; instead compile and staticlly link the version of
122       #     zlib in third_party/externals/zlib.
123       'skia_zlib_static%': '0',
124
125       # skia_no_fontconfig - On POSIX systems that would normally use the
126       #     SkFontHost_fontconfig interface; use the SkFontHost_linux
127       #     version instead.
128       'skia_no_fontconfig%': '0',
129
130       'skia_sanitizer%': '',
131       'skia_scalar%': 'float',
132       'skia_mesa%': 0,
133       'skia_stroke_path_rendering%': 0,
134       'skia_android_path_rendering%': 0,
135       'skia_resource_cache_mb_limit%': 0,
136       'skia_resource_cache_count_limit%': 0,
137       'skia_angle%': 0,
138       'skia_directwrite%': 0,
139       'skia_gpu%': 1,
140       'skia_osx_deployment_target%': '',
141       'skia_profile_enabled%': 0,
142       'skia_win_debuggers_path%': '',
143       'skia_shared_lib%': 0,
144       'skia_opencl%': 0,
145       'skia_force_distancefield_fonts%': 0,
146
147       # These variables determine the default optimization level for different
148       # compilers.
149       'skia_default_vs_optimization_level': 3, # full (/Ox)
150       'skia_default_gcc_optimization_level': 3, # -O3
151     },
152
153     'conditions': [
154       [ 'skia_os == "win" and skia_arch_width == 32 or '
155         'skia_os in ["linux", "freebsd", "openbsd", "solaris", "android"] '
156             'and skia_android_framework == 0 or '
157         'skia_os == "mac" and skia_arch_width == 32', {
158         'skia_warnings_as_errors%': 1,
159       }, {
160         'skia_warnings_as_errors%': 0,
161       }],
162
163       # This variable allows the user to customize the optimization level used
164       # by the compiler.  The user should be aware that this has different
165       # meanings for different compilers and should exercise caution when
166       # overriding it.
167       [ 'skia_os == "win"', {
168         'skia_release_optimization_level%': '<(skia_default_vs_optimization_level)',
169       }, {
170         'skia_release_optimization_level%': '<(skia_default_gcc_optimization_level)',
171       }],
172       [ 'skia_sanitizer', {
173         'skia_clang_build': 1,
174         'skia_keep_frame_pointer': 1,
175       }, {
176         'skia_clang_build%': 0,
177         'skia_keep_frame_pointer%': 0,
178       }],
179     ],
180
181     # Re-define all variables defined within the level-2 'variables' dict,
182     # so that siblings of the level-1 'variables' dict can see them.
183     'arm_version%': '<(arm_version)',
184     'arm_neon%': '<(arm_neon)',
185     'arm_neon_optional%': 0,
186     'skia_os%': '<(skia_os)',
187     'os_posix%': '<(os_posix)',
188
189     'skia_freetype_static%': '<(skia_freetype_static)',
190     'skia_giflib_static%': '<(skia_giflib_static)',
191     'skia_libpng_static%': '<(skia_libpng_static)',
192     'skia_zlib_static%': '<(skia_zlib_static)',
193     'skia_no_fontconfig%': '<(skia_no_fontconfig)',
194     'skia_sanitizer%': '<(skia_sanitizer)',
195     'skia_scalar%': '<(skia_scalar)',
196     'skia_mesa%': '<(skia_mesa)',
197     'skia_stroke_path_rendering%': '<(skia_stroke_path_rendering)',
198     'skia_android_framework%': '<(skia_android_framework)',
199     'skia_android_path_rendering%': '<(skia_android_path_rendering)',
200     'skia_resource_cache_mb_limit%': '<(skia_resource_cache_mb_limit)',
201     'skia_resource_cache_count_limit%': '<(skia_resource_cache_count_limit)',
202     'skia_angle%': '<(skia_angle)',
203     'skia_poppler_enabled%': '<(skia_poppler_enabled)',
204     'skia_arch_width%': '<(skia_arch_width)',
205     'skia_arch_type%': '<(skia_arch_type)',
206     'skia_chrome_utils%': '<(skia_chrome_utils)',
207     'skia_directwrite%': '<(skia_directwrite)',
208     'skia_gpu%': '<(skia_gpu)',
209     'skia_win_exceptions%': 0,
210     'skia_osx_deployment_target%': '<(skia_osx_deployment_target)',
211     'skia_profile_enabled%': '<(skia_profile_enabled)',
212     'skia_shared_lib%': '<(skia_shared_lib)',
213     'skia_opencl%': '<(skia_opencl)',
214     'skia_force_distancefield_fonts%': '<(skia_force_distancefield_fonts)',
215     'skia_static_initializers%': '<(skia_static_initializers)',
216     'ios_sdk_version%': '6.0',
217     'skia_win_debuggers_path%': '<(skia_win_debuggers_path)',
218     'skia_run_pdfviewer_in_gm%': 0,
219     'skia_disable_inlining%': 0,
220
221     # These are referenced by our .gypi files that list files (e.g. core.gypi)
222     #
223     'skia_src_path%': '../src',
224     'skia_include_path%': '../include',
225   },
226 }