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 'variables': { # level 4 44 # We use 'skia_os' instead of 'OS' throughout our gyp files, to allow 45 # for cross-compilation (e.g. building for either MacOS or iOS on Mac). 46 # We set it automatically based on 'OS' (the host OS), but allow the 47 # user to override it via GYP_DEFINES if they like. 48 'skia_os%': '<(OS)', 49 }, 50 'skia_os%': '<(skia_os)', 51 52 'skia_android_framework%': 0, 53 'conditions' : [ 54 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "mac"]', { 55 'skia_arch_type%': 'x86_64', 56 }, { 57 'skia_arch_type%': 'x86', 58 }], 59 ], 60 'arm_version%': 0, 61 'arm_neon%': 0, 62 'skia_egl%': 0, 63 }, 64 65 # Re-define all variables defined within the level-3 'variables' dict, 66 # so that siblings of the level-2 'variables' dict can see them. 67 # (skia_os will depend on skia_android_framework.) 68 'skia_android_framework%': '<(skia_android_framework)', 69 'skia_arch_type%': '<(skia_arch_type)', 70 'arm_version%': '<(arm_version)', 71 'arm_neon%': '<(arm_neon)', 72 'skia_egl%': '<(skia_egl)', 73 74 'conditions': [ 75 [ 'skia_android_framework == 1', { 76 'skia_os%': 'android', 77 'skia_chrome_utils%': 0, 78 'skia_use_system_json%': 1, 79 }, { 80 'skia_os%': '<(skia_os)', 81 'skia_chrome_utils%': 1, 82 'skia_use_system_json%': 0, 83 }], 84 [ 'skia_os == "win"', { 85 'os_posix%': 0, 86 }, { 87 'os_posix%': 1, 88 }], 89 ['"64" in skia_arch_type', { 90 'skia_arch_width%': 64, 91 }, { 92 'skia_arch_width%': 32, 93 }], 94 [ 'skia_os == "android"', { 95 'skia_static_initializers%': 0, 96 'skia_egl%': 1, 97 }, { 98 'skia_static_initializers%': 1, 99 }], 100 [ 'skia_os == "ios"', { 101 'skia_arch_type%': 'arm', 102 'arm_version%': 7, 103 'arm_neon%': 0, # neon asm files known not to work with the ios build 104 }], 105 [ 'skia_os == "android" and not skia_android_framework', 106 # skia_freetype_static - on OS variants that normally would 107 # dynamically link the system FreeType library, don't do 108 # that; instead statically link to the version in 109 # third_party/freetype and third_party/externals/freetype. 110 { 111 'skia_freetype_static%': '1', 112 }, { 113 'skia_freetype_static%': '0', 114 } 115 ], 116 ], 117 118 # skia_no_fontconfig - On POSIX systems that would normally use the 119 # SkFontHost_fontconfig interface; use the SkFontHost_linux 120 # version instead. 121 'skia_no_fontconfig%': '0', 122 'skia_embedded_fonts%': '0', 123 124 'skia_sanitizer%': '', 125 'skia_scalar%': 'float', 126 'skia_mesa%': 0, 127 'skia_gpu_extra_dependency_path%': '', 128 'skia_stroke_path_rendering%': 0, 129 'skia_android_path_rendering%': 0, 130 'skia_resource_cache_mb_limit%': 0, 131 'skia_resource_cache_count_limit%': 0, 132 'skia_angle%': 0, 133 'skia_gdi%': 0, 134 'skia_gpu%': 1, 135 'skia_osx_deployment_target%': '', 136 'skia_profile_enabled%': 0, 137 'skia_win_debuggers_path%': '', 138 'skia_shared_lib%': 0, 139 'skia_opencl%': 0, 140 'skia_force_distance_field_text%': 0, 141 142 # These variables determine the default optimization level for different 143 # compilers. 144 'skia_default_vs_optimization_level': 3, # full (/Ox) 145 'skia_default_gcc_optimization_level': 3, # -O3 146 }, 147 148 'conditions': [ 149 [ 'skia_os in ["mac", "linux", "freebsd", "openbsd", "solaris", "android", "win"] ' 150 'and skia_android_framework == 0', { 151 'skia_warnings_as_errors%': 1, 152 }, { 153 'skia_warnings_as_errors%': 0, 154 }], 155 156 # This variable allows the user to customize the optimization level used 157 # by the compiler. The user should be aware that this has different 158 # meanings for different compilers and should exercise caution when 159 # overriding it. 160 [ 'skia_os == "win"', { 161 'skia_release_optimization_level%': '<(skia_default_vs_optimization_level)', 162 }, { 163 'skia_release_optimization_level%': '<(skia_default_gcc_optimization_level)', 164 }], 165 [ 'skia_sanitizer', { 166 'skia_clang_build': 1, 167 'skia_keep_frame_pointer': 1, 168 }, { 169 'skia_clang_build%': 0, 170 'skia_keep_frame_pointer%': 0, 171 }], 172 [ 'skia_shared_lib or skia_sanitizer or skia_os == "android"', { 173 'skia_pic%' : 1, 174 }, { 175 'skia_pic%' : 0, 176 } 177 ], 178 ], 179 180 # Re-define all variables defined within the level-2 'variables' dict, 181 # so that siblings of the level-1 'variables' dict can see them. 182 'arm_version%': '<(arm_version)', 183 'arm_neon%': '<(arm_neon)', 184 'arm_neon_optional%': 0, 185 'mips_arch_variant%': 'mips32', 186 'mips_dsp%': 0, 187 'skia_os%': '<(skia_os)', 188 'os_posix%': '<(os_posix)', 189 190 'skia_freetype_static%': '<(skia_freetype_static)', 191 'skia_no_fontconfig%': '<(skia_no_fontconfig)', 192 'skia_embedded_fonts%': '<(skia_embedded_fonts)', 193 'skia_sanitizer%': '<(skia_sanitizer)', 194 'skia_scalar%': '<(skia_scalar)', 195 'skia_mesa%': '<(skia_mesa)', 196 'skia_gpu_extra_dependency_path%': '<(skia_gpu_extra_dependency_path)', 197 'skia_stroke_path_rendering%': '<(skia_stroke_path_rendering)', 198 'skia_android_framework%': '<(skia_android_framework)', 199 'skia_use_system_json%': '<(skia_use_system_json)', 200 'skia_android_path_rendering%': '<(skia_android_path_rendering)', 201 'skia_resource_cache_mb_limit%': '<(skia_resource_cache_mb_limit)', 202 'skia_resource_cache_count_limit%': '<(skia_resource_cache_count_limit)', 203 'skia_angle%': '<(skia_angle)', 204 'skia_arch_width%': '<(skia_arch_width)', 205 'skia_arch_type%': '<(skia_arch_type)', 206 'skia_chrome_utils%': '<(skia_chrome_utils)', 207 'skia_gdi%': '<(skia_gdi)', 208 'skia_gpu%': '<(skia_gpu)', 209 'skia_win_exceptions%': 0, 210 'skia_win_ltcg%': 1, 211 'skia_osx_deployment_target%': '<(skia_osx_deployment_target)', 212 'skia_profile_enabled%': '<(skia_profile_enabled)', 213 'skia_shared_lib%': '<(skia_shared_lib)', 214 'skia_opencl%': '<(skia_opencl)', 215 'skia_force_distance_field_text%': '<(skia_force_distance_field_text)', 216 'skia_static_initializers%': '<(skia_static_initializers)', 217 'ios_sdk_version%': '6.0', 218 'skia_win_debuggers_path%': '<(skia_win_debuggers_path)', 219 'skia_run_pdfviewer_in_gm%': 0, 220 'skia_disable_inlining%': 0, 221 'skia_moz2d%': 0, 222 'skia_is_bot%': '<!(python -c "import os; print os.environ.get(\'CHROME_HEADLESS\', 0)")', 223 'skia_egl%': '<(skia_egl)', 224 'skia_fast%': 0, 225 'skia_fast_flags': [ 226 '-O3', # Even for Debug builds. 227 '-march=native', # Use all features of and optimize for THIS machine. 228 '-fomit-frame-pointer', # Sometimes an extra register is nice, and cuts a push/pop. 229 '-ffast-math', # Optimize float math even when it breaks IEEE compliance. 230 #'-flto' # Enable link-time optimization. 231 ], 232 233 # These are referenced by our .gypi files that list files (e.g. core.gypi) 234 # 235 'skia_src_path%': '../src', 236 'skia_include_path%': '../include', 237 }, 238 } 239