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 | |
Brian Osman | f2c9014 | 2017-07-13 15:50:03 -0400 | [diff] [blame] | 6 | import("gn/flutter_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 | |
Forrest Reiling | 30229ac | 2017-04-17 13:36:39 -0700 | [diff] [blame] | 9 | if (is_fuchsia) { |
| 10 | import("//build/vulkan/config.gni") |
| 11 | } |
| 12 | |
Mike Klein | 3669a82 | 2017-03-03 10:55:02 -0500 | [diff] [blame] | 13 | if (!defined(is_skia_standalone)) { |
| 14 | is_skia_standalone = false |
| 15 | } |
| 16 | is_skia_dev_build = is_skia_standalone && !is_official_build |
| 17 | |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 18 | declare_args() { |
Mike Klein | c168a3a | 2016-11-14 14:53:13 +0000 | [diff] [blame] | 19 | skia_use_angle = false |
Kevin Lubick | 4a24e10 | 2017-03-29 11:19:01 -0400 | [diff] [blame] | 20 | skia_use_egl = false |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 21 | skia_use_expat = true |
mtklein | 3cc2218 | 2016-08-29 13:26:14 -0700 | [diff] [blame] | 22 | skia_use_fontconfig = is_linux |
mtklein | cdedd0e | 2016-09-12 15:15:44 -0700 | [diff] [blame] | 23 | skia_use_freetype = is_android || is_fuchsia || is_linux |
Mike Klein | 69f6ed4 | 2016-10-13 15:45:07 -0400 | [diff] [blame] | 24 | skia_use_gdi = false |
Mike Klein | 7d30288 | 2016-11-03 14:06:31 -0400 | [diff] [blame] | 25 | skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 26 | skia_use_libjpeg_turbo = true |
| 27 | skia_use_libpng = true |
mtklein | eb3c425 | 2016-08-23 07:38:09 -0700 | [diff] [blame] | 28 | skia_use_libwebp = !is_fuchsia |
Mike Klein | 38af943 | 2016-11-11 11:39:44 -0500 | [diff] [blame] | 29 | skia_use_lua = false |
mtklein | a627b5c | 2016-09-20 13:36:47 -0700 | [diff] [blame] | 30 | skia_use_mesa = false |
Mike Klein | 10d665d | 2016-11-01 11:46:10 -0400 | [diff] [blame] | 31 | skia_use_piex = !is_win |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 32 | skia_use_zlib = true |
Greg Daniel | e5ddff5 | 2017-07-05 16:49:36 -0400 | [diff] [blame] | 33 | skia_use_metal = false |
Leon Scroggins III | 04be2b5 | 2017-08-17 15:13:20 -0400 | [diff] [blame] | 34 | skia_use_libheif = false |
mtklein | 1bd72ba | 2016-09-16 07:45:52 -0700 | [diff] [blame] | 35 | |
Mike Klein | 7d92103 | 2017-01-05 12:20:41 -0500 | [diff] [blame] | 36 | skia_android_serial = "" |
Brian Osman | 3f375d0 | 2016-12-28 11:19:22 -0500 | [diff] [blame] | 37 | skia_enable_discrete_gpu = true |
Mike Klein | a04bb45 | 2017-02-09 12:24:07 -0500 | [diff] [blame] | 38 | skia_enable_effects = true |
Brian Osman | f2c9014 | 2017-07-13 15:50:03 -0400 | [diff] [blame] | 39 | skia_enable_flutter_defines = false |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 40 | skia_enable_gpu = true |
Hal Canary | 43fb7a0 | 2016-12-30 13:09:03 -0500 | [diff] [blame] | 41 | skia_enable_pdf = true |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 42 | skia_enable_spirv_validation = is_skia_dev_build && is_debug |
Mike Klein | 3669a82 | 2017-03-03 10:55:02 -0500 | [diff] [blame] | 43 | skia_enable_tools = is_skia_dev_build |
| 44 | skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug |
Greg Daniel | 686bb21 | 2016-10-27 10:48:48 -0400 | [diff] [blame] | 45 | skia_vulkan_sdk = getenv("VULKAN_SDK") |
Robert Phillips | a6d2d70 | 2017-09-01 12:17:03 -0400 | [diff] [blame] | 46 | skia_qt_path = getenv("QT_PATH") |
Ethan Nicholas | 762466e | 2017-06-29 10:03:38 -0400 | [diff] [blame] | 47 | skia_compile_processors = false |
Mike Klein | c55a6cb | 2017-06-28 13:21:47 -0400 | [diff] [blame] | 48 | |
| 49 | skia_jumper_clang = "" |
| 50 | skia_jumper_objdump = "" |
| 51 | skia_jumper_ccache = "" |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 52 | } |
Brian Salomon | 23d73ea | 2016-10-27 13:31:37 -0400 | [diff] [blame] | 53 | declare_args() { |
Matt Sarett | 189491c | 2017-03-20 18:09:30 -0400 | [diff] [blame] | 54 | skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib |
Mike Klein | 10d665d | 2016-11-01 11:46:10 -0400 | [diff] [blame] | 55 | skia_use_sfntly = skia_use_icu |
| 56 | |
Mike Klein | 4d598a3 | 2016-10-31 13:44:49 -0400 | [diff] [blame] | 57 | if (is_android) { |
| 58 | skia_use_vulkan = defined(ndk_api) && ndk_api >= 24 |
Forrest Reiling | 30229ac | 2017-04-17 13:36:39 -0700 | [diff] [blame] | 59 | } else if (is_fuchsia) { |
| 60 | skia_use_vulkan = fuchsia_use_vulkan |
Mike Klein | 4d598a3 | 2016-10-31 13:44:49 -0400 | [diff] [blame] | 61 | } else { |
| 62 | skia_use_vulkan = skia_vulkan_sdk != "" |
| 63 | } |
Brian Salomon | 23d73ea | 2016-10-27 13:31:37 -0400 | [diff] [blame] | 64 | } |
Greg Daniel | ec6ae52 | 2017-04-25 13:38:26 -0400 | [diff] [blame] | 65 | declare_args() { |
Robert Phillips | fcd5fdd | 2017-06-14 01:43:29 +0000 | [diff] [blame] | 66 | skia_vulkan_headers = "" |
Greg Daniel | ec6ae52 | 2017-04-25 13:38:26 -0400 | [diff] [blame] | 67 | if (skia_use_vulkan) { |
Robert Phillips | fcd5fdd | 2017-06-14 01:43:29 +0000 | [diff] [blame] | 68 | # When buliding on Android we get the header via the NDK so no need for any extra path. |
Greg Daniel | ec6ae52 | 2017-04-25 13:38:26 -0400 | [diff] [blame] | 69 | if (is_fuchsia) { |
| 70 | skia_vulkan_headers = "$fuchsia_vulkan_sdk/include" |
| 71 | } else if (is_linux || is_win) { |
| 72 | skia_vulkan_headers = "$skia_vulkan_sdk/include" |
Greg Daniel | ec6ae52 | 2017-04-25 13:38:26 -0400 | [diff] [blame] | 73 | } |
Greg Daniel | ec6ae52 | 2017-04-25 13:38:26 -0400 | [diff] [blame] | 74 | } |
| 75 | } |
Brian Salomon | 789e25e | 2016-09-30 13:41:03 -0400 | [diff] [blame] | 76 | |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 77 | # Our tools require static linking (they use non-exported symbols). |
| 78 | skia_enable_tools = skia_enable_tools && !is_component_build |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 79 | |
mtklein | a45be61 | 2016-08-29 15:22:10 -0700 | [diff] [blame] | 80 | fontmgr_android_enabled = skia_use_expat && skia_use_freetype |
| 81 | |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 82 | skia_public_includes = [ |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 83 | "include/android", |
mtklein | fa84d94 | 2016-07-28 09:45:14 -0700 | [diff] [blame] | 84 | "include/c", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 85 | "include/codec", |
| 86 | "include/config", |
| 87 | "include/core", |
| 88 | "include/effects", |
Matt Sarett | 94fd06f | 2017-05-08 17:31:00 -0400 | [diff] [blame] | 89 | "include/encode", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 90 | "include/gpu", |
| 91 | "include/gpu/gl", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 92 | "include/pathops", |
| 93 | "include/ports", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 94 | "include/svg", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 95 | "include/utils", |
| 96 | "include/utils/mac", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 97 | ] |
| 98 | |
Robert Phillips | fcd5fdd | 2017-06-14 01:43:29 +0000 | [diff] [blame] | 99 | if (skia_use_vulkan) { |
| 100 | skia_public_includes += [ "include/gpu/vk" ] |
| 101 | } |
Greg Daniel | e5ddff5 | 2017-07-05 16:49:36 -0400 | [diff] [blame] | 102 | if (skia_use_metal) { |
| 103 | skia_public_includes += [ "include/gpu/mtl" ] |
| 104 | } |
Robert Phillips | fcd5fdd | 2017-06-14 01:43:29 +0000 | [diff] [blame] | 105 | |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 106 | # Skia public API, generally provided by :skia. |
| 107 | config("skia_public") { |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 108 | include_dirs = skia_public_includes |
Greg Daniel | ec6ae52 | 2017-04-25 13:38:26 -0400 | [diff] [blame] | 109 | if (skia_vulkan_headers != "") { |
| 110 | include_dirs += [ skia_vulkan_headers ] |
| 111 | } |
Mike Klein | ae7e671 | 2016-10-11 17:49:33 -0400 | [diff] [blame] | 112 | defines = [] |
| 113 | if (is_component_build) { |
| 114 | defines += [ "SKIA_DLL" ] |
| 115 | } |
Mike Klein | c4cbd74 | 2016-09-26 21:37:09 -0400 | [diff] [blame] | 116 | if (is_fuchsia || is_linux) { |
jcgregorio | 5561e3d | 2016-08-25 09:25:11 -0700 | [diff] [blame] | 117 | defines += [ "SK_SAMPLES_FOR_X" ] |
| 118 | } |
Brian Osman | f2c9014 | 2017-07-13 15:50:03 -0400 | [diff] [blame] | 119 | if (skia_enable_flutter_defines) { |
| 120 | defines += flutter_defines |
| 121 | } |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 122 | if (!skia_enable_gpu) { |
| 123 | defines += [ "SK_SUPPORT_GPU=0" ] |
| 124 | } |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 125 | } |
| 126 | |
| 127 | # Skia internal APIs, used by Skia itself and a few test tools. |
| 128 | config("skia_private") { |
| 129 | visibility = [ ":*" ] |
| 130 | |
| 131 | include_dirs = [ |
| 132 | "include/private", |
| 133 | "src/c", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 134 | "src/codec", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 135 | "src/core", |
| 136 | "src/effects", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 137 | "src/fonts", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 138 | "src/image", |
| 139 | "src/images", |
| 140 | "src/lazy", |
| 141 | "src/opts", |
| 142 | "src/pathops", |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 143 | "src/pdf", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 144 | "src/ports", |
| 145 | "src/sfnt", |
Florin Malita | 5edba45 | 2017-05-30 16:39:47 -0400 | [diff] [blame] | 146 | "src/shaders", |
| 147 | "src/shaders/gradients", |
mtklein | 9e0d9dd | 2016-08-30 10:37:19 -0700 | [diff] [blame] | 148 | "src/sksl", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 149 | "src/utils", |
mtklein | 7a1f45f | 2016-08-04 06:19:33 -0700 | [diff] [blame] | 150 | "src/utils/win", |
Herb Derby | 5a8fe97 | 2017-02-14 14:42:30 -0500 | [diff] [blame] | 151 | "src/xml", |
scroggo | 19b9153 | 2016-10-24 09:03:26 -0700 | [diff] [blame] | 152 | "third_party/gif", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 153 | ] |
mtklein | 150d113 | 2016-08-01 06:56:40 -0700 | [diff] [blame] | 154 | |
Mike Reed | a9e241d | 2017-05-03 10:52:00 -0400 | [diff] [blame] | 155 | defines = [ "SK_GAMMA_APPLY_TO_A8" ] |
mtklein | b37c034 | 2016-09-09 11:07:45 -0700 | [diff] [blame] | 156 | if (is_android) { |
| 157 | defines += [ |
| 158 | "SK_GAMMA_EXPONENT=1.4", |
| 159 | "SK_GAMMA_CONTRAST=0.0", |
| 160 | ] |
| 161 | } |
mtklein | 88a7ac0 | 2016-09-14 11:16:49 -0700 | [diff] [blame] | 162 | if (is_official_build || is_android) { |
| 163 | # TODO(bsalomon): it'd be nice to make Android normal. |
| 164 | defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ] |
| 165 | } |
Brian Salomon | 789e25e | 2016-09-30 13:41:03 -0400 | [diff] [blame] | 166 | libs = [] |
| 167 | lib_dirs = [] |
| 168 | if (skia_use_vulkan) { |
Michael Jurka | da3e596 | 2017-04-14 17:44:09 -0700 | [diff] [blame] | 169 | if (skia_vulkan_sdk != "" && !is_android && !is_fuchsia) { |
Mike Klein | 487bfc2 | 2016-10-14 14:04:56 -0400 | [diff] [blame] | 170 | if (is_win) { |
Brian Salomon | 3b5bf35 | 2017-03-20 15:54:41 -0400 | [diff] [blame] | 171 | lib_dirs += [ |
| 172 | "$skia_vulkan_sdk/Bin", |
| 173 | "$skia_vulkan_sdk/Lib", |
| 174 | ] |
Mike Klein | 487bfc2 | 2016-10-14 14:04:56 -0400 | [diff] [blame] | 175 | } else { |
Greg Daniel | 686bb21 | 2016-10-27 10:48:48 -0400 | [diff] [blame] | 176 | lib_dirs += [ "$skia_vulkan_sdk/lib/" ] |
Mike Klein | 487bfc2 | 2016-10-14 14:04:56 -0400 | [diff] [blame] | 177 | } |
Brian Salomon | 789e25e | 2016-09-30 13:41:03 -0400 | [diff] [blame] | 178 | } |
Brian Salomon | 789e25e | 2016-09-30 13:41:03 -0400 | [diff] [blame] | 179 | } |
Brian Salomon | 03e0584 | 2017-02-23 12:23:47 -0500 | [diff] [blame] | 180 | if (skia_enable_gpu) { |
| 181 | include_dirs += [ "src/gpu" ] |
| 182 | } |
Brian Osman | 34755e2 | 2016-12-05 09:46:02 -0500 | [diff] [blame] | 183 | if (skia_use_angle) { |
| 184 | defines += [ "SK_ANGLE" ] |
| 185 | } |
Brian Osman | 3f375d0 | 2016-12-28 11:19:22 -0500 | [diff] [blame] | 186 | if (skia_enable_discrete_gpu) { |
| 187 | defines += [ "SK_ENABLE_DISCRETE_GPU" ] |
| 188 | } |
Brian Salomon | 0c26a9d | 2017-07-06 10:09:38 -0400 | [diff] [blame] | 189 | if (!is_official_build) { |
| 190 | defines += [ "GR_TEST_UTILS=1" ] |
| 191 | } |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 192 | } |
| 193 | |
| 194 | # Any code that's linked into Skia-the-library should use this config via += skia_library_configs. |
| 195 | config("skia_library") { |
| 196 | visibility = [ ":*" ] |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 197 | defines = [ "SKIA_IMPLEMENTATION=1" ] |
| 198 | } |
| 199 | |
| 200 | skia_library_configs = [ |
| 201 | ":skia_public", |
| 202 | ":skia_private", |
| 203 | ":skia_library", |
| 204 | ] |
| 205 | |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 206 | # Use for CPU-specific Skia code that needs particular compiler flags. |
| 207 | template("opts") { |
| 208 | if (invoker.enabled) { |
| 209 | source_set(target_name) { |
| 210 | forward_variables_from(invoker, "*") |
| 211 | configs += skia_library_configs |
| 212 | } |
| 213 | } else { |
| 214 | # If not enabled, a phony empty target that swallows all otherwise unused variables. |
| 215 | source_set(target_name) { |
| 216 | forward_variables_from(invoker, |
| 217 | "*", |
| 218 | [ |
| 219 | "sources", |
| 220 | "cflags", |
| 221 | ]) |
| 222 | } |
| 223 | } |
anmittal | a7eaf2e | 2016-08-17 13:57:26 -0700 | [diff] [blame] | 224 | } |
| 225 | |
mtklein | 422310d | 2016-08-16 18:28:43 -0700 | [diff] [blame] | 226 | is_x86 = current_cpu == "x64" || current_cpu == "x86" |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 227 | |
mtklein | 7d6fb2c | 2016-08-25 14:50:44 -0700 | [diff] [blame] | 228 | opts("none") { |
| 229 | enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64" |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 230 | sources = skia_opts.none_sources |
anmittal | b8b3f71 | 2016-08-25 04:55:19 -0700 | [diff] [blame] | 231 | cflags = [] |
| 232 | } |
| 233 | |
mtklein | 7d6fb2c | 2016-08-25 14:50:44 -0700 | [diff] [blame] | 234 | opts("armv7") { |
anmittal | b8b3f71 | 2016-08-25 04:55:19 -0700 | [diff] [blame] | 235 | enabled = current_cpu == "arm" |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 236 | sources = skia_opts.armv7_sources + skia_opts.neon_sources |
mtklein | 7d6fb2c | 2016-08-25 14:50:44 -0700 | [diff] [blame] | 237 | cflags = [] |
anmittal | b8b3f71 | 2016-08-25 04:55:19 -0700 | [diff] [blame] | 238 | } |
| 239 | |
| 240 | opts("arm64") { |
| 241 | enabled = current_cpu == "arm64" |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 242 | sources = skia_opts.arm64_sources |
anmittal | b8b3f71 | 2016-08-25 04:55:19 -0700 | [diff] [blame] | 243 | cflags = [] |
| 244 | } |
| 245 | |
| 246 | opts("crc32") { |
| 247 | enabled = current_cpu == "arm64" |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 248 | sources = skia_opts.crc32_sources |
anmittal | b8b3f71 | 2016-08-25 04:55:19 -0700 | [diff] [blame] | 249 | cflags = [ "-march=armv8-a+crc" ] |
| 250 | } |
| 251 | |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 252 | opts("sse2") { |
| 253 | enabled = is_x86 |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 254 | sources = skia_opts.sse2_sources |
Mike Klein | c722f79 | 2017-07-31 11:57:21 -0400 | [diff] [blame] | 255 | if (!is_clang && is_win) { |
Mike Klein | d8765e3 | 2016-10-19 13:39:13 -0400 | [diff] [blame] | 256 | defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ] |
| 257 | } else { |
Mike Klein | 3eb7121 | 2016-10-11 17:08:53 -0400 | [diff] [blame] | 258 | cflags = [ "-msse2" ] |
| 259 | } |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 260 | } |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 261 | |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 262 | opts("ssse3") { |
| 263 | enabled = is_x86 |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 264 | sources = skia_opts.ssse3_sources |
Mike Klein | c722f79 | 2017-07-31 11:57:21 -0400 | [diff] [blame] | 265 | if (!is_clang && is_win) { |
Mike Klein | d8765e3 | 2016-10-19 13:39:13 -0400 | [diff] [blame] | 266 | defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ] |
| 267 | } else { |
Mike Klein | 3eb7121 | 2016-10-11 17:08:53 -0400 | [diff] [blame] | 268 | cflags = [ "-mssse3" ] |
| 269 | } |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 270 | } |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 271 | |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 272 | opts("sse41") { |
| 273 | enabled = is_x86 |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 274 | sources = skia_opts.sse41_sources |
Mike Klein | c722f79 | 2017-07-31 11:57:21 -0400 | [diff] [blame] | 275 | if (!is_clang && is_win) { |
Mike Klein | d8765e3 | 2016-10-19 13:39:13 -0400 | [diff] [blame] | 276 | defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ] |
| 277 | } else { |
Mike Klein | 3eb7121 | 2016-10-11 17:08:53 -0400 | [diff] [blame] | 278 | cflags = [ "-msse4.1" ] |
| 279 | } |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 280 | } |
mtklein | 4e97607 | 2016-08-08 09:06:27 -0700 | [diff] [blame] | 281 | |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 282 | opts("sse42") { |
| 283 | enabled = is_x86 |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 284 | sources = skia_opts.sse42_sources |
Mike Klein | c722f79 | 2017-07-31 11:57:21 -0400 | [diff] [blame] | 285 | if (!is_clang && is_win) { |
Mike Klein | d8765e3 | 2016-10-19 13:39:13 -0400 | [diff] [blame] | 286 | defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ] |
| 287 | } else { |
Mike Klein | 3eb7121 | 2016-10-11 17:08:53 -0400 | [diff] [blame] | 288 | cflags = [ "-msse4.2" ] |
| 289 | } |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 290 | } |
| 291 | |
| 292 | opts("avx") { |
| 293 | enabled = is_x86 |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 294 | sources = skia_opts.avx_sources |
Mike Klein | c722f79 | 2017-07-31 11:57:21 -0400 | [diff] [blame] | 295 | if (!is_clang && is_win) { |
Mike Klein | 17b6e48 | 2016-11-18 22:11:41 +0000 | [diff] [blame] | 296 | cflags = [ "/arch:AVX" ] |
Mike Klein | 3eb7121 | 2016-10-11 17:08:53 -0400 | [diff] [blame] | 297 | } else { |
| 298 | cflags = [ "-mavx" ] |
| 299 | } |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 300 | } |
| 301 | |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 302 | # 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] | 303 | template("optional") { |
| 304 | if (invoker.enabled) { |
| 305 | config(target_name + "_public") { |
mtklein | cd01b03 | 2016-08-31 04:58:19 -0700 | [diff] [blame] | 306 | if (defined(invoker.public_defines)) { |
| 307 | defines = invoker.public_defines |
| 308 | } |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 309 | } |
| 310 | source_set(target_name) { |
mtklein | cd01b03 | 2016-08-31 04:58:19 -0700 | [diff] [blame] | 311 | forward_variables_from(invoker, |
| 312 | "*", |
| 313 | [ |
| 314 | "public_defines", |
| 315 | "sources_when_disabled", |
scroggo | f84ad64 | 2016-10-31 09:02:57 -0700 | [diff] [blame] | 316 | "configs_to_remove", |
mtklein | cd01b03 | 2016-08-31 04:58:19 -0700 | [diff] [blame] | 317 | ]) |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 318 | all_dependent_configs = [ ":" + target_name + "_public" ] |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 319 | configs += skia_library_configs |
scroggo | f84ad64 | 2016-10-31 09:02:57 -0700 | [diff] [blame] | 320 | if (defined(invoker.configs_to_remove)) { |
| 321 | configs -= invoker.configs_to_remove |
| 322 | } |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 323 | } |
| 324 | } else { |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 325 | source_set(target_name) { |
| 326 | forward_variables_from(invoker, |
| 327 | "*", |
| 328 | [ |
| 329 | "public_defines", |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 330 | "deps", |
mtklein | 6ef6999 | 2016-09-14 06:12:09 -0700 | [diff] [blame] | 331 | "libs", |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 332 | "sources", |
mtklein | cd01b03 | 2016-08-31 04:58:19 -0700 | [diff] [blame] | 333 | "sources_when_disabled", |
scroggo | f84ad64 | 2016-10-31 09:02:57 -0700 | [diff] [blame] | 334 | "configs_to_remove", |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 335 | ]) |
mtklein | cd01b03 | 2016-08-31 04:58:19 -0700 | [diff] [blame] | 336 | if (defined(invoker.sources_when_disabled)) { |
| 337 | sources = invoker.sources_when_disabled |
| 338 | } |
| 339 | configs += skia_library_configs |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 340 | } |
mtklein | eb3c425 | 2016-08-23 07:38:09 -0700 | [diff] [blame] | 341 | } |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 342 | } |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 343 | |
Mike Klein | a04bb45 | 2017-02-09 12:24:07 -0500 | [diff] [blame] | 344 | optional("effects") { |
| 345 | enabled = skia_enable_effects |
Ethan Nicholas | 762466e | 2017-06-29 10:03:38 -0400 | [diff] [blame] | 346 | deps = [ |
| 347 | ":compile_processors", |
| 348 | ] |
Mike Klein | a04bb45 | 2017-02-09 12:24:07 -0500 | [diff] [blame] | 349 | sources = |
| 350 | skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ] |
| 351 | sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ] |
| 352 | } |
| 353 | |
mtklein | a45be61 | 2016-08-29 15:22:10 -0700 | [diff] [blame] | 354 | optional("fontmgr_android") { |
| 355 | enabled = fontmgr_android_enabled |
mtklein | a45be61 | 2016-08-29 15:22:10 -0700 | [diff] [blame] | 356 | |
| 357 | deps = [ |
Ben Wagner | fc49734 | 2017-02-24 11:15:26 -0500 | [diff] [blame] | 358 | ":typeface_freetype", |
mtklein | a45be61 | 2016-08-29 15:22:10 -0700 | [diff] [blame] | 359 | "//third_party/expat", |
mtklein | a45be61 | 2016-08-29 15:22:10 -0700 | [diff] [blame] | 360 | ] |
| 361 | sources = [ |
| 362 | "src/ports/SkFontMgr_android.cpp", |
| 363 | "src/ports/SkFontMgr_android_factory.cpp", |
| 364 | "src/ports/SkFontMgr_android_parser.cpp", |
| 365 | ] |
| 366 | } |
| 367 | |
mtklein | d2e39db | 2016-09-07 07:52:55 -0700 | [diff] [blame] | 368 | optional("fontmgr_custom") { |
| 369 | enabled = is_linux && skia_use_freetype && !skia_use_fontconfig |
| 370 | |
| 371 | deps = [ |
Ben Wagner | fc49734 | 2017-02-24 11:15:26 -0500 | [diff] [blame] | 372 | ":typeface_freetype", |
mtklein | d2e39db | 2016-09-07 07:52:55 -0700 | [diff] [blame] | 373 | ] |
| 374 | sources = [ |
| 375 | "src/ports/SkFontMgr_custom.cpp", |
Ben Wagner | 8ab590f | 2017-02-08 17:29:33 -0500 | [diff] [blame] | 376 | "src/ports/SkFontMgr_custom.h", |
| 377 | "src/ports/SkFontMgr_custom_directory.cpp", |
mtklein | d2e39db | 2016-09-07 07:52:55 -0700 | [diff] [blame] | 378 | "src/ports/SkFontMgr_custom_directory_factory.cpp", |
Ben Wagner | 8ab590f | 2017-02-08 17:29:33 -0500 | [diff] [blame] | 379 | "src/ports/SkFontMgr_custom_embedded.cpp", |
| 380 | "src/ports/SkFontMgr_custom_empty.cpp", |
mtklein | d2e39db | 2016-09-07 07:52:55 -0700 | [diff] [blame] | 381 | ] |
| 382 | } |
| 383 | |
mtklein | 3cc2218 | 2016-08-29 13:26:14 -0700 | [diff] [blame] | 384 | optional("fontmgr_fontconfig") { |
| 385 | enabled = skia_use_freetype && skia_use_fontconfig |
mtklein | 3cc2218 | 2016-08-29 13:26:14 -0700 | [diff] [blame] | 386 | |
| 387 | deps = [ |
Ben Wagner | fc49734 | 2017-02-24 11:15:26 -0500 | [diff] [blame] | 388 | ":typeface_freetype", |
mtklein | 3cc2218 | 2016-08-29 13:26:14 -0700 | [diff] [blame] | 389 | "//third_party:fontconfig", |
mtklein | 3cc2218 | 2016-08-29 13:26:14 -0700 | [diff] [blame] | 390 | ] |
| 391 | sources = [ |
bungeman | 1ae0e01 | 2016-09-19 12:13:16 -0700 | [diff] [blame] | 392 | "src/ports/SkFontConfigInterface.cpp", |
mtklein | 3cc2218 | 2016-08-29 13:26:14 -0700 | [diff] [blame] | 393 | "src/ports/SkFontConfigInterface_direct.cpp", |
| 394 | "src/ports/SkFontConfigInterface_direct_factory.cpp", |
| 395 | "src/ports/SkFontMgr_FontConfigInterface.cpp", |
| 396 | "src/ports/SkFontMgr_fontconfig.cpp", |
| 397 | "src/ports/SkFontMgr_fontconfig_factory.cpp", |
| 398 | ] |
| 399 | } |
| 400 | |
mtklein | cdedd0e | 2016-09-12 15:15:44 -0700 | [diff] [blame] | 401 | optional("fontmgr_fuchsia") { |
| 402 | enabled = is_fuchsia && skia_use_freetype |
| 403 | |
| 404 | deps = [ |
Ben Wagner | fc49734 | 2017-02-24 11:15:26 -0500 | [diff] [blame] | 405 | ":typeface_freetype", |
mtklein | cdedd0e | 2016-09-12 15:15:44 -0700 | [diff] [blame] | 406 | ] |
| 407 | sources = [ |
| 408 | "src/ports/SkFontMgr_custom.cpp", |
Ben Wagner | 8ab590f | 2017-02-08 17:29:33 -0500 | [diff] [blame] | 409 | "src/ports/SkFontMgr_custom_empty.cpp", |
mtklein | cdedd0e | 2016-09-12 15:15:44 -0700 | [diff] [blame] | 410 | "src/ports/SkFontMgr_custom_empty_factory.cpp", |
| 411 | ] |
| 412 | } |
| 413 | |
Ethan Nicholas | 762466e | 2017-06-29 10:03:38 -0400 | [diff] [blame] | 414 | if (skia_compile_processors) { |
Ethan Nicholas | ca82a92 | 2017-09-07 09:39:50 -0400 | [diff] [blame] | 415 | executable("sksllex") { |
| 416 | sources = [ |
| 417 | "src/sksl/lex/Main.cpp", |
| 418 | "src/sksl/lex/NFA.cpp", |
| 419 | "src/sksl/lex/RegexNode.cpp", |
| 420 | "src/sksl/lex/RegexParser.cpp", |
| 421 | ] |
| 422 | include_dirs = [ "src/sksl/lex" ] |
| 423 | } |
| 424 | |
Ethan Nicholas | 762466e | 2017-06-29 10:03:38 -0400 | [diff] [blame] | 425 | executable("skslc") { |
| 426 | defines = [ "SKSL_STANDALONE" ] |
| 427 | sources = [ |
| 428 | "src/sksl/SkSLMain.cpp", |
| 429 | ] |
| 430 | sources += skia_sksl_sources |
| 431 | include_dirs = [ |
| 432 | "src/gpu", |
| 433 | "src/sksl", |
| 434 | ] |
| 435 | deps = [ |
| 436 | "//third_party/spirv-tools", |
| 437 | ] |
| 438 | } |
| 439 | |
| 440 | skia_gpu_processor_outputs = [] |
| 441 | foreach(src, skia_gpu_processor_sources) { |
| 442 | dir = get_path_info(src, "dir") |
| 443 | name = get_path_info(src, "name") |
| 444 | |
| 445 | # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a |
| 446 | # path that starts with target_out_dir and then uses ".." to back up into the src dir. |
| 447 | skia_gpu_processor_outputs += [ |
| 448 | "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir), |
| 449 | # the script also modifies the corresponding .cpp file, but if we tell GN that it gets |
| 450 | # confused due to the same file being named by two different paths |
| 451 | ] |
| 452 | } |
| 453 | |
| 454 | action("compile_processors") { |
| 455 | script = "gn/compile_processors.py" |
| 456 | deps = [ |
| 457 | ":skslc(//gn/toolchain:$host_toolchain)", |
| 458 | ] |
| 459 | sources = skia_gpu_processor_sources |
| 460 | outputs = skia_gpu_processor_outputs |
| 461 | skslc_path = "$root_out_dir/" |
| 462 | if (host_toolchain != default_toolchain_name) { |
| 463 | skslc_path += "$host_toolchain/" |
| 464 | } |
| 465 | skslc_path += "skslc" |
| 466 | if (host_os == "win") { |
| 467 | skslc_path += ".exe" |
| 468 | } |
Ethan Nicholas | b9f6afb | 2017-07-27 16:02:37 -0400 | [diff] [blame] | 469 | args = [ |
| 470 | rebase_path(skslc_path), |
Eric Boren | b121be7 | 2017-07-28 10:00:51 -0400 | [diff] [blame] | 471 | rebase_path("bin/clang-format"), |
Ethan Nicholas | b9f6afb | 2017-07-27 16:02:37 -0400 | [diff] [blame] | 472 | ] |
Ethan Nicholas | 762466e | 2017-06-29 10:03:38 -0400 | [diff] [blame] | 473 | args += rebase_path(skia_gpu_processor_sources) |
| 474 | } |
| 475 | } else { |
| 476 | skia_gpu_processor_outputs = [] |
| 477 | group("compile_processors") { |
| 478 | } |
| 479 | } |
| 480 | |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 481 | optional("gpu") { |
| 482 | enabled = skia_enable_gpu |
Ethan Nicholas | 762466e | 2017-06-29 10:03:38 -0400 | [diff] [blame] | 483 | deps = [ |
| 484 | ":compile_processors", |
| 485 | ] |
mtklein | e9fb3d5 | 2016-09-20 15:11:46 -0700 | [diff] [blame] | 486 | public_defines = [] |
| 487 | |
Mike Klein | 29b3e58 | 2017-02-09 11:57:32 -0500 | [diff] [blame] | 488 | sources = skia_gpu_sources + skia_sksl_sources + |
Ethan Nicholas | 762466e | 2017-06-29 10:03:38 -0400 | [diff] [blame] | 489 | [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ] + |
| 490 | skia_gpu_processor_outputs |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 491 | |
| 492 | # These paths need to be absolute to match the ones produced by shared_sources.gni. |
| 493 | sources -= get_path_info([ |
| 494 | "src/gpu/gl/GrGLCreateNativeInterface_none.cpp", |
| 495 | "src/gpu/gl/GrGLDefaultInterface_none.cpp", |
| 496 | ], |
| 497 | "abspath") |
Mike Klein | 703cf5a | 2016-10-13 17:18:04 -0400 | [diff] [blame] | 498 | libs = [] |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 499 | if (is_android) { |
| 500 | sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ] |
Derek Sollenberger | 7a86987 | 2017-06-27 15:37:25 -0400 | [diff] [blame] | 501 | |
| 502 | # this lib is required to link against AHardwareBuffer |
| 503 | if (defined(ndk_api) && ndk_api >= 26) { |
| 504 | libs += [ "android" ] |
| 505 | } |
Kevin Lubick | 4a24e10 | 2017-03-29 11:19:01 -0400 | [diff] [blame] | 506 | } else if (skia_use_egl) { |
| 507 | sources += [ "src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp" ] |
| 508 | libs += [ "EGL" ] |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 509 | } else if (is_linux) { |
| 510 | sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ] |
Mike Klein | a979a1d | 2017-02-23 10:31:13 -0500 | [diff] [blame] | 511 | libs += [ |
| 512 | "GL", |
| 513 | "GLU", |
| 514 | ] |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 515 | } else if (is_mac) { |
| 516 | sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ] |
Chinmay Garde | 130a118 | 2016-11-23 11:43:56 -0800 | [diff] [blame] | 517 | } else if (is_ios) { |
| 518 | sources += [ "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp" ] |
Mike Klein | 703cf5a | 2016-10-13 17:18:04 -0400 | [diff] [blame] | 519 | } else if (is_win) { |
| 520 | sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ] |
| 521 | libs += [ "OpenGL32.lib" ] |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 522 | } else { |
| 523 | sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ] |
| 524 | } |
mtklein | e9fb3d5 | 2016-09-20 15:11:46 -0700 | [diff] [blame] | 525 | |
| 526 | if (skia_use_vulkan) { |
| 527 | public_defines += [ "SK_VULKAN" ] |
| 528 | sources += skia_vk_sources |
egdaniel | e4a9bd7 | 2016-09-21 07:36:14 -0700 | [diff] [blame] | 529 | if (skia_enable_vulkan_debug_layers) { |
| 530 | public_defines += [ "SK_ENABLE_VK_LAYERS" ] |
| 531 | } |
mtklein | e9fb3d5 | 2016-09-20 15:11:46 -0700 | [diff] [blame] | 532 | } |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 533 | if (skia_enable_spirv_validation) { |
Ethan Nicholas | 762466e | 2017-06-29 10:03:38 -0400 | [diff] [blame] | 534 | deps += [ "//third_party/spirv-tools" ] |
Ethan Nicholas | a6ae1f7 | 2017-03-16 09:56:54 -0400 | [diff] [blame] | 535 | public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ] |
| 536 | } |
Greg Daniel | e5ddff5 | 2017-07-05 16:49:36 -0400 | [diff] [blame] | 537 | |
Greg Daniel | 6b7e0e2 | 2017-07-12 16:21:09 -0400 | [diff] [blame] | 538 | cflags_objcc = [] |
Greg Daniel | e5ddff5 | 2017-07-05 16:49:36 -0400 | [diff] [blame] | 539 | if (skia_use_metal) { |
| 540 | public_defines += [ "SK_METAL" ] |
| 541 | sources += skia_metal_sources |
| 542 | libs += [ "Metal.framework" ] |
Greg Daniel | 6b7e0e2 | 2017-07-12 16:21:09 -0400 | [diff] [blame] | 543 | cflags_objcc += [ "-fobjc-arc" ] |
Greg Daniel | e5ddff5 | 2017-07-05 16:49:36 -0400 | [diff] [blame] | 544 | } |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 545 | } |
| 546 | |
Leon Scroggins III | 04be2b5 | 2017-08-17 15:13:20 -0400 | [diff] [blame] | 547 | optional("heif") { |
| 548 | enabled = skia_use_libheif |
| 549 | public_defines = [ "SK_HAS_HEIF_LIBRARY" ] |
| 550 | |
| 551 | deps = [] |
| 552 | |
| 553 | sources = [ |
| 554 | "src/codec/SkHeifCodec.cpp", |
| 555 | ] |
| 556 | } |
| 557 | |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 558 | optional("jpeg") { |
| 559 | enabled = skia_use_libjpeg_turbo |
| 560 | public_defines = [ "SK_HAS_JPEG_LIBRARY" ] |
| 561 | |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 562 | deps = [ |
| 563 | "//third_party/libjpeg-turbo:libjpeg", |
| 564 | ] |
| 565 | sources = [ |
| 566 | "src/codec/SkJpegCodec.cpp", |
| 567 | "src/codec/SkJpegDecoderMgr.cpp", |
| 568 | "src/codec/SkJpegUtility.cpp", |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 569 | "src/images/SkJPEGWriteUtility.cpp", |
Matt Sarett | 04c3731 | 2017-05-05 14:02:13 -0400 | [diff] [blame] | 570 | "src/images/SkJpegEncoder.cpp", |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 571 | ] |
| 572 | } |
| 573 | |
| 574 | optional("pdf") { |
Hal Canary | 43fb7a0 | 2016-12-30 13:09:03 -0500 | [diff] [blame] | 575 | enabled = skia_use_zlib && skia_enable_pdf |
| 576 | public_defines = [ "SK_SUPPORT_PDF" ] |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 577 | |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 578 | deps = [ |
| 579 | "//third_party/zlib", |
| 580 | ] |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 581 | sources = skia_pdf_sources |
mtklein | cd01b03 | 2016-08-31 04:58:19 -0700 | [diff] [blame] | 582 | sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ] |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 583 | |
| 584 | if (skia_use_sfntly) { |
| 585 | deps += [ "//third_party/sfntly" ] |
Hal Canary | 43fb7a0 | 2016-12-30 13:09:03 -0500 | [diff] [blame] | 586 | public_defines += [ "SK_PDF_USE_SFNTLY" ] |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 587 | } |
| 588 | } |
| 589 | |
| 590 | optional("png") { |
| 591 | enabled = skia_use_libpng |
| 592 | public_defines = [ "SK_HAS_PNG_LIBRARY" ] |
| 593 | |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 594 | deps = [ |
| 595 | "//third_party/libpng", |
| 596 | ] |
| 597 | sources = [ |
| 598 | "src/codec/SkIcoCodec.cpp", |
| 599 | "src/codec/SkPngCodec.cpp", |
Matt Sarett | 04c3731 | 2017-05-05 14:02:13 -0400 | [diff] [blame] | 600 | "src/images/SkPngEncoder.cpp", |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 601 | ] |
| 602 | } |
| 603 | |
scroggo | f84ad64 | 2016-10-31 09:02:57 -0700 | [diff] [blame] | 604 | optional("raw") { |
Mike Klein | 10d665d | 2016-11-01 11:46:10 -0400 | [diff] [blame] | 605 | enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex |
scroggo | f84ad64 | 2016-10-31 09:02:57 -0700 | [diff] [blame] | 606 | public_defines = [ "SK_CODEC_DECODES_RAW" ] |
| 607 | |
| 608 | deps = [ |
| 609 | "//third_party/dng_sdk", |
| 610 | "//third_party/libjpeg-turbo:libjpeg", |
| 611 | "//third_party/piex", |
| 612 | ] |
| 613 | |
| 614 | # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of |
| 615 | # Skia. |
| 616 | configs_to_remove = [ "//gn:no_exceptions" ] |
| 617 | |
| 618 | sources = [ |
| 619 | "src/codec/SkRawAdapterCodec.cpp", |
| 620 | "src/codec/SkRawCodec.cpp", |
| 621 | ] |
| 622 | } |
| 623 | |
mtklein | 3cc2218 | 2016-08-29 13:26:14 -0700 | [diff] [blame] | 624 | optional("typeface_freetype") { |
| 625 | enabled = skia_use_freetype |
mtklein | 3cc2218 | 2016-08-29 13:26:14 -0700 | [diff] [blame] | 626 | |
| 627 | deps = [ |
| 628 | "//third_party/freetype2", |
| 629 | ] |
| 630 | sources = [ |
| 631 | "src/ports/SkFontHost_FreeType.cpp", |
| 632 | "src/ports/SkFontHost_FreeType_common.cpp", |
| 633 | ] |
| 634 | } |
| 635 | |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 636 | optional("webp") { |
| 637 | enabled = skia_use_libwebp |
| 638 | public_defines = [ "SK_HAS_WEBP_LIBRARY" ] |
| 639 | |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 640 | deps = [ |
| 641 | "//third_party/libwebp", |
| 642 | ] |
| 643 | sources = [ |
| 644 | "src/codec/SkWebpAdapterCodec.cpp", |
| 645 | "src/codec/SkWebpCodec.cpp", |
Matt Sarett | 04c3731 | 2017-05-05 14:02:13 -0400 | [diff] [blame] | 646 | "src/images/SkWebpEncoder.cpp", |
mtklein | 457b42a | 2016-08-23 13:56:37 -0700 | [diff] [blame] | 647 | ] |
mtklein | eb3c425 | 2016-08-23 07:38:09 -0700 | [diff] [blame] | 648 | } |
| 649 | |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 650 | optional("xml") { |
| 651 | enabled = skia_use_expat |
Florin Malita | 442fff9 | 2016-11-08 16:07:52 +0000 | [diff] [blame] | 652 | public_defines = [ "SK_XML" ] |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 653 | |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 654 | deps = [ |
| 655 | "//third_party/expat", |
| 656 | ] |
| 657 | sources = [ |
Mike Klein | bd41bcc | 2017-02-09 16:38:15 -0500 | [diff] [blame] | 658 | "src/svg/SkSVGCanvas.cpp", |
| 659 | "src/svg/SkSVGDevice.cpp", |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 660 | "src/xml/SkDOM.cpp", |
| 661 | "src/xml/SkXMLParser.cpp", |
| 662 | "src/xml/SkXMLWriter.cpp", |
| 663 | ] |
| 664 | } |
| 665 | |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 666 | component("skia") { |
| 667 | public_configs = [ ":skia_public" ] |
| 668 | configs += skia_library_configs |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 669 | |
| 670 | deps = [ |
anmittal | b8b3f71 | 2016-08-25 04:55:19 -0700 | [diff] [blame] | 671 | ":arm64", |
| 672 | ":armv7", |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 673 | ":avx", |
anmittal | b8b3f71 | 2016-08-25 04:55:19 -0700 | [diff] [blame] | 674 | ":crc32", |
Mike Klein | a04bb45 | 2017-02-09 12:24:07 -0500 | [diff] [blame] | 675 | ":effects", |
mtklein | a45be61 | 2016-08-29 15:22:10 -0700 | [diff] [blame] | 676 | ":fontmgr_android", |
mtklein | d2e39db | 2016-09-07 07:52:55 -0700 | [diff] [blame] | 677 | ":fontmgr_custom", |
mtklein | 3cc2218 | 2016-08-29 13:26:14 -0700 | [diff] [blame] | 678 | ":fontmgr_fontconfig", |
mtklein | cdedd0e | 2016-09-12 15:15:44 -0700 | [diff] [blame] | 679 | ":fontmgr_fuchsia", |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 680 | ":gpu", |
Leon Scroggins III | 04be2b5 | 2017-08-17 15:13:20 -0400 | [diff] [blame] | 681 | ":heif", |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 682 | ":jpeg", |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 683 | ":none", |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 684 | ":pdf", |
| 685 | ":png", |
scroggo | f84ad64 | 2016-10-31 09:02:57 -0700 | [diff] [blame] | 686 | ":raw", |
mtklein | 9b8583d | 2016-08-24 17:32:30 -0700 | [diff] [blame] | 687 | ":sse2", |
| 688 | ":sse41", |
| 689 | ":sse42", |
| 690 | ":ssse3", |
mtklein | eb3c425 | 2016-08-23 07:38:09 -0700 | [diff] [blame] | 691 | ":webp", |
mtklein | 6321381 | 2016-08-24 09:55:56 -0700 | [diff] [blame] | 692 | ":xml", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 693 | ] |
| 694 | |
Chinmay Garde | 43f115c | 2016-11-16 15:04:12 -0800 | [diff] [blame] | 695 | # This file (and all GN files in Skia) are designed to work with an |
| 696 | # empty sources assignment filter; we handle all that explicitly. |
| 697 | # We clear the filter here for clients who may have set up a global filter. |
| 698 | set_sources_assignment_filter([]) |
| 699 | |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 700 | sources = [] |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 701 | sources += skia_core_sources |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 702 | sources += skia_utils_sources |
Hal Canary | 6ad3d2f | 2016-12-20 16:15:56 -0500 | [diff] [blame] | 703 | sources += skia_xps_sources |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 704 | sources += [ |
Stan Iliev | 73d8fd9 | 2017-08-02 15:36:24 -0400 | [diff] [blame] | 705 | "src/android/SkAndroidFrameworkUtils.cpp", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 706 | "src/android/SkBitmapRegionCodec.cpp", |
| 707 | "src/android/SkBitmapRegionDecoder.cpp", |
| 708 | "src/codec/SkAndroidCodec.cpp", |
Leon Scroggins III | d81fed9 | 2017-06-01 13:42:28 -0400 | [diff] [blame] | 709 | "src/codec/SkBmpBaseCodec.cpp", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 710 | "src/codec/SkBmpCodec.cpp", |
| 711 | "src/codec/SkBmpMaskCodec.cpp", |
| 712 | "src/codec/SkBmpRLECodec.cpp", |
| 713 | "src/codec/SkBmpStandardCodec.cpp", |
| 714 | "src/codec/SkCodec.cpp", |
| 715 | "src/codec/SkCodecImageGenerator.cpp", |
scroggo | 19b9153 | 2016-10-24 09:03:26 -0700 | [diff] [blame] | 716 | "src/codec/SkGifCodec.cpp", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 717 | "src/codec/SkMaskSwizzler.cpp", |
| 718 | "src/codec/SkMasks.cpp", |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 719 | "src/codec/SkSampledCodec.cpp", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 720 | "src/codec/SkSampler.cpp", |
scroggo | 19b9153 | 2016-10-24 09:03:26 -0700 | [diff] [blame] | 721 | "src/codec/SkStreamBuffer.cpp", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 722 | "src/codec/SkSwizzler.cpp", |
| 723 | "src/codec/SkWbmpCodec.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 724 | "src/images/SkImageEncoder.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 725 | "src/ports/SkDiscardableMemory_none.cpp", |
mtklein | 1211e0c | 2016-07-26 13:55:45 -0700 | [diff] [blame] | 726 | "src/ports/SkImageGenerator_skia.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 727 | "src/ports/SkMemory_malloc.cpp", |
| 728 | "src/ports/SkOSFile_stdio.cpp", |
| 729 | "src/sfnt/SkOTTable_name.cpp", |
| 730 | "src/sfnt/SkOTUtils.cpp", |
| 731 | "src/utils/mac/SkStream_mac.cpp", |
scroggo | 3d3a65c | 2016-10-24 12:28:30 -0700 | [diff] [blame] | 732 | "third_party/gif/SkGifImageReader.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 733 | ] |
brettw | b944728 | 2016-09-01 14:24:39 -0700 | [diff] [blame] | 734 | |
mtklein | 7d6fb2c | 2016-08-25 14:50:44 -0700 | [diff] [blame] | 735 | libs = [] |
| 736 | |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 737 | if (is_win) { |
| 738 | sources += [ |
Mike Klein | ae7e671 | 2016-10-11 17:49:33 -0400 | [diff] [blame] | 739 | "src/fonts/SkFontMgr_indirect.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 740 | "src/ports/SkDebug_win.cpp", |
| 741 | "src/ports/SkFontHost_win.cpp", |
| 742 | "src/ports/SkFontMgr_win_dw.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 743 | "src/ports/SkImageEncoder_WIC.cpp", |
| 744 | "src/ports/SkImageGeneratorWIC.cpp", |
| 745 | "src/ports/SkOSFile_win.cpp", |
mtklein | 605d952 | 2016-09-21 14:01:32 -0700 | [diff] [blame] | 746 | "src/ports/SkOSLibrary_win.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 747 | "src/ports/SkScalerContext_win_dw.cpp", |
| 748 | "src/ports/SkTLS_win.cpp", |
| 749 | "src/ports/SkTypeface_win_dw.cpp", |
| 750 | ] |
Mike Klein | 69f6ed4 | 2016-10-13 15:45:07 -0400 | [diff] [blame] | 751 | if (skia_use_gdi) { |
| 752 | sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ] |
| 753 | libs += [ |
| 754 | "Gdi32.lib", |
| 755 | "Usp10.lib", |
| 756 | ] |
| 757 | } else { |
| 758 | sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ] |
| 759 | } |
mtklein | b9be979 | 2016-09-16 14:44:18 -0700 | [diff] [blame] | 760 | sources -= |
| 761 | [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ] |
Mike Klein | 4b167fc | 2016-10-11 18:13:53 -0400 | [diff] [blame] | 762 | libs += [ |
| 763 | "FontSub.lib", |
| 764 | "Ole32.lib", |
| 765 | "OleAut32.lib", |
| 766 | "User32.lib", |
| 767 | ] |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 768 | } else { |
| 769 | sources += [ |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 770 | "src/ports/SkOSFile_posix.cpp", |
mtklein | 605d952 | 2016-09-21 14:01:32 -0700 | [diff] [blame] | 771 | "src/ports/SkOSLibrary_posix.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 772 | "src/ports/SkTLS_pthread.cpp", |
| 773 | ] |
Ben Wagner | be6ae5b | 2017-08-31 16:45:23 -0400 | [diff] [blame] | 774 | libs += [ "dl" ] |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 775 | } |
| 776 | |
mtklein | 7d6fb2c | 2016-08-25 14:50:44 -0700 | [diff] [blame] | 777 | if (is_android) { |
Mike Klein | 1c47187 | 2017-01-13 15:27:45 -0500 | [diff] [blame] | 778 | deps += [ "//third_party/expat" ] |
Mike Klein | e459afd | 2017-03-03 09:21:30 -0500 | [diff] [blame] | 779 | if (defined(ndk) && ndk != "") { |
Mike Klein | 1c47187 | 2017-01-13 15:27:45 -0500 | [diff] [blame] | 780 | deps += [ "//third_party/cpu-features" ] |
| 781 | } |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 782 | sources += [ "src/ports/SkDebug_android.cpp" ] |
mtklein | 7d6fb2c | 2016-08-25 14:50:44 -0700 | [diff] [blame] | 783 | libs += [ |
| 784 | "EGL", |
| 785 | "GLESv2", |
| 786 | "log", |
| 787 | ] |
| 788 | } |
| 789 | |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 790 | if (is_linux) { |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 791 | sources += [ "src/ports/SkDebug_stdio.cpp" ] |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 792 | } |
| 793 | |
| 794 | if (is_mac) { |
| 795 | sources += [ |
mtklein | 7d6fb2c | 2016-08-25 14:50:44 -0700 | [diff] [blame] | 796 | "src/ports/SkDebug_stdio.cpp", |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 797 | "src/ports/SkFontHost_mac.cpp", |
| 798 | "src/ports/SkImageEncoder_CG.cpp", |
| 799 | "src/ports/SkImageGeneratorCG.cpp", |
| 800 | ] |
mtklein | 09e61f7 | 2016-08-23 13:35:28 -0700 | [diff] [blame] | 801 | libs += [ |
bungeman | 3e306f6 | 2017-03-29 11:32:02 -0400 | [diff] [blame] | 802 | # AppKit symbols NSFontWeightXXX may be dlsym'ed. |
| 803 | "AppKit.framework", |
mtklein | 09e61f7 | 2016-08-23 13:35:28 -0700 | [diff] [blame] | 804 | "ApplicationServices.framework", |
| 805 | "OpenGL.framework", |
| 806 | ] |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 807 | } |
abarth | 6fc8ff0 | 2016-07-15 15:15:15 -0700 | [diff] [blame] | 808 | |
Mike Klein | 7d30288 | 2016-11-03 14:06:31 -0400 | [diff] [blame] | 809 | if (is_ios) { |
| 810 | sources += [ |
| 811 | "src/ports/SkDebug_stdio.cpp", |
| 812 | "src/ports/SkFontHost_mac.cpp", |
| 813 | "src/ports/SkImageEncoder_CG.cpp", |
| 814 | "src/ports/SkImageGeneratorCG.cpp", |
| 815 | ] |
| 816 | libs += [ |
| 817 | "CoreFoundation.framework", |
| 818 | "CoreGraphics.framework", |
| 819 | "CoreText.framework", |
| 820 | "ImageIO.framework", |
| 821 | "MobileCoreServices.framework", |
bungeman | 3e306f6 | 2017-03-29 11:32:02 -0400 | [diff] [blame] | 822 | |
| 823 | # UIKit symbols UIFontWeightXXX may be dlsym'ed. |
| 824 | "UIKit.framework", |
Mike Klein | 7d30288 | 2016-11-03 14:06:31 -0400 | [diff] [blame] | 825 | ] |
| 826 | } |
| 827 | |
abarth | 6fc8ff0 | 2016-07-15 15:15:15 -0700 | [diff] [blame] | 828 | if (is_fuchsia) { |
mtklein | 06c35c0 | 2016-09-20 12:28:12 -0700 | [diff] [blame] | 829 | sources += [ "src/ports/SkDebug_stdio.cpp" ] |
abarth | 6fc8ff0 | 2016-07-15 15:15:15 -0700 | [diff] [blame] | 830 | } |
mtklein | c04ff47 | 2016-06-23 10:29:30 -0700 | [diff] [blame] | 831 | } |
| 832 | |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 833 | # Targets guarded by skia_enable_tools may use //third_party freely. |
| 834 | if (skia_enable_tools) { |
Mike Klein | 308b5ac | 2016-12-06 16:03:52 -0500 | [diff] [blame] | 835 | # Used by gn_to_bp.py to list our public include dirs. |
| 836 | source_set("public") { |
| 837 | configs += [ ":skia_public" ] |
| 838 | } |
| 839 | |
Mike Klein | c36dedf | 2016-11-18 09:35:28 -0500 | [diff] [blame] | 840 | config("skia.h_config") { |
| 841 | include_dirs = [ "$target_gen_dir" ] |
| 842 | } |
| 843 | action("skia.h") { |
| 844 | public_configs = [ ":skia.h_config" ] |
| 845 | skia_h = "$target_gen_dir/skia.h" |
| 846 | script = "gn/find_headers.py" |
Greg Daniel | c819e66 | 2017-04-19 16:39:45 -0400 | [diff] [blame] | 847 | args = [ rebase_path(skia_h, root_build_dir) ] + |
Robert Phillips | fcd5fdd | 2017-06-14 01:43:29 +0000 | [diff] [blame] | 848 | rebase_path(skia_public_includes) |
Mike Klein | c36dedf | 2016-11-18 09:35:28 -0500 | [diff] [blame] | 849 | depfile = "$skia_h.deps" |
| 850 | outputs = [ |
| 851 | skia_h, |
| 852 | ] |
| 853 | } |
| 854 | |
| 855 | if (skia_enable_gpu && target_cpu == "x64") { |
| 856 | # Our bots only have 64-bit libOSMesa installed. |
| 857 | # TODO: worth fixing? |
| 858 | executable("fiddle") { |
| 859 | libs = [] |
Mike Klein | c36dedf | 2016-11-18 09:35:28 -0500 | [diff] [blame] | 860 | sources = [ |
Mike Klein | c36dedf | 2016-11-18 09:35:28 -0500 | [diff] [blame] | 861 | "tools/fiddle/draw.cpp", |
| 862 | "tools/fiddle/fiddle_main.cpp", |
| 863 | ] |
Joe Gregorio | a8fabd3 | 2017-05-31 09:45:19 -0400 | [diff] [blame] | 864 | |
| 865 | if (skia_use_egl) { |
| 866 | sources += [ "tools/fiddle/egl_context.cpp" ] |
| 867 | } else if (skia_use_mesa) { |
| 868 | sources += [ "tools/fiddle/mesa_context.cpp" ] |
| 869 | if (is_linux) { |
| 870 | libs += [ "OSMesa" ] |
| 871 | } |
| 872 | } else { |
| 873 | sources += [ "tools/fiddle/null_context.cpp" ] |
| 874 | } |
Joe Gregorio | 1e735c0 | 2017-04-19 14:05:14 -0400 | [diff] [blame] | 875 | testonly = true |
Mike Klein | c36dedf | 2016-11-18 09:35:28 -0500 | [diff] [blame] | 876 | deps = [ |
Joe Gregorio | 1e735c0 | 2017-04-19 14:05:14 -0400 | [diff] [blame] | 877 | ":flags", |
Mike Klein | c36dedf | 2016-11-18 09:35:28 -0500 | [diff] [blame] | 878 | ":skia", |
| 879 | ":skia.h", |
| 880 | ] |
| 881 | } |
| 882 | } |
| 883 | |
| 884 | if (skia_enable_gpu) { |
| 885 | source_set("public_headers_warnings_check") { |
| 886 | sources = [ |
| 887 | "tools/public_headers_warnings_check.cpp", |
| 888 | ] |
| 889 | configs -= [ "//gn:warnings_except_public_headers" ] |
| 890 | deps = [ |
| 891 | ":skia", |
| 892 | ":skia.h", |
| 893 | ] |
| 894 | } |
| 895 | } |
| 896 | |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 897 | template("test_lib") { |
| 898 | config(target_name + "_config") { |
| 899 | include_dirs = invoker.public_include_dirs |
mtklein | a627b5c | 2016-09-20 13:36:47 -0700 | [diff] [blame] | 900 | if (defined(invoker.public_defines)) { |
| 901 | defines = invoker.public_defines |
| 902 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 903 | } |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 904 | source_set(target_name) { |
| 905 | forward_variables_from(invoker, "*", [ "public_include_dirs" ]) |
| 906 | public_configs = [ |
| 907 | ":" + target_name + "_config", |
| 908 | ":skia_private", |
| 909 | ] |
| 910 | |
| 911 | if (!defined(deps)) { |
| 912 | deps = [] |
| 913 | } |
| 914 | deps += [ ":skia" ] |
| 915 | testonly = true |
| 916 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 917 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 918 | |
Mike Klein | e6682eb | 2017-01-05 10:54:57 -0500 | [diff] [blame] | 919 | template("test_app") { |
| 920 | if (defined(invoker.is_shared_library) && invoker.is_shared_library) { |
| 921 | shared_library("lib" + target_name) { |
| 922 | forward_variables_from(invoker, "*", [ "is_shared_library" ]) |
Mike Klein | 154e6da | 2017-07-26 15:13:47 -0400 | [diff] [blame] | 923 | configs += [ ":skia_private" ] |
Mike Klein | e6682eb | 2017-01-05 10:54:57 -0500 | [diff] [blame] | 924 | testonly = true |
| 925 | } |
| 926 | } else { |
Mike Klein | 7d92103 | 2017-01-05 12:20:41 -0500 | [diff] [blame] | 927 | _executable = target_name |
| 928 | executable(_executable) { |
Mike Klein | e6682eb | 2017-01-05 10:54:57 -0500 | [diff] [blame] | 929 | forward_variables_from(invoker, "*", [ "is_shared_library" ]) |
Mike Klein | 154e6da | 2017-07-26 15:13:47 -0400 | [diff] [blame] | 930 | configs += [ ":skia_private" ] |
Mike Klein | e6682eb | 2017-01-05 10:54:57 -0500 | [diff] [blame] | 931 | testonly = true |
| 932 | } |
| 933 | } |
Mike Klein | 7d92103 | 2017-01-05 12:20:41 -0500 | [diff] [blame] | 934 | if (is_android && skia_android_serial != "" && defined(_executable)) { |
| 935 | action("push_" + target_name) { |
| 936 | script = "gn/push_to_android.py" |
| 937 | deps = [ |
| 938 | ":" + _executable, |
| 939 | ] |
| 940 | _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial" |
| 941 | outputs = [ |
| 942 | _stamp, |
| 943 | ] |
| 944 | args = [ |
| 945 | rebase_path("$root_build_dir/$_executable"), |
| 946 | skia_android_serial, |
| 947 | rebase_path(_stamp), |
| 948 | ] |
| 949 | testonly = true |
| 950 | } |
| 951 | } |
Mike Klein | e6682eb | 2017-01-05 10:54:57 -0500 | [diff] [blame] | 952 | } |
| 953 | |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 954 | test_lib("gpu_tool_utils") { |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 955 | public_include_dirs = [] |
| 956 | if (skia_enable_gpu) { |
| 957 | public_defines = [] |
| 958 | public_include_dirs += [ "tools/gpu" ] |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 959 | |
| 960 | deps = [] |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 961 | sources = [ |
| 962 | "tools/gpu/GrContextFactory.cpp", |
| 963 | "tools/gpu/GrTest.cpp", |
| 964 | "tools/gpu/TestContext.cpp", |
| 965 | "tools/gpu/gl/GLTestContext.cpp", |
mtklein | 605d952 | 2016-09-21 14:01:32 -0700 | [diff] [blame] | 966 | "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp", |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 967 | "tools/gpu/gl/debug/DebugGLTestContext.cpp", |
| 968 | "tools/gpu/gl/debug/GrBufferObj.cpp", |
| 969 | "tools/gpu/gl/debug/GrFrameBufferObj.cpp", |
| 970 | "tools/gpu/gl/debug/GrProgramObj.cpp", |
| 971 | "tools/gpu/gl/debug/GrShaderObj.cpp", |
| 972 | "tools/gpu/gl/debug/GrTextureObj.cpp", |
| 973 | "tools/gpu/gl/debug/GrTextureUnitObj.cpp", |
| 974 | "tools/gpu/gl/null/NullGLTestContext.cpp", |
Brian Salomon | cfe910d | 2017-07-06 16:40:18 -0400 | [diff] [blame] | 975 | "tools/gpu/mock/MockTestContext.cpp", |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 976 | ] |
| 977 | libs = [] |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 978 | |
Kevin Lubick | 4a24e10 | 2017-03-29 11:19:01 -0400 | [diff] [blame] | 979 | if (is_android || skia_use_egl) { |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 980 | sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ] |
Mike Klein | 7d30288 | 2016-11-03 14:06:31 -0400 | [diff] [blame] | 981 | } else if (is_ios) { |
| 982 | sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ] |
| 983 | libs += [ "OpenGLES.framework" ] |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 984 | } else if (is_linux) { |
| 985 | sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ] |
Mike Klein | a979a1d | 2017-02-23 10:31:13 -0500 | [diff] [blame] | 986 | libs += [ "X11" ] |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 987 | } else if (is_mac) { |
| 988 | sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ] |
Mike Klein | 4b167fc | 2016-10-11 18:13:53 -0400 | [diff] [blame] | 989 | } else if (is_win) { |
| 990 | sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ] |
| 991 | libs += [ |
| 992 | "Gdi32.lib", |
| 993 | "OpenGL32.lib", |
| 994 | ] |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 995 | } |
mtklein | 6ef6999 | 2016-09-14 06:12:09 -0700 | [diff] [blame] | 996 | |
Greg Daniel | 6b7e0e2 | 2017-07-12 16:21:09 -0400 | [diff] [blame] | 997 | cflags_objcc = [ "-fobjc-arc" ] |
| 998 | |
Mike Klein | c168a3a | 2016-11-14 14:53:13 +0000 | [diff] [blame] | 999 | if (skia_use_angle) { |
Mike Klein | c168a3a | 2016-11-14 14:53:13 +0000 | [diff] [blame] | 1000 | deps += [ "//third_party/angle2" ] |
| 1001 | sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ] |
| 1002 | } |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 1003 | if (skia_use_mesa) { |
| 1004 | public_defines += [ "SK_MESA" ] |
| 1005 | sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ] |
| 1006 | libs += [ "OSMesa" ] |
| 1007 | } |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 1008 | if (skia_use_vulkan) { |
| 1009 | sources += [ "tools/gpu/vk/VkTestContext.cpp" ] |
Brian Salomon | 5db010b | 2017-04-25 16:05:29 -0400 | [diff] [blame] | 1010 | if (is_win) { |
| 1011 | libs += [ "vulkan-1.lib" ] |
| 1012 | } else { |
| 1013 | libs += [ "vulkan" ] |
| 1014 | } |
mtklein | d68f9b0 | 2016-09-23 13:18:41 -0700 | [diff] [blame] | 1015 | } |
Greg Daniel | b76a72a | 2017-07-13 15:07:54 -0400 | [diff] [blame] | 1016 | if (skia_use_metal) { |
| 1017 | sources += [ "tools/gpu/mtl/MtlTestContext.mm" ] |
| 1018 | } |
mtklein | a627b5c | 2016-09-20 13:36:47 -0700 | [diff] [blame] | 1019 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 1020 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 1021 | |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 1022 | test_lib("flags") { |
| 1023 | public_include_dirs = [ "tools/flags" ] |
| 1024 | sources = [ |
| 1025 | "tools/flags/SkCommandLineFlags.cpp", |
mtklein | 046cb56 | 2016-09-16 10:23:12 -0700 | [diff] [blame] | 1026 | ] |
| 1027 | } |
| 1028 | test_lib("common_flags") { |
| 1029 | public_include_dirs = [ "tools/flags" ] |
| 1030 | sources = [ |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 1031 | "tools/flags/SkCommonFlags.cpp", |
| 1032 | "tools/flags/SkCommonFlagsConfig.cpp", |
| 1033 | ] |
| 1034 | deps = [ |
mtklein | 046cb56 | 2016-09-16 10:23:12 -0700 | [diff] [blame] | 1035 | ":flags", |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 1036 | ":gpu_tool_utils", |
| 1037 | ] |
| 1038 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 1039 | |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 1040 | test_lib("tool_utils") { |
| 1041 | public_include_dirs = [ |
| 1042 | "tools", |
| 1043 | "tools/debugger", |
| 1044 | "tools/timer", |
Brian Salomon | dcbb9d9 | 2017-07-19 10:53:20 -0400 | [diff] [blame] | 1045 | "tools/trace", |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 1046 | ] |
| 1047 | sources = [ |
mtklein | b37c034 | 2016-09-09 11:07:45 -0700 | [diff] [blame] | 1048 | "tools/AndroidSkDebugToStdOut.cpp", |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 1049 | "tools/CrashHandler.cpp", |
mtklein | 0590fa5 | 2016-09-01 07:06:54 -0700 | [diff] [blame] | 1050 | "tools/LsanSuppressions.cpp", |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 1051 | "tools/ProcStats.cpp", |
| 1052 | "tools/Resources.cpp", |
| 1053 | "tools/ThermalManager.cpp", |
| 1054 | "tools/UrlDataManager.cpp", |
| 1055 | "tools/debugger/SkDebugCanvas.cpp", |
| 1056 | "tools/debugger/SkDrawCommand.cpp", |
| 1057 | "tools/debugger/SkJsonWriteBuffer.cpp", |
| 1058 | "tools/debugger/SkObjectParser.cpp", |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 1059 | "tools/picture_utils.cpp", |
| 1060 | "tools/random_parse_path.cpp", |
| 1061 | "tools/sk_tool_utils.cpp", |
| 1062 | "tools/sk_tool_utils_font.cpp", |
| 1063 | "tools/timer/Timer.cpp", |
Brian Osman | 53136aa | 2017-07-20 15:43:35 -0400 | [diff] [blame] | 1064 | "tools/trace/SkChromeTracingTracer.cpp", |
| 1065 | "tools/trace/SkChromeTracingTracer.h", |
Brian Salomon | dcbb9d9 | 2017-07-19 10:53:20 -0400 | [diff] [blame] | 1066 | "tools/trace/SkDebugfTracer.cpp", |
| 1067 | "tools/trace/SkDebugfTracer.h", |
Brian Osman | 53136aa | 2017-07-20 15:43:35 -0400 | [diff] [blame] | 1068 | "tools/trace/SkEventTracingPriv.cpp", |
| 1069 | "tools/trace/SkEventTracingPriv.h", |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 1070 | ] |
Mike Klein | adacaef | 2017-02-06 09:26:14 -0500 | [diff] [blame] | 1071 | libs = [] |
| 1072 | if (is_ios) { |
| 1073 | sources += [ "tools/ios_utils.m" ] |
| 1074 | libs += [ "Foundation.framework" ] |
| 1075 | } |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 1076 | deps = [ |
mtklein | 046cb56 | 2016-09-16 10:23:12 -0700 | [diff] [blame] | 1077 | ":common_flags", |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 1078 | ":flags", |
| 1079 | "//third_party/libpng", |
| 1080 | ] |
| 1081 | public_deps = [ |
| 1082 | "//third_party/jsoncpp", |
| 1083 | ] |
| 1084 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 1085 | |
Mike Klein | 6e74412 | 2016-10-27 12:21:40 -0400 | [diff] [blame] | 1086 | import("gn/gm.gni") |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 1087 | test_lib("gm") { |
| 1088 | public_include_dirs = [ "gm" ] |
| 1089 | sources = gm_sources |
| 1090 | deps = [ |
scroggo | 19b9153 | 2016-10-24 09:03:26 -0700 | [diff] [blame] | 1091 | ":flags", |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 1092 | ":gpu_tool_utils", |
| 1093 | ":skia", |
| 1094 | ":tool_utils", |
| 1095 | ] |
| 1096 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 1097 | |
Mike Klein | 6e74412 | 2016-10-27 12:21:40 -0400 | [diff] [blame] | 1098 | import("gn/tests.gni") |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 1099 | test_lib("tests") { |
| 1100 | public_include_dirs = [ "tests" ] |
Mike Klein | 6e74412 | 2016-10-27 12:21:40 -0400 | [diff] [blame] | 1101 | sources = tests_sources + pathops_tests_sources |
mtklein | a45be61 | 2016-08-29 15:22:10 -0700 | [diff] [blame] | 1102 | if (!fontmgr_android_enabled) { |
Mike Klein | 6e74412 | 2016-10-27 12:21:40 -0400 | [diff] [blame] | 1103 | sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ] |
mtklein | a45be61 | 2016-08-29 15:22:10 -0700 | [diff] [blame] | 1104 | } |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 1105 | deps = [ |
fmalita | 6cf896d | 2016-08-25 08:44:35 -0700 | [diff] [blame] | 1106 | ":experimental_svg_model", |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 1107 | ":flags", |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 1108 | ":skia", |
| 1109 | ":tool_utils", |
| 1110 | "//third_party/libpng", |
| 1111 | "//third_party/zlib", |
| 1112 | ] |
Mike Klein | d63442d | 2017-03-27 14:16:04 -0400 | [diff] [blame] | 1113 | public_deps = [ |
| 1114 | ":gpu_tool_utils", # Test.h #includes headers from this target. |
| 1115 | ] |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 1116 | } |
mtklein | 2f3416d | 2016-08-02 16:02:05 -0700 | [diff] [blame] | 1117 | |
Mike Klein | 6e74412 | 2016-10-27 12:21:40 -0400 | [diff] [blame] | 1118 | import("gn/bench.gni") |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 1119 | test_lib("bench") { |
| 1120 | public_include_dirs = [ "bench" ] |
| 1121 | sources = bench_sources |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 1122 | deps = [ |
| 1123 | ":flags", |
| 1124 | ":gm", |
| 1125 | ":gpu_tool_utils", |
| 1126 | ":skia", |
| 1127 | ":tool_utils", |
| 1128 | ] |
| 1129 | } |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 1130 | |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 1131 | test_lib("experimental_svg_model") { |
| 1132 | public_include_dirs = [ "experimental/svg/model" ] |
| 1133 | sources = [ |
| 1134 | "experimental/svg/model/SkSVGAttribute.cpp", |
| 1135 | "experimental/svg/model/SkSVGAttributeParser.cpp", |
| 1136 | "experimental/svg/model/SkSVGCircle.cpp", |
Florin Malita | ce8840e | 2016-12-08 09:26:47 -0500 | [diff] [blame] | 1137 | "experimental/svg/model/SkSVGClipPath.cpp", |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 1138 | "experimental/svg/model/SkSVGContainer.cpp", |
| 1139 | "experimental/svg/model/SkSVGDOM.cpp", |
| 1140 | "experimental/svg/model/SkSVGEllipse.cpp", |
| 1141 | "experimental/svg/model/SkSVGLine.cpp", |
fmalita | 28d5b72 | 2016-09-12 17:06:47 -0700 | [diff] [blame] | 1142 | "experimental/svg/model/SkSVGLinearGradient.cpp", |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 1143 | "experimental/svg/model/SkSVGNode.cpp", |
| 1144 | "experimental/svg/model/SkSVGPath.cpp", |
| 1145 | "experimental/svg/model/SkSVGPoly.cpp", |
| 1146 | "experimental/svg/model/SkSVGRect.cpp", |
| 1147 | "experimental/svg/model/SkSVGRenderContext.cpp", |
| 1148 | "experimental/svg/model/SkSVGSVG.cpp", |
| 1149 | "experimental/svg/model/SkSVGShape.cpp", |
fmalita | 28d5b72 | 2016-09-12 17:06:47 -0700 | [diff] [blame] | 1150 | "experimental/svg/model/SkSVGStop.cpp", |
mtklein | c095df5 | 2016-08-24 12:23:52 -0700 | [diff] [blame] | 1151 | "experimental/svg/model/SkSVGTransformableNode.cpp", |
| 1152 | "experimental/svg/model/SkSVGValue.cpp", |
| 1153 | ] |
| 1154 | deps = [ |
| 1155 | ":skia", |
| 1156 | ] |
| 1157 | } |
fmalita | a2b9fdf | 2016-08-03 19:53:36 -0700 | [diff] [blame] | 1158 | |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 1159 | test_lib("views") { |
| 1160 | public_include_dirs = [ "include/views" ] |
| 1161 | sources = [ |
| 1162 | "src/views/SkEvent.cpp", |
| 1163 | "src/views/SkEventSink.cpp", |
| 1164 | "src/views/SkOSMenu.cpp", |
| 1165 | "src/views/SkTagList.cpp", |
| 1166 | "src/views/SkTouchGesture.cpp", |
| 1167 | "src/views/SkView.cpp", |
| 1168 | "src/views/SkViewPriv.cpp", |
| 1169 | ] |
| 1170 | libs = [] |
Brian Osman | 34755e2 | 2016-12-05 09:46:02 -0500 | [diff] [blame] | 1171 | deps = [] |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 1172 | if (!is_android) { |
| 1173 | sources += [ "src/views/SkWindow.cpp" ] |
| 1174 | } |
Jim Van Verth | 4e56a91 | 2016-10-21 10:58:52 -0400 | [diff] [blame] | 1175 | if (is_linux) { |
Brian Osman | 2dd9693 | 2016-10-18 15:33:53 -0400 | [diff] [blame] | 1176 | public_include_dirs += [ "src/views/unix" ] |
| 1177 | sources += [ |
| 1178 | "src/views/unix/SkOSWindow_Unix.cpp", |
| 1179 | "src/views/unix/keysym2ucs.c", |
| 1180 | ] |
Mike Klein | a979a1d | 2017-02-23 10:31:13 -0500 | [diff] [blame] | 1181 | libs += [ |
| 1182 | "GL", |
| 1183 | "X11", |
| 1184 | ] |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 1185 | } else if (is_mac) { |
| 1186 | sources += [ |
| 1187 | "src/views/mac/SkEventNotifier.mm", |
| 1188 | "src/views/mac/SkNSView.mm", |
| 1189 | "src/views/mac/SkOSWindow_Mac.mm", |
| 1190 | "src/views/mac/SkTextFieldCell.m", |
| 1191 | ] |
| 1192 | libs += [ |
| 1193 | "QuartzCore.framework", |
| 1194 | "Cocoa.framework", |
| 1195 | "Foundation.framework", |
| 1196 | ] |
| 1197 | } else if (is_win) { |
| 1198 | sources += [ "src/views/win/SkOSWindow_win.cpp" ] |
Jim Van Verth | dbb24ef | 2017-09-01 11:01:51 -0400 | [diff] [blame] | 1199 | } else if (is_ios) { |
| 1200 | sources += [ "src/views/mac/SkEventNotifier.mm" ] |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 1201 | } |
Brian Osman | 34755e2 | 2016-12-05 09:46:02 -0500 | [diff] [blame] | 1202 | if (skia_use_angle) { |
| 1203 | deps += [ "//third_party/angle2" ] |
| 1204 | } |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 1205 | } |
| 1206 | |
Mike Klein | 38af943 | 2016-11-11 11:39:44 -0500 | [diff] [blame] | 1207 | if (skia_use_lua) { |
| 1208 | test_lib("lua") { |
| 1209 | public_include_dirs = [] |
| 1210 | sources = [ |
| 1211 | "src/utils/SkLua.cpp", |
| 1212 | "src/utils/SkLuaCanvas.cpp", |
| 1213 | ] |
| 1214 | deps = [ |
| 1215 | "//third_party/lua", |
| 1216 | ] |
| 1217 | } |
| 1218 | |
Mike Klein | e6682eb | 2017-01-05 10:54:57 -0500 | [diff] [blame] | 1219 | test_app("lua_app") { |
Mike Klein | 38af943 | 2016-11-11 11:39:44 -0500 | [diff] [blame] | 1220 | sources = [ |
| 1221 | "tools/lua/lua_app.cpp", |
| 1222 | ] |
| 1223 | deps = [ |
| 1224 | ":lua", |
| 1225 | ":skia", |
| 1226 | "//third_party/lua", |
| 1227 | ] |
Mike Klein | 38af943 | 2016-11-11 11:39:44 -0500 | [diff] [blame] | 1228 | } |
| 1229 | |
Mike Klein | e6682eb | 2017-01-05 10:54:57 -0500 | [diff] [blame] | 1230 | test_app("lua_pictures") { |
Mike Klein | 38af943 | 2016-11-11 11:39:44 -0500 | [diff] [blame] | 1231 | sources = [ |
| 1232 | "tools/lua/lua_pictures.cpp", |
| 1233 | ] |
| 1234 | deps = [ |
| 1235 | ":flags", |
| 1236 | ":lua", |
| 1237 | ":skia", |
| 1238 | ":tool_utils", |
| 1239 | "//third_party/lua", |
| 1240 | ] |
Mike Klein | 38af943 | 2016-11-11 11:39:44 -0500 | [diff] [blame] | 1241 | } |
| 1242 | } |
| 1243 | |
Cary Clark | 8032b98 | 2017-07-28 11:04:54 -0400 | [diff] [blame] | 1244 | test_app("bookmaker") { |
| 1245 | sources = [ |
| 1246 | "tools/bookmaker/bookmaker.cpp", |
| 1247 | "tools/bookmaker/fiddleParser.cpp", |
| 1248 | "tools/bookmaker/includeParser.cpp", |
| 1249 | "tools/bookmaker/includeWriter.cpp", |
| 1250 | "tools/bookmaker/mdOut.cpp", |
| 1251 | "tools/bookmaker/parserCommon.cpp", |
| 1252 | "tools/bookmaker/spellCheck.cpp", |
| 1253 | ] |
| 1254 | deps = [ |
| 1255 | ":flags", |
| 1256 | ":skia", |
| 1257 | ":tool_utils", |
| 1258 | ] |
| 1259 | } |
| 1260 | |
Mike Klein | 6e74412 | 2016-10-27 12:21:40 -0400 | [diff] [blame] | 1261 | import("gn/samples.gni") |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 1262 | test_lib("samples") { |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 1263 | public_include_dirs = [ "samplecode" ] |
Mike Klein | 6e74412 | 2016-10-27 12:21:40 -0400 | [diff] [blame] | 1264 | include_dirs = [ "experimental" ] |
| 1265 | sources = samples_sources + [ |
Mike Klein | 6e74412 | 2016-10-27 12:21:40 -0400 | [diff] [blame] | 1266 | "experimental/SkSetPoly3To3.cpp", |
| 1267 | "experimental/SkSetPoly3To3_A.cpp", |
| 1268 | "experimental/SkSetPoly3To3_D.cpp", |
Brian Osman | cff94e4 | 2017-06-26 13:12:37 -0400 | [diff] [blame] | 1269 | |
| 1270 | # Relocating these files here, so that clients don't try to build them while they're |
| 1271 | # still in active development. Clang's thread safety analysis gets tripped up by |
| 1272 | # conditional locks. |
| 1273 | "src/core/SkThreadedBMPDevice.cpp", |
| 1274 | "src/core/SkThreadedBMPDevice.h", |
Mike Klein | 6e74412 | 2016-10-27 12:21:40 -0400 | [diff] [blame] | 1275 | ] |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 1276 | deps = [ |
| 1277 | ":experimental_svg_model", |
csmartdalton | 8c67909 | 2017-03-27 12:32:29 -0600 | [diff] [blame] | 1278 | ":flags", |
Mike Klein | 6e74412 | 2016-10-27 12:21:40 -0400 | [diff] [blame] | 1279 | ":gm", |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 1280 | ":tool_utils", |
| 1281 | ":views", |
| 1282 | ":xml", |
| 1283 | ] |
Mike Klein | 38af943 | 2016-11-11 11:39:44 -0500 | [diff] [blame] | 1284 | |
| 1285 | if (skia_use_lua) { |
| 1286 | sources += [ "samplecode/SampleLua.cpp" ] |
| 1287 | deps += [ |
| 1288 | ":lua", |
| 1289 | "//third_party/lua", |
| 1290 | ] |
| 1291 | } |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 1292 | } |
| 1293 | |
Mike Klein | e6682eb | 2017-01-05 10:54:57 -0500 | [diff] [blame] | 1294 | test_app("dm") { |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 1295 | sources = [ |
| 1296 | "dm/DM.cpp", |
| 1297 | "dm/DMJsonWriter.cpp", |
| 1298 | "dm/DMSrcSink.cpp", |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 1299 | ] |
| 1300 | include_dirs = [ "tests" ] |
| 1301 | deps = [ |
mtklein | 046cb56 | 2016-09-16 10:23:12 -0700 | [diff] [blame] | 1302 | ":common_flags", |
fmalita | a2b9fdf | 2016-08-03 19:53:36 -0700 | [diff] [blame] | 1303 | ":experimental_svg_model", |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 1304 | ":flags", |
| 1305 | ":gm", |
| 1306 | ":gpu_tool_utils", |
| 1307 | ":skia", |
mtklein | 2f3416d | 2016-08-02 16:02:05 -0700 | [diff] [blame] | 1308 | ":tests", |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 1309 | ":tool_utils", |
| 1310 | "//third_party/jsoncpp", |
| 1311 | "//third_party/libpng", |
| 1312 | ] |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 1313 | } |
| 1314 | |
Mike Klein | 06432b2 | 2017-03-21 13:14:33 -0400 | [diff] [blame] | 1315 | test_app("ok") { |
| 1316 | sources = [ |
| 1317 | "tools/ok.cpp", |
Mike Klein | 7ac0483 | 2017-03-25 11:29:41 -0400 | [diff] [blame] | 1318 | "tools/ok_dsts.cpp", |
Mike Klein | 154e6da | 2017-07-26 15:13:47 -0400 | [diff] [blame] | 1319 | "tools/ok_engines.cpp", |
Mike Klein | 7ac0483 | 2017-03-25 11:29:41 -0400 | [diff] [blame] | 1320 | "tools/ok_srcs.cpp", |
Mike Klein | d63442d | 2017-03-27 14:16:04 -0400 | [diff] [blame] | 1321 | "tools/ok_test.cpp", |
Mike Klein | f5d1a55 | 2017-03-25 12:32:22 -0400 | [diff] [blame] | 1322 | "tools/ok_vias.cpp", |
Mike Klein | 06432b2 | 2017-03-21 13:14:33 -0400 | [diff] [blame] | 1323 | ] |
| 1324 | deps = [ |
Mike Klein | 4f6e271 | 2017-08-11 10:37:35 -0400 | [diff] [blame] | 1325 | ":bench", |
Mike Klein | 06432b2 | 2017-03-21 13:14:33 -0400 | [diff] [blame] | 1326 | ":gm", |
| 1327 | ":skia", |
Mike Klein | d63442d | 2017-03-27 14:16:04 -0400 | [diff] [blame] | 1328 | ":tests", |
Mike Klein | 62669ad | 2017-05-09 16:03:07 -0400 | [diff] [blame] | 1329 | ":tool_utils", |
Mike Klein | 06432b2 | 2017-03-21 13:14:33 -0400 | [diff] [blame] | 1330 | ] |
| 1331 | } |
| 1332 | |
Mike Klein | e6682eb | 2017-01-05 10:54:57 -0500 | [diff] [blame] | 1333 | test_app("nanobench") { |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 1334 | sources = [ |
| 1335 | "bench/nanobench.cpp", |
| 1336 | ] |
| 1337 | deps = [ |
| 1338 | ":bench", |
mtklein | 046cb56 | 2016-09-16 10:23:12 -0700 | [diff] [blame] | 1339 | ":common_flags", |
fmalita | 6519c21 | 2016-09-14 08:05:17 -0700 | [diff] [blame] | 1340 | ":experimental_svg_model", |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 1341 | ":flags", |
| 1342 | ":gm", |
| 1343 | ":gpu_tool_utils", |
| 1344 | ":skia", |
| 1345 | ":tool_utils", |
| 1346 | "//third_party/jsoncpp", |
| 1347 | ] |
mtklein | 2b6870c | 2016-07-28 14:17:33 -0700 | [diff] [blame] | 1348 | } |
halcanary | 19a9720 | 2016-08-03 15:08:04 -0700 | [diff] [blame] | 1349 | |
Ravi Mistry | 10d36c5 | 2017-01-31 09:49:18 -0500 | [diff] [blame] | 1350 | test_app("skpinfo") { |
| 1351 | sources = [ |
| 1352 | "tools/skpinfo.cpp", |
| 1353 | ] |
| 1354 | deps = [ |
| 1355 | ":flags", |
| 1356 | ":skia", |
| 1357 | ] |
| 1358 | } |
| 1359 | |
Jim Van Verth | 57a98fc | 2016-10-28 13:35:50 -0400 | [diff] [blame] | 1360 | if (is_linux || is_win || is_mac) { |
Mike Klein | e6682eb | 2017-01-05 10:54:57 -0500 | [diff] [blame] | 1361 | test_app("SampleApp") { |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 1362 | sources = [ |
Jim Van Verth | b6c5e53 | 2016-10-28 10:38:08 -0400 | [diff] [blame] | 1363 | "samplecode/SampleApp.cpp", |
| 1364 | "samplecode/SamplePictFile.cpp", |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 1365 | ] |
Jim Van Verth | b6c5e53 | 2016-10-28 10:38:08 -0400 | [diff] [blame] | 1366 | if (is_mac) { |
| 1367 | sources += [ "src/views/mac/skia_mac.mm" ] |
| 1368 | } else if (is_win) { |
| 1369 | sources += [ "src/views/win/skia_win.cpp" ] |
| 1370 | } else if (is_linux) { |
| 1371 | sources += [ "src/views/unix/skia_unix.cpp" ] |
| 1372 | } |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 1373 | deps = [ |
| 1374 | ":flags", |
Jim Van Verth | b6c5e53 | 2016-10-28 10:38:08 -0400 | [diff] [blame] | 1375 | ":gm", |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 1376 | ":gpu_tool_utils", |
Jim Van Verth | b6c5e53 | 2016-10-28 10:38:08 -0400 | [diff] [blame] | 1377 | ":samples", |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 1378 | ":skia", |
| 1379 | ":tool_utils", |
Jim Van Verth | b6c5e53 | 2016-10-28 10:38:08 -0400 | [diff] [blame] | 1380 | ":views", |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 1381 | ] |
Mike Klein | c168a3a | 2016-11-14 14:53:13 +0000 | [diff] [blame] | 1382 | if (skia_use_angle) { |
| 1383 | deps += [ "//third_party/angle2" ] |
| 1384 | } |
mtklein | 38925aa | 2016-09-21 10:11:25 -0700 | [diff] [blame] | 1385 | } |
Jim Van Verth | 8f5468f | 2016-10-31 09:52:33 -0400 | [diff] [blame] | 1386 | } |
Jim Van Verth | b6c5e53 | 2016-10-28 10:38:08 -0400 | [diff] [blame] | 1387 | |
Jim Van Verth | 8f5468f | 2016-10-31 09:52:33 -0400 | [diff] [blame] | 1388 | if (skia_enable_gpu) { |
Mike Klein | e6682eb | 2017-01-05 10:54:57 -0500 | [diff] [blame] | 1389 | test_app("skpbench") { |
Jim Van Verth | 8f5468f | 2016-10-31 09:52:33 -0400 | [diff] [blame] | 1390 | sources = [ |
| 1391 | "tools/skpbench/skpbench.cpp", |
| 1392 | ] |
| 1393 | deps = [ |
| 1394 | ":flags", |
| 1395 | ":gpu_tool_utils", |
| 1396 | ":skia", |
| 1397 | ":tool_utils", |
| 1398 | ] |
Jim Van Verth | b6c5e53 | 2016-10-28 10:38:08 -0400 | [diff] [blame] | 1399 | } |
csmartdalton | 4b5179b | 2016-09-19 11:03:58 -0700 | [diff] [blame] | 1400 | } |
| 1401 | |
Mike Klein | 7d30288 | 2016-11-03 14:06:31 -0400 | [diff] [blame] | 1402 | # We can't yet build ICU on iOS or Windows. |
| 1403 | if (!is_ios && !is_win) { |
Mike Klein | e6682eb | 2017-01-05 10:54:57 -0500 | [diff] [blame] | 1404 | test_app("sktexttopdf-hb") { |
mtklein | 6f5df6a | 2016-08-29 16:01:10 -0700 | [diff] [blame] | 1405 | sources = [ |
Ben Wagner | a25fbef | 2017-08-30 13:56:19 -0400 | [diff] [blame] | 1406 | "tools/shape/SkShaper_harfbuzz.cpp", |
| 1407 | "tools/shape/using_skia_and_harfbuzz.cpp", |
mtklein | 6f5df6a | 2016-08-29 16:01:10 -0700 | [diff] [blame] | 1408 | ] |
| 1409 | deps = [ |
| 1410 | ":skia", |
| 1411 | "//third_party/harfbuzz", |
Ben Wagner | a25fbef | 2017-08-30 13:56:19 -0400 | [diff] [blame] | 1412 | "//third_party/icu", |
mtklein | 6f5df6a | 2016-08-29 16:01:10 -0700 | [diff] [blame] | 1413 | ] |
mtklein | 6f5df6a | 2016-08-29 16:01:10 -0700 | [diff] [blame] | 1414 | } |
halcanary | 19a9720 | 2016-08-03 15:08:04 -0700 | [diff] [blame] | 1415 | } |
Mike Klein | e6682eb | 2017-01-05 10:54:57 -0500 | [diff] [blame] | 1416 | test_app("sktexttopdf") { |
halcanary | 3eee9d9 | 2016-09-10 07:01:53 -0700 | [diff] [blame] | 1417 | sources = [ |
Ben Wagner | a25fbef | 2017-08-30 13:56:19 -0400 | [diff] [blame] | 1418 | "tools/shape/SkShaper_primitive.cpp", |
| 1419 | "tools/shape/using_skia_and_harfbuzz.cpp", |
halcanary | 3eee9d9 | 2016-09-10 07:01:53 -0700 | [diff] [blame] | 1420 | ] |
| 1421 | deps = [ |
| 1422 | ":skia", |
| 1423 | ] |
halcanary | 3eee9d9 | 2016-09-10 07:01:53 -0700 | [diff] [blame] | 1424 | } |
mtklein | 046cb56 | 2016-09-16 10:23:12 -0700 | [diff] [blame] | 1425 | |
Matt Sarett | 9f1c403 | 2017-05-17 10:06:32 -0400 | [diff] [blame] | 1426 | test_app("create_flutter_test_images") { |
| 1427 | sources = [ |
| 1428 | "tools/create_flutter_test_images.cpp", |
| 1429 | ] |
| 1430 | deps = [ |
| 1431 | ":skia", |
| 1432 | ":tool_utils", |
| 1433 | ] |
| 1434 | } |
| 1435 | |
Ben Wagner | 219f362 | 2017-07-17 15:32:25 -0400 | [diff] [blame] | 1436 | test_app("create_test_font") { |
| 1437 | sources = [ |
| 1438 | "tools/create_test_font.cpp", |
| 1439 | ] |
| 1440 | deps = [ |
| 1441 | ":skia", |
| 1442 | ] |
| 1443 | assert_no_deps = [ |
| 1444 | # tool_utils requires the output of this app. |
| 1445 | ":tool_utils", |
| 1446 | ] |
| 1447 | } |
| 1448 | |
Mike Klein | e6682eb | 2017-01-05 10:54:57 -0500 | [diff] [blame] | 1449 | test_app("get_images_from_skps") { |
mtklein | 046cb56 | 2016-09-16 10:23:12 -0700 | [diff] [blame] | 1450 | sources = [ |
| 1451 | "tools/get_images_from_skps.cpp", |
| 1452 | ] |
| 1453 | deps = [ |
| 1454 | ":flags", |
| 1455 | ":skia", |
| 1456 | "//third_party/jsoncpp", |
| 1457 | ] |
mtklein | 046cb56 | 2016-09-16 10:23:12 -0700 | [diff] [blame] | 1458 | } |
mtklein | ecbc526 | 2016-09-22 11:51:24 -0700 | [diff] [blame] | 1459 | |
Mike Klein | e6682eb | 2017-01-05 10:54:57 -0500 | [diff] [blame] | 1460 | test_app("colorspaceinfo") { |
Matt Sarett | 8740d58 | 2016-11-11 13:59:14 -0500 | [diff] [blame] | 1461 | sources = [ |
| 1462 | "tools/colorspaceinfo.cpp", |
| 1463 | ] |
| 1464 | deps = [ |
| 1465 | ":flags", |
| 1466 | ":skia", |
| 1467 | ":tool_utils", |
| 1468 | ] |
Matt Sarett | 8740d58 | 2016-11-11 13:59:14 -0500 | [diff] [blame] | 1469 | } |
| 1470 | |
Mike Klein | 7d30288 | 2016-11-03 14:06:31 -0400 | [diff] [blame] | 1471 | if (!is_ios) { |
Mike Klein | e6682eb | 2017-01-05 10:54:57 -0500 | [diff] [blame] | 1472 | test_app("skiaserve") { |
Mike Klein | 7d30288 | 2016-11-03 14:06:31 -0400 | [diff] [blame] | 1473 | sources = [ |
| 1474 | "tools/skiaserve/Request.cpp", |
| 1475 | "tools/skiaserve/Response.cpp", |
| 1476 | "tools/skiaserve/skiaserve.cpp", |
Mike Klein | 7d30288 | 2016-11-03 14:06:31 -0400 | [diff] [blame] | 1477 | "tools/skiaserve/urlhandlers/BreakHandler.cpp", |
| 1478 | "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp", |
| 1479 | "tools/skiaserve/urlhandlers/CmdHandler.cpp", |
| 1480 | "tools/skiaserve/urlhandlers/ColorModeHandler.cpp", |
| 1481 | "tools/skiaserve/urlhandlers/DataHandler.cpp", |
| 1482 | "tools/skiaserve/urlhandlers/DownloadHandler.cpp", |
| 1483 | "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp", |
| 1484 | "tools/skiaserve/urlhandlers/ImgHandler.cpp", |
| 1485 | "tools/skiaserve/urlhandlers/InfoHandler.cpp", |
Brian Salomon | 144a5c5 | 2016-12-20 16:48:59 -0500 | [diff] [blame] | 1486 | "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp", |
| 1487 | "tools/skiaserve/urlhandlers/OpsHandler.cpp", |
Mike Klein | 7d30288 | 2016-11-03 14:06:31 -0400 | [diff] [blame] | 1488 | "tools/skiaserve/urlhandlers/OverdrawHandler.cpp", |
| 1489 | "tools/skiaserve/urlhandlers/PostHandler.cpp", |
| 1490 | "tools/skiaserve/urlhandlers/QuitHandler.cpp", |
| 1491 | "tools/skiaserve/urlhandlers/RootHandler.cpp", |
| 1492 | ] |
| 1493 | deps = [ |
| 1494 | ":flags", |
| 1495 | ":gpu_tool_utils", |
| 1496 | ":skia", |
| 1497 | ":tool_utils", |
| 1498 | "//third_party/jsoncpp", |
| 1499 | "//third_party/libmicrohttpd", |
| 1500 | "//third_party/libpng", |
| 1501 | ] |
Mike Klein | 7d30288 | 2016-11-03 14:06:31 -0400 | [diff] [blame] | 1502 | } |
mtklein | ecbc526 | 2016-09-22 11:51:24 -0700 | [diff] [blame] | 1503 | } |
kjlubick | 14f984b | 2016-10-03 11:49:45 -0700 | [diff] [blame] | 1504 | |
Mike Klein | e6682eb | 2017-01-05 10:54:57 -0500 | [diff] [blame] | 1505 | test_app("fuzz") { |
kjlubick | 14f984b | 2016-10-03 11:49:45 -0700 | [diff] [blame] | 1506 | sources = [ |
| 1507 | "fuzz/FilterFuzz.cpp", |
Hal Canary | 24ac42b | 2017-02-14 13:35:14 -0500 | [diff] [blame] | 1508 | "fuzz/FuzzCanvas.cpp", |
Kevin Lubick | fec1dea | 2016-11-22 13:57:18 -0500 | [diff] [blame] | 1509 | "fuzz/FuzzDrawFunctions.cpp", |
kjlubick | 14f984b | 2016-10-03 11:49:45 -0700 | [diff] [blame] | 1510 | "fuzz/FuzzGradients.cpp", |
| 1511 | "fuzz/FuzzParsePath.cpp", |
| 1512 | "fuzz/FuzzPathop.cpp", |
| 1513 | "fuzz/FuzzScaleToSides.cpp", |
| 1514 | "fuzz/fuzz.cpp", |
| 1515 | ] |
| 1516 | deps = [ |
| 1517 | ":flags", |
Hal Canary | 44801ca | 2017-03-15 11:39:06 -0400 | [diff] [blame] | 1518 | ":gpu_tool_utils", |
kjlubick | 14f984b | 2016-10-03 11:49:45 -0700 | [diff] [blame] | 1519 | ":skia", |
Hal Canary | db68301 | 2016-11-23 08:55:18 -0700 | [diff] [blame] | 1520 | ":tool_utils", |
kjlubick | 14f984b | 2016-10-03 11:49:45 -0700 | [diff] [blame] | 1521 | ] |
kjlubick | 14f984b | 2016-10-03 11:49:45 -0700 | [diff] [blame] | 1522 | } |
Mike Klein | 3831242 | 2016-10-05 15:41:01 -0400 | [diff] [blame] | 1523 | |
Mike Klein | e6682eb | 2017-01-05 10:54:57 -0500 | [diff] [blame] | 1524 | test_app("pathops_unittest") { |
Mike Klein | 6e74412 | 2016-10-27 12:21:40 -0400 | [diff] [blame] | 1525 | sources = pathops_tests_sources + [ |
Mike Klein | 6e55fef | 2016-10-26 11:41:47 -0400 | [diff] [blame] | 1526 | rebase_path("tests/skia_test.cpp"), |
| 1527 | rebase_path("tests/Test.cpp"), |
| 1528 | ] |
caryclark | 9feb632 | 2016-10-25 08:58:26 -0700 | [diff] [blame] | 1529 | deps = [ |
| 1530 | ":flags", |
| 1531 | ":gpu_tool_utils", |
| 1532 | ":skia", |
| 1533 | ":tool_utils", |
| 1534 | ] |
caryclark | 9feb632 | 2016-10-25 08:58:26 -0700 | [diff] [blame] | 1535 | } |
| 1536 | |
Mike Klein | e6682eb | 2017-01-05 10:54:57 -0500 | [diff] [blame] | 1537 | test_app("dump_record") { |
Mike Klein | 3831242 | 2016-10-05 15:41:01 -0400 | [diff] [blame] | 1538 | sources = [ |
| 1539 | "tools/DumpRecord.cpp", |
| 1540 | "tools/dump_record.cpp", |
| 1541 | ] |
| 1542 | deps = [ |
| 1543 | ":flags", |
| 1544 | ":skia", |
| 1545 | ] |
Mike Klein | 3831242 | 2016-10-05 15:41:01 -0400 | [diff] [blame] | 1546 | } |
bungeman | fe91727 | 2016-10-13 17:36:40 -0400 | [diff] [blame] | 1547 | |
Mike Klein | e6682eb | 2017-01-05 10:54:57 -0500 | [diff] [blame] | 1548 | test_app("skdiff") { |
bungeman | fe91727 | 2016-10-13 17:36:40 -0400 | [diff] [blame] | 1549 | sources = [ |
| 1550 | "tools/skdiff/skdiff.cpp", |
| 1551 | "tools/skdiff/skdiff_html.cpp", |
| 1552 | "tools/skdiff/skdiff_main.cpp", |
| 1553 | "tools/skdiff/skdiff_utils.cpp", |
| 1554 | ] |
| 1555 | deps = [ |
| 1556 | ":skia", |
| 1557 | ":tool_utils", |
| 1558 | ] |
bungeman | fe91727 | 2016-10-13 17:36:40 -0400 | [diff] [blame] | 1559 | } |
halcanary | a73d76a | 2016-10-17 13:19:02 -0700 | [diff] [blame] | 1560 | |
Mike Klein | e6682eb | 2017-01-05 10:54:57 -0500 | [diff] [blame] | 1561 | test_app("skp_parser") { |
halcanary | a73d76a | 2016-10-17 13:19:02 -0700 | [diff] [blame] | 1562 | sources = [ |
| 1563 | "tools/skp_parser.cpp", |
| 1564 | ] |
| 1565 | deps = [ |
| 1566 | ":skia", |
| 1567 | ":tool_utils", |
| 1568 | "//third_party/jsoncpp", |
| 1569 | ] |
halcanary | a73d76a | 2016-10-17 13:19:02 -0700 | [diff] [blame] | 1570 | } |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 1571 | |
Jim Van Verth | dbb24ef | 2017-09-01 11:01:51 -0400 | [diff] [blame] | 1572 | if (skia_enable_gpu) { |
Mike Klein | e6682eb | 2017-01-05 10:54:57 -0500 | [diff] [blame] | 1573 | test_app("viewer") { |
| 1574 | is_shared_library = is_android |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 1575 | sources = [ |
| 1576 | "tools/viewer/GMSlide.cpp", |
| 1577 | "tools/viewer/ImageSlide.cpp", |
| 1578 | "tools/viewer/SKPSlide.cpp", |
| 1579 | "tools/viewer/SampleSlide.cpp", |
| 1580 | "tools/viewer/Viewer.cpp", |
| 1581 | "tools/viewer/sk_app/CommandSet.cpp", |
| 1582 | "tools/viewer/sk_app/GLWindowContext.cpp", |
| 1583 | "tools/viewer/sk_app/Window.cpp", |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 1584 | ] |
Brian Osman | 2dd9693 | 2016-10-18 15:33:53 -0400 | [diff] [blame] | 1585 | libs = [] |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 1586 | |
Jim Van Verth | 4e56a91 | 2016-10-21 10:58:52 -0400 | [diff] [blame] | 1587 | if (is_android) { |
| 1588 | sources += [ |
| 1589 | "tools/viewer/sk_app/android/GLWindowContext_android.cpp", |
| 1590 | "tools/viewer/sk_app/android/RasterWindowContext_android.cpp", |
| 1591 | "tools/viewer/sk_app/android/Window_android.cpp", |
| 1592 | "tools/viewer/sk_app/android/main_android.cpp", |
| 1593 | "tools/viewer/sk_app/android/surface_glue_android.cpp", |
| 1594 | ] |
Brian Osman | 462334e | 2017-02-09 11:22:57 -0500 | [diff] [blame] | 1595 | libs += [ "android" ] |
Jim Van Verth | 4e56a91 | 2016-10-21 10:58:52 -0400 | [diff] [blame] | 1596 | } else if (is_linux) { |
Brian Osman | 2dd9693 | 2016-10-18 15:33:53 -0400 | [diff] [blame] | 1597 | sources += [ |
| 1598 | "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp", |
| 1599 | "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp", |
| 1600 | "tools/viewer/sk_app/unix/Window_unix.cpp", |
| 1601 | "tools/viewer/sk_app/unix/main_unix.cpp", |
| 1602 | ] |
| 1603 | } else if (is_win) { |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 1604 | sources += [ |
| 1605 | "tools/viewer/sk_app/win/GLWindowContext_win.cpp", |
| 1606 | "tools/viewer/sk_app/win/RasterWindowContext_win.cpp", |
| 1607 | "tools/viewer/sk_app/win/Window_win.cpp", |
| 1608 | "tools/viewer/sk_app/win/main_win.cpp", |
| 1609 | ] |
Brian Salomon | 194db17 | 2017-08-17 14:37:06 -0400 | [diff] [blame] | 1610 | if (skia_use_angle) { |
| 1611 | sources += [ "tools/viewer/sk_app/win/ANGLEWindowContext_win.cpp" ] |
| 1612 | } |
Mike Klein | 43c2526 | 2016-10-20 10:17:47 -0400 | [diff] [blame] | 1613 | } else if (is_mac) { |
| 1614 | sources += [ |
| 1615 | "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp", |
| 1616 | "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp", |
| 1617 | "tools/viewer/sk_app/mac/Window_mac.cpp", |
| 1618 | "tools/viewer/sk_app/mac/main_mac.cpp", |
| 1619 | ] |
Jim Van Verth | dbb24ef | 2017-09-01 11:01:51 -0400 | [diff] [blame] | 1620 | } else if (is_ios) { |
| 1621 | sources += [ |
| 1622 | "tools/viewer/sk_app/ios/GLWindowContext_ios.cpp", |
| 1623 | "tools/viewer/sk_app/ios/RasterWindowContext_ios.cpp", |
| 1624 | "tools/viewer/sk_app/ios/Window_ios.cpp", |
| 1625 | "tools/viewer/sk_app/ios/main_ios.cpp", |
| 1626 | ] |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 1627 | } |
| 1628 | |
| 1629 | if (skia_use_vulkan) { |
| 1630 | sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ] |
Jim Van Verth | 4e56a91 | 2016-10-21 10:58:52 -0400 | [diff] [blame] | 1631 | if (is_android) { |
| 1632 | sources += |
| 1633 | [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ] |
Jim Van Verth | 4e56a91 | 2016-10-21 10:58:52 -0400 | [diff] [blame] | 1634 | } else if (is_linux) { |
Brian Osman | 2dd9693 | 2016-10-18 15:33:53 -0400 | [diff] [blame] | 1635 | sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ] |
| 1636 | libs += [ "X11-xcb" ] |
| 1637 | } else if (is_win) { |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 1638 | sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ] |
| 1639 | } |
| 1640 | } |
| 1641 | |
| 1642 | include_dirs = [] |
| 1643 | deps = [ |
| 1644 | ":flags", |
| 1645 | ":gm", |
| 1646 | ":gpu_tool_utils", |
| 1647 | ":samples", |
| 1648 | ":skia", |
| 1649 | ":tool_utils", |
| 1650 | ":views", |
Brian Osman | 79086b9 | 2017-02-10 13:36:16 -0500 | [diff] [blame] | 1651 | "//third_party/imgui", |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 1652 | "//third_party/jsoncpp", |
| 1653 | ] |
Jim Van Verth | 4e56a91 | 2016-10-21 10:58:52 -0400 | [diff] [blame] | 1654 | if (is_android) { |
| 1655 | deps += [ "//third_party/native_app_glue" ] |
Jim Van Verth | dbb24ef | 2017-09-01 11:01:51 -0400 | [diff] [blame] | 1656 | } else if (is_mac || is_ios) { |
Mike Klein | 43c2526 | 2016-10-20 10:17:47 -0400 | [diff] [blame] | 1657 | deps += [ "//third_party/libsdl" ] |
| 1658 | } |
Brian Salomon | 194db17 | 2017-08-17 14:37:06 -0400 | [diff] [blame] | 1659 | if (skia_use_angle) { |
| 1660 | deps += [ "//third_party/angle2" ] |
| 1661 | } |
Mike Klein | a92c383 | 2016-12-08 09:49:39 -0500 | [diff] [blame] | 1662 | } |
Brian Osman | 16adfa3 | 2016-10-18 14:42:44 -0400 | [diff] [blame] | 1663 | } |
Ethan Nicholas | 4f3985c | 2016-11-14 11:16:37 -0500 | [diff] [blame] | 1664 | |
Jim Van Verth | ecfed2b | 2017-08-30 14:02:50 -0400 | [diff] [blame] | 1665 | if (skia_enable_gpu && (is_linux || is_mac || is_ios)) { |
Jim Van Verth | 4c70c75 | 2017-07-11 12:03:01 -0400 | [diff] [blame] | 1666 | test_app("SkiaSDLExample") { |
| 1667 | sources = [ |
| 1668 | "example/SkiaSDLExample.cpp", |
| 1669 | ] |
| 1670 | libs = [] |
| 1671 | include_dirs = [] |
| 1672 | deps = [ |
| 1673 | ":gpu_tool_utils", |
| 1674 | ":skia", |
| 1675 | "//third_party/libsdl", |
| 1676 | ] |
| 1677 | } |
| 1678 | } |
| 1679 | |
Robert Phillips | a6d2d70 | 2017-09-01 12:17:03 -0400 | [diff] [blame] | 1680 | if (skia_qt_path != "" && (is_win || is_linux || is_mac)) { |
| 1681 | action_foreach("generate_mocs") { |
| 1682 | script = "gn/call.py" |
| 1683 | sources = [ |
| 1684 | "tools/mdbviz/MainWindow.h", |
| 1685 | ] |
| 1686 | outputs = [ |
| 1687 | "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp", |
| 1688 | ] |
| 1689 | args = [ |
| 1690 | "$skia_qt_path" + "/bin/moc", |
| 1691 | "{{source}}", |
| 1692 | "-o", |
| 1693 | "gen/mdbviz/{{source_name_part}}_moc.cpp", |
| 1694 | ] |
| 1695 | } |
| 1696 | action_foreach("generate_resources") { |
| 1697 | script = "gn/call.py" |
| 1698 | sources = [ |
| 1699 | "tools/mdbviz/resources.qrc", |
| 1700 | ] |
| 1701 | outputs = [ |
| 1702 | "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp", |
| 1703 | ] |
| 1704 | args = [ |
| 1705 | "$skia_qt_path" + "/bin/rcc", |
| 1706 | "{{source}}", |
| 1707 | "-o", |
| 1708 | "gen/mdbviz/{{source_name_part}}_res.cpp", |
| 1709 | ] |
| 1710 | } |
| 1711 | test_app("mdbviz") { |
| 1712 | if (is_win) { |
| 1713 | # on Windows we need to disable some exception handling warnings due to the Qt headers |
| 1714 | cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017 |
| 1715 | } |
| 1716 | sources = [ |
Robert Phillips | 5fccf9d | 2017-09-05 15:10:12 -0400 | [diff] [blame] | 1717 | "tools/UrlDataManager.cpp", |
| 1718 | "tools/debugger/SkDebugCanvas.cpp", |
| 1719 | "tools/debugger/SkDrawCommand.cpp", |
| 1720 | "tools/debugger/SkJsonWriteBuffer.cpp", |
| 1721 | "tools/debugger/SkObjectParser.cpp", |
Robert Phillips | a6d2d70 | 2017-09-01 12:17:03 -0400 | [diff] [blame] | 1722 | "tools/mdbviz/MainWindow.cpp", |
Robert Phillips | deaf568 | 2017-09-06 13:07:21 -0400 | [diff] [blame] | 1723 | "tools/mdbviz/Model.cpp", |
Robert Phillips | a6d2d70 | 2017-09-01 12:17:03 -0400 | [diff] [blame] | 1724 | "tools/mdbviz/main.cpp", |
Robert Phillips | 5fccf9d | 2017-09-05 15:10:12 -0400 | [diff] [blame] | 1725 | "tools/picture_utils.cpp", |
Robert Phillips | a6d2d70 | 2017-09-01 12:17:03 -0400 | [diff] [blame] | 1726 | |
| 1727 | # generated files |
| 1728 | "$target_gen_dir/mdbviz/MainWindow_moc.cpp", |
| 1729 | "$target_gen_dir/mdbviz/resources_res.cpp", |
| 1730 | ] |
| 1731 | lib_dirs = [ "$skia_qt_path/lib" ] |
| 1732 | libs = [ |
| 1733 | "Qt5Core.lib", |
| 1734 | "Qt5Gui.lib", |
| 1735 | "Qt5Widgets.lib", |
| 1736 | ] |
| 1737 | include_dirs = [ |
| 1738 | "$skia_qt_path/include", |
Robert Phillips | 276066b | 2017-09-06 17:17:44 -0400 | [diff] [blame] | 1739 | "$skia_qt_path/include/QtCore", |
Robert Phillips | a6d2d70 | 2017-09-01 12:17:03 -0400 | [diff] [blame] | 1740 | "$skia_qt_path/include/QtWidgets", |
Robert Phillips | 5fccf9d | 2017-09-05 15:10:12 -0400 | [diff] [blame] | 1741 | "tools", |
| 1742 | "tools/debugger", |
Robert Phillips | a6d2d70 | 2017-09-01 12:17:03 -0400 | [diff] [blame] | 1743 | ] |
| 1744 | deps = [ |
| 1745 | ":generate_mocs", |
| 1746 | ":generate_resources", |
| 1747 | ":skia", |
Robert Phillips | 5fccf9d | 2017-09-05 15:10:12 -0400 | [diff] [blame] | 1748 | "//third_party/jsoncpp", |
| 1749 | "//third_party/libpng", |
Robert Phillips | a6d2d70 | 2017-09-01 12:17:03 -0400 | [diff] [blame] | 1750 | ] |
| 1751 | } |
| 1752 | } |
| 1753 | |
Mike Klein | e459afd | 2017-03-03 09:21:30 -0500 | [diff] [blame] | 1754 | if (is_android && defined(ndk) && ndk != "") { |
Derek Sollenberger | 70120c7 | 2017-01-05 11:39:04 -0500 | [diff] [blame] | 1755 | copy("gdbserver") { |
| 1756 | sources = [ |
| 1757 | "$ndk/$ndk_gdbserver", |
| 1758 | ] |
| 1759 | outputs = [ |
| 1760 | "$root_out_dir/gdbserver", |
| 1761 | ] |
| 1762 | } |
Derek Sollenberger | 70120c7 | 2017-01-05 11:39:04 -0500 | [diff] [blame] | 1763 | } |
mtklein | 25c81d4 | 2016-07-27 13:55:26 -0700 | [diff] [blame] | 1764 | } |
Mike Klein | c55a6cb | 2017-06-28 13:21:47 -0400 | [diff] [blame] | 1765 | |
| 1766 | if (skia_jumper_clang != "") { |
| 1767 | action("regen_jumper") { |
| 1768 | script = "src/jumper/build_stages.py" |
| 1769 | |
| 1770 | inputs = [ |
| 1771 | "src/jumper/SkJumper_stages.cpp", |
Mike Klein | 255607f | 2017-08-02 14:25:55 -0400 | [diff] [blame] | 1772 | "src/jumper/SkJumper_stages_8bit.cpp", |
Mike Klein | c55a6cb | 2017-06-28 13:21:47 -0400 | [diff] [blame] | 1773 | ] |
| 1774 | |
| 1775 | # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it. |
| 1776 | outputs = [ |
| 1777 | "$target_out_dir/" + |
| 1778 | rebase_path("src/jumper/SkJumper_generated.S", target_out_dir), |
| 1779 | "$target_out_dir/" + |
| 1780 | rebase_path("src/jumper/SkJumper_generated_win.S", target_out_dir), |
| 1781 | ] |
| 1782 | |
| 1783 | args = [ |
| 1784 | skia_jumper_clang, |
| 1785 | skia_jumper_objdump, |
| 1786 | skia_jumper_ccache, |
| 1787 | ] + rebase_path(inputs) + rebase_path(outputs) |
| 1788 | } |
| 1789 | } |