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