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