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 | |
Mike Klein | cfc4f44 | 2016-10-26 17:19:03 -0400 | [diff] [blame] | 6 | import("gn/android_framework_defines.gni") |
mikejurka | 8c24f4f | 2016-09-12 16:51:58 -0700 | [diff] [blame] | 7 | import("gn/shared_sources.gni") |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 8 | |
mtklein | 3e8012e | 2016-09-21 09:14:19 -0700 | [diff] [blame] | 9 | if (!defined(is_skia_standalone)) { |
| 10 | is_skia_standalone = false |
| 11 | } |
| 12 | |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 13 | declare_args() { |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 14 | skia_use_angle = false |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 15 | skia_use_expat = true |
mtklein | 3cc2218 | 2016-08-29 13:26:14 -0700 | [diff] [blame] | 16 | skia_use_fontconfig = is_linux |
mtklein | cdedd0e | 2016-09-12 15:15:44 -0700 | [diff] [blame] | 17 | skia_use_freetype = is_android || is_fuchsia || is_linux |
Mike Klein | 69f6ed4 | 2016-10-13 15:45:07 -0400 | [diff] [blame] | 18 | skia_use_gdi = false |
Mike Klein | 7d30288 | 2016-11-03 14:06:31 -0400 | [diff] [blame] | 19 | skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 20 | skia_use_libjpeg_turbo = true |
| 21 | skia_use_libpng = true |
mtklein | eb3c425 | 2016-08-23 07:38:09 -0700 | [diff] [blame] | 22 | skia_use_libwebp = !is_fuchsia |
mtklein | a627b5c | 2016-09-20 13:36:47 -0700 | [diff] [blame] | 23 | skia_use_mesa = false |
Mike Klein | 10d665d | 2016-11-01 11:46:10 -0400 | [diff] [blame] | 24 | skia_use_piex = !is_win |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 25 | skia_use_zlib = true |
mtklein | 1bd72ba | 2016-09-16 07:45:52 -0700 | [diff] [blame] | 26 | |
| 27 | skia_enable_android_framework_defines = false |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 28 | skia_enable_gpu = true |
mtklein | 3e8012e | 2016-09-21 09:14:19 -0700 | [diff] [blame] | 29 | skia_enable_tools = is_skia_standalone |
| 30 | skia_enable_vulkan_debug_layers = is_skia_standalone && is_debug |
Greg Daniel | 686bb21 | 2016-10-27 10:48:48 -0400 | [diff] [blame] | 31 | skia_vulkan_sdk = getenv("VULKAN_SDK") |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 32 | } |
Brian Salomon | 23d73ea | 2016-10-27 13:31:37 -0400 | [diff] [blame] | 33 | declare_args() { |
Mike Klein | 10d665d | 2016-11-01 11:46:10 -0400 | [diff] [blame] | 34 | skia_use_dng_sdk = !is_win && skia_use_libjpeg_turbo && skia_use_zlib |
| 35 | skia_use_sfntly = skia_use_icu |
| 36 | |
Mike Klein | 4d598a3 | 2016-10-31 13:44:49 -0400 | [diff] [blame] | 37 | if (is_android) { |
| 38 | skia_use_vulkan = defined(ndk_api) && ndk_api >= 24 |
| 39 | } else { |
| 40 | skia_use_vulkan = skia_vulkan_sdk != "" |
| 41 | } |
Brian Salomon | 23d73ea | 2016-10-27 13:31:37 -0400 | [diff] [blame] | 42 | } |
Brian Salomon | 789e25e | 2016-09-30 13:41:03 -0400 | [diff] [blame] | 43 | |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 44 | # Our tools require static linking (they use non-exported symbols). |
| 45 | skia_enable_tools = skia_enable_tools && !is_component_build |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 46 | |
mtklein | a45be61 | 2016-08-29 15:22:10 -0700 | [diff] [blame] | 47 | fontmgr_android_enabled = skia_use_expat && skia_use_freetype |
| 48 | |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 49 | skia_public_includes = [ |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 50 | "include/android", |
mtklein | fa84d94 | 2016-07-28 09:45:14 -0700 | [diff] [blame] | 51 | "include/c", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 52 | "include/codec", |
| 53 | "include/config", |
| 54 | "include/core", |
| 55 | "include/effects", |
| 56 | "include/gpu", |
| 57 | "include/gpu/gl", |
| 58 | "include/images", |
| 59 | "include/pathops", |
| 60 | "include/ports", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 61 | "include/svg", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 62 | "include/utils", |
| 63 | "include/utils/mac", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 64 | "include/xml", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 65 | ] |
| 66 | |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 67 | # Skia public API, generally provided by :skia. |
| 68 | config("skia_public") { |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 69 | include_dirs = skia_public_includes |
Mike Klein | ae7e671 | 2016-10-11 17:49:33 -0400 | [diff] [blame] | 70 | defines = [] |
| 71 | if (is_component_build) { |
| 72 | defines += [ "SKIA_DLL" ] |
| 73 | } |
Mike Klein | c4cbd74 | 2016-09-26 21:37:09 -0400 | [diff] [blame] | 74 | if (is_fuchsia || is_linux) { |
jcgregorio | 5561e3d | 2016-08-25 09:25:11 -0700 | [diff] [blame] | 75 | defines += [ "SK_SAMPLES_FOR_X" ] |
| 76 | } |
mtklein | cae1be5 | 2016-09-20 08:24:34 -0700 | [diff] [blame] | 77 | if (skia_enable_android_framework_defines) { |
Mike Klein | cfc4f44 | 2016-10-26 17:19:03 -0400 | [diff] [blame] | 78 | defines += android_framework_defines |
mtklein | cae1be5 | 2016-09-20 08:24:34 -0700 | [diff] [blame] | 79 | } |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 80 | if (!skia_enable_gpu) { |
| 81 | defines += [ "SK_SUPPORT_GPU=0" ] |
| 82 | } |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 83 | } |
| 84 | |
| 85 | # Skia internal APIs, used by Skia itself and a few test tools. |
| 86 | config("skia_private") { |
| 87 | visibility = [ ":*" ] |
| 88 | |
| 89 | include_dirs = [ |
| 90 | "include/private", |
| 91 | "src/c", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 92 | "src/codec", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 93 | "src/config", |
| 94 | "src/core", |
| 95 | "src/effects", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 96 | "src/effects/gradients", |
| 97 | "src/fonts", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 98 | "src/gpu", |
| 99 | "src/image", |
| 100 | "src/images", |
| 101 | "src/lazy", |
| 102 | "src/opts", |
| 103 | "src/pathops", |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 104 | "src/pdf", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 105 | "src/ports", |
| 106 | "src/sfnt", |
mtklein | 9e0d9dd | 2016-08-30 10:37:19 -0700 | [diff] [blame] | 107 | "src/sksl", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 108 | "src/utils", |
mtklein | 7a1f45f | 2016-08-04 06:19:33 -0700 | [diff] [blame] | 109 | "src/utils/win", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 110 | "third_party/etc1", |
scroggo | 19b9153 | 2016-10-24 09:03:26 -0700 | [diff] [blame] | 111 | "third_party/gif", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 112 | "third_party/ktx", |
| 113 | ] |
mtklein | 150d113 | 2016-08-01 06:56:40 -0700 | [diff] [blame] | 114 | |
Jim Van Verth | b6c5e53 | 2016-10-28 10:38:08 -0400 | [diff] [blame] | 115 | defines = [ |
| 116 | "SK_GAMMA_APPLY_TO_A8", |
| 117 | "SK_INTERNAL", |
| 118 | ] |
mtklein | b37c034 | 2016-09-09 11:07:45 -0700 | [diff] [blame] | 119 | if (is_android) { |
| 120 | defines += [ |
| 121 | "SK_GAMMA_EXPONENT=1.4", |
| 122 | "SK_GAMMA_CONTRAST=0.0", |
| 123 | ] |
| 124 | } |
mtklein | 88a7ac0 | 2016-09-14 11:16:49 -0700 | [diff] [blame] | 125 | if (is_official_build || is_android) { |
| 126 | # TODO(bsalomon): it'd be nice to make Android normal. |
| 127 | defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ] |
| 128 | } |
Brian Salomon | 789e25e | 2016-09-30 13:41:03 -0400 | [diff] [blame] | 129 | libs = [] |
| 130 | lib_dirs = [] |
| 131 | if (skia_use_vulkan) { |
Greg Daniel | ab563d4 | 2016-10-31 11:19:59 -0400 | [diff] [blame] | 132 | if (skia_vulkan_sdk != "" && !is_android) { |
Mike Klein | 487bfc2 | 2016-10-14 14:04:56 -0400 | [diff] [blame] | 133 | if (is_win) { |
| 134 | include_dirs += [ "$skia_vulkan_sdk/Include/" ] |
| 135 | lib_dirs += [ "$skia_vulkan_sdk/Bin" ] |
| 136 | } else { |
Greg Daniel | 686bb21 | 2016-10-27 10:48:48 -0400 | [diff] [blame] | 137 | include_dirs += [ "$skia_vulkan_sdk/include/" ] |
| 138 | lib_dirs += [ "$skia_vulkan_sdk/lib/" ] |
Mike Klein | 487bfc2 | 2016-10-14 14:04:56 -0400 | [diff] [blame] | 139 | } |
Brian Salomon | 789e25e | 2016-09-30 13:41:03 -0400 | [diff] [blame] | 140 | } |
Mike Klein | 487bfc2 | 2016-10-14 14:04:56 -0400 | [diff] [blame] | 141 | if (is_win) { |
| 142 | libs += [ "vulkan-1.lib" ] |
| 143 | } else { |
| 144 | libs += [ "vulkan" ] |
| 145 | } |
Brian Salomon | 789e25e | 2016-09-30 13:41:03 -0400 | [diff] [blame] | 146 | } |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 147 | } |
| 148 | |
| 149 | # Any code that's linked into Skia-the-library should use this config via += skia_library_configs. |
| 150 | config("skia_library") { |
| 151 | visibility = [ ":*" ] |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 152 | defines = [ "SKIA_IMPLEMENTATION=1" ] |
| 153 | } |
| 154 | |
| 155 | skia_library_configs = [ |
| 156 | ":skia_public", |
| 157 | ":skia_private", |
| 158 | ":skia_library", |
| 159 | ] |
| 160 | |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 161 | # Use for CPU-specific Skia code that needs particular compiler flags. |
| 162 | template("opts") { |
| 163 | if (invoker.enabled) { |
| 164 | source_set(target_name) { |
| 165 | forward_variables_from(invoker, "*") |
| 166 | configs += skia_library_configs |
| 167 | } |
| 168 | } else { |
| 169 | # If not enabled, a phony empty target that swallows all otherwise unused variables. |
| 170 | source_set(target_name) { |
| 171 | forward_variables_from(invoker, |
| 172 | "*", |
| 173 | [ |
| 174 | "sources", |
| 175 | "cflags", |
| 176 | ]) |
| 177 | } |
| 178 | } |
anmittal | a7eaf2e | 2016-08-17 13:57:26 -0700 | [diff] [blame] | 179 | } |
| 180 | |
mtklein | 422310d | 2016-08-16 18:28:43 -0700 | [diff] [blame] | 181 | is_x86 = current_cpu == "x64" || current_cpu == "x86" |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 182 | |
mtklein | 7d6fb2c | 2016-08-25 14:50:44 -0700 | [diff] [blame] | 183 | opts("none") { |
| 184 | enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64" |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 185 | sources = skia_opts.none_sources |
anmittal | b8b3f71 | 2016-08-25 04:55:19 -0700 | [diff] [blame] | 186 | cflags = [] |
| 187 | } |
| 188 | |
mtklein | 7d6fb2c | 2016-08-25 14:50:44 -0700 | [diff] [blame] | 189 | opts("armv7") { |
anmittal | b8b3f71 | 2016-08-25 04:55:19 -0700 | [diff] [blame] | 190 | enabled = current_cpu == "arm" |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 191 | sources = skia_opts.armv7_sources + skia_opts.neon_sources |
mtklein | 7d6fb2c | 2016-08-25 14:50:44 -0700 | [diff] [blame] | 192 | cflags = [] |
anmittal | b8b3f71 | 2016-08-25 04:55:19 -0700 | [diff] [blame] | 193 | } |
| 194 | |
| 195 | opts("arm64") { |
| 196 | enabled = current_cpu == "arm64" |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 197 | sources = skia_opts.arm64_sources |
anmittal | b8b3f71 | 2016-08-25 04:55:19 -0700 | [diff] [blame] | 198 | cflags = [] |
| 199 | } |
| 200 | |
| 201 | opts("crc32") { |
| 202 | enabled = current_cpu == "arm64" |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 203 | sources = skia_opts.crc32_sources |
anmittal | b8b3f71 | 2016-08-25 04:55:19 -0700 | [diff] [blame] | 204 | cflags = [ "-march=armv8-a+crc" ] |
| 205 | } |
| 206 | |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 207 | opts("sse2") { |
| 208 | enabled = is_x86 |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 209 | sources = skia_opts.sse2_sources |
Mike Klein | d8765e3 | 2016-10-19 13:39:13 -0400 | [diff] [blame] | 210 | if (is_win) { |
| 211 | defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ] |
| 212 | } else { |
Mike Klein | 3eb7121 | 2016-10-11 17:08:53 -0400 | [diff] [blame] | 213 | cflags = [ "-msse2" ] |
| 214 | } |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 215 | } |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 216 | |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 217 | opts("ssse3") { |
| 218 | enabled = is_x86 |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 219 | sources = skia_opts.ssse3_sources |
Mike Klein | d8765e3 | 2016-10-19 13:39:13 -0400 | [diff] [blame] | 220 | if (is_win) { |
| 221 | defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ] |
| 222 | } else { |
Mike Klein | 3eb7121 | 2016-10-11 17:08:53 -0400 | [diff] [blame] | 223 | cflags = [ "-mssse3" ] |
| 224 | } |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 225 | } |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 226 | |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 227 | opts("sse41") { |
| 228 | enabled = is_x86 |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 229 | sources = skia_opts.sse41_sources |
Mike Klein | d8765e3 | 2016-10-19 13:39:13 -0400 | [diff] [blame] | 230 | if (is_win) { |
| 231 | defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ] |
| 232 | } else { |
Mike Klein | 3eb7121 | 2016-10-11 17:08:53 -0400 | [diff] [blame] | 233 | cflags = [ "-msse4.1" ] |
| 234 | } |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 235 | } |
mtklein | 4e97607 | 2016-08-08 09:06:27 -0700 | [diff] [blame] | 236 | |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 237 | opts("sse42") { |
| 238 | enabled = is_x86 |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 239 | sources = skia_opts.sse42_sources |
Mike Klein | d8765e3 | 2016-10-19 13:39:13 -0400 | [diff] [blame] | 240 | if (is_win) { |
| 241 | defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ] |
| 242 | } else { |
Mike Klein | 3eb7121 | 2016-10-11 17:08:53 -0400 | [diff] [blame] | 243 | cflags = [ "-msse4.2" ] |
| 244 | } |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 245 | } |
| 246 | |
| 247 | opts("avx") { |
| 248 | enabled = is_x86 |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 249 | sources = skia_opts.avx_sources |
Mike Klein | 3eb7121 | 2016-10-11 17:08:53 -0400 | [diff] [blame] | 250 | if (is_win) { |
| 251 | cflags = [ "/arch:AVX" ] |
| 252 | } else { |
| 253 | cflags = [ "-mavx" ] |
| 254 | } |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 255 | } |
| 256 | |
Mike Klein | 78d5a3b | 2016-09-30 10:48:01 -0400 | [diff] [blame] | 257 | opts("hsw") { |
| 258 | enabled = is_x86 |
| 259 | sources = skia_opts.hsw_sources |
Mike Klein | 3eb7121 | 2016-10-11 17:08:53 -0400 | [diff] [blame] | 260 | if (is_win) { |
| 261 | cflags = [ "/arch:AVX2" ] |
| 262 | } else { |
| 263 | cflags = [ |
| 264 | "-mavx2", |
| 265 | "-mbmi", |
| 266 | "-mbmi2", |
| 267 | "-mf16c", |
| 268 | "-mfma", |
| 269 | ] |
| 270 | } |
Mike Klein | 78d5a3b | 2016-09-30 10:48:01 -0400 | [diff] [blame] | 271 | } |
| 272 | |
mtklein | 349cece | 2016-08-26 08:13:04 -0700 | [diff] [blame] | 273 | opts("dsp") { |
| 274 | enabled = current_cpu == "mipsel" |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 275 | sources = skia_opts.mips_dsp_sources |
mtklein | b6064ef | 2016-08-30 11:49:24 -0700 | [diff] [blame] | 276 | cflags = [] |
mtklein | 349cece | 2016-08-26 08:13:04 -0700 | [diff] [blame] | 277 | } |
| 278 | |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 279 | # 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] | 280 | template("optional") { |
| 281 | if (invoker.enabled) { |
| 282 | config(target_name + "_public") { |
mtklein | cd01b03 | 2016-08-31 04:58:19 -0700 | [diff] [blame] | 283 | if (defined(invoker.public_defines)) { |
| 284 | defines = invoker.public_defines |
| 285 | } |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 286 | } |
| 287 | source_set(target_name) { |
mtklein | cd01b03 | 2016-08-31 04:58:19 -0700 | [diff] [blame] | 288 | forward_variables_from(invoker, |
| 289 | "*", |
| 290 | [ |
| 291 | "public_defines", |
| 292 | "sources_when_disabled", |
scroggo | f84ad64 | 2016-10-31 09:02:57 -0700 | [diff] [blame] | 293 | "configs_to_remove", |
mtklein | cd01b03 | 2016-08-31 04:58:19 -0700 | [diff] [blame] | 294 | ]) |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 295 | all_dependent_configs = [ ":" + target_name + "_public" ] |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 296 | configs += skia_library_configs |
scroggo | f84ad64 | 2016-10-31 09:02:57 -0700 | [diff] [blame] | 297 | if (defined(invoker.configs_to_remove)) { |
| 298 | configs -= invoker.configs_to_remove |
| 299 | } |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 300 | } |
| 301 | } else { |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 302 | source_set(target_name) { |
| 303 | forward_variables_from(invoker, |
| 304 | "*", |
| 305 | [ |
| 306 | "public_defines", |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 307 | "deps", |
mtklein | 6ef6999 | 2016-09-14 06:12:09 -0700 | [diff] [blame] | 308 | "libs", |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 309 | "sources", |
mtklein | cd01b03 | 2016-08-31 04:58:19 -0700 | [diff] [blame] | 310 | "sources_when_disabled", |
scroggo | f84ad64 | 2016-10-31 09:02:57 -0700 | [diff] [blame] | 311 | "configs_to_remove", |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 312 | ]) |
mtklein | cd01b03 | 2016-08-31 04:58:19 -0700 | [diff] [blame] | 313 | if (defined(invoker.sources_when_disabled)) { |
| 314 | sources = invoker.sources_when_disabled |
| 315 | } |
| 316 | configs += skia_library_configs |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 317 | } |
mtklein | eb3c425 | 2016-08-23 07:38:09 -0700 | [diff] [blame] | 318 | } |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 319 | } |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 320 | |
mtklein | a45be61 | 2016-08-29 15:22:10 -0700 | [diff] [blame] | 321 | optional("fontmgr_android") { |
| 322 | enabled = fontmgr_android_enabled |
mtklein | a45be61 | 2016-08-29 15:22:10 -0700 | [diff] [blame] | 323 | |
| 324 | deps = [ |
| 325 | "//third_party/expat", |
| 326 | "//third_party/freetype2", |
| 327 | ] |
| 328 | sources = [ |
| 329 | "src/ports/SkFontMgr_android.cpp", |
| 330 | "src/ports/SkFontMgr_android_factory.cpp", |
| 331 | "src/ports/SkFontMgr_android_parser.cpp", |
| 332 | ] |
| 333 | } |
| 334 | |
mtklein | d2e39db | 2016-09-07 07:52:55 -0700 | [diff] [blame] | 335 | optional("fontmgr_custom") { |
| 336 | enabled = is_linux && skia_use_freetype && !skia_use_fontconfig |
| 337 | |
| 338 | deps = [ |
| 339 | "//third_party/freetype2", |
| 340 | ] |
| 341 | sources = [ |
| 342 | "src/ports/SkFontMgr_custom.cpp", |
| 343 | "src/ports/SkFontMgr_custom_directory_factory.cpp", |
| 344 | ] |
| 345 | } |
| 346 | |
mtklein | 3cc2218 | 2016-08-29 13:26:14 -0700 | [diff] [blame] | 347 | optional("fontmgr_fontconfig") { |
| 348 | enabled = skia_use_freetype && skia_use_fontconfig |
mtklein | 3cc2218 | 2016-08-29 13:26:14 -0700 | [diff] [blame] | 349 | |
| 350 | deps = [ |
| 351 | "//third_party:fontconfig", |
| 352 | "//third_party/freetype2", |
| 353 | ] |
| 354 | sources = [ |
bungeman | 1ae0e01 | 2016-09-19 12:13:16 -0700 | [diff] [blame] | 355 | "src/ports/SkFontConfigInterface.cpp", |
mtklein | 3cc2218 | 2016-08-29 13:26:14 -0700 | [diff] [blame] | 356 | "src/ports/SkFontConfigInterface_direct.cpp", |
| 357 | "src/ports/SkFontConfigInterface_direct_factory.cpp", |
| 358 | "src/ports/SkFontMgr_FontConfigInterface.cpp", |
| 359 | "src/ports/SkFontMgr_fontconfig.cpp", |
| 360 | "src/ports/SkFontMgr_fontconfig_factory.cpp", |
| 361 | ] |
| 362 | } |
| 363 | |
mtklein | cdedd0e | 2016-09-12 15:15:44 -0700 | [diff] [blame] | 364 | optional("fontmgr_fuchsia") { |
| 365 | enabled = is_fuchsia && skia_use_freetype |
| 366 | |
| 367 | deps = [ |
| 368 | "//third_party/freetype2", |
| 369 | ] |
| 370 | sources = [ |
| 371 | "src/ports/SkFontMgr_custom.cpp", |
| 372 | "src/ports/SkFontMgr_custom_empty_factory.cpp", |
| 373 | ] |
| 374 | } |
| 375 | |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 376 | optional("gpu") { |
| 377 | enabled = skia_enable_gpu |
mtklein | e9fb3d5 | 2016-09-20 15:11:46 -0700 | [diff] [blame] | 378 | public_defines = [] |
| 379 | |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 380 | sources = skia_gpu_sources + [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ] |
| 381 | |
| 382 | # These paths need to be absolute to match the ones produced by shared_sources.gni. |
| 383 | sources -= get_path_info([ |
| 384 | "src/gpu/gl/GrGLCreateNativeInterface_none.cpp", |
| 385 | "src/gpu/gl/GrGLDefaultInterface_none.cpp", |
| 386 | ], |
| 387 | "abspath") |
Mike Klein | 703cf5a | 2016-10-13 17:18:04 -0400 | [diff] [blame] | 388 | libs = [] |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 389 | if (is_android) { |
| 390 | sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ] |
| 391 | } else if (is_linux) { |
| 392 | sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ] |
| 393 | } else if (is_mac) { |
| 394 | sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ] |
Mike Klein | 703cf5a | 2016-10-13 17:18:04 -0400 | [diff] [blame] | 395 | } else if (is_win) { |
| 396 | sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ] |
| 397 | libs += [ "OpenGL32.lib" ] |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 398 | } else { |
| 399 | sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ] |
| 400 | } |
mtklein | e9fb3d5 | 2016-09-20 15:11:46 -0700 | [diff] [blame] | 401 | |
| 402 | if (skia_use_vulkan) { |
| 403 | public_defines += [ "SK_VULKAN" ] |
| 404 | sources += skia_vk_sources |
egdaniel | e4a9bd7 | 2016-09-21 07:36:14 -0700 | [diff] [blame] | 405 | if (skia_enable_vulkan_debug_layers) { |
| 406 | public_defines += [ "SK_ENABLE_VK_LAYERS" ] |
| 407 | } |
mtklein | e9fb3d5 | 2016-09-20 15:11:46 -0700 | [diff] [blame] | 408 | } |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 409 | } |
| 410 | |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 411 | optional("jpeg") { |
| 412 | enabled = skia_use_libjpeg_turbo |
| 413 | public_defines = [ "SK_HAS_JPEG_LIBRARY" ] |
| 414 | |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 415 | deps = [ |
| 416 | "//third_party/libjpeg-turbo:libjpeg", |
| 417 | ] |
| 418 | sources = [ |
| 419 | "src/codec/SkJpegCodec.cpp", |
| 420 | "src/codec/SkJpegDecoderMgr.cpp", |
| 421 | "src/codec/SkJpegUtility.cpp", |
| 422 | "src/images/SkJPEGImageEncoder.cpp", |
| 423 | "src/images/SkJPEGWriteUtility.cpp", |
| 424 | ] |
| 425 | } |
| 426 | |
| 427 | optional("pdf") { |
| 428 | enabled = skia_use_zlib |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 429 | |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 430 | deps = [ |
| 431 | "//third_party/zlib", |
| 432 | ] |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 433 | sources = skia_pdf_sources |
mtklein | cd01b03 | 2016-08-31 04:58:19 -0700 | [diff] [blame] | 434 | sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ] |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 435 | |
| 436 | if (skia_use_sfntly) { |
| 437 | deps += [ "//third_party/sfntly" ] |
mtklein | cd01b03 | 2016-08-31 04:58:19 -0700 | [diff] [blame] | 438 | public_defines = [ "SK_PDF_USE_SFNTLY" ] |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 439 | } |
| 440 | } |
| 441 | |
| 442 | optional("png") { |
| 443 | enabled = skia_use_libpng |
| 444 | public_defines = [ "SK_HAS_PNG_LIBRARY" ] |
| 445 | |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 446 | deps = [ |
| 447 | "//third_party/libpng", |
| 448 | ] |
| 449 | sources = [ |
| 450 | "src/codec/SkIcoCodec.cpp", |
| 451 | "src/codec/SkPngCodec.cpp", |
| 452 | "src/images/SkPNGImageEncoder.cpp", |
| 453 | ] |
| 454 | } |
| 455 | |
scroggo | f84ad64 | 2016-10-31 09:02:57 -0700 | [diff] [blame] | 456 | optional("raw") { |
Mike Klein | 10d665d | 2016-11-01 11:46:10 -0400 | [diff] [blame] | 457 | enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex |
scroggo | f84ad64 | 2016-10-31 09:02:57 -0700 | [diff] [blame] | 458 | public_defines = [ "SK_CODEC_DECODES_RAW" ] |
| 459 | |
| 460 | deps = [ |
| 461 | "//third_party/dng_sdk", |
| 462 | "//third_party/libjpeg-turbo:libjpeg", |
| 463 | "//third_party/piex", |
| 464 | ] |
| 465 | |
| 466 | # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of |
| 467 | # Skia. |
| 468 | configs_to_remove = [ "//gn:no_exceptions" ] |
| 469 | |
| 470 | sources = [ |
| 471 | "src/codec/SkRawAdapterCodec.cpp", |
| 472 | "src/codec/SkRawCodec.cpp", |
| 473 | ] |
| 474 | } |
| 475 | |
mtklein | 3cc2218 | 2016-08-29 13:26:14 -0700 | [diff] [blame] | 476 | optional("typeface_freetype") { |
| 477 | enabled = skia_use_freetype |
mtklein | 3cc2218 | 2016-08-29 13:26:14 -0700 | [diff] [blame] | 478 | |
| 479 | deps = [ |
| 480 | "//third_party/freetype2", |
| 481 | ] |
| 482 | sources = [ |
| 483 | "src/ports/SkFontHost_FreeType.cpp", |
| 484 | "src/ports/SkFontHost_FreeType_common.cpp", |
| 485 | ] |
| 486 | } |
| 487 | |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 488 | optional("webp") { |
| 489 | enabled = skia_use_libwebp |
| 490 | public_defines = [ "SK_HAS_WEBP_LIBRARY" ] |
| 491 | |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 492 | deps = [ |
| 493 | "//third_party/libwebp", |
| 494 | ] |
| 495 | sources = [ |
| 496 | "src/codec/SkWebpAdapterCodec.cpp", |
| 497 | "src/codec/SkWebpCodec.cpp", |
| 498 | "src/images/SkWEBPImageEncoder.cpp", |
| 499 | ] |
mtklein | eb3c425 | 2016-08-23 07:38:09 -0700 | [diff] [blame] | 500 | } |
| 501 | |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 502 | optional("xml") { |
| 503 | enabled = skia_use_expat |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 504 | |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 505 | deps = [ |
| 506 | "//third_party/expat", |
| 507 | ] |
| 508 | sources = [ |
| 509 | "src/xml/SkDOM.cpp", |
| 510 | "src/xml/SkXMLParser.cpp", |
| 511 | "src/xml/SkXMLWriter.cpp", |
| 512 | ] |
| 513 | } |
| 514 | |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 515 | component("skia") { |
| 516 | public_configs = [ ":skia_public" ] |
| 517 | configs += skia_library_configs |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 518 | |
| 519 | deps = [ |
anmittal | b8b3f71 | 2016-08-25 04:55:19 -0700 | [diff] [blame] | 520 | ":arm64", |
| 521 | ":armv7", |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 522 | ":avx", |
anmittal | b8b3f71 | 2016-08-25 04:55:19 -0700 | [diff] [blame] | 523 | ":crc32", |
mtklein | 349cece | 2016-08-26 08:13:04 -0700 | [diff] [blame] | 524 | ":dsp", |
mtklein | a45be61 | 2016-08-29 15:22:10 -0700 | [diff] [blame] | 525 | ":fontmgr_android", |
mtklein | d2e39db | 2016-09-07 07:52:55 -0700 | [diff] [blame] | 526 | ":fontmgr_custom", |
mtklein | 3cc2218 | 2016-08-29 13:26:14 -0700 | [diff] [blame] | 527 | ":fontmgr_fontconfig", |
mtklein | cdedd0e | 2016-09-12 15:15:44 -0700 | [diff] [blame] | 528 | ":fontmgr_fuchsia", |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 529 | ":gpu", |
Mike Klein | 78d5a3b | 2016-09-30 10:48:01 -0400 | [diff] [blame] | 530 | ":hsw", |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 531 | ":jpeg", |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 532 | ":none", |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 533 | ":pdf", |
| 534 | ":png", |
scroggo | f84ad64 | 2016-10-31 09:02:57 -0700 | [diff] [blame] | 535 | ":raw", |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 536 | ":sse2", |
| 537 | ":sse41", |
| 538 | ":sse42", |
| 539 | ":ssse3", |
mtklein | 3cc2218 | 2016-08-29 13:26:14 -0700 | [diff] [blame] | 540 | ":typeface_freetype", |
mtklein | eb3c425 | 2016-08-23 07:38:09 -0700 | [diff] [blame] | 541 | ":webp", |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 542 | ":xml", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 543 | ] |
| 544 | |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 545 | sources = [] |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 546 | sources += skia_core_sources |
| 547 | sources += skia_effects_sources |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 548 | sources += skia_sksl_sources |
| 549 | sources += skia_utils_sources |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 550 | sources += [ |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 551 | "src/android/SkBitmapRegionCodec.cpp", |
| 552 | "src/android/SkBitmapRegionDecoder.cpp", |
| 553 | "src/codec/SkAndroidCodec.cpp", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 554 | "src/codec/SkBmpCodec.cpp", |
| 555 | "src/codec/SkBmpMaskCodec.cpp", |
| 556 | "src/codec/SkBmpRLECodec.cpp", |
| 557 | "src/codec/SkBmpStandardCodec.cpp", |
| 558 | "src/codec/SkCodec.cpp", |
| 559 | "src/codec/SkCodecImageGenerator.cpp", |
scroggo | 19b9153 | 2016-10-24 09:03:26 -0700 | [diff] [blame] | 560 | "src/codec/SkGifCodec.cpp", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 561 | "src/codec/SkMaskSwizzler.cpp", |
| 562 | "src/codec/SkMasks.cpp", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 563 | "src/codec/SkSampledCodec.cpp", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 564 | "src/codec/SkSampler.cpp", |
scroggo | 19b9153 | 2016-10-24 09:03:26 -0700 | [diff] [blame] | 565 | "src/codec/SkStreamBuffer.cpp", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 566 | "src/codec/SkSwizzler.cpp", |
| 567 | "src/codec/SkWbmpCodec.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 568 | "src/images/SkImageEncoder.cpp", |
| 569 | "src/images/SkImageEncoder_Factory.cpp", |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 570 | "src/images/SkKTXImageEncoder.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 571 | "src/ports/SkDiscardableMemory_none.cpp", |
| 572 | "src/ports/SkGlobalInitialization_default.cpp", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 573 | "src/ports/SkImageGenerator_skia.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 574 | "src/ports/SkMemory_malloc.cpp", |
| 575 | "src/ports/SkOSFile_stdio.cpp", |
| 576 | "src/sfnt/SkOTTable_name.cpp", |
| 577 | "src/sfnt/SkOTUtils.cpp", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 578 | "src/svg/SkSVGCanvas.cpp", |
| 579 | "src/svg/SkSVGDevice.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 580 | "src/utils/mac/SkStream_mac.cpp", |
| 581 | "third_party/etc1/etc1.cpp", |
scroggo | 3d3a65c | 2016-10-24 12:28:30 -0700 | [diff] [blame] | 582 | "third_party/gif/SkGifImageReader.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 583 | "third_party/ktx/ktx.cpp", |
| 584 | ] |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 585 | |
mtklein | 7d6fb2c | 2016-08-25 14:50:44 -0700 | [diff] [blame] | 586 | libs = [] |
| 587 | |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 588 | if (is_win) { |
| 589 | sources += [ |
Mike Klein | ae7e671 | 2016-10-11 17:49:33 -0400 | [diff] [blame] | 590 | "src/fonts/SkFontMgr_indirect.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 591 | "src/ports/SkDebug_win.cpp", |
| 592 | "src/ports/SkFontHost_win.cpp", |
| 593 | "src/ports/SkFontMgr_win_dw.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 594 | "src/ports/SkImageEncoder_WIC.cpp", |
| 595 | "src/ports/SkImageGeneratorWIC.cpp", |
| 596 | "src/ports/SkOSFile_win.cpp", |
mtklein | 605d952 | 2016-09-21 14:01:32 -0700 | [diff] [blame] | 597 | "src/ports/SkOSLibrary_win.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 598 | "src/ports/SkScalerContext_win_dw.cpp", |
| 599 | "src/ports/SkTLS_win.cpp", |
| 600 | "src/ports/SkTypeface_win_dw.cpp", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 601 | "src/xps/SkDocument_XPS.cpp", |
Mike Klein | 4b167fc | 2016-10-11 18:13:53 -0400 | [diff] [blame] | 602 | "src/xps/SkXPSDevice.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 603 | ] |
Mike Klein | 69f6ed4 | 2016-10-13 15:45:07 -0400 | [diff] [blame] | 604 | if (skia_use_gdi) { |
| 605 | sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ] |
| 606 | libs += [ |
| 607 | "Gdi32.lib", |
| 608 | "Usp10.lib", |
| 609 | ] |
| 610 | } else { |
| 611 | sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ] |
| 612 | } |
mtklein | b9be979 | 2016-09-16 14:44:18 -0700 | [diff] [blame] | 613 | sources -= |
| 614 | [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ] |
Mike Klein | 4b167fc | 2016-10-11 18:13:53 -0400 | [diff] [blame] | 615 | libs += [ |
| 616 | "FontSub.lib", |
| 617 | "Ole32.lib", |
| 618 | "OleAut32.lib", |
| 619 | "User32.lib", |
| 620 | ] |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 621 | } else { |
| 622 | sources += [ |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 623 | "src/ports/SkOSFile_posix.cpp", |
mtklein | 605d952 | 2016-09-21 14:01:32 -0700 | [diff] [blame] | 624 | "src/ports/SkOSLibrary_posix.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 625 | "src/ports/SkTLS_pthread.cpp", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 626 | "src/xps/SkDocument_XPS_None.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 627 | ] |
| 628 | } |
| 629 | |
mtklein | 7d6fb2c | 2016-08-25 14:50:44 -0700 | [diff] [blame] | 630 | if (is_android) { |
| 631 | deps += [ |
| 632 | "//third_party/cpu-features", |
| 633 | "//third_party/expat", |
mtklein | 7d6fb2c | 2016-08-25 14:50:44 -0700 | [diff] [blame] | 634 | ] |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 635 | sources += [ "src/ports/SkDebug_android.cpp" ] |
mtklein | 7d6fb2c | 2016-08-25 14:50:44 -0700 | [diff] [blame] | 636 | libs += [ |
| 637 | "EGL", |
| 638 | "GLESv2", |
| 639 | "log", |
| 640 | ] |
| 641 | } |
| 642 | |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 643 | if (is_linux) { |
mtklein | 09e61f7 | 2016-08-23 13:35:28 -0700 | [diff] [blame] | 644 | libs += [ |
| 645 | "GL", |
| 646 | "GLU", |
| 647 | "X11", |
| 648 | ] |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 649 | sources += [ "src/ports/SkDebug_stdio.cpp" ] |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 650 | } |
| 651 | |
| 652 | if (is_mac) { |
| 653 | sources += [ |
mtklein | 7d6fb2c | 2016-08-25 14:50:44 -0700 | [diff] [blame] | 654 | "src/ports/SkDebug_stdio.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 655 | "src/ports/SkFontHost_mac.cpp", |
| 656 | "src/ports/SkImageEncoder_CG.cpp", |
| 657 | "src/ports/SkImageGeneratorCG.cpp", |
| 658 | ] |
mtklein | 09e61f7 | 2016-08-23 13:35:28 -0700 | [diff] [blame] | 659 | libs += [ |
| 660 | "ApplicationServices.framework", |
| 661 | "OpenGL.framework", |
| 662 | ] |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 663 | } |
abarth | 6fc8ff0 | 2016-07-15 15:15:15 -0700 | [diff] [blame] | 664 | |
Mike Klein | 7d30288 | 2016-11-03 14:06:31 -0400 | [diff] [blame] | 665 | if (is_ios) { |
| 666 | sources += [ |
| 667 | "src/ports/SkDebug_stdio.cpp", |
| 668 | "src/ports/SkFontHost_mac.cpp", |
| 669 | "src/ports/SkImageEncoder_CG.cpp", |
| 670 | "src/ports/SkImageGeneratorCG.cpp", |
| 671 | ] |
| 672 | libs += [ |
| 673 | "CoreFoundation.framework", |
| 674 | "CoreGraphics.framework", |
| 675 | "CoreText.framework", |
| 676 | "ImageIO.framework", |
| 677 | "MobileCoreServices.framework", |
| 678 | ] |
| 679 | } |
| 680 | |
abarth | 6fc8ff0 | 2016-07-15 15:15:15 -0700 | [diff] [blame] | 681 | if (is_fuchsia) { |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 682 | sources += [ "src/ports/SkDebug_stdio.cpp" ] |
abarth | 6fc8ff0 | 2016-07-15 15:15:15 -0700 | [diff] [blame] | 683 | } |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 684 | } |
| 685 | |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 686 | action("skia.h") { |
Mike Klein | 89eda8a | 2016-11-02 09:14:55 -0400 | [diff] [blame] | 687 | skia_h = "$target_gen_dir/skia.h" |
| 688 | script = "gn/find_headers.py" |
| 689 | args = [ rebase_path(skia_h, root_build_dir) ] + |
| 690 | rebase_path(skia_public_includes) |
| 691 | depfile = "$skia_h.deps" |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 692 | outputs = [ |
Mike Klein | 89eda8a | 2016-11-02 09:14:55 -0400 | [diff] [blame] | 693 | skia_h, |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 694 | ] |
| 695 | } |
| 696 | |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 697 | if (skia_enable_gpu && target_cpu == "x64") { |
mtklein | 1fbdf98 | 2016-09-15 12:07:48 -0700 | [diff] [blame] | 698 | # Our bots only have 64-bit libOSMesa installed. |
| 699 | # TODO: worth fixing? |
| 700 | executable("fiddle") { |
| 701 | include_dirs = [ "$target_gen_dir" ] |
| 702 | libs = [] |
| 703 | if (is_linux) { |
| 704 | libs += [ "OSMesa" ] |
| 705 | } |
mtklein | 56d5669 | 2016-09-15 11:18:55 -0700 | [diff] [blame] | 706 | |
mtklein | 1fbdf98 | 2016-09-15 12:07:48 -0700 | [diff] [blame] | 707 | sources = [ |
| 708 | "src/images/SkForceLinking.cpp", |
| 709 | "tools/fiddle/draw.cpp", |
| 710 | "tools/fiddle/fiddle_main.cpp", |
| 711 | ] |
| 712 | deps = [ |
| 713 | ":skia", |
| 714 | ":skia.h", |
| 715 | ] |
| 716 | } |
mtklein | c04ff47 | 2016-06-23 10:29:30 -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 | # Targets guarded by skia_enable_tools may use //third_party freely. |
| 720 | if (skia_enable_tools) { |
| 721 | template("test_lib") { |
| 722 | config(target_name + "_config") { |
| 723 | include_dirs = invoker.public_include_dirs |
mtklein | a627b5c | 2016-09-20 13:36:47 -0700 | [diff] [blame] | 724 | if (defined(invoker.public_defines)) { |
| 725 | defines = invoker.public_defines |
| 726 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 727 | } |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 728 | source_set(target_name) { |
| 729 | forward_variables_from(invoker, "*", [ "public_include_dirs" ]) |
| 730 | public_configs = [ |
| 731 | ":" + target_name + "_config", |
| 732 | ":skia_private", |
| 733 | ] |
| 734 | |
| 735 | if (!defined(deps)) { |
| 736 | deps = [] |
| 737 | } |
| 738 | deps += [ ":skia" ] |
| 739 | testonly = true |
| 740 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 741 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 742 | |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 743 | test_lib("gpu_tool_utils") { |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 744 | public_include_dirs = [] |
| 745 | if (skia_enable_gpu) { |
| 746 | public_defines = [] |
| 747 | public_include_dirs += [ "tools/gpu" ] |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 748 | |
| 749 | deps = [] |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 750 | sources = [ |
| 751 | "tools/gpu/GrContextFactory.cpp", |
| 752 | "tools/gpu/GrTest.cpp", |
| 753 | "tools/gpu/TestContext.cpp", |
| 754 | "tools/gpu/gl/GLTestContext.cpp", |
mtklein | 605d952 | 2016-09-21 14:01:32 -0700 | [diff] [blame] | 755 | "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp", |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 756 | "tools/gpu/gl/debug/DebugGLTestContext.cpp", |
| 757 | "tools/gpu/gl/debug/GrBufferObj.cpp", |
| 758 | "tools/gpu/gl/debug/GrFrameBufferObj.cpp", |
| 759 | "tools/gpu/gl/debug/GrProgramObj.cpp", |
| 760 | "tools/gpu/gl/debug/GrShaderObj.cpp", |
| 761 | "tools/gpu/gl/debug/GrTextureObj.cpp", |
| 762 | "tools/gpu/gl/debug/GrTextureUnitObj.cpp", |
| 763 | "tools/gpu/gl/null/NullGLTestContext.cpp", |
| 764 | ] |
| 765 | libs = [] |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 766 | |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 767 | if (is_android) { |
| 768 | sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ] |
Mike Klein | 7d30288 | 2016-11-03 14:06:31 -0400 | [diff] [blame] | 769 | } else if (is_ios) { |
| 770 | sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ] |
| 771 | libs += [ "OpenGLES.framework" ] |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 772 | } else if (is_linux) { |
| 773 | sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ] |
| 774 | } else if (is_mac) { |
| 775 | sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ] |
Mike Klein | 4b167fc | 2016-10-11 18:13:53 -0400 | [diff] [blame] | 776 | } else if (is_win) { |
| 777 | sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ] |
| 778 | libs += [ |
| 779 | "Gdi32.lib", |
| 780 | "OpenGL32.lib", |
| 781 | ] |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 782 | } |
mtklein | 6ef6999 | 2016-09-14 06:12:09 -0700 | [diff] [blame] | 783 | |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 784 | if (skia_use_angle) { |
| 785 | public_defines += [ "SK_ANGLE" ] |
| 786 | deps += [ "//third_party/angle2" ] |
| 787 | sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ] |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 788 | } |
| 789 | if (skia_use_mesa) { |
| 790 | public_defines += [ "SK_MESA" ] |
| 791 | sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ] |
| 792 | libs += [ "OSMesa" ] |
| 793 | } |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 794 | if (skia_use_vulkan) { |
| 795 | sources += [ "tools/gpu/vk/VkTestContext.cpp" ] |
| 796 | } |
mtklein | a627b5c | 2016-09-20 13:36:47 -0700 | [diff] [blame] | 797 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 798 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 799 | |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 800 | test_lib("flags") { |
| 801 | public_include_dirs = [ "tools/flags" ] |
| 802 | sources = [ |
| 803 | "tools/flags/SkCommandLineFlags.cpp", |
mtklein | 046cb56 | 2016-09-16 10:23:12 -0700 | [diff] [blame] | 804 | ] |
| 805 | } |
| 806 | test_lib("common_flags") { |
| 807 | public_include_dirs = [ "tools/flags" ] |
| 808 | sources = [ |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 809 | "tools/flags/SkCommonFlags.cpp", |
| 810 | "tools/flags/SkCommonFlagsConfig.cpp", |
| 811 | ] |
| 812 | deps = [ |
mtklein | 046cb56 | 2016-09-16 10:23:12 -0700 | [diff] [blame] | 813 | ":flags", |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 814 | ":gpu_tool_utils", |
| 815 | ] |
| 816 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 817 | |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 818 | test_lib("tool_utils") { |
| 819 | public_include_dirs = [ |
| 820 | "tools", |
| 821 | "tools/debugger", |
| 822 | "tools/timer", |
| 823 | ] |
| 824 | sources = [ |
| 825 | "src/images/SkForceLinking.cpp", |
| 826 | "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools? |
mtklein | b37c034 | 2016-09-09 11:07:45 -0700 | [diff] [blame] | 827 | "tools/AndroidSkDebugToStdOut.cpp", |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 828 | "tools/CrashHandler.cpp", |
mtklein | 0590fa5 | 2016-09-01 07:06:54 -0700 | [diff] [blame] | 829 | "tools/LsanSuppressions.cpp", |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 830 | "tools/ProcStats.cpp", |
| 831 | "tools/Resources.cpp", |
| 832 | "tools/ThermalManager.cpp", |
| 833 | "tools/UrlDataManager.cpp", |
| 834 | "tools/debugger/SkDebugCanvas.cpp", |
| 835 | "tools/debugger/SkDrawCommand.cpp", |
| 836 | "tools/debugger/SkJsonWriteBuffer.cpp", |
| 837 | "tools/debugger/SkObjectParser.cpp", |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 838 | "tools/picture_utils.cpp", |
| 839 | "tools/random_parse_path.cpp", |
| 840 | "tools/sk_tool_utils.cpp", |
| 841 | "tools/sk_tool_utils_font.cpp", |
| 842 | "tools/timer/Timer.cpp", |
| 843 | ] |
| 844 | deps = [ |
mtklein | 046cb56 | 2016-09-16 10:23:12 -0700 | [diff] [blame] | 845 | ":common_flags", |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 846 | ":flags", |
| 847 | "//third_party/libpng", |
| 848 | ] |
| 849 | public_deps = [ |
| 850 | "//third_party/jsoncpp", |
| 851 | ] |
| 852 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 853 | |
Mike Klein | 6e74412 | 2016-10-27 12:21:40 -0400 | [diff] [blame] | 854 | import("gn/gm.gni") |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 855 | test_lib("gm") { |
| 856 | public_include_dirs = [ "gm" ] |
| 857 | sources = gm_sources |
| 858 | deps = [ |
scroggo | 19b9153 | 2016-10-24 09:03:26 -0700 | [diff] [blame] | 859 | ":flags", |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 860 | ":gpu_tool_utils", |
| 861 | ":skia", |
| 862 | ":tool_utils", |
| 863 | ] |
| 864 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 865 | |
Mike Klein | 6e74412 | 2016-10-27 12:21:40 -0400 | [diff] [blame] | 866 | import("gn/tests.gni") |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 867 | test_lib("tests") { |
| 868 | public_include_dirs = [ "tests" ] |
Mike Klein | 6e74412 | 2016-10-27 12:21:40 -0400 | [diff] [blame] | 869 | sources = tests_sources + pathops_tests_sources |
mtklein | a45be61 | 2016-08-29 15:22:10 -0700 | [diff] [blame] | 870 | if (!fontmgr_android_enabled) { |
Mike Klein | 6e74412 | 2016-10-27 12:21:40 -0400 | [diff] [blame] | 871 | sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ] |
mtklein | a45be61 | 2016-08-29 15:22:10 -0700 | [diff] [blame] | 872 | } |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 873 | deps = [ |
fmalita | 6cf896d | 2016-08-25 08:44:35 -0700 | [diff] [blame] | 874 | ":experimental_svg_model", |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 875 | ":flags", |
| 876 | ":gpu_tool_utils", |
| 877 | ":skia", |
| 878 | ":tool_utils", |
| 879 | "//third_party/libpng", |
| 880 | "//third_party/zlib", |
| 881 | ] |
| 882 | } |
mtklein | 2f3416d | 2016-08-02 16:02:05 -0700 | [diff] [blame] | 883 | |
Mike Klein | 6e74412 | 2016-10-27 12:21:40 -0400 | [diff] [blame] | 884 | import("gn/bench.gni") |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 885 | test_lib("bench") { |
| 886 | public_include_dirs = [ "bench" ] |
| 887 | sources = bench_sources |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 888 | deps = [ |
| 889 | ":flags", |
| 890 | ":gm", |
| 891 | ":gpu_tool_utils", |
| 892 | ":skia", |
| 893 | ":tool_utils", |
| 894 | ] |
| 895 | } |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 896 | |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 897 | test_lib("experimental_svg_model") { |
| 898 | public_include_dirs = [ "experimental/svg/model" ] |
| 899 | sources = [ |
| 900 | "experimental/svg/model/SkSVGAttribute.cpp", |
| 901 | "experimental/svg/model/SkSVGAttributeParser.cpp", |
| 902 | "experimental/svg/model/SkSVGCircle.cpp", |
| 903 | "experimental/svg/model/SkSVGContainer.cpp", |
| 904 | "experimental/svg/model/SkSVGDOM.cpp", |
| 905 | "experimental/svg/model/SkSVGEllipse.cpp", |
| 906 | "experimental/svg/model/SkSVGLine.cpp", |
fmalita | 28d5b72 | 2016-09-12 17:06:47 -0700 | [diff] [blame] | 907 | "experimental/svg/model/SkSVGLinearGradient.cpp", |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 908 | "experimental/svg/model/SkSVGNode.cpp", |
| 909 | "experimental/svg/model/SkSVGPath.cpp", |
| 910 | "experimental/svg/model/SkSVGPoly.cpp", |
| 911 | "experimental/svg/model/SkSVGRect.cpp", |
| 912 | "experimental/svg/model/SkSVGRenderContext.cpp", |
| 913 | "experimental/svg/model/SkSVGSVG.cpp", |
| 914 | "experimental/svg/model/SkSVGShape.cpp", |
fmalita | 28d5b72 | 2016-09-12 17:06:47 -0700 | [diff] [blame] | 915 | "experimental/svg/model/SkSVGStop.cpp", |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 916 | "experimental/svg/model/SkSVGTransformableNode.cpp", |
| 917 | "experimental/svg/model/SkSVGValue.cpp", |
| 918 | ] |
| 919 | deps = [ |
| 920 | ":skia", |
| 921 | ] |
| 922 | } |
fmalita | a2b9fdf | 2016-08-03 19:53:36 -0700 | [diff] [blame] | 923 | |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 924 | test_lib("views") { |
| 925 | public_include_dirs = [ "include/views" ] |
| 926 | sources = [ |
| 927 | "src/views/SkEvent.cpp", |
| 928 | "src/views/SkEventSink.cpp", |
| 929 | "src/views/SkOSMenu.cpp", |
| 930 | "src/views/SkTagList.cpp", |
| 931 | "src/views/SkTouchGesture.cpp", |
| 932 | "src/views/SkView.cpp", |
| 933 | "src/views/SkViewPriv.cpp", |
| 934 | ] |
| 935 | libs = [] |
| 936 | if (!is_android) { |
| 937 | sources += [ "src/views/SkWindow.cpp" ] |
| 938 | } |
Jim Van Verth | 4e56a91 | 2016-10-21 10:58:52 -0400 | [diff] [blame] | 939 | if (is_linux) { |
Brian Osman | 2dd9693 | 2016-10-18 15:33:53 -0400 | [diff] [blame] | 940 | public_include_dirs += [ "src/views/unix" ] |
| 941 | sources += [ |
| 942 | "src/views/unix/SkOSWindow_Unix.cpp", |
| 943 | "src/views/unix/keysym2ucs.c", |
| 944 | ] |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 945 | } else if (is_mac) { |
| 946 | sources += [ |
| 947 | "src/views/mac/SkEventNotifier.mm", |
| 948 | "src/views/mac/SkNSView.mm", |
| 949 | "src/views/mac/SkOSWindow_Mac.mm", |
| 950 | "src/views/mac/SkTextFieldCell.m", |
| 951 | ] |
| 952 | libs += [ |
| 953 | "QuartzCore.framework", |
| 954 | "Cocoa.framework", |
| 955 | "Foundation.framework", |
| 956 | ] |
| 957 | } else if (is_win) { |
| 958 | sources += [ "src/views/win/SkOSWindow_win.cpp" ] |
| 959 | } |
| 960 | } |
| 961 | |
Mike Klein | 6e74412 | 2016-10-27 12:21:40 -0400 | [diff] [blame] | 962 | import("gn/samples.gni") |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 963 | test_lib("samples") { |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 964 | public_include_dirs = [ "samplecode" ] |
Mike Klein | 6e74412 | 2016-10-27 12:21:40 -0400 | [diff] [blame] | 965 | include_dirs = [ "experimental" ] |
| 966 | sources = samples_sources + [ |
| 967 | "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp", |
| 968 | "experimental/SkSetPoly3To3.cpp", |
| 969 | "experimental/SkSetPoly3To3_A.cpp", |
| 970 | "experimental/SkSetPoly3To3_D.cpp", |
| 971 | ] |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 972 | deps = [ |
| 973 | ":experimental_svg_model", |
Mike Klein | 6e74412 | 2016-10-27 12:21:40 -0400 | [diff] [blame] | 974 | ":gm", |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 975 | ":tool_utils", |
| 976 | ":views", |
| 977 | ":xml", |
| 978 | ] |
| 979 | } |
| 980 | |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 981 | executable("dm") { |
| 982 | sources = [ |
| 983 | "dm/DM.cpp", |
| 984 | "dm/DMJsonWriter.cpp", |
| 985 | "dm/DMSrcSink.cpp", |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 986 | ] |
| 987 | include_dirs = [ "tests" ] |
| 988 | deps = [ |
mtklein | 046cb56 | 2016-09-16 10:23:12 -0700 | [diff] [blame] | 989 | ":common_flags", |
fmalita | a2b9fdf | 2016-08-03 19:53:36 -0700 | [diff] [blame] | 990 | ":experimental_svg_model", |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 991 | ":flags", |
| 992 | ":gm", |
| 993 | ":gpu_tool_utils", |
| 994 | ":skia", |
mtklein | 2f3416d | 2016-08-02 16:02:05 -0700 | [diff] [blame] | 995 | ":tests", |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 996 | ":tool_utils", |
| 997 | "//third_party/jsoncpp", |
| 998 | "//third_party/libpng", |
| 999 | ] |
| 1000 | testonly = true |
| 1001 | } |
| 1002 | |
Mike Klein | a343017 | 2016-09-27 16:46:29 -0400 | [diff] [blame] | 1003 | if (!is_debug) { # I've benchmarked debug code once too many times... |
| 1004 | executable("monobench") { |
| 1005 | sources = [ |
| 1006 | "tools/monobench.cpp", |
| 1007 | ] |
| 1008 | deps = [ |
| 1009 | ":bench", |
| 1010 | ":skia", |
| 1011 | ] |
| 1012 | testonly = true |
| 1013 | } |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 1014 | } |
| 1015 | |
| 1016 | executable("nanobench") { |
| 1017 | sources = [ |
| 1018 | "bench/nanobench.cpp", |
| 1019 | ] |
| 1020 | deps = [ |
| 1021 | ":bench", |
mtklein | 046cb56 | 2016-09-16 10:23:12 -0700 | [diff] [blame] | 1022 | ":common_flags", |
fmalita | 6519c21 | 2016-09-14 08:05:17 -0700 | [diff] [blame] | 1023 | ":experimental_svg_model", |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 1024 | ":flags", |
| 1025 | ":gm", |
| 1026 | ":gpu_tool_utils", |
| 1027 | ":skia", |
| 1028 | ":tool_utils", |
| 1029 | "//third_party/jsoncpp", |
| 1030 | ] |
| 1031 | testonly = true |
| 1032 | } |
halcanary | 19a9720 | 2016-08-03 15:08:04 -0700 | [diff] [blame] | 1033 | |
Jim Van Verth | 57a98fc | 2016-10-28 13:35:50 -0400 | [diff] [blame] | 1034 | if (is_linux || is_win || is_mac) { |
Jim Van Verth | b6c5e53 | 2016-10-28 10:38:08 -0400 | [diff] [blame] | 1035 | executable("SampleApp") { |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 1036 | sources = [ |
Jim Van Verth | b6c5e53 | 2016-10-28 10:38:08 -0400 | [diff] [blame] | 1037 | "samplecode/SampleApp.cpp", |
| 1038 | "samplecode/SamplePictFile.cpp", |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 1039 | ] |
Jim Van Verth | b6c5e53 | 2016-10-28 10:38:08 -0400 | [diff] [blame] | 1040 | if (is_mac) { |
| 1041 | sources += [ "src/views/mac/skia_mac.mm" ] |
| 1042 | } else if (is_win) { |
| 1043 | sources += [ "src/views/win/skia_win.cpp" ] |
| 1044 | } else if (is_linux) { |
| 1045 | sources += [ "src/views/unix/skia_unix.cpp" ] |
| 1046 | } |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 1047 | deps = [ |
| 1048 | ":flags", |
Jim Van Verth | b6c5e53 | 2016-10-28 10:38:08 -0400 | [diff] [blame] | 1049 | ":gm", |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 1050 | ":gpu_tool_utils", |
Jim Van Verth | b6c5e53 | 2016-10-28 10:38:08 -0400 | [diff] [blame] | 1051 | ":samples", |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 1052 | ":skia", |
| 1053 | ":tool_utils", |
Jim Van Verth | b6c5e53 | 2016-10-28 10:38:08 -0400 | [diff] [blame] | 1054 | ":views", |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 1055 | ] |
Jim Van Verth | b6c5e53 | 2016-10-28 10:38:08 -0400 | [diff] [blame] | 1056 | if (skia_use_angle) { |
| 1057 | deps += [ "//third_party/angle2" ] |
| 1058 | } |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 1059 | testonly = true |
| 1060 | } |
Jim Van Verth | 8f5468f | 2016-10-31 09:52:33 -0400 | [diff] [blame] | 1061 | } |
Jim Van Verth | b6c5e53 | 2016-10-28 10:38:08 -0400 | [diff] [blame] | 1062 | |
Jim Van Verth | 8f5468f | 2016-10-31 09:52:33 -0400 | [diff] [blame] | 1063 | if (skia_enable_gpu) { |
| 1064 | executable("skpbench") { |
| 1065 | sources = [ |
| 1066 | "tools/skpbench/skpbench.cpp", |
| 1067 | ] |
| 1068 | deps = [ |
| 1069 | ":flags", |
| 1070 | ":gpu_tool_utils", |
| 1071 | ":skia", |
| 1072 | ":tool_utils", |
| 1073 | ] |
| 1074 | testonly = true |
Jim Van Verth | b6c5e53 | 2016-10-28 10:38:08 -0400 | [diff] [blame] | 1075 | } |
csmartdalton | 4b5179b | 2016-09-19 11:03:58 -0700 | [diff] [blame] | 1076 | } |
| 1077 | |
Mike Klein | 7d30288 | 2016-11-03 14:06:31 -0400 | [diff] [blame] | 1078 | # We can't yet build ICU on iOS or Windows. |
| 1079 | if (!is_ios && !is_win) { |
halcanary | 3eee9d9 | 2016-09-10 07:01:53 -0700 | [diff] [blame] | 1080 | executable("sktexttopdf-hb") { |
mtklein | 6f5df6a | 2016-08-29 16:01:10 -0700 | [diff] [blame] | 1081 | sources = [ |
| 1082 | "tools/SkShaper_harfbuzz.cpp", |
| 1083 | "tools/using_skia_and_harfbuzz.cpp", |
| 1084 | ] |
| 1085 | deps = [ |
| 1086 | ":skia", |
| 1087 | "//third_party/harfbuzz", |
| 1088 | ] |
| 1089 | testonly = true |
| 1090 | } |
halcanary | 19a9720 | 2016-08-03 15:08:04 -0700 | [diff] [blame] | 1091 | } |
halcanary | 3eee9d9 | 2016-09-10 07:01:53 -0700 | [diff] [blame] | 1092 | executable("sktexttopdf") { |
| 1093 | sources = [ |
| 1094 | "tools/SkShaper_primitive.cpp", |
| 1095 | "tools/using_skia_and_harfbuzz.cpp", |
| 1096 | ] |
| 1097 | deps = [ |
| 1098 | ":skia", |
| 1099 | ] |
| 1100 | testonly = true |
| 1101 | } |
mtklein | 046cb56 | 2016-09-16 10:23:12 -0700 | [diff] [blame] | 1102 | |
| 1103 | executable("get_images_from_skps") { |
| 1104 | sources = [ |
| 1105 | "tools/get_images_from_skps.cpp", |
| 1106 | ] |
| 1107 | deps = [ |
| 1108 | ":flags", |
| 1109 | ":skia", |
| 1110 | "//third_party/jsoncpp", |
| 1111 | ] |
| 1112 | testonly = true |
| 1113 | } |
mtklein | ecbc526 | 2016-09-22 11:51:24 -0700 | [diff] [blame] | 1114 | |
Mike Klein | 7d30288 | 2016-11-03 14:06:31 -0400 | [diff] [blame] | 1115 | if (!is_ios) { |
| 1116 | executable("skiaserve") { |
| 1117 | sources = [ |
| 1118 | "tools/skiaserve/Request.cpp", |
| 1119 | "tools/skiaserve/Response.cpp", |
| 1120 | "tools/skiaserve/skiaserve.cpp", |
| 1121 | "tools/skiaserve/urlhandlers/BatchBoundsHandler.cpp", |
| 1122 | "tools/skiaserve/urlhandlers/BatchesHandler.cpp", |
| 1123 | "tools/skiaserve/urlhandlers/BreakHandler.cpp", |
| 1124 | "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp", |
| 1125 | "tools/skiaserve/urlhandlers/CmdHandler.cpp", |
| 1126 | "tools/skiaserve/urlhandlers/ColorModeHandler.cpp", |
| 1127 | "tools/skiaserve/urlhandlers/DataHandler.cpp", |
| 1128 | "tools/skiaserve/urlhandlers/DownloadHandler.cpp", |
| 1129 | "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp", |
| 1130 | "tools/skiaserve/urlhandlers/ImgHandler.cpp", |
| 1131 | "tools/skiaserve/urlhandlers/InfoHandler.cpp", |
| 1132 | "tools/skiaserve/urlhandlers/OverdrawHandler.cpp", |
| 1133 | "tools/skiaserve/urlhandlers/PostHandler.cpp", |
| 1134 | "tools/skiaserve/urlhandlers/QuitHandler.cpp", |
| 1135 | "tools/skiaserve/urlhandlers/RootHandler.cpp", |
| 1136 | ] |
| 1137 | deps = [ |
| 1138 | ":flags", |
| 1139 | ":gpu_tool_utils", |
| 1140 | ":skia", |
| 1141 | ":tool_utils", |
| 1142 | "//third_party/jsoncpp", |
| 1143 | "//third_party/libmicrohttpd", |
| 1144 | "//third_party/libpng", |
| 1145 | ] |
| 1146 | testonly = true |
| 1147 | } |
mtklein | ecbc526 | 2016-09-22 11:51:24 -0700 | [diff] [blame] | 1148 | } |
kjlubick | 14f984b | 2016-10-03 11:49:45 -0700 | [diff] [blame] | 1149 | |
| 1150 | executable("fuzz") { |
| 1151 | sources = [ |
| 1152 | "fuzz/FilterFuzz.cpp", |
| 1153 | "fuzz/FuzzGradients.cpp", |
| 1154 | "fuzz/FuzzParsePath.cpp", |
| 1155 | "fuzz/FuzzPathop.cpp", |
| 1156 | "fuzz/FuzzScaleToSides.cpp", |
| 1157 | "fuzz/fuzz.cpp", |
| 1158 | ] |
| 1159 | deps = [ |
| 1160 | ":flags", |
| 1161 | ":skia", |
| 1162 | ] |
| 1163 | testonly = true |
| 1164 | } |
Mike Klein | 3831242 | 2016-10-05 15:41:01 -0400 | [diff] [blame] | 1165 | |
caryclark | 9feb632 | 2016-10-25 08:58:26 -0700 | [diff] [blame] | 1166 | executable("pathops_unittest") { |
Mike Klein | 6e74412 | 2016-10-27 12:21:40 -0400 | [diff] [blame] | 1167 | sources = pathops_tests_sources + [ |
Mike Klein | 6e55fef | 2016-10-26 11:41:47 -0400 | [diff] [blame] | 1168 | rebase_path("tests/skia_test.cpp"), |
| 1169 | rebase_path("tests/Test.cpp"), |
| 1170 | ] |
caryclark | 9feb632 | 2016-10-25 08:58:26 -0700 | [diff] [blame] | 1171 | deps = [ |
| 1172 | ":flags", |
| 1173 | ":gpu_tool_utils", |
| 1174 | ":skia", |
| 1175 | ":tool_utils", |
| 1176 | ] |
| 1177 | testonly = true |
| 1178 | } |
| 1179 | |
Mike Klein | 3831242 | 2016-10-05 15:41:01 -0400 | [diff] [blame] | 1180 | executable("dump_record") { |
| 1181 | sources = [ |
| 1182 | "tools/DumpRecord.cpp", |
| 1183 | "tools/dump_record.cpp", |
| 1184 | ] |
| 1185 | deps = [ |
| 1186 | ":flags", |
| 1187 | ":skia", |
| 1188 | ] |
| 1189 | testonly = true |
| 1190 | } |
bungeman | fe91727 | 2016-10-13 17:36:40 -0400 | [diff] [blame] | 1191 | |
| 1192 | executable("skdiff") { |
| 1193 | sources = [ |
| 1194 | "tools/skdiff/skdiff.cpp", |
| 1195 | "tools/skdiff/skdiff_html.cpp", |
| 1196 | "tools/skdiff/skdiff_main.cpp", |
| 1197 | "tools/skdiff/skdiff_utils.cpp", |
| 1198 | ] |
| 1199 | deps = [ |
| 1200 | ":skia", |
| 1201 | ":tool_utils", |
| 1202 | ] |
| 1203 | testonly = true |
| 1204 | } |
halcanary | a73d76a | 2016-10-17 13:19:02 -0700 | [diff] [blame] | 1205 | |
| 1206 | executable("skp_parser") { |
| 1207 | sources = [ |
| 1208 | "tools/skp_parser.cpp", |
| 1209 | ] |
| 1210 | deps = [ |
| 1211 | ":skia", |
| 1212 | ":tool_utils", |
| 1213 | "//third_party/jsoncpp", |
| 1214 | ] |
| 1215 | testonly = true |
| 1216 | } |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 1217 | |
Mike Klein | 43c2526 | 2016-10-20 10:17:47 -0400 | [diff] [blame] | 1218 | if (skia_enable_gpu && (is_linux || is_win || is_mac)) { |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 1219 | executable("viewer") { |
| 1220 | sources = [ |
| 1221 | "tools/viewer/GMSlide.cpp", |
| 1222 | "tools/viewer/ImageSlide.cpp", |
| 1223 | "tools/viewer/SKPSlide.cpp", |
| 1224 | "tools/viewer/SampleSlide.cpp", |
| 1225 | "tools/viewer/Viewer.cpp", |
| 1226 | "tools/viewer/sk_app/CommandSet.cpp", |
| 1227 | "tools/viewer/sk_app/GLWindowContext.cpp", |
| 1228 | "tools/viewer/sk_app/Window.cpp", |
| 1229 | "tools/viewer/sk_app/WindowContext.cpp", |
| 1230 | ] |
Brian Osman | 2dd9693 | 2016-10-18 15:33:53 -0400 | [diff] [blame] | 1231 | libs = [] |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 1232 | |
Jim Van Verth | 4e56a91 | 2016-10-21 10:58:52 -0400 | [diff] [blame] | 1233 | if (is_android) { |
| 1234 | sources += [ |
| 1235 | "tools/viewer/sk_app/android/GLWindowContext_android.cpp", |
| 1236 | "tools/viewer/sk_app/android/RasterWindowContext_android.cpp", |
| 1237 | "tools/viewer/sk_app/android/Window_android.cpp", |
| 1238 | "tools/viewer/sk_app/android/main_android.cpp", |
| 1239 | "tools/viewer/sk_app/android/surface_glue_android.cpp", |
| 1240 | ] |
| 1241 | } else if (is_linux) { |
Brian Osman | 2dd9693 | 2016-10-18 15:33:53 -0400 | [diff] [blame] | 1242 | sources += [ |
| 1243 | "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp", |
| 1244 | "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp", |
| 1245 | "tools/viewer/sk_app/unix/Window_unix.cpp", |
| 1246 | "tools/viewer/sk_app/unix/main_unix.cpp", |
| 1247 | ] |
| 1248 | } else if (is_win) { |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 1249 | sources += [ |
| 1250 | "tools/viewer/sk_app/win/GLWindowContext_win.cpp", |
| 1251 | "tools/viewer/sk_app/win/RasterWindowContext_win.cpp", |
| 1252 | "tools/viewer/sk_app/win/Window_win.cpp", |
| 1253 | "tools/viewer/sk_app/win/main_win.cpp", |
| 1254 | ] |
Mike Klein | 43c2526 | 2016-10-20 10:17:47 -0400 | [diff] [blame] | 1255 | } else if (is_mac) { |
| 1256 | sources += [ |
| 1257 | "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp", |
| 1258 | "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp", |
| 1259 | "tools/viewer/sk_app/mac/Window_mac.cpp", |
| 1260 | "tools/viewer/sk_app/mac/main_mac.cpp", |
| 1261 | ] |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 1262 | } |
| 1263 | |
| 1264 | if (skia_use_vulkan) { |
| 1265 | sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ] |
Jim Van Verth | 4e56a91 | 2016-10-21 10:58:52 -0400 | [diff] [blame] | 1266 | if (is_android) { |
| 1267 | sources += |
| 1268 | [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ] |
| 1269 | libs += [ "android" ] |
| 1270 | } else if (is_linux) { |
Brian Osman | 2dd9693 | 2016-10-18 15:33:53 -0400 | [diff] [blame] | 1271 | sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ] |
| 1272 | libs += [ "X11-xcb" ] |
| 1273 | } else if (is_win) { |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 1274 | sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ] |
| 1275 | } |
| 1276 | } |
| 1277 | |
| 1278 | include_dirs = [] |
| 1279 | deps = [ |
| 1280 | ":flags", |
| 1281 | ":gm", |
| 1282 | ":gpu_tool_utils", |
| 1283 | ":samples", |
| 1284 | ":skia", |
| 1285 | ":tool_utils", |
| 1286 | ":views", |
| 1287 | "//third_party/jsoncpp", |
| 1288 | ] |
Jim Van Verth | 4e56a91 | 2016-10-21 10:58:52 -0400 | [diff] [blame] | 1289 | if (is_android) { |
| 1290 | deps += [ "//third_party/native_app_glue" ] |
| 1291 | } else if (is_mac) { |
Mike Klein | 43c2526 | 2016-10-20 10:17:47 -0400 | [diff] [blame] | 1292 | deps += [ "//third_party/libsdl" ] |
| 1293 | } |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 1294 | testonly = true |
| 1295 | } |
| 1296 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 1297 | } |