blob: 23ce00a8acdc5e94dc795821fac56dea2e4bb687 [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
hendrikw10b371c2015-07-21 14:50:07 -070039 'angle_path%': '../',
epoger@google.com573e8ba2012-03-16 18:28:24 +000040 'variables': { # level 2
41
42 # Variables needed by conditions list within the level-2 variables dict.
43 'variables': { # level 3
scroggodf1c3372015-02-12 10:48:25 -080044 'variables': { # level 4
45 # We use 'skia_os' instead of 'OS' throughout our gyp files, to allow
46 # for cross-compilation (e.g. building for either MacOS or iOS on Mac).
47 # We set it automatically based on 'OS' (the host OS), but allow the
48 # user to override it via GYP_DEFINES if they like.
49 'skia_os%': '<(OS)',
50 },
51 'skia_os%': '<(skia_os)',
scroggo@google.comd4adfa32014-02-05 16:35:12 +000052
53 'skia_android_framework%': 0,
scroggodf1c3372015-02-12 10:48:25 -080054 'conditions' : [
55 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "mac"]', {
56 'skia_arch_type%': 'x86_64',
57 }, {
58 'skia_arch_type%': 'x86',
59 }],
60 ],
djsollen@google.com6ee7a092014-05-29 17:00:28 +000061 'arm_version%': 0,
62 'arm_neon%': 0,
derekf29dda802014-10-01 10:52:52 -070063 'skia_egl%': 0,
epoger@google.com573e8ba2012-03-16 18:28:24 +000064 },
65
66 # Re-define all variables defined within the level-3 'variables' dict,
67 # so that siblings of the level-2 'variables' dict can see them.
scroggo@google.comd4adfa32014-02-05 16:35:12 +000068 # (skia_os will depend on skia_android_framework.)
69 'skia_android_framework%': '<(skia_android_framework)',
commit-bot@chromium.org6f2d4d42014-04-02 15:03:56 +000070 'skia_arch_type%': '<(skia_arch_type)',
djsollen@google.com6ee7a092014-05-29 17:00:28 +000071 'arm_version%': '<(arm_version)',
72 'arm_neon%': '<(arm_neon)',
derekf29dda802014-10-01 10:52:52 -070073 'skia_egl%': '<(skia_egl)',
caryclark@google.com976298e2012-09-24 19:41:43 +000074
epoger@google.com573e8ba2012-03-16 18:28:24 +000075 'conditions': [
scroggo@google.comd4adfa32014-02-05 16:35:12 +000076 [ 'skia_android_framework == 1', {
77 'skia_os%': 'android',
commit-bot@chromium.org93f5e512014-02-17 15:22:26 +000078 'skia_chrome_utils%': 0,
borenet243406e2015-07-22 13:29:25 -070079 'skia_use_android_framework_defines%': 1,
scroggof01a6c32014-06-18 10:31:40 -070080 'skia_use_system_json%': 1,
scroggo@google.comd4adfa32014-02-05 16:35:12 +000081 }, {
82 'skia_os%': '<(skia_os)',
commit-bot@chromium.org93f5e512014-02-17 15:22:26 +000083 'skia_chrome_utils%': 1,
borenet243406e2015-07-22 13:29:25 -070084 'skia_use_android_framework_defines%': 0,
scroggof01a6c32014-06-18 10:31:40 -070085 'skia_use_system_json%': 0,
scroggo@google.comd4adfa32014-02-05 16:35:12 +000086 }],
borenet@google.comefb1d772012-10-10 19:45:51 +000087 [ 'skia_os == "win"', {
epoger@google.com573e8ba2012-03-16 18:28:24 +000088 'os_posix%': 0,
89 }, {
90 'os_posix%': 1,
91 }],
borenet@google.comefb1d772012-10-10 19:45:51 +000092 [ 'skia_os == "android"', {
borenet@google.comc2dd3d42012-09-11 21:37:28 +000093 'skia_static_initializers%': 0,
derekf29dda802014-10-01 10:52:52 -070094 'skia_egl%': 1,
borenet@google.comc2dd3d42012-09-11 21:37:28 +000095 }, {
96 'skia_static_initializers%': 1,
97 }],
borenet@google.comefb1d772012-10-10 19:45:51 +000098 [ 'skia_os == "ios"', {
99 'skia_arch_type%': 'arm',
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000100 'arm_version%': 7,
borenet@google.comefb1d772012-10-10 19:45:51 +0000101 'arm_neon%': 0, # neon asm files known not to work with the ios build
borenet@google.comefb1d772012-10-10 19:45:51 +0000102 }],
borenet48087572015-04-02 12:16:36 -0700103 [ 'skia_os == "android" and not skia_android_framework',
commit-bot@chromium.orgf84722e2014-02-24 20:22:34 +0000104 # skia_freetype_static - on OS variants that normally would
105 # dynamically link the system FreeType library, don't do
106 # that; instead statically link to the version in
107 # third_party/freetype and third_party/externals/freetype.
108 {
109 'skia_freetype_static%': '1',
110 }, {
111 'skia_freetype_static%': '0',
112 }
113 ],
epoger@google.com573e8ba2012-03-16 18:28:24 +0000114 ],
115
commit-bot@chromium.orgf84722e2014-02-24 20:22:34 +0000116 # skia_no_fontconfig - On POSIX systems that would normally use the
117 # SkFontHost_fontconfig interface; use the SkFontHost_linux
118 # version instead.
119 'skia_no_fontconfig%': '0',
bungeman5c9fa282015-03-30 12:53:48 -0700120 'skia_embedded_fonts%': '0',
commit-bot@chromium.orgf84722e2014-02-24 20:22:34 +0000121
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000122 'skia_sanitizer%': '',
epoger@google.com573e8ba2012-03-16 18:28:24 +0000123 'skia_scalar%': 'float',
124 'skia_mesa%': 0,
egdaniel86e31a12015-03-09 09:40:42 -0700125 'skia_gpu_extra_dependency_path%': '',
egdaniel4b5472b2015-08-12 06:51:08 -0700126 'skia_gpu_extra_tests_path%': '',
sugoi@google.come3453cb2013-01-07 14:26:40 +0000127 'skia_stroke_path_rendering%': 0,
jvanverth@google.com74dda902013-01-09 21:04:52 +0000128 'skia_android_path_rendering%': 0,
robertphillips@google.com4e5559a2013-10-30 17:04:16 +0000129 'skia_resource_cache_mb_limit%': 0,
130 'skia_resource_cache_count_limit%': 0,
mtkleinee2a3ea2015-02-25 08:16:19 -0800131 'skia_angle%': 0,
hendrikw885bf092015-08-27 10:38:39 -0700132 'skia_command_buffer%': 0,
Mike Klein93587062014-07-16 13:06:04 -0400133 'skia_gdi%': 0,
bsalomon@google.comcf8fb1f2012-08-02 14:03:32 +0000134 'skia_gpu%': 1,
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000135 'skia_osx_deployment_target%': '',
halcanary8ee06f22015-08-11 10:30:12 -0700136 'skia_pdf%': 1,
djsollen@google.com5afbbc42012-11-29 15:09:58 +0000137 'skia_profile_enabled%': 0,
jvanverth65bd7ae2015-08-12 12:58:13 -0700138 'skia_vulkan%': 0,
borenet@google.com663a9792013-03-08 22:22:44 +0000139 'skia_win_debuggers_path%': '',
djsollen@google.com52f02972013-06-03 12:10:19 +0000140 'skia_shared_lib%': 0,
zachr@google.comd6585682013-07-17 19:29:19 +0000141 'skia_opencl%': 0,
jvanverth4736e142014-11-07 07:12:46 -0800142 'skia_force_distance_field_text%': 0,
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000143
144 # These variables determine the default optimization level for different
145 # compilers.
146 'skia_default_vs_optimization_level': 3, # full (/Ox)
147 'skia_default_gcc_optimization_level': 3, # -O3
epoger@google.com573e8ba2012-03-16 18:28:24 +0000148 },
149
borenet@google.coma72aef82013-03-22 13:16:06 +0000150 'conditions': [
mtkleinf19ec512014-12-15 10:38:42 -0800151 [ 'skia_os in ["mac", "linux", "freebsd", "openbsd", "solaris", "android", "win"] '
152 'and skia_android_framework == 0', {
mtklein161b6de2014-12-15 09:45:00 -0800153 'skia_warnings_as_errors%': 1,
mtklein616e4512014-12-15 09:49:12 -0800154 }, {
155 'skia_warnings_as_errors%': 0,
borenet@google.coma72aef82013-03-22 13:16:06 +0000156 }],
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000157
158 # This variable allows the user to customize the optimization level used
159 # by the compiler. The user should be aware that this has different
160 # meanings for different compilers and should exercise caution when
161 # overriding it.
162 [ 'skia_os == "win"', {
163 'skia_release_optimization_level%': '<(skia_default_vs_optimization_level)',
164 }, {
165 'skia_release_optimization_level%': '<(skia_default_gcc_optimization_level)',
166 }],
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000167 [ 'skia_sanitizer', {
borenet@google.com47ae4b02013-08-21 18:02:50 +0000168 'skia_clang_build': 1,
commit-bot@chromium.org5003bde2013-10-25 18:14:54 +0000169 'skia_keep_frame_pointer': 1,
borenet@google.com47ae4b02013-08-21 18:02:50 +0000170 }, {
171 'skia_clang_build%': 0,
commit-bot@chromium.org5003bde2013-10-25 18:14:54 +0000172 'skia_keep_frame_pointer%': 0,
borenet@google.com47ae4b02013-08-21 18:02:50 +0000173 }],
scroggoc0bc9132014-07-22 12:09:30 -0700174 [ 'skia_shared_lib or skia_sanitizer or skia_os == "android"', {
175 'skia_pic%' : 1,
176 }, {
177 'skia_pic%' : 0,
178 }
179 ],
borenet@google.coma72aef82013-03-22 13:16:06 +0000180 ],
181
epoger@google.com573e8ba2012-03-16 18:28:24 +0000182 # Re-define all variables defined within the level-2 'variables' dict,
183 # so that siblings of the level-1 'variables' dict can see them.
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000184 'arm_version%': '<(arm_version)',
borenet@google.comefb1d772012-10-10 19:45:51 +0000185 'arm_neon%': '<(arm_neon)',
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000186 'arm_neon_optional%': 0,
djordje.pesutaaf1df62014-06-06 14:09:12 -0700187 'mips_arch_variant%': 'mips32',
188 'mips_dsp%': 0,
epoger@google.com573e8ba2012-03-16 18:28:24 +0000189 'skia_os%': '<(skia_os)',
190 'os_posix%': '<(os_posix)',
commit-bot@chromium.orgf84722e2014-02-24 20:22:34 +0000191
192 'skia_freetype_static%': '<(skia_freetype_static)',
commit-bot@chromium.orgf84722e2014-02-24 20:22:34 +0000193 'skia_no_fontconfig%': '<(skia_no_fontconfig)',
bungeman5c9fa282015-03-30 12:53:48 -0700194 'skia_embedded_fonts%': '<(skia_embedded_fonts)',
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000195 'skia_sanitizer%': '<(skia_sanitizer)',
epoger@google.com573e8ba2012-03-16 18:28:24 +0000196 'skia_scalar%': '<(skia_scalar)',
197 'skia_mesa%': '<(skia_mesa)',
egdaniel86e31a12015-03-09 09:40:42 -0700198 'skia_gpu_extra_dependency_path%': '<(skia_gpu_extra_dependency_path)',
egdaniel4b5472b2015-08-12 06:51:08 -0700199 'skia_gpu_extra_tests_path%': '<(skia_gpu_extra_tests_path)',
sugoi@google.come3453cb2013-01-07 14:26:40 +0000200 'skia_stroke_path_rendering%': '<(skia_stroke_path_rendering)',
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000201 'skia_android_framework%': '<(skia_android_framework)',
borenet243406e2015-07-22 13:29:25 -0700202 'skia_use_android_framework_defines%': '<(skia_use_android_framework_defines)',
scroggof01a6c32014-06-18 10:31:40 -0700203 'skia_use_system_json%': '<(skia_use_system_json)',
jvanverth@google.com74dda902013-01-09 21:04:52 +0000204 'skia_android_path_rendering%': '<(skia_android_path_rendering)',
robertphillips@google.com4e5559a2013-10-30 17:04:16 +0000205 'skia_resource_cache_mb_limit%': '<(skia_resource_cache_mb_limit)',
206 'skia_resource_cache_count_limit%': '<(skia_resource_cache_count_limit)',
robertphillips@google.com021bce92012-04-02 20:42:26 +0000207 'skia_angle%': '<(skia_angle)',
borenet@google.comefb1d772012-10-10 19:45:51 +0000208 'skia_arch_type%': '<(skia_arch_type)',
robertphillips@google.com42cc2372013-12-10 15:19:32 +0000209 'skia_chrome_utils%': '<(skia_chrome_utils)',
hendrikw885bf092015-08-27 10:38:39 -0700210 'skia_command_buffer%': '<(skia_command_buffer)',
Mike Klein720c66b2014-07-16 13:26:19 -0400211 'skia_gdi%': '<(skia_gdi)',
bsalomon@google.comcf8fb1f2012-08-02 14:03:32 +0000212 'skia_gpu%': '<(skia_gpu)',
jvanverth65bd7ae2015-08-12 12:58:13 -0700213 'skia_vulkan%': '<(skia_vulkan)',
commit-bot@chromium.org5a6c2d82013-06-14 17:10:09 +0000214 'skia_win_exceptions%': 0,
bsalomonda07a082014-06-26 12:56:28 -0700215 'skia_win_ltcg%': 1,
mtklein4abc1862015-07-14 05:52:52 -0700216 'sknx_no_simd%': 0,
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000217 'skia_osx_deployment_target%': '<(skia_osx_deployment_target)',
halcanary8ee06f22015-08-11 10:30:12 -0700218 'skia_pdf%': '<(skia_pdf)',
djsollen@google.com5afbbc42012-11-29 15:09:58 +0000219 'skia_profile_enabled%': '<(skia_profile_enabled)',
djsollen@google.com52f02972013-06-03 12:10:19 +0000220 'skia_shared_lib%': '<(skia_shared_lib)',
zachr@google.comd6585682013-07-17 19:29:19 +0000221 'skia_opencl%': '<(skia_opencl)',
jvanverth4736e142014-11-07 07:12:46 -0800222 'skia_force_distance_field_text%': '<(skia_force_distance_field_text)',
chudy@google.combbad34d2012-08-13 14:26:36 +0000223 'skia_static_initializers%': '<(skia_static_initializers)',
bsalomon@google.com46638222012-10-04 12:52:03 +0000224 'ios_sdk_version%': '6.0',
edisonn@google.com184487c2013-03-08 18:00:16 +0000225 'skia_win_debuggers_path%': '<(skia_win_debuggers_path)',
commit-bot@chromium.org35d48722014-02-13 18:36:36 +0000226 'skia_disable_inlining%': 0,
commit-bot@chromium.org199cf692014-05-08 15:29:57 +0000227 'skia_moz2d%': 0,
mtkleina7e930f2014-08-06 10:08:42 -0700228 'skia_is_bot%': '<!(python -c "import os; print os.environ.get(\'CHROME_HEADLESS\', 0)")',
derekf29dda802014-10-01 10:52:52 -0700229 'skia_egl%': '<(skia_egl)',
mtkleindee3df92015-03-26 05:30:44 -0700230 'skia_fast%': 0,
231 'skia_fast_flags': [
232 '-O3', # Even for Debug builds.
233 '-march=native', # Use all features of and optimize for THIS machine.
234 '-fomit-frame-pointer', # Sometimes an extra register is nice, and cuts a push/pop.
235 '-ffast-math', # Optimize float math even when it breaks IEEE compliance.
236 #'-flto' # Enable link-time optimization.
237 ],
chudy@google.combbad34d2012-08-13 14:26:36 +0000238
reed@google.combaa5d942012-08-08 20:39:17 +0000239 # These are referenced by our .gypi files that list files (e.g. core.gypi)
240 #
241 'skia_src_path%': '../src',
242 'skia_include_path%': '../include',
epoger@google.com573e8ba2012-03-16 18:28:24 +0000243 },
244}