mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 1 | # Copyright 2016 Google Inc. |
| 2 | # |
| 3 | # Use of this source code is governed by a BSD-style license that can be |
| 4 | # found in the LICENSE file. |
| 5 | |
mikejurka | 8c24f4f | 2016-09-12 16:51:58 -0700 | [diff] [blame] | 6 | import("gn/shared_sources.gni") |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 7 | |
mtklein | 3e8012e | 2016-09-21 09:14:19 -0700 | [diff] [blame] | 8 | if (!defined(is_skia_standalone)) { |
| 9 | is_skia_standalone = false |
| 10 | } |
| 11 | |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 12 | declare_args() { |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 13 | skia_use_angle = false |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 14 | skia_use_expat = true |
mtklein | 3cc2218 | 2016-08-29 13:26:14 -0700 | [diff] [blame] | 15 | skia_use_fontconfig = is_linux |
mtklein | cdedd0e | 2016-09-12 15:15:44 -0700 | [diff] [blame] | 16 | skia_use_freetype = is_android || is_fuchsia || is_linux |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 17 | skia_use_giflib = !is_fuchsia |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 18 | skia_use_libjpeg_turbo = true |
| 19 | skia_use_libpng = true |
mtklein | eb3c425 | 2016-08-23 07:38:09 -0700 | [diff] [blame] | 20 | skia_use_libwebp = !is_fuchsia |
mtklein | a627b5c | 2016-09-20 13:36:47 -0700 | [diff] [blame] | 21 | skia_use_mesa = false |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 22 | skia_use_sfntly = !is_fuchsia |
mtklein | f29180e | 2016-09-16 07:01:17 -0700 | [diff] [blame] | 23 | skia_use_vulkan = is_android && defined(ndk_api) && ndk_api >= 24 |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 24 | skia_use_zlib = true |
mtklein | 1bd72ba | 2016-09-16 07:45:52 -0700 | [diff] [blame] | 25 | |
| 26 | skia_enable_android_framework_defines = false |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 27 | skia_enable_gpu = true |
mtklein | 3e8012e | 2016-09-21 09:14:19 -0700 | [diff] [blame] | 28 | skia_enable_tools = is_skia_standalone |
| 29 | skia_enable_vulkan_debug_layers = is_skia_standalone && is_debug |
Brian Salomon | 789e25e | 2016-09-30 13:41:03 -0400 | [diff] [blame] | 30 | skia_vulkan_sdk = "" |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 31 | } |
| 32 | |
Brian Salomon | 789e25e | 2016-09-30 13:41:03 -0400 | [diff] [blame] | 33 | skia_use_vulkan = skia_use_vulkan || skia_vulkan_sdk != "" |
| 34 | |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 35 | # Our tools require static linking (they use non-exported symbols). |
| 36 | skia_enable_tools = skia_enable_tools && !is_component_build |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 37 | |
mtklein | a45be61 | 2016-08-29 15:22:10 -0700 | [diff] [blame] | 38 | fontmgr_android_enabled = skia_use_expat && skia_use_freetype |
| 39 | |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 40 | skia_public_includes = [ |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 41 | "include/android", |
mtklein | fa84d94 | 2016-07-28 09:45:14 -0700 | [diff] [blame] | 42 | "include/c", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 43 | "include/codec", |
| 44 | "include/config", |
| 45 | "include/core", |
| 46 | "include/effects", |
| 47 | "include/gpu", |
| 48 | "include/gpu/gl", |
| 49 | "include/images", |
| 50 | "include/pathops", |
| 51 | "include/ports", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 52 | "include/svg", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 53 | "include/utils", |
| 54 | "include/utils/mac", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 55 | "include/xml", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 56 | ] |
| 57 | |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 58 | # Skia public API, generally provided by :skia. |
| 59 | config("skia_public") { |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 60 | include_dirs = skia_public_includes |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 61 | defines = [ "SKIA_DLL" ] |
Mike Klein | c4cbd74 | 2016-09-26 21:37:09 -0400 | [diff] [blame] | 62 | if (is_fuchsia || is_linux) { |
jcgregorio | 5561e3d | 2016-08-25 09:25:11 -0700 | [diff] [blame] | 63 | defines += [ "SK_SAMPLES_FOR_X" ] |
| 64 | } |
mtklein | cae1be5 | 2016-09-20 08:24:34 -0700 | [diff] [blame] | 65 | if (skia_enable_android_framework_defines) { |
| 66 | defines += skia_android_framework_defines |
| 67 | } |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 68 | if (!skia_enable_gpu) { |
| 69 | defines += [ "SK_SUPPORT_GPU=0" ] |
| 70 | } |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | # Skia internal APIs, used by Skia itself and a few test tools. |
| 74 | config("skia_private") { |
| 75 | visibility = [ ":*" ] |
| 76 | |
| 77 | include_dirs = [ |
| 78 | "include/private", |
| 79 | "src/c", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 80 | "src/codec", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 81 | "src/config", |
| 82 | "src/core", |
| 83 | "src/effects", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 84 | "src/effects/gradients", |
| 85 | "src/fonts", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 86 | "src/gpu", |
| 87 | "src/image", |
| 88 | "src/images", |
| 89 | "src/lazy", |
| 90 | "src/opts", |
| 91 | "src/pathops", |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 92 | "src/pdf", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 93 | "src/ports", |
| 94 | "src/sfnt", |
mtklein | 9e0d9dd | 2016-08-30 10:37:19 -0700 | [diff] [blame] | 95 | "src/sksl", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 96 | "src/utils", |
mtklein | 7a1f45f | 2016-08-04 06:19:33 -0700 | [diff] [blame] | 97 | "src/utils/win", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 98 | "third_party/etc1", |
| 99 | "third_party/ktx", |
| 100 | ] |
mtklein | 150d113 | 2016-08-01 06:56:40 -0700 | [diff] [blame] | 101 | |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 102 | defines = [ "SK_GAMMA_APPLY_TO_A8" ] |
mtklein | b37c034 | 2016-09-09 11:07:45 -0700 | [diff] [blame] | 103 | if (is_android) { |
| 104 | defines += [ |
| 105 | "SK_GAMMA_EXPONENT=1.4", |
| 106 | "SK_GAMMA_CONTRAST=0.0", |
| 107 | ] |
| 108 | } |
mtklein | 88a7ac0 | 2016-09-14 11:16:49 -0700 | [diff] [blame] | 109 | if (is_official_build || is_android) { |
| 110 | # TODO(bsalomon): it'd be nice to make Android normal. |
| 111 | defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ] |
| 112 | } |
Brian Salomon | 789e25e | 2016-09-30 13:41:03 -0400 | [diff] [blame] | 113 | libs = [] |
| 114 | lib_dirs = [] |
| 115 | if (skia_use_vulkan) { |
| 116 | if (skia_vulkan_sdk != "") { |
| 117 | include_dirs += [ "$skia_vulkan_sdk/x86_64/include/" ] |
| 118 | lib_dirs += [ "$skia_vulkan_sdk/x86_64/lib/" ] |
| 119 | } |
| 120 | libs += [ "vulkan" ] |
| 121 | } |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 122 | } |
| 123 | |
| 124 | # Any code that's linked into Skia-the-library should use this config via += skia_library_configs. |
| 125 | config("skia_library") { |
| 126 | visibility = [ ":*" ] |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 127 | defines = [ "SKIA_IMPLEMENTATION=1" ] |
| 128 | } |
| 129 | |
| 130 | skia_library_configs = [ |
| 131 | ":skia_public", |
| 132 | ":skia_private", |
| 133 | ":skia_library", |
| 134 | ] |
| 135 | |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 136 | # Use for CPU-specific Skia code that needs particular compiler flags. |
| 137 | template("opts") { |
| 138 | if (invoker.enabled) { |
| 139 | source_set(target_name) { |
| 140 | forward_variables_from(invoker, "*") |
| 141 | configs += skia_library_configs |
| 142 | } |
| 143 | } else { |
| 144 | # If not enabled, a phony empty target that swallows all otherwise unused variables. |
| 145 | source_set(target_name) { |
| 146 | forward_variables_from(invoker, |
| 147 | "*", |
| 148 | [ |
| 149 | "sources", |
| 150 | "cflags", |
| 151 | ]) |
| 152 | } |
| 153 | } |
anmittal | a7eaf2e | 2016-08-17 13:57:26 -0700 | [diff] [blame] | 154 | } |
| 155 | |
mtklein | 422310d | 2016-08-16 18:28:43 -0700 | [diff] [blame] | 156 | is_x86 = current_cpu == "x64" || current_cpu == "x86" |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 157 | |
mtklein | 7d6fb2c | 2016-08-25 14:50:44 -0700 | [diff] [blame] | 158 | opts("none") { |
| 159 | enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64" |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 160 | sources = skia_opts.none_sources |
anmittal | b8b3f71 | 2016-08-25 04:55:19 -0700 | [diff] [blame] | 161 | cflags = [] |
| 162 | } |
| 163 | |
mtklein | 7d6fb2c | 2016-08-25 14:50:44 -0700 | [diff] [blame] | 164 | opts("armv7") { |
anmittal | b8b3f71 | 2016-08-25 04:55:19 -0700 | [diff] [blame] | 165 | enabled = current_cpu == "arm" |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 166 | sources = skia_opts.armv7_sources + skia_opts.neon_sources |
mtklein | 7d6fb2c | 2016-08-25 14:50:44 -0700 | [diff] [blame] | 167 | cflags = [] |
anmittal | b8b3f71 | 2016-08-25 04:55:19 -0700 | [diff] [blame] | 168 | } |
| 169 | |
| 170 | opts("arm64") { |
| 171 | enabled = current_cpu == "arm64" |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 172 | sources = skia_opts.arm64_sources |
anmittal | b8b3f71 | 2016-08-25 04:55:19 -0700 | [diff] [blame] | 173 | cflags = [] |
| 174 | } |
| 175 | |
| 176 | opts("crc32") { |
| 177 | enabled = current_cpu == "arm64" |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 178 | sources = skia_opts.crc32_sources |
anmittal | b8b3f71 | 2016-08-25 04:55:19 -0700 | [diff] [blame] | 179 | cflags = [ "-march=armv8-a+crc" ] |
| 180 | } |
| 181 | |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 182 | opts("sse2") { |
| 183 | enabled = is_x86 |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 184 | sources = skia_opts.sse2_sources |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 185 | cflags = [ "-msse2" ] |
| 186 | } |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 187 | |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 188 | opts("ssse3") { |
| 189 | enabled = is_x86 |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 190 | sources = skia_opts.ssse3_sources |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 191 | cflags = [ "-mssse3" ] |
| 192 | } |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 193 | |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 194 | opts("sse41") { |
| 195 | enabled = is_x86 |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 196 | sources = skia_opts.sse41_sources |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 197 | cflags = [ "-msse4.1" ] |
| 198 | } |
mtklein | 4e97607 | 2016-08-08 09:06:27 -0700 | [diff] [blame] | 199 | |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 200 | opts("sse42") { |
| 201 | enabled = is_x86 |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 202 | sources = skia_opts.sse42_sources |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 203 | cflags = [ "-msse4.2" ] |
| 204 | } |
| 205 | |
| 206 | opts("avx") { |
| 207 | enabled = is_x86 |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 208 | sources = skia_opts.avx_sources |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 209 | cflags = [ "-mavx" ] |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 210 | } |
| 211 | |
Mike Klein | 78d5a3b | 2016-09-30 10:48:01 -0400 | [diff] [blame] | 212 | opts("hsw") { |
| 213 | enabled = is_x86 |
| 214 | sources = skia_opts.hsw_sources |
| 215 | cflags = [ |
| 216 | "-mavx2", |
| 217 | "-mbmi", |
| 218 | "-mbmi2", |
| 219 | "-mf16c", |
| 220 | "-mfma", |
| 221 | ] |
| 222 | } |
| 223 | |
mtklein | 349cece | 2016-08-26 08:13:04 -0700 | [diff] [blame] | 224 | opts("dsp") { |
| 225 | enabled = current_cpu == "mipsel" |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 226 | sources = skia_opts.mips_dsp_sources |
mtklein | b6064ef | 2016-08-30 11:49:24 -0700 | [diff] [blame] | 227 | cflags = [] |
mtklein | 349cece | 2016-08-26 08:13:04 -0700 | [diff] [blame] | 228 | } |
| 229 | |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 230 | # Any feature of Skia that requires third-party code should be optional and use this template. |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 231 | template("optional") { |
| 232 | if (invoker.enabled) { |
| 233 | config(target_name + "_public") { |
mtklein | cd01b03 | 2016-08-31 04:58:19 -0700 | [diff] [blame] | 234 | if (defined(invoker.public_defines)) { |
| 235 | defines = invoker.public_defines |
| 236 | } |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 237 | } |
| 238 | source_set(target_name) { |
mtklein | cd01b03 | 2016-08-31 04:58:19 -0700 | [diff] [blame] | 239 | forward_variables_from(invoker, |
| 240 | "*", |
| 241 | [ |
| 242 | "public_defines", |
| 243 | "sources_when_disabled", |
| 244 | ]) |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 245 | all_dependent_configs = [ ":" + target_name + "_public" ] |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 246 | configs += skia_library_configs |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 247 | } |
| 248 | } else { |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 249 | source_set(target_name) { |
| 250 | forward_variables_from(invoker, |
| 251 | "*", |
| 252 | [ |
| 253 | "public_defines", |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 254 | "deps", |
mtklein | 6ef6999 | 2016-09-14 06:12:09 -0700 | [diff] [blame] | 255 | "libs", |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 256 | "sources", |
mtklein | cd01b03 | 2016-08-31 04:58:19 -0700 | [diff] [blame] | 257 | "sources_when_disabled", |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 258 | ]) |
mtklein | cd01b03 | 2016-08-31 04:58:19 -0700 | [diff] [blame] | 259 | if (defined(invoker.sources_when_disabled)) { |
| 260 | sources = invoker.sources_when_disabled |
| 261 | } |
| 262 | configs += skia_library_configs |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 263 | } |
mtklein | eb3c425 | 2016-08-23 07:38:09 -0700 | [diff] [blame] | 264 | } |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 265 | } |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 266 | |
mtklein | a45be61 | 2016-08-29 15:22:10 -0700 | [diff] [blame] | 267 | optional("fontmgr_android") { |
| 268 | enabled = fontmgr_android_enabled |
mtklein | a45be61 | 2016-08-29 15:22:10 -0700 | [diff] [blame] | 269 | |
| 270 | deps = [ |
| 271 | "//third_party/expat", |
| 272 | "//third_party/freetype2", |
| 273 | ] |
| 274 | sources = [ |
| 275 | "src/ports/SkFontMgr_android.cpp", |
| 276 | "src/ports/SkFontMgr_android_factory.cpp", |
| 277 | "src/ports/SkFontMgr_android_parser.cpp", |
| 278 | ] |
| 279 | } |
| 280 | |
mtklein | d2e39db | 2016-09-07 07:52:55 -0700 | [diff] [blame] | 281 | optional("fontmgr_custom") { |
| 282 | enabled = is_linux && skia_use_freetype && !skia_use_fontconfig |
| 283 | |
| 284 | deps = [ |
| 285 | "//third_party/freetype2", |
| 286 | ] |
| 287 | sources = [ |
| 288 | "src/ports/SkFontMgr_custom.cpp", |
| 289 | "src/ports/SkFontMgr_custom_directory_factory.cpp", |
| 290 | ] |
| 291 | } |
| 292 | |
mtklein | 3cc2218 | 2016-08-29 13:26:14 -0700 | [diff] [blame] | 293 | optional("fontmgr_fontconfig") { |
| 294 | enabled = skia_use_freetype && skia_use_fontconfig |
mtklein | 3cc2218 | 2016-08-29 13:26:14 -0700 | [diff] [blame] | 295 | |
| 296 | deps = [ |
| 297 | "//third_party:fontconfig", |
| 298 | "//third_party/freetype2", |
| 299 | ] |
| 300 | sources = [ |
bungeman | 1ae0e01 | 2016-09-19 12:13:16 -0700 | [diff] [blame] | 301 | "src/ports/SkFontConfigInterface.cpp", |
mtklein | 3cc2218 | 2016-08-29 13:26:14 -0700 | [diff] [blame] | 302 | "src/ports/SkFontConfigInterface_direct.cpp", |
| 303 | "src/ports/SkFontConfigInterface_direct_factory.cpp", |
| 304 | "src/ports/SkFontMgr_FontConfigInterface.cpp", |
| 305 | "src/ports/SkFontMgr_fontconfig.cpp", |
| 306 | "src/ports/SkFontMgr_fontconfig_factory.cpp", |
| 307 | ] |
| 308 | } |
| 309 | |
mtklein | cdedd0e | 2016-09-12 15:15:44 -0700 | [diff] [blame] | 310 | optional("fontmgr_fuchsia") { |
| 311 | enabled = is_fuchsia && skia_use_freetype |
| 312 | |
| 313 | deps = [ |
| 314 | "//third_party/freetype2", |
| 315 | ] |
| 316 | sources = [ |
| 317 | "src/ports/SkFontMgr_custom.cpp", |
| 318 | "src/ports/SkFontMgr_custom_empty_factory.cpp", |
| 319 | ] |
| 320 | } |
| 321 | |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 322 | optional("gif") { |
| 323 | enabled = skia_use_giflib |
| 324 | public_defines = [ "SK_HAS_GIF_LIBRARY" ] |
| 325 | |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 326 | deps = [ |
| 327 | "//third_party/giflib", |
| 328 | ] |
| 329 | sources = [ |
| 330 | "src/codec/SkGifCodec.cpp", |
| 331 | ] |
| 332 | } |
| 333 | |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 334 | optional("gpu") { |
| 335 | enabled = skia_enable_gpu |
mtklein | e9fb3d5 | 2016-09-20 15:11:46 -0700 | [diff] [blame] | 336 | public_defines = [] |
| 337 | |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 338 | sources = skia_gpu_sources + [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ] |
| 339 | |
| 340 | # These paths need to be absolute to match the ones produced by shared_sources.gni. |
| 341 | sources -= get_path_info([ |
| 342 | "src/gpu/gl/GrGLCreateNativeInterface_none.cpp", |
| 343 | "src/gpu/gl/GrGLDefaultInterface_none.cpp", |
| 344 | ], |
| 345 | "abspath") |
| 346 | if (is_android) { |
| 347 | sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ] |
| 348 | } else if (is_linux) { |
| 349 | sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ] |
| 350 | } else if (is_mac) { |
| 351 | sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ] |
| 352 | } else { |
| 353 | sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ] |
| 354 | } |
mtklein | e9fb3d5 | 2016-09-20 15:11:46 -0700 | [diff] [blame] | 355 | libs = [] |
| 356 | |
| 357 | if (skia_use_vulkan) { |
| 358 | public_defines += [ "SK_VULKAN" ] |
| 359 | sources += skia_vk_sources |
egdaniel | e4a9bd7 | 2016-09-21 07:36:14 -0700 | [diff] [blame] | 360 | if (skia_enable_vulkan_debug_layers) { |
| 361 | public_defines += [ "SK_ENABLE_VK_LAYERS" ] |
| 362 | } |
mtklein | e9fb3d5 | 2016-09-20 15:11:46 -0700 | [diff] [blame] | 363 | } |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 364 | } |
| 365 | |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 366 | optional("jpeg") { |
| 367 | enabled = skia_use_libjpeg_turbo |
| 368 | public_defines = [ "SK_HAS_JPEG_LIBRARY" ] |
| 369 | |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 370 | deps = [ |
| 371 | "//third_party/libjpeg-turbo:libjpeg", |
| 372 | ] |
| 373 | sources = [ |
| 374 | "src/codec/SkJpegCodec.cpp", |
| 375 | "src/codec/SkJpegDecoderMgr.cpp", |
| 376 | "src/codec/SkJpegUtility.cpp", |
| 377 | "src/images/SkJPEGImageEncoder.cpp", |
| 378 | "src/images/SkJPEGWriteUtility.cpp", |
| 379 | ] |
| 380 | } |
| 381 | |
| 382 | optional("pdf") { |
| 383 | enabled = skia_use_zlib |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 384 | |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 385 | deps = [ |
| 386 | "//third_party/zlib", |
| 387 | ] |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 388 | sources = skia_pdf_sources |
mtklein | cd01b03 | 2016-08-31 04:58:19 -0700 | [diff] [blame] | 389 | sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ] |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 390 | |
| 391 | if (skia_use_sfntly) { |
| 392 | deps += [ "//third_party/sfntly" ] |
mtklein | cd01b03 | 2016-08-31 04:58:19 -0700 | [diff] [blame] | 393 | public_defines = [ "SK_PDF_USE_SFNTLY" ] |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 394 | } |
| 395 | } |
| 396 | |
| 397 | optional("png") { |
| 398 | enabled = skia_use_libpng |
| 399 | public_defines = [ "SK_HAS_PNG_LIBRARY" ] |
| 400 | |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 401 | deps = [ |
| 402 | "//third_party/libpng", |
| 403 | ] |
| 404 | sources = [ |
| 405 | "src/codec/SkIcoCodec.cpp", |
| 406 | "src/codec/SkPngCodec.cpp", |
| 407 | "src/images/SkPNGImageEncoder.cpp", |
| 408 | ] |
| 409 | } |
| 410 | |
mtklein | 3cc2218 | 2016-08-29 13:26:14 -0700 | [diff] [blame] | 411 | optional("typeface_freetype") { |
| 412 | enabled = skia_use_freetype |
mtklein | 3cc2218 | 2016-08-29 13:26:14 -0700 | [diff] [blame] | 413 | |
| 414 | deps = [ |
| 415 | "//third_party/freetype2", |
| 416 | ] |
| 417 | sources = [ |
| 418 | "src/ports/SkFontHost_FreeType.cpp", |
| 419 | "src/ports/SkFontHost_FreeType_common.cpp", |
| 420 | ] |
| 421 | } |
| 422 | |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 423 | optional("webp") { |
| 424 | enabled = skia_use_libwebp |
| 425 | public_defines = [ "SK_HAS_WEBP_LIBRARY" ] |
| 426 | |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 427 | deps = [ |
| 428 | "//third_party/libwebp", |
| 429 | ] |
| 430 | sources = [ |
| 431 | "src/codec/SkWebpAdapterCodec.cpp", |
| 432 | "src/codec/SkWebpCodec.cpp", |
| 433 | "src/images/SkWEBPImageEncoder.cpp", |
| 434 | ] |
mtklein | eb3c425 | 2016-08-23 07:38:09 -0700 | [diff] [blame] | 435 | } |
| 436 | |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 437 | optional("xml") { |
| 438 | enabled = skia_use_expat |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 439 | |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 440 | deps = [ |
| 441 | "//third_party/expat", |
| 442 | ] |
| 443 | sources = [ |
| 444 | "src/xml/SkDOM.cpp", |
| 445 | "src/xml/SkXMLParser.cpp", |
| 446 | "src/xml/SkXMLWriter.cpp", |
| 447 | ] |
| 448 | } |
| 449 | |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 450 | component("skia") { |
| 451 | public_configs = [ ":skia_public" ] |
| 452 | configs += skia_library_configs |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 453 | |
| 454 | deps = [ |
anmittal | b8b3f71 | 2016-08-25 04:55:19 -0700 | [diff] [blame] | 455 | ":arm64", |
| 456 | ":armv7", |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 457 | ":avx", |
anmittal | b8b3f71 | 2016-08-25 04:55:19 -0700 | [diff] [blame] | 458 | ":crc32", |
mtklein | 349cece | 2016-08-26 08:13:04 -0700 | [diff] [blame] | 459 | ":dsp", |
mtklein | a45be61 | 2016-08-29 15:22:10 -0700 | [diff] [blame] | 460 | ":fontmgr_android", |
mtklein | d2e39db | 2016-09-07 07:52:55 -0700 | [diff] [blame] | 461 | ":fontmgr_custom", |
mtklein | 3cc2218 | 2016-08-29 13:26:14 -0700 | [diff] [blame] | 462 | ":fontmgr_fontconfig", |
mtklein | cdedd0e | 2016-09-12 15:15:44 -0700 | [diff] [blame] | 463 | ":fontmgr_fuchsia", |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 464 | ":gif", |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 465 | ":gpu", |
Mike Klein | 78d5a3b | 2016-09-30 10:48:01 -0400 | [diff] [blame] | 466 | ":hsw", |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 467 | ":jpeg", |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 468 | ":none", |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 469 | ":pdf", |
| 470 | ":png", |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 471 | ":sse2", |
| 472 | ":sse41", |
| 473 | ":sse42", |
| 474 | ":ssse3", |
mtklein | 3cc2218 | 2016-08-29 13:26:14 -0700 | [diff] [blame] | 475 | ":typeface_freetype", |
mtklein | eb3c425 | 2016-08-23 07:38:09 -0700 | [diff] [blame] | 476 | ":webp", |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 477 | ":xml", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 478 | ] |
| 479 | |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 480 | sources = [] |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 481 | sources += skia_core_sources |
| 482 | sources += skia_effects_sources |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 483 | sources += skia_sksl_sources |
| 484 | sources += skia_utils_sources |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 485 | sources += [ |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 486 | "src/android/SkBitmapRegionCodec.cpp", |
| 487 | "src/android/SkBitmapRegionDecoder.cpp", |
| 488 | "src/codec/SkAndroidCodec.cpp", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 489 | "src/codec/SkBmpCodec.cpp", |
| 490 | "src/codec/SkBmpMaskCodec.cpp", |
| 491 | "src/codec/SkBmpRLECodec.cpp", |
| 492 | "src/codec/SkBmpStandardCodec.cpp", |
| 493 | "src/codec/SkCodec.cpp", |
| 494 | "src/codec/SkCodecImageGenerator.cpp", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 495 | "src/codec/SkMaskSwizzler.cpp", |
| 496 | "src/codec/SkMasks.cpp", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 497 | "src/codec/SkSampledCodec.cpp", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 498 | "src/codec/SkSampler.cpp", |
| 499 | "src/codec/SkSwizzler.cpp", |
| 500 | "src/codec/SkWbmpCodec.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 501 | "src/images/SkImageEncoder.cpp", |
| 502 | "src/images/SkImageEncoder_Factory.cpp", |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 503 | "src/images/SkKTXImageEncoder.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 504 | "src/ports/SkDiscardableMemory_none.cpp", |
| 505 | "src/ports/SkGlobalInitialization_default.cpp", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 506 | "src/ports/SkImageGenerator_skia.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 507 | "src/ports/SkMemory_malloc.cpp", |
| 508 | "src/ports/SkOSFile_stdio.cpp", |
| 509 | "src/sfnt/SkOTTable_name.cpp", |
| 510 | "src/sfnt/SkOTUtils.cpp", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 511 | "src/svg/SkSVGCanvas.cpp", |
| 512 | "src/svg/SkSVGDevice.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 513 | "src/utils/mac/SkStream_mac.cpp", |
| 514 | "third_party/etc1/etc1.cpp", |
| 515 | "third_party/ktx/ktx.cpp", |
| 516 | ] |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 517 | |
mtklein | 7d6fb2c | 2016-08-25 14:50:44 -0700 | [diff] [blame] | 518 | libs = [] |
| 519 | |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 520 | if (is_win) { |
| 521 | sources += [ |
| 522 | "src/ports/SkDebug_win.cpp", |
| 523 | "src/ports/SkFontHost_win.cpp", |
| 524 | "src/ports/SkFontMgr_win_dw.cpp", |
| 525 | "src/ports/SkFontMgr_win_dw_factory.cpp", |
| 526 | "src/ports/SkImageEncoder_WIC.cpp", |
| 527 | "src/ports/SkImageGeneratorWIC.cpp", |
| 528 | "src/ports/SkOSFile_win.cpp", |
mtklein | 605d952 | 2016-09-21 14:01:32 -0700 | [diff] [blame] | 529 | "src/ports/SkOSLibrary_win.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 530 | "src/ports/SkScalerContext_win_dw.cpp", |
| 531 | "src/ports/SkTLS_win.cpp", |
| 532 | "src/ports/SkTypeface_win_dw.cpp", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 533 | "src/xps/SkDocument_XPS.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 534 | ] |
mtklein | b9be979 | 2016-09-16 14:44:18 -0700 | [diff] [blame] | 535 | sources -= |
| 536 | [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ] |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 537 | } else { |
| 538 | sources += [ |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 539 | "src/ports/SkOSFile_posix.cpp", |
mtklein | 605d952 | 2016-09-21 14:01:32 -0700 | [diff] [blame] | 540 | "src/ports/SkOSLibrary_posix.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 541 | "src/ports/SkTLS_pthread.cpp", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 542 | "src/xps/SkDocument_XPS_None.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 543 | ] |
| 544 | } |
| 545 | |
mtklein | 7d6fb2c | 2016-08-25 14:50:44 -0700 | [diff] [blame] | 546 | if (is_android) { |
| 547 | deps += [ |
| 548 | "//third_party/cpu-features", |
| 549 | "//third_party/expat", |
mtklein | 7d6fb2c | 2016-08-25 14:50:44 -0700 | [diff] [blame] | 550 | ] |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 551 | sources += [ "src/ports/SkDebug_android.cpp" ] |
mtklein | 7d6fb2c | 2016-08-25 14:50:44 -0700 | [diff] [blame] | 552 | libs += [ |
| 553 | "EGL", |
| 554 | "GLESv2", |
| 555 | "log", |
| 556 | ] |
| 557 | } |
| 558 | |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 559 | if (is_linux) { |
mtklein | 09e61f7 | 2016-08-23 13:35:28 -0700 | [diff] [blame] | 560 | libs += [ |
| 561 | "GL", |
| 562 | "GLU", |
| 563 | "X11", |
| 564 | ] |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 565 | sources += [ "src/ports/SkDebug_stdio.cpp" ] |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 566 | } |
| 567 | |
| 568 | if (is_mac) { |
| 569 | sources += [ |
mtklein | 7d6fb2c | 2016-08-25 14:50:44 -0700 | [diff] [blame] | 570 | "src/ports/SkDebug_stdio.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 571 | "src/ports/SkFontHost_mac.cpp", |
| 572 | "src/ports/SkImageEncoder_CG.cpp", |
| 573 | "src/ports/SkImageGeneratorCG.cpp", |
| 574 | ] |
mtklein | 09e61f7 | 2016-08-23 13:35:28 -0700 | [diff] [blame] | 575 | libs += [ |
| 576 | "ApplicationServices.framework", |
| 577 | "OpenGL.framework", |
| 578 | ] |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 579 | } |
abarth | 6fc8ff0 | 2016-07-15 15:15:15 -0700 | [diff] [blame] | 580 | |
| 581 | if (is_fuchsia) { |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 582 | sources += [ "src/ports/SkDebug_stdio.cpp" ] |
abarth | 6fc8ff0 | 2016-07-15 15:15:15 -0700 | [diff] [blame] | 583 | } |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 584 | } |
| 585 | |
mtklein | ada5a44 | 2016-08-02 14:28:26 -0700 | [diff] [blame] | 586 | skia_h_headers = exec_script("gyp/find.py", |
| 587 | [ "*.h" ] + rebase_path(skia_public_includes), |
| 588 | "list lines", |
| 589 | []) - |
| 590 | [ |
| 591 | rebase_path("include/gpu/gl/GrGLConfig_chrome.h"), |
| 592 | rebase_path("include/gpu/vk/GrVkBackendContext.h"), |
| 593 | rebase_path("include/gpu/vk/GrVkDefines.h"), |
| 594 | rebase_path("include/gpu/vk/GrVkInterface.h"), |
| 595 | rebase_path("include/gpu/vk/GrVkTypes.h"), |
| 596 | rebase_path("include/ports/SkFontMgr_fontconfig.h"), |
| 597 | ] |
| 598 | |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 599 | action("skia.h") { |
| 600 | script = "gn/echo_headers.py" |
| 601 | args = [ rebase_path("$target_gen_dir/skia.h", root_build_dir) ] + |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 602 | rebase_path(skia_h_headers, target_gen_dir) |
Ben Wagner | bc34404 | 2016-09-29 15:41:53 -0400 | [diff] [blame] | 603 | inputs = skia_h_headers |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 604 | outputs = [ |
| 605 | "$target_gen_dir/skia.h", |
| 606 | ] |
| 607 | } |
| 608 | |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 609 | if (skia_enable_gpu && target_cpu == "x64") { |
mtklein | 1fbdf98 | 2016-09-15 12:07:48 -0700 | [diff] [blame] | 610 | # Our bots only have 64-bit libOSMesa installed. |
| 611 | # TODO: worth fixing? |
| 612 | executable("fiddle") { |
| 613 | include_dirs = [ "$target_gen_dir" ] |
| 614 | libs = [] |
| 615 | if (is_linux) { |
| 616 | libs += [ "OSMesa" ] |
| 617 | } |
mtklein | 56d5669 | 2016-09-15 11:18:55 -0700 | [diff] [blame] | 618 | |
mtklein | 1fbdf98 | 2016-09-15 12:07:48 -0700 | [diff] [blame] | 619 | sources = [ |
| 620 | "src/images/SkForceLinking.cpp", |
| 621 | "tools/fiddle/draw.cpp", |
| 622 | "tools/fiddle/fiddle_main.cpp", |
| 623 | ] |
| 624 | deps = [ |
| 625 | ":skia", |
| 626 | ":skia.h", |
| 627 | ] |
| 628 | } |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 629 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 630 | |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 631 | # Targets guarded by skia_enable_tools may use //third_party freely. |
| 632 | if (skia_enable_tools) { |
| 633 | template("test_lib") { |
| 634 | config(target_name + "_config") { |
| 635 | include_dirs = invoker.public_include_dirs |
mtklein | a627b5c | 2016-09-20 13:36:47 -0700 | [diff] [blame] | 636 | if (defined(invoker.public_defines)) { |
| 637 | defines = invoker.public_defines |
| 638 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 639 | } |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 640 | source_set(target_name) { |
| 641 | forward_variables_from(invoker, "*", [ "public_include_dirs" ]) |
| 642 | public_configs = [ |
| 643 | ":" + target_name + "_config", |
| 644 | ":skia_private", |
| 645 | ] |
| 646 | |
| 647 | if (!defined(deps)) { |
| 648 | deps = [] |
| 649 | } |
| 650 | deps += [ ":skia" ] |
| 651 | testonly = true |
| 652 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 653 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 654 | |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 655 | test_lib("gpu_tool_utils") { |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 656 | public_include_dirs = [] |
| 657 | if (skia_enable_gpu) { |
| 658 | public_defines = [] |
| 659 | public_include_dirs += [ "tools/gpu" ] |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 660 | |
| 661 | deps = [] |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 662 | sources = [ |
| 663 | "tools/gpu/GrContextFactory.cpp", |
| 664 | "tools/gpu/GrTest.cpp", |
| 665 | "tools/gpu/TestContext.cpp", |
| 666 | "tools/gpu/gl/GLTestContext.cpp", |
mtklein | 605d952 | 2016-09-21 14:01:32 -0700 | [diff] [blame] | 667 | "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp", |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 668 | "tools/gpu/gl/debug/DebugGLTestContext.cpp", |
| 669 | "tools/gpu/gl/debug/GrBufferObj.cpp", |
| 670 | "tools/gpu/gl/debug/GrFrameBufferObj.cpp", |
| 671 | "tools/gpu/gl/debug/GrProgramObj.cpp", |
| 672 | "tools/gpu/gl/debug/GrShaderObj.cpp", |
| 673 | "tools/gpu/gl/debug/GrTextureObj.cpp", |
| 674 | "tools/gpu/gl/debug/GrTextureUnitObj.cpp", |
| 675 | "tools/gpu/gl/null/NullGLTestContext.cpp", |
| 676 | ] |
| 677 | libs = [] |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 678 | |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 679 | if (is_android) { |
| 680 | sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ] |
| 681 | } else if (is_linux) { |
| 682 | sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ] |
| 683 | } else if (is_mac) { |
| 684 | sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ] |
| 685 | } |
mtklein | 6ef6999 | 2016-09-14 06:12:09 -0700 | [diff] [blame] | 686 | |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 687 | if (skia_use_angle) { |
| 688 | public_defines += [ "SK_ANGLE" ] |
| 689 | deps += [ "//third_party/angle2" ] |
| 690 | sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ] |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 691 | } |
| 692 | if (skia_use_mesa) { |
| 693 | public_defines += [ "SK_MESA" ] |
| 694 | sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ] |
| 695 | libs += [ "OSMesa" ] |
| 696 | } |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 697 | if (skia_use_vulkan) { |
| 698 | sources += [ "tools/gpu/vk/VkTestContext.cpp" ] |
| 699 | } |
mtklein | a627b5c | 2016-09-20 13:36:47 -0700 | [diff] [blame] | 700 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 701 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 702 | |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 703 | test_lib("flags") { |
| 704 | public_include_dirs = [ "tools/flags" ] |
| 705 | sources = [ |
| 706 | "tools/flags/SkCommandLineFlags.cpp", |
mtklein | 046cb56 | 2016-09-16 10:23:12 -0700 | [diff] [blame] | 707 | ] |
| 708 | } |
| 709 | test_lib("common_flags") { |
| 710 | public_include_dirs = [ "tools/flags" ] |
| 711 | sources = [ |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 712 | "tools/flags/SkCommonFlags.cpp", |
| 713 | "tools/flags/SkCommonFlagsConfig.cpp", |
| 714 | ] |
| 715 | deps = [ |
mtklein | 046cb56 | 2016-09-16 10:23:12 -0700 | [diff] [blame] | 716 | ":flags", |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 717 | ":gpu_tool_utils", |
| 718 | ] |
| 719 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 720 | |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 721 | test_lib("tool_utils") { |
| 722 | public_include_dirs = [ |
| 723 | "tools", |
| 724 | "tools/debugger", |
| 725 | "tools/timer", |
| 726 | ] |
| 727 | sources = [ |
| 728 | "src/images/SkForceLinking.cpp", |
| 729 | "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools? |
mtklein | b37c034 | 2016-09-09 11:07:45 -0700 | [diff] [blame] | 730 | "tools/AndroidSkDebugToStdOut.cpp", |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 731 | "tools/CrashHandler.cpp", |
mtklein | 0590fa5 | 2016-09-01 07:06:54 -0700 | [diff] [blame] | 732 | "tools/LsanSuppressions.cpp", |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 733 | "tools/ProcStats.cpp", |
| 734 | "tools/Resources.cpp", |
| 735 | "tools/ThermalManager.cpp", |
| 736 | "tools/UrlDataManager.cpp", |
| 737 | "tools/debugger/SkDebugCanvas.cpp", |
| 738 | "tools/debugger/SkDrawCommand.cpp", |
| 739 | "tools/debugger/SkJsonWriteBuffer.cpp", |
| 740 | "tools/debugger/SkObjectParser.cpp", |
| 741 | "tools/debugger/SkOverdrawMode.cpp", |
| 742 | "tools/picture_utils.cpp", |
| 743 | "tools/random_parse_path.cpp", |
| 744 | "tools/sk_tool_utils.cpp", |
| 745 | "tools/sk_tool_utils_font.cpp", |
| 746 | "tools/timer/Timer.cpp", |
| 747 | ] |
| 748 | deps = [ |
mtklein | 046cb56 | 2016-09-16 10:23:12 -0700 | [diff] [blame] | 749 | ":common_flags", |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 750 | ":flags", |
| 751 | "//third_party/libpng", |
| 752 | ] |
| 753 | public_deps = [ |
| 754 | "//third_party/jsoncpp", |
| 755 | ] |
| 756 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 757 | |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 758 | gm_sources = exec_script("gyp/find.py", |
| 759 | [ |
| 760 | "*.c*", |
| 761 | rebase_path("gm"), |
| 762 | ], |
| 763 | "list lines", |
| 764 | []) |
| 765 | test_lib("gm") { |
| 766 | public_include_dirs = [ "gm" ] |
| 767 | sources = gm_sources |
| 768 | deps = [ |
| 769 | ":gpu_tool_utils", |
| 770 | ":skia", |
| 771 | ":tool_utils", |
| 772 | ] |
| 773 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 774 | |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 775 | tests_sources = exec_script("gyp/find.py", |
| 776 | [ |
| 777 | "*.c*", |
| 778 | rebase_path("tests"), |
| 779 | ], |
| 780 | "list lines", |
| 781 | []) |
mtklein | 2f3416d | 2016-08-02 16:02:05 -0700 | [diff] [blame] | 782 | |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 783 | test_lib("tests") { |
| 784 | public_include_dirs = [ "tests" ] |
mtklein | a45be61 | 2016-08-29 15:22:10 -0700 | [diff] [blame] | 785 | sources = tests_sources - [ |
| 786 | rebase_path("tests/PathOpsSkpClipTest.cpp"), # alternate main |
mtklein | a45be61 | 2016-08-29 15:22:10 -0700 | [diff] [blame] | 787 | rebase_path("tests/SkpSkGrTest.cpp"), # doesn't compile |
| 788 | rebase_path("tests/skia_test.cpp"), # alternate main |
| 789 | ] |
| 790 | if (!fontmgr_android_enabled) { |
| 791 | sources -= [ rebase_path("tests/FontMgrAndroidParserTest.cpp") ] |
| 792 | } |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 793 | deps = [ |
fmalita | 6cf896d | 2016-08-25 08:44:35 -0700 | [diff] [blame] | 794 | ":experimental_svg_model", |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 795 | ":flags", |
| 796 | ":gpu_tool_utils", |
| 797 | ":skia", |
| 798 | ":tool_utils", |
| 799 | "//third_party/libpng", |
| 800 | "//third_party/zlib", |
| 801 | ] |
| 802 | } |
mtklein | 2f3416d | 2016-08-02 16:02:05 -0700 | [diff] [blame] | 803 | |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 804 | bench_sources = exec_script("gyp/find.py", |
| 805 | [ |
| 806 | "*.c*", |
| 807 | rebase_path("bench"), |
| 808 | ], |
| 809 | "list lines", |
| 810 | []) |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 811 | |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 812 | test_lib("bench") { |
| 813 | public_include_dirs = [ "bench" ] |
| 814 | sources = bench_sources |
| 815 | sources -= [ |
| 816 | rebase_path("bench/nanobench.cpp"), |
| 817 | rebase_path("bench/nanobenchAndroid.cpp"), |
| 818 | ] |
| 819 | deps = [ |
| 820 | ":flags", |
| 821 | ":gm", |
| 822 | ":gpu_tool_utils", |
| 823 | ":skia", |
| 824 | ":tool_utils", |
| 825 | ] |
| 826 | } |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 827 | |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 828 | test_lib("experimental_svg_model") { |
| 829 | public_include_dirs = [ "experimental/svg/model" ] |
| 830 | sources = [ |
| 831 | "experimental/svg/model/SkSVGAttribute.cpp", |
| 832 | "experimental/svg/model/SkSVGAttributeParser.cpp", |
| 833 | "experimental/svg/model/SkSVGCircle.cpp", |
| 834 | "experimental/svg/model/SkSVGContainer.cpp", |
| 835 | "experimental/svg/model/SkSVGDOM.cpp", |
| 836 | "experimental/svg/model/SkSVGEllipse.cpp", |
| 837 | "experimental/svg/model/SkSVGLine.cpp", |
fmalita | 28d5b72 | 2016-09-12 17:06:47 -0700 | [diff] [blame] | 838 | "experimental/svg/model/SkSVGLinearGradient.cpp", |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 839 | "experimental/svg/model/SkSVGNode.cpp", |
| 840 | "experimental/svg/model/SkSVGPath.cpp", |
| 841 | "experimental/svg/model/SkSVGPoly.cpp", |
| 842 | "experimental/svg/model/SkSVGRect.cpp", |
| 843 | "experimental/svg/model/SkSVGRenderContext.cpp", |
| 844 | "experimental/svg/model/SkSVGSVG.cpp", |
| 845 | "experimental/svg/model/SkSVGShape.cpp", |
fmalita | 28d5b72 | 2016-09-12 17:06:47 -0700 | [diff] [blame] | 846 | "experimental/svg/model/SkSVGStop.cpp", |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 847 | "experimental/svg/model/SkSVGTransformableNode.cpp", |
| 848 | "experimental/svg/model/SkSVGValue.cpp", |
| 849 | ] |
| 850 | deps = [ |
| 851 | ":skia", |
| 852 | ] |
| 853 | } |
fmalita | a2b9fdf | 2016-08-03 19:53:36 -0700 | [diff] [blame] | 854 | |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 855 | executable("dm") { |
| 856 | sources = [ |
| 857 | "dm/DM.cpp", |
| 858 | "dm/DMJsonWriter.cpp", |
| 859 | "dm/DMSrcSink.cpp", |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 860 | ] |
| 861 | include_dirs = [ "tests" ] |
| 862 | deps = [ |
mtklein | 046cb56 | 2016-09-16 10:23:12 -0700 | [diff] [blame] | 863 | ":common_flags", |
fmalita | a2b9fdf | 2016-08-03 19:53:36 -0700 | [diff] [blame] | 864 | ":experimental_svg_model", |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 865 | ":flags", |
| 866 | ":gm", |
| 867 | ":gpu_tool_utils", |
| 868 | ":skia", |
mtklein | 2f3416d | 2016-08-02 16:02:05 -0700 | [diff] [blame] | 869 | ":tests", |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 870 | ":tool_utils", |
| 871 | "//third_party/jsoncpp", |
| 872 | "//third_party/libpng", |
| 873 | ] |
| 874 | testonly = true |
| 875 | } |
| 876 | |
Mike Klein | a343017 | 2016-09-27 16:46:29 -0400 | [diff] [blame] | 877 | if (!is_debug) { # I've benchmarked debug code once too many times... |
| 878 | executable("monobench") { |
| 879 | sources = [ |
| 880 | "tools/monobench.cpp", |
| 881 | ] |
| 882 | deps = [ |
| 883 | ":bench", |
| 884 | ":skia", |
| 885 | ] |
| 886 | testonly = true |
| 887 | } |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 888 | } |
| 889 | |
| 890 | executable("nanobench") { |
| 891 | sources = [ |
| 892 | "bench/nanobench.cpp", |
| 893 | ] |
| 894 | deps = [ |
| 895 | ":bench", |
mtklein | 046cb56 | 2016-09-16 10:23:12 -0700 | [diff] [blame] | 896 | ":common_flags", |
fmalita | 6519c21 | 2016-09-14 08:05:17 -0700 | [diff] [blame] | 897 | ":experimental_svg_model", |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 898 | ":flags", |
| 899 | ":gm", |
| 900 | ":gpu_tool_utils", |
| 901 | ":skia", |
| 902 | ":tool_utils", |
| 903 | "//third_party/jsoncpp", |
| 904 | ] |
| 905 | testonly = true |
| 906 | } |
halcanary | 19a9720 | 2016-08-03 15:08:04 -0700 | [diff] [blame] | 907 | |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 908 | if (skia_enable_gpu) { |
| 909 | executable("skpbench") { |
| 910 | sources = [ |
| 911 | "tools/skpbench/skpbench.cpp", |
| 912 | ] |
| 913 | deps = [ |
| 914 | ":flags", |
| 915 | ":gpu_tool_utils", |
| 916 | ":skia", |
| 917 | ":tool_utils", |
| 918 | ] |
| 919 | testonly = true |
| 920 | } |
csmartdalton | 4b5179b | 2016-09-19 11:03:58 -0700 | [diff] [blame] | 921 | } |
| 922 | |
mtklein | 6f5df6a | 2016-08-29 16:01:10 -0700 | [diff] [blame] | 923 | if (current_cpu != "mipsel") { # Clang 3.8 crashes while compiling hb-icu.cc for mipsel. |
halcanary | 3eee9d9 | 2016-09-10 07:01:53 -0700 | [diff] [blame] | 924 | executable("sktexttopdf-hb") { |
mtklein | 6f5df6a | 2016-08-29 16:01:10 -0700 | [diff] [blame] | 925 | sources = [ |
| 926 | "tools/SkShaper_harfbuzz.cpp", |
| 927 | "tools/using_skia_and_harfbuzz.cpp", |
| 928 | ] |
| 929 | deps = [ |
| 930 | ":skia", |
| 931 | "//third_party/harfbuzz", |
| 932 | ] |
| 933 | testonly = true |
| 934 | } |
halcanary | 19a9720 | 2016-08-03 15:08:04 -0700 | [diff] [blame] | 935 | } |
halcanary | 3eee9d9 | 2016-09-10 07:01:53 -0700 | [diff] [blame] | 936 | executable("sktexttopdf") { |
| 937 | sources = [ |
| 938 | "tools/SkShaper_primitive.cpp", |
| 939 | "tools/using_skia_and_harfbuzz.cpp", |
| 940 | ] |
| 941 | deps = [ |
| 942 | ":skia", |
| 943 | ] |
| 944 | testonly = true |
| 945 | } |
mtklein | 046cb56 | 2016-09-16 10:23:12 -0700 | [diff] [blame] | 946 | |
| 947 | executable("get_images_from_skps") { |
| 948 | sources = [ |
| 949 | "tools/get_images_from_skps.cpp", |
| 950 | ] |
| 951 | deps = [ |
| 952 | ":flags", |
| 953 | ":skia", |
| 954 | "//third_party/jsoncpp", |
| 955 | ] |
| 956 | testonly = true |
| 957 | } |
mtklein | ecbc526 | 2016-09-22 11:51:24 -0700 | [diff] [blame] | 958 | |
| 959 | executable("skiaserve") { |
| 960 | sources = [ |
| 961 | "tools/skiaserve/Request.cpp", |
| 962 | "tools/skiaserve/Response.cpp", |
| 963 | "tools/skiaserve/skiaserve.cpp", |
| 964 | "tools/skiaserve/urlhandlers/BatchBoundsHandler.cpp", |
| 965 | "tools/skiaserve/urlhandlers/BatchesHandler.cpp", |
| 966 | "tools/skiaserve/urlhandlers/BreakHandler.cpp", |
| 967 | "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp", |
| 968 | "tools/skiaserve/urlhandlers/CmdHandler.cpp", |
| 969 | "tools/skiaserve/urlhandlers/ColorModeHandler.cpp", |
| 970 | "tools/skiaserve/urlhandlers/DataHandler.cpp", |
| 971 | "tools/skiaserve/urlhandlers/DownloadHandler.cpp", |
| 972 | "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp", |
| 973 | "tools/skiaserve/urlhandlers/ImgHandler.cpp", |
| 974 | "tools/skiaserve/urlhandlers/InfoHandler.cpp", |
| 975 | "tools/skiaserve/urlhandlers/PostHandler.cpp", |
| 976 | "tools/skiaserve/urlhandlers/QuitHandler.cpp", |
| 977 | "tools/skiaserve/urlhandlers/RootHandler.cpp", |
| 978 | ] |
| 979 | deps = [ |
| 980 | ":flags", |
| 981 | ":gpu_tool_utils", |
| 982 | ":skia", |
| 983 | ":tool_utils", |
| 984 | "//third_party/jsoncpp", |
| 985 | "//third_party/libmicrohttpd", |
| 986 | "//third_party/libpng", |
| 987 | ] |
| 988 | testonly = true |
| 989 | } |
kjlubick | 14f984b | 2016-10-03 11:49:45 -0700 | [diff] [blame] | 990 | |
| 991 | executable("fuzz") { |
| 992 | sources = [ |
| 993 | "fuzz/FilterFuzz.cpp", |
| 994 | "fuzz/FuzzGradients.cpp", |
| 995 | "fuzz/FuzzParsePath.cpp", |
| 996 | "fuzz/FuzzPathop.cpp", |
| 997 | "fuzz/FuzzScaleToSides.cpp", |
| 998 | "fuzz/fuzz.cpp", |
| 999 | ] |
| 1000 | deps = [ |
| 1001 | ":flags", |
| 1002 | ":skia", |
| 1003 | ] |
| 1004 | testonly = true |
| 1005 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 1006 | } |