James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 1 | # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | import("//build/config/features.gni") |
| 6 | import("//build/config/ui.gni") |
James Robinson | 5e66a79 | 2015-01-21 17:02:08 -0800 | [diff] [blame] | 7 | import("//testing/test.gni") |
Jeff Brown | a3a75ea | 2015-12-10 14:04:42 -0800 | [diff] [blame] | 8 | if (current_cpu == "arm" || current_cpu == "arm64") { |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 9 | import("//build/config/arm.gni") |
| 10 | } |
Alhaad Gokhale | 4f51307 | 2015-03-24 10:49:34 -0700 | [diff] [blame] | 11 | if (current_cpu == "mipsel" || current_cpu == "mips64el") { |
| 12 | import("//build/config/mips.gni") |
| 13 | } |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 14 | |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 15 | # The list of Skia defines that are to be set for chromium. |
James Robinson | 447ca5e | 2014-12-03 17:32:51 -0800 | [diff] [blame] | 16 | gypi_skia_defines = |
| 17 | exec_script("//build/gypi_to_gn.py", |
| 18 | [ |
| 19 | rebase_path( |
| 20 | "//third_party/skia/gyp/skia_for_chromium_defines.gypi"), |
| 21 | "--replace=<(skia_include_path)=//third_party/skia/include", |
| 22 | "--replace=<(skia_src_path)=//third_party/skia/src", |
| 23 | ], |
| 24 | "scope", |
| 25 | [ "//third_party/skia/gyp/skia_for_chromium_defines.gypi" ]) |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 26 | |
| 27 | # The list of Skia core sources that are to be set for chromium. |
James Robinson | 447ca5e | 2014-12-03 17:32:51 -0800 | [diff] [blame] | 28 | gypi_skia_core = |
| 29 | exec_script("//build/gypi_to_gn.py", |
| 30 | [ |
| 31 | rebase_path("//third_party/skia/gyp/core.gypi"), |
| 32 | "--replace=<(skia_include_path)=//third_party/skia/include", |
| 33 | "--replace=<(skia_src_path)=//third_party/skia/src", |
| 34 | ], |
| 35 | "scope", |
| 36 | [ "//third_party/skia/gyp/core.gypi" ]) |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 37 | |
| 38 | # The list of Skia gpu sources that are to be set for chromium. |
Chinmay Garde | 67a4363 | 2015-06-10 16:13:31 -0700 | [diff] [blame] | 39 | gypi_skia_gpu = |
| 40 | exec_script("//build/gypi_to_gn.py", |
| 41 | [ |
| 42 | rebase_path("//third_party/skia/gyp/gpu.gypi"), |
| 43 | "--replace=<(skia_include_path)=//third_party/skia/include", |
| 44 | "--replace=<(skia_src_path)=//third_party/skia/src", |
| 45 | ], |
| 46 | "scope", |
| 47 | [ "//third_party/skia/gyp/gpu.gypi" ]) |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 48 | |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 49 | # The list of Skia effects that are to be set for chromium. |
James Robinson | 447ca5e | 2014-12-03 17:32:51 -0800 | [diff] [blame] | 50 | gypi_skia_effects = |
| 51 | exec_script("//build/gypi_to_gn.py", |
| 52 | [ |
| 53 | rebase_path("//third_party/skia/gyp/effects.gypi"), |
| 54 | "--replace=<(skia_include_path)=//third_party/skia/include", |
| 55 | "--replace=<(skia_src_path)=//third_party/skia/src", |
| 56 | ], |
| 57 | "scope", |
| 58 | [ "//third_party/skia/gyp/effects.gypi" ]) |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 59 | |
Benjamin Lerman | cdfc88d | 2015-02-03 14:35:12 +0100 | [diff] [blame] | 60 | # The list of Skia utils that are to be set for chromium. |
James Robinson | 447ca5e | 2014-12-03 17:32:51 -0800 | [diff] [blame] | 61 | gypi_skia_utils = |
| 62 | exec_script("//build/gypi_to_gn.py", |
| 63 | [ |
| 64 | rebase_path("//third_party/skia/gyp/utils.gypi"), |
| 65 | "--replace=<(skia_include_path)=//third_party/skia/include", |
| 66 | "--replace=<(skia_src_path)=//third_party/skia/src", |
| 67 | ], |
| 68 | "scope", |
| 69 | [ "//third_party/skia/gyp/utils.gypi" ]) |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 70 | |
Benjamin Lerman | cdfc88d | 2015-02-03 14:35:12 +0100 | [diff] [blame] | 71 | gypi_skia_opts = |
| 72 | exec_script("//build/gypi_to_gn.py", |
| 73 | [ |
| 74 | rebase_path("//third_party/skia/gyp/opts.gypi"), |
| 75 | "--replace=<(skia_include_path)=//third_party/skia/include", |
| 76 | "--replace=<(skia_src_path)=//third_party/skia/src", |
| 77 | ], |
| 78 | "scope", |
| 79 | [ "//third_party/skia/gyp/opts.gypi" ]) |
| 80 | |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 81 | # External-facing config for dependent code. |
| 82 | config("skia_config") { |
| 83 | include_dirs = [ |
| 84 | "config", |
| 85 | "ext", |
James Robinson | 6165015 | 2014-10-26 23:24:55 -0700 | [diff] [blame] | 86 | "//third_party/skia/include/c", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 87 | "//third_party/skia/include/config", |
| 88 | "//third_party/skia/include/core", |
| 89 | "//third_party/skia/include/effects", |
| 90 | "//third_party/skia/include/images", |
| 91 | "//third_party/skia/include/lazy", |
| 92 | "//third_party/skia/include/pathops", |
| 93 | "//third_party/skia/include/pdf", |
| 94 | "//third_party/skia/include/pipe", |
| 95 | "//third_party/skia/include/ports", |
| 96 | "//third_party/skia/include/utils", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 97 | ] |
| 98 | |
| 99 | defines = gypi_skia_defines.skia_for_chromium_defines |
| 100 | |
Jeff Brown | a3a75ea | 2015-12-10 14:04:42 -0800 | [diff] [blame] | 101 | defines += [ "SK_SUPPORT_LEGACY_SHADERBITMAPTYPE" ] |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 102 | |
| 103 | if (component_mode == "shared_library") { |
Nick Bray | 0bcbd3b | 2015-03-12 16:29:36 -0700 | [diff] [blame] | 104 | defines += [ |
| 105 | "SKIA_DLL", |
| 106 | "GR_GL_IGNORE_ES3_MSAA=0", |
| 107 | ] |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 108 | } |
| 109 | |
Chinmay Garde | 67a4363 | 2015-06-10 16:13:31 -0700 | [diff] [blame] | 110 | include_dirs += [ |
| 111 | "//third_party/skia/include/gpu", |
| 112 | "//third_party/skia/src/gpu", |
| 113 | ] |
| 114 | defines += [ "SK_SUPPORT_GPU=1" ] |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 115 | |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 116 | if (is_android) { |
| 117 | defines += [ |
| 118 | "SK_BUILD_FOR_ANDROID", |
| 119 | "USE_CHROMIUM_SKIA", |
| 120 | ] |
| 121 | } |
| 122 | |
| 123 | if (is_mac) { |
| 124 | defines += [ "SK_BUILD_FOR_MAC" ] |
James Robinson | 5668be0 | 2015-12-11 15:31:17 -0800 | [diff] [blame] | 125 | } else if (is_ios) { |
Chinmay Garde | 67a4363 | 2015-06-10 16:13:31 -0700 | [diff] [blame] | 126 | defines += [ "SK_BUILD_FOR_IOS" ] |
James Robinson | 5668be0 | 2015-12-11 15:31:17 -0800 | [diff] [blame] | 127 | } else { |
| 128 | defines += [ "SK_BUILD_FOR_UNIX" ] |
Chinmay Garde | 67a4363 | 2015-06-10 16:13:31 -0700 | [diff] [blame] | 129 | } |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 130 | } |
| 131 | |
| 132 | # Internal-facing config for Skia library code. |
| 133 | config("skia_library_config") { |
| 134 | # These include directories are only included for Skia code and are not |
| 135 | # exported to dependents. It's not clear if this is on purpose, but this |
| 136 | # matches the GYP build. |
Etienne Membrives | 386015a | 2015-02-19 17:27:12 +0100 | [diff] [blame] | 137 | include_dirs = [ |
Jeff Brown | a3a75ea | 2015-12-10 14:04:42 -0800 | [diff] [blame] | 138 | "//third_party/skia/include/private", |
Nick Bray | 0bcbd3b | 2015-03-12 16:29:36 -0700 | [diff] [blame] | 139 | "//third_party/skia/src/core", |
Etienne Membrives | 386015a | 2015-02-19 17:27:12 +0100 | [diff] [blame] | 140 | "//third_party/skia/src/image", |
| 141 | "//third_party/skia/src/opts", |
| 142 | "//third_party/skia/src/pdf", |
| 143 | "//third_party/skia/src/ports", |
| 144 | "//third_party/skia/src/sfnt", |
| 145 | "//third_party/skia/src/utils", |
| 146 | "//third_party/skia/src/lazy", |
| 147 | ] |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 148 | if (is_mac || is_ios) { |
| 149 | include_dirs += [ "//third_party/skia/include/utils/mac" ] |
| 150 | } |
| 151 | if (is_mac) { |
| 152 | include_dirs += [ "//third_party/skia/include/utils/ios" ] |
| 153 | } |
| 154 | |
Etienne Membrives | 386015a | 2015-02-19 17:27:12 +0100 | [diff] [blame] | 155 | defines = [] |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 156 | |
| 157 | if (component_mode == "shared_library") { |
| 158 | defines += [ "SKIA_IMPLEMENTATION=1" ] |
| 159 | } |
| 160 | |
Benjamin Lerman | e8ca9b7 | 2015-02-24 16:42:13 +0100 | [diff] [blame] | 161 | if (current_cpu == "arm") { |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 162 | if (arm_use_neon) { |
| 163 | defines += [ "SK_ARM_HAS_NEON" ] |
| 164 | } |
| 165 | if (arm_optionally_use_neon) { |
| 166 | defines += [ "SK_ARM_HAS_OPTIONAL_NEON" ] |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | # Settings for text blitting, chosen to approximate the system browser. |
| 171 | if (is_linux) { |
| 172 | defines += [ |
| 173 | "SK_GAMMA_EXPONENT=1.2", |
| 174 | "SK_GAMMA_CONTRAST=0.2", |
| 175 | "SK_HIGH_QUALITY_IS_LANCZOS", |
| 176 | ] |
| 177 | } else if (is_android) { |
| 178 | defines += [ |
| 179 | "SK_GAMMA_APPLY_TO_A8", |
| 180 | "SK_GAMMA_EXPONENT=1.4", |
| 181 | "SK_GAMMA_CONTRAST=0.0", |
| 182 | ] |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 183 | } else if (is_mac) { |
| 184 | defines += [ |
| 185 | "SK_GAMMA_SRGB", |
| 186 | "SK_GAMMA_CONTRAST=0.0", |
| 187 | "SK_HIGH_QUALITY_IS_LANCZOS", |
| 188 | ] |
| 189 | } |
| 190 | |
| 191 | if (is_android) { |
| 192 | defines += [ |
| 193 | # Android devices are typically more memory constrained, so default to a |
| 194 | # smaller glyph cache (it may be overriden at runtime when the renderer |
| 195 | # starts up, depending on the actual device memory). |
James Robinson | 447ca5e | 2014-12-03 17:32:51 -0800 | [diff] [blame] | 196 | "SK_DEFAULT_FONT_CACHE_LIMIT=1048576", # 1024 * 1024 |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 197 | ] |
| 198 | } else { |
| 199 | defines += [ "SK_DEFAULT_FONT_CACHE_LIMIT=20971520" ] # 20 * 1024 * 1024 |
| 200 | } |
| 201 | |
Jeff Brown | a3a75ea | 2015-12-10 14:04:42 -0800 | [diff] [blame] | 202 | if (is_ios) { |
Chinmay Garde | 67a4363 | 2015-06-10 16:13:31 -0700 | [diff] [blame] | 203 | cflags = [ |
| 204 | # Skia uses routines deprecated in iOS 7 and above |
| 205 | "-Wno-deprecated-declarations", |
| 206 | ] |
| 207 | |
| 208 | libs = [ "ImageIO.framework" ] |
| 209 | } |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 210 | } |
| 211 | |
| 212 | component("skia") { |
| 213 | sources = [ |
| 214 | # Chrome sources. |
| 215 | "config/SkUserConfig.h", |
Dave Moore | cc0e4f9 | 2015-03-10 15:23:04 -0700 | [diff] [blame] | 216 | "ext/SkDiscardableMemory_chrome.cc", |
| 217 | "ext/SkDiscardableMemory_chrome.h", |
| 218 | "ext/SkMemory_new_handler.cpp", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 219 | "ext/bitmap_platform_device.h", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 220 | "ext/event_tracer_impl.cc", |
| 221 | "ext/event_tracer_impl.h", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 222 | "ext/google_logging.cc", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 223 | "ext/opacity_draw_filter.cc", |
| 224 | "ext/opacity_draw_filter.h", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 225 | "ext/platform_canvas.cc", |
| 226 | "ext/platform_canvas.h", |
| 227 | "ext/platform_device.cc", |
| 228 | "ext/platform_device.h", |
| 229 | "ext/platform_device_linux.cc", |
| 230 | "ext/platform_device_mac.cc", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 231 | "ext/refptr.h", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 232 | "ext/skia_utils_base.cc", |
| 233 | "ext/skia_utils_base.h", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 234 | "ext/skia_utils_ios.h", |
Dave Moore | cc0e4f9 | 2015-03-10 15:23:04 -0700 | [diff] [blame] | 235 | "ext/skia_utils_ios.mm", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 236 | "ext/skia_utils_mac.h", |
Dave Moore | cc0e4f9 | 2015-03-10 15:23:04 -0700 | [diff] [blame] | 237 | "ext/skia_utils_mac.mm", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 238 | ] |
| 239 | |
| 240 | # The skia gypi values are relative to the skia_dir, so we need to rebase. |
| 241 | sources += gypi_skia_core.sources |
| 242 | sources += gypi_skia_effects.sources |
| 243 | sources += gypi_skia_utils.sources |
Viet-Trung Luu | af1033f | 2015-12-11 17:07:02 -0800 | [diff] [blame] | 244 | |
| 245 | sources += [ |
| 246 | "//third_party/skia/include/images/SkMovie.h", |
| 247 | "//third_party/skia/include/images/SkPageFlipper.h", |
| 248 | "//third_party/skia/include/ports/SkTypeface_win.h", |
| 249 | "//third_party/skia/src/fonts/SkFontMgr_indirect.cpp", |
| 250 | "//third_party/skia/src/fonts/SkRemotableFontMgr.cpp", |
| 251 | "//third_party/skia/src/images/SkScaledBitmapSampler.cpp", |
| 252 | "//third_party/skia/src/images/SkScaledBitmapSampler.h", |
| 253 | "//third_party/skia/src/ports/SkFontHost_FreeType.cpp", |
| 254 | "//third_party/skia/src/ports/SkFontHost_FreeType_common.cpp", |
| 255 | "//third_party/skia/src/ports/SkFontHost_FreeType_common.h", |
| 256 | "//third_party/skia/src/ports/SkFontHost_mac.cpp", |
| 257 | "//third_party/skia/src/ports/SkFontHost_win.cpp", |
| 258 | "//third_party/skia/src/ports/SkFontMgr_android.cpp", |
| 259 | "//third_party/skia/src/ports/SkFontMgr_android_factory.cpp", |
| 260 | "//third_party/skia/src/ports/SkFontMgr_android_parser.cpp", |
| 261 | "//third_party/skia/src/ports/SkFontMgr_win_dw.cpp", |
| 262 | "//third_party/skia/src/ports/SkGlobalInitialization_chromium.cpp", |
| 263 | "//third_party/skia/src/ports/SkImageDecoder_empty.cpp", |
| 264 | "//third_party/skia/src/ports/SkImageGenerator_none.cpp", |
| 265 | "//third_party/skia/src/ports/SkOSFile_posix.cpp", |
| 266 | "//third_party/skia/src/ports/SkOSFile_stdio.cpp", |
| 267 | "//third_party/skia/src/ports/SkOSFile_win.cpp", |
| 268 | "//third_party/skia/src/ports/SkRemotableFontMgr_win_dw.cpp", |
| 269 | "//third_party/skia/src/ports/SkScalerContext_win_dw.cpp", |
| 270 | "//third_party/skia/src/ports/SkScalerContext_win_dw.h", |
| 271 | "//third_party/skia/src/ports/SkTLS_pthread.cpp", |
| 272 | "//third_party/skia/src/ports/SkTLS_win.cpp", |
| 273 | "//third_party/skia/src/ports/SkTime_Unix.cpp", |
| 274 | "//third_party/skia/src/ports/SkTypeface_win_dw.cpp", |
| 275 | "//third_party/skia/src/ports/SkTypeface_win_dw.h", |
| 276 | "//third_party/skia/src/sfnt/SkOTTable_name.cpp", |
| 277 | "//third_party/skia/src/sfnt/SkOTTable_name.h", |
| 278 | "//third_party/skia/src/sfnt/SkOTUtils.cpp", |
| 279 | "//third_party/skia/src/sfnt/SkOTUtils.h", |
| 280 | "//third_party/skia/src/utils/mac/SkStream_mac.cpp", |
| 281 | ] |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 282 | |
Benjamin Lerman | e8ca9b7 | 2015-02-24 16:42:13 +0100 | [diff] [blame] | 283 | # This and skia_opts are really the same conceptual target so share headers. |
| 284 | allow_circular_includes_from = [ ":skia_opts" ] |
| 285 | |
| 286 | if (current_cpu == "arm") { |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 287 | sources += [ |
| 288 | "//third_party/skia/src/core/SkUtilsArm.cpp", |
| 289 | "//third_party/skia/src/core/SkUtilsArm.h", |
| 290 | ] |
| 291 | } |
| 292 | |
| 293 | # GPU |
Chinmay Garde | 67a4363 | 2015-06-10 16:13:31 -0700 | [diff] [blame] | 294 | |
| 295 | sources += gypi_skia_gpu.skgpu_sources |
| 296 | sources += gypi_skia_gpu.skgpu_null_gl_sources |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 297 | |
Viet-Trung Luu | af1033f | 2015-12-11 17:07:02 -0800 | [diff] [blame] | 298 | # Remove unused files from utils. |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 299 | sources -= [ |
James Robinson | 447ca5e | 2014-12-03 17:32:51 -0800 | [diff] [blame] | 300 | "//third_party/skia/include/utils/SkBoundaryPatch.h", |
James Robinson | 447ca5e | 2014-12-03 17:32:51 -0800 | [diff] [blame] | 301 | "//third_party/skia/include/utils/SkCamera.h", |
| 302 | "//third_party/skia/include/utils/SkCanvasStateUtils.h", |
| 303 | "//third_party/skia/include/utils/SkCubicInterval.h", |
| 304 | "//third_party/skia/include/utils/SkCullPoints.h", |
| 305 | "//third_party/skia/include/utils/SkDebugUtils.h", |
| 306 | "//third_party/skia/include/utils/SkDumpCanvas.h", |
| 307 | "//third_party/skia/include/utils/SkEventTracer.h", |
Dave Moore | cc0e4f9 | 2015-03-10 15:23:04 -0700 | [diff] [blame] | 308 | "//third_party/skia/include/utils/SkFrontBufferedStream.h", |
James Robinson | 447ca5e | 2014-12-03 17:32:51 -0800 | [diff] [blame] | 309 | "//third_party/skia/include/utils/SkInterpolator.h", |
| 310 | "//third_party/skia/include/utils/SkLayer.h", |
| 311 | "//third_party/skia/include/utils/SkMeshUtils.h", |
| 312 | "//third_party/skia/include/utils/SkNinePatch.h", |
James Robinson | 447ca5e | 2014-12-03 17:32:51 -0800 | [diff] [blame] | 313 | "//third_party/skia/include/utils/SkParsePaint.h", |
| 314 | "//third_party/skia/include/utils/SkParsePath.h", |
| 315 | "//third_party/skia/include/utils/SkRandom.h", |
| 316 | "//third_party/skia/src/utils/SkBitmapHasher.cpp", |
| 317 | "//third_party/skia/src/utils/SkBitmapHasher.h", |
| 318 | "//third_party/skia/src/utils/SkBoundaryPatch.cpp", |
James Robinson | 447ca5e | 2014-12-03 17:32:51 -0800 | [diff] [blame] | 319 | "//third_party/skia/src/utils/SkCamera.cpp", |
| 320 | "//third_party/skia/src/utils/SkCanvasStack.h", |
| 321 | "//third_party/skia/src/utils/SkCubicInterval.cpp", |
| 322 | "//third_party/skia/src/utils/SkCullPoints.cpp", |
| 323 | "//third_party/skia/src/utils/SkDumpCanvas.cpp", |
| 324 | "//third_party/skia/src/utils/SkFloatUtils.h", |
Dave Moore | cc0e4f9 | 2015-03-10 15:23:04 -0700 | [diff] [blame] | 325 | "//third_party/skia/src/utils/SkFrontBufferedStream.cpp", |
James Robinson | 447ca5e | 2014-12-03 17:32:51 -0800 | [diff] [blame] | 326 | "//third_party/skia/src/utils/SkInterpolator.cpp", |
| 327 | "//third_party/skia/src/utils/SkLayer.cpp", |
| 328 | "//third_party/skia/src/utils/SkMD5.cpp", |
| 329 | "//third_party/skia/src/utils/SkMD5.h", |
| 330 | "//third_party/skia/src/utils/SkMeshUtils.cpp", |
| 331 | "//third_party/skia/src/utils/SkNinePatch.cpp", |
James Robinson | 447ca5e | 2014-12-03 17:32:51 -0800 | [diff] [blame] | 332 | "//third_party/skia/src/utils/SkParsePath.cpp", |
James Robinson | 447ca5e | 2014-12-03 17:32:51 -0800 | [diff] [blame] | 333 | "//third_party/skia/src/utils/SkSHA1.cpp", |
| 334 | "//third_party/skia/src/utils/SkSHA1.h", |
| 335 | "//third_party/skia/src/utils/SkTFitsIn.h", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 336 | ] |
| 337 | |
Jeff Brown | a3a75ea | 2015-12-10 14:04:42 -0800 | [diff] [blame] | 338 | if (is_ios || is_mac || is_android) { |
| 339 | sources -= |
| 340 | [ "//third_party/skia/src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ] |
| 341 | |
| 342 | set_sources_assignment_filter([]) |
| 343 | |
| 344 | if (is_ios) { |
| 345 | sources += [ "//third_party/skia/src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp" ] |
| 346 | } else if (is_mac) { |
| 347 | sources += [ "//third_party/skia/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ] |
| 348 | } else if (is_android) { |
| 349 | sources += [ "//third_party/skia/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ] |
| 350 | } |
| 351 | |
| 352 | set_sources_assignment_filter(sources_assignment_filter) |
| 353 | } |
| 354 | |
Chinmay Garde | 67a4363 | 2015-06-10 16:13:31 -0700 | [diff] [blame] | 355 | if (is_ios) { |
| 356 | set_sources_assignment_filter([]) |
| 357 | |
| 358 | sources += [ |
| 359 | "//third_party/skia/src/utils/mac/SkCreateCGImageRef.cpp", |
| 360 | "//third_party/skia/src/utils/mac/SkStream_mac.cpp", |
| 361 | ] |
| 362 | |
| 363 | set_sources_assignment_filter(sources_assignment_filter) |
| 364 | } |
| 365 | |
Viet-Trung Luu | 76c5853 | 2015-12-11 09:02:38 -0800 | [diff] [blame] | 366 | if (is_android) { |
James Robinson | 447ca5e | 2014-12-03 17:32:51 -0800 | [diff] [blame] | 367 | sources -= [ "ext/skia_utils_base.cc" ] |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 368 | } |
| 369 | |
| 370 | # Fixup skia library sources. |
James Robinson | 9498ce0 | 2015-12-11 15:45:36 -0800 | [diff] [blame] | 371 | sources -= [ |
| 372 | "//third_party/skia/src/ports/SkFontHost_win.cpp", |
| 373 | "//third_party/skia/src/ports/SkFontMgr_win_dw.cpp", |
| 374 | "//third_party/skia/src/ports/SkOSFile_win.cpp", |
| 375 | "//third_party/skia/src/ports/SkRemotableFontMgr_win_dw.cpp", |
| 376 | "//third_party/skia/src/ports/SkScalerContext_win_dw.cpp", |
| 377 | "//third_party/skia/src/ports/SkScalerContext_win_dw.h", |
| 378 | "//third_party/skia/src/ports/SkTLS_win.cpp", |
| 379 | "//third_party/skia/src/ports/SkTypeface_win_dw.cpp", |
| 380 | "//third_party/skia/src/ports/SkTypeface_win_dw.h", |
| 381 | "//third_party/skia/src/utils/SkThreadUtils_win.cpp", |
| 382 | ] |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 383 | if (!is_android) { |
| 384 | sources -= [ |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 385 | "//third_party/skia/src/ports/SkFontMgr_android.cpp", |
Adam Barth | 823f640 | 2015-07-13 12:54:08 -0700 | [diff] [blame] | 386 | "//third_party/skia/src/ports/SkFontMgr_android_factory.cpp", |
| 387 | "//third_party/skia/src/ports/SkFontMgr_android_parser.cpp", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 388 | ] |
| 389 | } |
Chinmay Garde | 67a4363 | 2015-06-10 16:13:31 -0700 | [diff] [blame] | 390 | if (!is_mac && !is_ios) { |
James Robinson | 447ca5e | 2014-12-03 17:32:51 -0800 | [diff] [blame] | 391 | sources -= [ "//third_party/skia/src/ports/SkFontHost_mac.cpp" ] |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 392 | } |
| 393 | |
Viet-Trung Luu | 59f4ce5 | 2015-12-11 14:46:34 -0800 | [diff] [blame] | 394 | # On "Linux" (i.e., not Android), we use our a custom SkFontMgr. |
| 395 | # TODO(vtl): We should probably do the same on Android. |
Sean Klein | 473c8d0 | 2015-12-16 14:45:41 -0800 | [diff] [blame] | 396 | if (is_linux || is_nacl) { |
Viet-Trung Luu | 59f4ce5 | 2015-12-11 14:46:34 -0800 | [diff] [blame] | 397 | sources += [ |
| 398 | "//third_party/skia/src/ports/SkFontMgr_custom.cpp", |
| 399 | "ports/font_mgr_factory.cc", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 400 | ] |
| 401 | } |
| 402 | |
Sean Klein | 473c8d0 | 2015-12-16 14:45:41 -0800 | [diff] [blame] | 403 | if (!is_linux && !is_android && !is_nacl) { |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 404 | sources -= [ |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 405 | "//third_party/skia/src/ports/SkFontHost_FreeType.cpp", |
Dave Moore | cc0e4f9 | 2015-03-10 15:23:04 -0700 | [diff] [blame] | 406 | "//third_party/skia/src/ports/SkFontHost_FreeType_common.cpp", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 407 | ] |
| 408 | } |
| 409 | |
| 410 | # Select the right BitmapPlatformDevice. |
James Robinson | 9498ce0 | 2015-12-11 15:45:36 -0800 | [diff] [blame] | 411 | if (is_mac || is_ios) { |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 412 | sources += [ |
| 413 | "ext/bitmap_platform_device_mac.cc", |
| 414 | "ext/bitmap_platform_device_mac.h", |
| 415 | ] |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 416 | } else { |
| 417 | sources += [ |
| 418 | "ext/bitmap_platform_device_skia.cc", |
| 419 | "ext/bitmap_platform_device_skia.h", |
| 420 | ] |
| 421 | } |
| 422 | |
| 423 | if (is_clang) { |
| 424 | # Skia won't compile with some of the more strict clang warnings. |
| 425 | # e.g. it does: |
| 426 | # SkASSERT(!"sk_out_of_memory"); |
| 427 | configs -= [ "//build/config/clang:extra_warnings" ] |
| 428 | } |
| 429 | |
| 430 | configs -= [ "//build/config/compiler:chromium_code" ] |
| 431 | configs += [ |
| 432 | ":skia_library_config", |
James Robinson | 447ca5e | 2014-12-03 17:32:51 -0800 | [diff] [blame] | 433 | "//build/config/compiler:no_chromium_code", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 434 | ] |
| 435 | public_configs = [ ":skia_config" ] |
| 436 | |
| 437 | deps = [ |
| 438 | ":skia_opts", |
| 439 | "//base", |
| 440 | "//base/third_party/dynamic_annotations", |
| 441 | "//third_party/zlib", |
| 442 | ] |
| 443 | |
Sean Klein | 473c8d0 | 2015-12-16 14:45:41 -0800 | [diff] [blame] | 444 | if (is_linux || is_nacl) { |
Viet-Trung Luu | 1e6dab8 | 2015-12-15 18:15:36 -0800 | [diff] [blame] | 445 | deps += [ |
| 446 | "//third_party/freetype2", |
| 447 | "//third_party/icu:icuuc", |
| 448 | ] |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 449 | } |
| 450 | |
| 451 | if (is_android) { |
| 452 | set_sources_assignment_filter([]) |
James Robinson | 447ca5e | 2014-12-03 17:32:51 -0800 | [diff] [blame] | 453 | sources += [ "ext/platform_device_linux.cc" ] |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 454 | set_sources_assignment_filter(sources_assignment_filter) |
| 455 | deps += [ |
Jeff Brown | 28dd561 | 2016-01-26 15:49:07 -0800 | [diff] [blame] | 456 | "//third_party/android_tools:cpu_features", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 457 | "//third_party/expat", |
Viet-Trung Luu | 235cf3d | 2015-06-11 10:01:25 -0700 | [diff] [blame] | 458 | "//third_party/freetype-android:freetype", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 459 | ] |
| 460 | } |
| 461 | |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 462 | if (is_android && !is_debug) { |
| 463 | configs -= [ "//build/config/compiler:optimize" ] |
| 464 | configs += [ "//build/config/compiler:optimize_max" ] |
| 465 | } |
| 466 | } |
| 467 | |
| 468 | # Separated out so it can be compiled with different flags for SSE. |
| 469 | source_set("skia_opts") { |
| 470 | cflags = [] |
| 471 | defines = [] |
| 472 | |
Benjamin Lerman | e8ca9b7 | 2015-02-24 16:42:13 +0100 | [diff] [blame] | 473 | if (current_cpu == "x86" || current_cpu == "x64") { |
Benjamin Lerman | cdfc88d | 2015-02-03 14:35:12 +0100 | [diff] [blame] | 474 | sources = gypi_skia_opts.sse2_sources + gypi_skia_opts.ssse3_sources + |
Sean Klein | f0e7a47 | 2015-12-14 09:14:51 -0800 | [diff] [blame] | 475 | gypi_skia_opts.sse41_sources + gypi_skia_opts.avx_sources |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 476 | if (is_linux || is_mac) { |
| 477 | cflags += [ "-msse4.1" ] |
| 478 | } |
cstout | 0d68ff2 | 2016-01-04 09:37:22 -0800 | [diff] [blame] | 479 | } else if (current_cpu == "arm" || current_cpu == "arm64") { |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 480 | # The assembly uses the frame pointer register (r7 in Thumb/r11 in |
| 481 | # ARM), the compiler doesn't like that. |
| 482 | cflags += [ "-fomit-frame-pointer" ] |
Chinmay Garde | 67a4363 | 2015-06-10 16:13:31 -0700 | [diff] [blame] | 483 | if (arm_version >= 7 && (arm_use_neon || arm_optionally_use_neon)) { |
Benjamin Lerman | cdfc88d | 2015-02-03 14:35:12 +0100 | [diff] [blame] | 484 | sources = gypi_skia_opts.armv7_sources |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 485 | if (arm_use_neon || arm_optionally_use_neon) { |
Benjamin Lerman | cdfc88d | 2015-02-03 14:35:12 +0100 | [diff] [blame] | 486 | sources += gypi_skia_opts.neon_sources |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 487 | |
| 488 | # Root build config sets -mfpu=$arm_fpu, which we expect to be neon |
| 489 | # when running this. |
| 490 | if (!arm_use_neon) { |
| 491 | configs -= [ "//build/config/compiler:compiler_arm_fpu" ] |
James Robinson | 447ca5e | 2014-12-03 17:32:51 -0800 | [diff] [blame] | 492 | cflags += [ "-mfpu=neon" ] |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 493 | } |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 494 | } |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 495 | } else { |
Chinmay Garde | 67a4363 | 2015-06-10 16:13:31 -0700 | [diff] [blame] | 496 | sources = gypi_skia_opts.none_sources |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 497 | } |
Jeff Brown | a3a75ea | 2015-12-10 14:04:42 -0800 | [diff] [blame] | 498 | } else if (current_cpu == "arm64") { |
| 499 | # TODO(1841): NEON sources are not currently used on arm64. |
| 500 | sources = gypi_skia_opts.none_sources |
Benjamin Lerman | e8ca9b7 | 2015-02-24 16:42:13 +0100 | [diff] [blame] | 501 | } else if (current_cpu == "mipsel") { |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 502 | cflags += [ "-fomit-frame-pointer" ] |
Alhaad Gokhale | 4f51307 | 2015-03-24 10:49:34 -0700 | [diff] [blame] | 503 | |
James Robinson | 9498ce0 | 2015-12-11 15:45:36 -0800 | [diff] [blame] | 504 | sources = gypi_skia_opts.none_sources |
Sean Klein | 473c8d0 | 2015-12-16 14:45:41 -0800 | [diff] [blame] | 505 | } else if (current_cpu == "pnacl") { |
| 506 | sources = gypi_skia_opts.none_sources |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 507 | } else { |
| 508 | assert(false, "Need to port cpu specific stuff from skia_library_opts.gyp") |
| 509 | } |
| 510 | |
| 511 | if (is_android && !is_debug) { |
| 512 | configs -= [ "//build/config/compiler:optimize" ] |
| 513 | configs += [ "//build/config/compiler:optimize_max" ] |
| 514 | } |
| 515 | |
| 516 | configs -= [ "//build/config/compiler:chromium_code" ] |
| 517 | configs += [ |
| 518 | ":skia_config", |
| 519 | ":skia_library_config", |
James Robinson | 447ca5e | 2014-12-03 17:32:51 -0800 | [diff] [blame] | 520 | "//build/config/compiler:no_chromium_code", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 521 | ] |
| 522 | |
| 523 | deps = [ |
| 524 | "//base", |
| 525 | ] |
| 526 | |
| 527 | visibility = [ ":skia" ] |
| 528 | } |
James Robinson | d753aca | 2015-01-12 13:07:20 -0800 | [diff] [blame] | 529 | |
| 530 | test("skia_unittests") { |
| 531 | sources = [ |
James Robinson | d753aca | 2015-01-12 13:07:20 -0800 | [diff] [blame] | 532 | "ext/bitmap_platform_device_mac_unittest.cc", |
James Robinson | d753aca | 2015-01-12 13:07:20 -0800 | [diff] [blame] | 533 | "ext/platform_canvas_unittest.cc", |
James Robinson | d753aca | 2015-01-12 13:07:20 -0800 | [diff] [blame] | 534 | "ext/refptr_unittest.cc", |
| 535 | "ext/skia_utils_ios_unittest.mm", |
| 536 | "ext/skia_utils_mac_unittest.mm", |
James Robinson | d753aca | 2015-01-12 13:07:20 -0800 | [diff] [blame] | 537 | ] |
| 538 | |
James Robinson | 9498ce0 | 2015-12-11 15:45:36 -0800 | [diff] [blame] | 539 | if (!is_mac) { |
James Robinson | d753aca | 2015-01-12 13:07:20 -0800 | [diff] [blame] | 540 | sources -= [ "ext/platform_canvas_unittest.cc" ] |
| 541 | } |
| 542 | |
| 543 | deps = [ |
| 544 | ":skia", |
| 545 | "//base", |
| 546 | "//base/test:run_all_unittests", |
| 547 | "//testing/gtest", |
| 548 | "//ui/gfx", |
| 549 | "//ui/gfx/geometry", |
| 550 | ] |
| 551 | } |