blob: 7275de238ef9d548b77ee7fc76e1f366dde62ef1 [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%': '../',
yujieqin916de9f2016-01-25 08:26:16 -080040
halcanary7a76f9c2016-02-03 11:53:18 -080041 'skia_mojo%': '0',
42
epoger@google.com573e8ba2012-03-16 18:28:24 +000043 'variables': { # level 2
epoger@google.com573e8ba2012-03-16 18:28:24 +000044 # Variables needed by conditions list within the level-2 variables dict.
45 'variables': { # level 3
scroggodf1c3372015-02-12 10:48:25 -080046 'variables': { # level 4
47 # We use 'skia_os' instead of 'OS' throughout our gyp files, to allow
48 # for cross-compilation (e.g. building for either MacOS or iOS on Mac).
49 # We set it automatically based on 'OS' (the host OS), but allow the
50 # user to override it via GYP_DEFINES if they like.
51 'skia_os%': '<(OS)',
52 },
53 'skia_os%': '<(skia_os)',
bsalomon365bbff2016-02-19 14:26:30 -080054 'vulkan_merged_into_skia': '1',
scroggo@google.comd4adfa32014-02-05 16:35:12 +000055 'skia_android_framework%': 0,
yujieqin4334ff22016-04-06 06:47:15 -070056 # RAW codec needs exceptions. Due to that, it is a separate target. Its usage can be
57 # controlled by skia_codec_decodes_raw.
58 'skia_codec_decodes_raw%' : 1,
scroggodf1c3372015-02-12 10:48:25 -080059 'conditions' : [
60 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "mac"]', {
61 'skia_arch_type%': 'x86_64',
62 }, {
63 'skia_arch_type%': 'x86',
64 }],
65 ],
djsollen@google.com6ee7a092014-05-29 17:00:28 +000066 'arm_version%': 0,
67 'arm_neon%': 0,
derekf29dda802014-10-01 10:52:52 -070068 'skia_egl%': 0,
epoger@google.com573e8ba2012-03-16 18:28:24 +000069 },
70
71 # Re-define all variables defined within the level-3 'variables' dict,
72 # so that siblings of the level-2 'variables' dict can see them.
scroggo@google.comd4adfa32014-02-05 16:35:12 +000073 # (skia_os will depend on skia_android_framework.)
74 'skia_android_framework%': '<(skia_android_framework)',
scroggo1497f9f2016-02-02 11:56:33 -080075 'skia_codec_decodes_raw%': '<(skia_codec_decodes_raw)',
commit-bot@chromium.org6f2d4d42014-04-02 15:03:56 +000076 'skia_arch_type%': '<(skia_arch_type)',
djsollen@google.com6ee7a092014-05-29 17:00:28 +000077 'arm_version%': '<(arm_version)',
78 'arm_neon%': '<(arm_neon)',
derekf29dda802014-10-01 10:52:52 -070079 'skia_egl%': '<(skia_egl)',
bsalomon365bbff2016-02-19 14:26:30 -080080 'vulkan_merged_into_skia%': '<(vulkan_merged_into_skia)',
epoger@google.com573e8ba2012-03-16 18:28:24 +000081 'conditions': [
scroggo@google.comd4adfa32014-02-05 16:35:12 +000082 [ 'skia_android_framework == 1', {
83 'skia_os%': 'android',
commit-bot@chromium.org93f5e512014-02-17 15:22:26 +000084 'skia_chrome_utils%': 0,
borenet243406e2015-07-22 13:29:25 -070085 'skia_use_android_framework_defines%': 1,
scroggof01a6c32014-06-18 10:31:40 -070086 'skia_use_system_json%': 1,
scroggo@google.comd4adfa32014-02-05 16:35:12 +000087 }, {
88 'skia_os%': '<(skia_os)',
commit-bot@chromium.org93f5e512014-02-17 15:22:26 +000089 'skia_chrome_utils%': 1,
borenet243406e2015-07-22 13:29:25 -070090 'skia_use_android_framework_defines%': 0,
scroggof01a6c32014-06-18 10:31:40 -070091 'skia_use_system_json%': 0,
scroggo@google.comd4adfa32014-02-05 16:35:12 +000092 }],
borenet@google.comefb1d772012-10-10 19:45:51 +000093 [ 'skia_os == "win"', {
epoger@google.com573e8ba2012-03-16 18:28:24 +000094 'os_posix%': 0,
95 }, {
96 'os_posix%': 1,
97 }],
hendrikw6f0fdac2015-09-23 11:35:55 -070098 [ 'skia_os == "linux"', {
99 # ANGLE on linux require these two variable be defined.
100 'chromeos%': 0,
101 'use_x11%': 1,
102 }],
borenet@google.comefb1d772012-10-10 19:45:51 +0000103 [ 'skia_os == "android"', {
borenet@google.comc2dd3d42012-09-11 21:37:28 +0000104 'skia_static_initializers%': 0,
derekf29dda802014-10-01 10:52:52 -0700105 'skia_egl%': 1,
borenet@google.comc2dd3d42012-09-11 21:37:28 +0000106 }, {
107 'skia_static_initializers%': 1,
108 }],
borenet@google.comefb1d772012-10-10 19:45:51 +0000109 [ 'skia_os == "ios"', {
110 'skia_arch_type%': 'arm',
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000111 'arm_version%': 7,
borenet@google.comefb1d772012-10-10 19:45:51 +0000112 'arm_neon%': 0, # neon asm files known not to work with the ios build
borenet@google.comefb1d772012-10-10 19:45:51 +0000113 }],
borenet48087572015-04-02 12:16:36 -0700114 [ 'skia_os == "android" and not skia_android_framework',
commit-bot@chromium.orgf84722e2014-02-24 20:22:34 +0000115 # skia_freetype_static - on OS variants that normally would
116 # dynamically link the system FreeType library, don't do
117 # that; instead statically link to the version in
118 # third_party/freetype and third_party/externals/freetype.
119 {
120 'skia_freetype_static%': '1',
121 }, {
122 'skia_freetype_static%': '0',
123 }
124 ],
epoger@google.com573e8ba2012-03-16 18:28:24 +0000125 ],
126
commit-bot@chromium.orgf84722e2014-02-24 20:22:34 +0000127 # skia_no_fontconfig - On POSIX systems that would normally use the
128 # SkFontHost_fontconfig interface; use the SkFontHost_linux
129 # version instead.
130 'skia_no_fontconfig%': '0',
bungeman5c9fa282015-03-30 12:53:48 -0700131 'skia_embedded_fonts%': '0',
commit-bot@chromium.orgf84722e2014-02-24 20:22:34 +0000132
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000133 'skia_sanitizer%': '',
epoger@google.com573e8ba2012-03-16 18:28:24 +0000134 'skia_mesa%': 0,
egdaniel86e31a12015-03-09 09:40:42 -0700135 'skia_gpu_extra_dependency_path%': '',
egdaniel4b5472b2015-08-12 06:51:08 -0700136 'skia_gpu_extra_tests_path%': '',
sugoi@google.come3453cb2013-01-07 14:26:40 +0000137 'skia_stroke_path_rendering%': 0,
jvanverth@google.com74dda902013-01-09 21:04:52 +0000138 'skia_android_path_rendering%': 0,
robertphillips@google.com4e5559a2013-10-30 17:04:16 +0000139 'skia_resource_cache_mb_limit%': 0,
140 'skia_resource_cache_count_limit%': 0,
mtkleinee2a3ea2015-02-25 08:16:19 -0800141 'skia_angle%': 0,
hendrikw885bf092015-08-27 10:38:39 -0700142 'skia_command_buffer%': 0,
Mike Klein93587062014-07-16 13:06:04 -0400143 'skia_gdi%': 0,
bsalomon@google.comcf8fb1f2012-08-02 14:03:32 +0000144 'skia_gpu%': 1,
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000145 'skia_osx_deployment_target%': '',
halcanary8ee06f22015-08-11 10:30:12 -0700146 'skia_pdf%': 1,
djsollen@google.com5afbbc42012-11-29 15:09:58 +0000147 'skia_profile_enabled%': 0,
jvanverth65bd7ae2015-08-12 12:58:13 -0700148 'skia_vulkan%': 0,
borenet@google.com663a9792013-03-08 22:22:44 +0000149 'skia_win_debuggers_path%': '',
djsollen@google.com52f02972013-06-03 12:10:19 +0000150 'skia_shared_lib%': 0,
jvanverth4736e142014-11-07 07:12:46 -0800151 'skia_force_distance_field_text%': 0,
mtkleinf7c08222015-10-27 11:24:40 -0700152 'skia_is_bot%': '<!(python -c "import os; print os.environ.get(\'CHROME_HEADLESS\', 0)")',
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000153
154 # These variables determine the default optimization level for different
155 # compilers.
156 'skia_default_vs_optimization_level': 3, # full (/Ox)
157 'skia_default_gcc_optimization_level': 3, # -O3
epoger@google.com573e8ba2012-03-16 18:28:24 +0000158 },
159
borenet@google.coma72aef82013-03-22 13:16:06 +0000160 'conditions': [
mtkleinf19ec512014-12-15 10:38:42 -0800161 [ 'skia_os in ["mac", "linux", "freebsd", "openbsd", "solaris", "android", "win"] '
162 'and skia_android_framework == 0', {
mtklein161b6de2014-12-15 09:45:00 -0800163 'skia_warnings_as_errors%': 1,
mtklein616e4512014-12-15 09:49:12 -0800164 }, {
165 'skia_warnings_as_errors%': 0,
borenet@google.coma72aef82013-03-22 13:16:06 +0000166 }],
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000167
168 # This variable allows the user to customize the optimization level used
169 # by the compiler. The user should be aware that this has different
170 # meanings for different compilers and should exercise caution when
171 # overriding it.
172 [ 'skia_os == "win"', {
173 'skia_release_optimization_level%': '<(skia_default_vs_optimization_level)',
174 }, {
175 'skia_release_optimization_level%': '<(skia_default_gcc_optimization_level)',
176 }],
hendrikw6f0fdac2015-09-23 11:35:55 -0700177 [ 'skia_os == "linux"', {
178 # ANGLE on linux require these two variable be defined.
179 'chromeos%': 0,
180 'use_x11%': 1,
181 }],
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000182 [ 'skia_sanitizer', {
borenet@google.com47ae4b02013-08-21 18:02:50 +0000183 'skia_clang_build': 1,
commit-bot@chromium.org5003bde2013-10-25 18:14:54 +0000184 'skia_keep_frame_pointer': 1,
borenet@google.com47ae4b02013-08-21 18:02:50 +0000185 }, {
186 'skia_clang_build%': 0,
commit-bot@chromium.org5003bde2013-10-25 18:14:54 +0000187 'skia_keep_frame_pointer%': 0,
borenet@google.com47ae4b02013-08-21 18:02:50 +0000188 }],
hendrikwb1ac52f2015-10-01 18:29:34 -0700189 [ 'skia_shared_lib or skia_sanitizer or skia_os == "android" or (skia_os == "linux" and (skia_angle == 1 or skia_command_buffer == 1))', {
scroggoc0bc9132014-07-22 12:09:30 -0700190 'skia_pic%' : 1,
191 }, {
192 'skia_pic%' : 0,
193 }
194 ],
borenet@google.coma72aef82013-03-22 13:16:06 +0000195 ],
196
epoger@google.com573e8ba2012-03-16 18:28:24 +0000197 # Re-define all variables defined within the level-2 'variables' dict,
198 # so that siblings of the level-1 'variables' dict can see them.
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000199 'arm_version%': '<(arm_version)',
borenet@google.comefb1d772012-10-10 19:45:51 +0000200 'arm_neon%': '<(arm_neon)',
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000201 'arm_neon_optional%': 0,
djordje.pesutaaf1df62014-06-06 14:09:12 -0700202 'mips_arch_variant%': 'mips32',
203 'mips_dsp%': 0,
epoger@google.com573e8ba2012-03-16 18:28:24 +0000204 'skia_os%': '<(skia_os)',
205 'os_posix%': '<(os_posix)',
commit-bot@chromium.orgf84722e2014-02-24 20:22:34 +0000206
207 'skia_freetype_static%': '<(skia_freetype_static)',
commit-bot@chromium.orgf84722e2014-02-24 20:22:34 +0000208 'skia_no_fontconfig%': '<(skia_no_fontconfig)',
bungeman5c9fa282015-03-30 12:53:48 -0700209 'skia_embedded_fonts%': '<(skia_embedded_fonts)',
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000210 'skia_sanitizer%': '<(skia_sanitizer)',
mtkleinbb5b77d2015-12-08 14:26:17 -0800211 'skia_sanitizer_blacklist%':
212 '<!(python -c "import sys; import os; print os.path.abspath(sys.argv[1])" ../tools/xsan.blacklist)',
epoger@google.com573e8ba2012-03-16 18:28:24 +0000213 'skia_mesa%': '<(skia_mesa)',
egdaniel86e31a12015-03-09 09:40:42 -0700214 'skia_gpu_extra_dependency_path%': '<(skia_gpu_extra_dependency_path)',
egdaniel4b5472b2015-08-12 06:51:08 -0700215 'skia_gpu_extra_tests_path%': '<(skia_gpu_extra_tests_path)',
sugoi@google.come3453cb2013-01-07 14:26:40 +0000216 'skia_stroke_path_rendering%': '<(skia_stroke_path_rendering)',
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000217 'skia_android_framework%': '<(skia_android_framework)',
scroggo1497f9f2016-02-02 11:56:33 -0800218 'skia_codec_decodes_raw%': '<(skia_codec_decodes_raw)',
borenet243406e2015-07-22 13:29:25 -0700219 'skia_use_android_framework_defines%': '<(skia_use_android_framework_defines)',
scroggof01a6c32014-06-18 10:31:40 -0700220 'skia_use_system_json%': '<(skia_use_system_json)',
jvanverth@google.com74dda902013-01-09 21:04:52 +0000221 'skia_android_path_rendering%': '<(skia_android_path_rendering)',
robertphillips@google.com4e5559a2013-10-30 17:04:16 +0000222 'skia_resource_cache_mb_limit%': '<(skia_resource_cache_mb_limit)',
223 'skia_resource_cache_count_limit%': '<(skia_resource_cache_count_limit)',
robertphillips@google.com021bce92012-04-02 20:42:26 +0000224 'skia_angle%': '<(skia_angle)',
borenet@google.comefb1d772012-10-10 19:45:51 +0000225 'skia_arch_type%': '<(skia_arch_type)',
robertphillips@google.com42cc2372013-12-10 15:19:32 +0000226 'skia_chrome_utils%': '<(skia_chrome_utils)',
hendrikw885bf092015-08-27 10:38:39 -0700227 'skia_command_buffer%': '<(skia_command_buffer)',
Mike Klein720c66b2014-07-16 13:26:19 -0400228 'skia_gdi%': '<(skia_gdi)',
bsalomon@google.comcf8fb1f2012-08-02 14:03:32 +0000229 'skia_gpu%': '<(skia_gpu)',
jvanverth65bd7ae2015-08-12 12:58:13 -0700230 'skia_vulkan%': '<(skia_vulkan)',
commit-bot@chromium.org5a6c2d82013-06-14 17:10:09 +0000231 'skia_win_exceptions%': 0,
mtkleinf7c08222015-10-27 11:24:40 -0700232 'skia_win_ltcg%': '<(skia_is_bot)',
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000233 'skia_osx_deployment_target%': '<(skia_osx_deployment_target)',
halcanary8ee06f22015-08-11 10:30:12 -0700234 'skia_pdf%': '<(skia_pdf)',
halcanary34422612015-10-12 10:11:18 -0700235 'skia_pdf_generate_pdfa%': 0, # emit larger PDF/A-2b file
djsollen@google.com5afbbc42012-11-29 15:09:58 +0000236 'skia_profile_enabled%': '<(skia_profile_enabled)',
djsollen@google.com52f02972013-06-03 12:10:19 +0000237 'skia_shared_lib%': '<(skia_shared_lib)',
jvanverth4736e142014-11-07 07:12:46 -0800238 'skia_force_distance_field_text%': '<(skia_force_distance_field_text)',
chudy@google.combbad34d2012-08-13 14:26:36 +0000239 'skia_static_initializers%': '<(skia_static_initializers)',
bsalomon@google.com46638222012-10-04 12:52:03 +0000240 'ios_sdk_version%': '6.0',
edisonn@google.com184487c2013-03-08 18:00:16 +0000241 'skia_win_debuggers_path%': '<(skia_win_debuggers_path)',
commit-bot@chromium.org35d48722014-02-13 18:36:36 +0000242 'skia_disable_inlining%': 0,
commit-bot@chromium.org199cf692014-05-08 15:29:57 +0000243 'skia_moz2d%': 0,
mtkleinf7c08222015-10-27 11:24:40 -0700244 'skia_is_bot%': '<(skia_is_bot)',
derekf29dda802014-10-01 10:52:52 -0700245 'skia_egl%': '<(skia_egl)',
joshualitt474a9ea2015-11-05 11:49:35 -0800246 'skia_use_sdl%': 0,
mtkleindee3df92015-03-26 05:30:44 -0700247 'skia_fast%': 0,
joshualittf16f88b2015-12-02 13:00:37 -0800248 'skia_dump_stats%': 0,
bsalomon365bbff2016-02-19 14:26:30 -0800249 'vulkan_merged_into_skia%': '<(vulkan_merged_into_skia)',
mtkleindee3df92015-03-26 05:30:44 -0700250 'skia_fast_flags': [
251 '-O3', # Even for Debug builds.
252 '-march=native', # Use all features of and optimize for THIS machine.
253 '-fomit-frame-pointer', # Sometimes an extra register is nice, and cuts a push/pop.
mtklein6f659572016-02-16 06:42:51 -0800254 #'-ffast-math', # Optimize float math even when it breaks IEEE compliance.
mtkleindee3df92015-03-26 05:30:44 -0700255 #'-flto' # Enable link-time optimization.
256 ],
chudy@google.combbad34d2012-08-13 14:26:36 +0000257
reed@google.combaa5d942012-08-08 20:39:17 +0000258 # These are referenced by our .gypi files that list files (e.g. core.gypi)
259 #
260 'skia_src_path%': '../src',
261 'skia_include_path%': '../include',
epoger@google.com573e8ba2012-03-16 18:28:24 +0000262 },
263}