blob: d59cea6dda0445fc789c4d7dec161a8bcf281291 [file] [log] [blame]
mtkleinc04ff472016-06-23 10:29:30 -07001# 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 Osmanf2c90142017-07-13 15:50:03 -04006import("gn/flutter_defines.gni")
mikejurka8c24f4f2016-09-12 16:51:58 -07007import("gn/shared_sources.gni")
brettwb9447282016-09-01 14:24:39 -07008
Forrest Reiling30229ac2017-04-17 13:36:39 -07009if (is_fuchsia) {
10 import("//build/vulkan/config.gni")
11}
12
Mike Klein3669a822017-03-03 10:55:02 -050013if (!defined(is_skia_standalone)) {
14 is_skia_standalone = false
15}
16is_skia_dev_build = is_skia_standalone && !is_official_build
17
mtkleinc04ff472016-06-23 10:29:30 -070018declare_args() {
Mike Kleinc168a3a2016-11-14 14:53:13 +000019 skia_use_angle = false
Kevin Lubick4a24e102017-03-29 11:19:01 -040020 skia_use_egl = false
mtklein63213812016-08-24 09:55:56 -070021 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070022 skia_use_fontconfig = is_linux
mtkleincdedd0e2016-09-12 15:15:44 -070023 skia_use_freetype = is_android || is_fuchsia || is_linux
Mike Klein7d302882016-11-03 14:06:31 -040024 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
mtklein63213812016-08-24 09:55:56 -070025 skia_use_libjpeg_turbo = true
26 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070027 skia_use_libwebp = !is_fuchsia
Mike Kleinfae86b72018-01-08 15:49:09 -050028 skia_use_lua = is_skia_dev_build && !is_ios
Mike Klein10d665d2016-11-01 11:46:10 -040029 skia_use_piex = !is_win
mtklein63213812016-08-24 09:55:56 -070030 skia_use_zlib = true
Greg Daniele5ddff52017-07-05 16:49:36 -040031 skia_use_metal = false
Mike Klein36f182f2017-10-20 12:33:53 -040032 skia_use_libheif = is_skia_dev_build
Brian Osman670a2902018-04-23 13:31:56 -040033 skia_use_skcms = true
mtklein1bd72ba2016-09-16 07:45:52 -070034
Mike Klein7d921032017-01-05 12:20:41 -050035 skia_android_serial = ""
Brian Osman3f375d02016-12-28 11:19:22 -050036 skia_enable_discrete_gpu = true
Mike Kleina04bb452017-02-09 12:24:07 -050037 skia_enable_effects = true
Brian Osmanf2c90142017-07-13 15:50:03 -040038 skia_enable_flutter_defines = false
Hal Canaryff2742e2018-01-30 11:35:47 -050039 skia_enable_fontmgr_empty = false
Brian Osman74511012018-04-02 20:13:46 +000040 skia_enable_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050041 skia_enable_pdf = true
Florin Malita87ccf332018-05-04 12:23:24 -040042 skia_enable_skottie = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040043 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Mike Klein3669a822017-03-03 10:55:02 -050044 skia_enable_tools = is_skia_dev_build
45 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Greg Danielafb7ec72017-12-07 12:48:30 -050046 skia_vulkan_header = ""
Greg Daniel686bb212016-10-27 10:48:48 -040047 skia_vulkan_sdk = getenv("VULKAN_SDK")
Chris Dalton3a67b8e2018-05-03 09:30:29 -060048 skia_moltenvk_path = ""
Robert Phillipsa6d2d702017-09-01 12:17:03 -040049 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040050 skia_compile_processors = false
Adrienne Walker1df7cd82018-04-18 13:46:25 -070051 skia_generate_workarounds = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070052 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040053
Hal Canary4689b542018-01-31 11:54:14 -050054 skia_skqp_enable_driver_correctness_workarounds = false
Hal Canary2331c822018-02-01 14:06:13 -050055 skia_skqp_global_error_tolerance = 0
Ethan Nicholas26a9aad2018-03-27 14:10:52 -040056
57 skia_llvm_path = ""
58 skia_llvm_lib = "LLVM"
Hal Canaryfd9bcab2018-04-24 11:47:23 -040059
60 skia_tools_require_resources = false
mtkleinc04ff472016-06-23 10:29:30 -070061}
Brian Salomon23d73ea2016-10-27 13:31:37 -040062declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040063 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040064 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050065 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Mike Klein10d665d2016-11-01 11:46:10 -040066
Brian Salomon5f33a8c2018-02-26 14:32:39 -050067 skia_use_legacy_gpu_pixel_ops = is_skia_dev_build && is_win # Arbitrary to keep old code path tested until deletion.
68
Mike Klein4d598a32016-10-31 13:44:49 -040069 if (is_android) {
70 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070071 } else if (is_fuchsia) {
72 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040073 } else {
Chris Dalton3a67b8e2018-05-03 09:30:29 -060074 skia_use_vulkan = skia_vulkan_sdk != "" || skia_moltenvk_path != ""
Mike Klein4d598a32016-10-31 13:44:49 -040075 }
Jim Van Verth4e502972017-12-07 15:16:10 -050076
77 if (is_ios) {
78 skia_ios_identity = ".*Google.*"
79 skia_ios_profile = "Google Development"
80 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040081}
Greg Danielec6ae522017-04-25 13:38:26 -040082declare_args() {
Greg Danielafb7ec72017-12-07 12:48:30 -050083 skia_tools_vulkan_header_dir = ""
Greg Danielec6ae522017-04-25 13:38:26 -040084 if (skia_use_vulkan) {
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +000085 # When buliding on Android we get the header via the NDK so no need for any extra path.
Greg Danielec6ae522017-04-25 13:38:26 -040086 if (is_fuchsia) {
Greg Danielafb7ec72017-12-07 12:48:30 -050087 skia_tools_vulkan_header_dir = "$fuchsia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040088 } else if (is_linux || is_win) {
Greg Danielafb7ec72017-12-07 12:48:30 -050089 skia_tools_vulkan_header_dir = "$skia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040090 }
Greg Danielec6ae522017-04-25 13:38:26 -040091 }
92}
Brian Salomon789e25e2016-09-30 13:41:03 -040093
Adam Barth54ef74a2017-10-13 10:59:38 -070094if (defined(skia_settings)) {
95 import(skia_settings)
96}
97
mtklein38925aa2016-09-21 10:11:25 -070098# Our tools require static linking (they use non-exported symbols).
99skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -0700100
mtkleina45be612016-08-29 15:22:10 -0700101fontmgr_android_enabled = skia_use_expat && skia_use_freetype
102
mtklein1211e0c2016-07-26 13:55:45 -0700103skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -0700104 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -0700105 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -0700106 "include/codec",
107 "include/config",
108 "include/core",
109 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -0400110 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -0700111 "include/gpu",
112 "include/gpu/gl",
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500113 "include/atlastext",
mtklein1211e0c2016-07-26 13:55:45 -0700114 "include/pathops",
115 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -0700116 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -0700117 "include/utils",
118 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -0700119]
120
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000121if (skia_use_vulkan) {
122 skia_public_includes += [ "include/gpu/vk" ]
123}
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500124if (skia_enable_atlas_text) {
125 skia_public_includes += [ "include/atlastext" ]
126}
Greg Daniele5ddff52017-07-05 16:49:36 -0400127if (skia_use_metal) {
128 skia_public_includes += [ "include/gpu/mtl" ]
129}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000130
mtkleinc04ff472016-06-23 10:29:30 -0700131# Skia public API, generally provided by :skia.
132config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700133 include_dirs = skia_public_includes
Greg Danielafb7ec72017-12-07 12:48:30 -0500134 if (skia_tools_vulkan_header_dir != "") {
135 include_dirs += [ skia_tools_vulkan_header_dir ]
Greg Danielec6ae522017-04-25 13:38:26 -0400136 }
Mike Kleinae7e6712016-10-11 17:49:33 -0400137 defines = []
138 if (is_component_build) {
139 defines += [ "SKIA_DLL" ]
140 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400141 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700142 defines += [ "SK_SAMPLES_FOR_X" ]
143 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400144 if (skia_enable_flutter_defines) {
145 defines += flutter_defines
146 }
mtklein06c35c02016-09-20 12:28:12 -0700147 if (!skia_enable_gpu) {
148 defines += [ "SK_SUPPORT_GPU=0" ]
149 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500150 if (skia_enable_atlas_text) {
151 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
152 }
mtkleinc04ff472016-06-23 10:29:30 -0700153}
154
155# Skia internal APIs, used by Skia itself and a few test tools.
156config("skia_private") {
157 visibility = [ ":*" ]
158
159 include_dirs = [
160 "include/private",
161 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700162 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700163 "src/core",
164 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700165 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700166 "src/image",
167 "src/images",
168 "src/lazy",
169 "src/opts",
170 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700171 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700172 "src/ports",
173 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400174 "src/shaders",
175 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700176 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700177 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700178 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500179 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700180 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700181 ]
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400182 if (skia_llvm_path != "") {
183 include_dirs += [ "$skia_llvm_path/include" ]
184 }
mtklein150d1132016-08-01 06:56:40 -0700185
Mike Reeda9e241d2017-05-03 10:52:00 -0400186 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700187 if (is_android) {
188 defines += [
189 "SK_GAMMA_EXPONENT=1.4",
190 "SK_GAMMA_CONTRAST=0.0",
191 ]
192 }
mtklein88a7ac02016-09-14 11:16:49 -0700193 if (is_official_build || is_android) {
194 # TODO(bsalomon): it'd be nice to make Android normal.
195 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
196 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400197 libs = []
198 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500199 if (skia_enable_gpu) {
200 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500201 if (is_skia_dev_build && skia_use_vulkan) {
202 include_dirs += [ "tools/gpu/vk" ]
203 }
Brian Salomon03e05842017-02-23 12:23:47 -0500204 }
Brian Osman34755e22016-12-05 09:46:02 -0500205 if (skia_use_angle) {
206 defines += [ "SK_ANGLE" ]
207 }
Brian Osman3f375d02016-12-28 11:19:22 -0500208 if (skia_enable_discrete_gpu) {
209 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
210 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400211 if (!is_official_build) {
212 defines += [ "GR_TEST_UTILS=1" ]
213 }
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400214 if (skia_llvm_path != "") {
215 defines += [ "SK_LLVM_AVAILABLE" ]
216 include_dirs += [ "$skia_llvm_path/include" ]
217 libs += [ skia_llvm_lib ]
218 lib_dirs += [ "$skia_llvm_path/lib/" ]
219 }
mtkleinc04ff472016-06-23 10:29:30 -0700220}
221
222# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
223config("skia_library") {
224 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700225 defines = [ "SKIA_IMPLEMENTATION=1" ]
226}
227
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600228config("moltenvk") {
229 if (is_ios) {
230 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS"
231 } else {
232 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS"
233 }
234 cflags = [
235 "-F$moltenvk_framework_path",
236 "-isystem$skia_moltenvk_path/MoltenVK/include", # for <vulkan/vulkan.h>
237 ]
238 ldflags = [ "-F$moltenvk_framework_path" ]
239 libs = [
240 "MoltenVK.framework",
241 "Metal.framework",
242 "IOSurface.framework",
243 "QuartzCore.framework",
244 "Foundation.framework",
245 ]
246 if (is_ios) {
247 libs += [ "UIKit.framework" ]
248 } else {
249 libs += [ "IOKit.framework" ]
250 }
251 defines = [ "SK_MOLTENVK" ]
252}
253
mtkleinc04ff472016-06-23 10:29:30 -0700254skia_library_configs = [
255 ":skia_public",
256 ":skia_private",
257 ":skia_library",
258]
259
mtklein9b8583d2016-08-24 17:32:30 -0700260# Use for CPU-specific Skia code that needs particular compiler flags.
261template("opts") {
262 if (invoker.enabled) {
263 source_set(target_name) {
264 forward_variables_from(invoker, "*")
265 configs += skia_library_configs
266 }
267 } else {
268 # If not enabled, a phony empty target that swallows all otherwise unused variables.
269 source_set(target_name) {
270 forward_variables_from(invoker,
271 "*",
272 [
273 "sources",
274 "cflags",
275 ])
276 }
277 }
anmittala7eaf2e2016-08-17 13:57:26 -0700278}
279
mtklein422310d2016-08-16 18:28:43 -0700280is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700281
mtklein7d6fb2c2016-08-25 14:50:44 -0700282opts("none") {
283 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700284 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700285 cflags = []
286}
287
mtklein7d6fb2c2016-08-25 14:50:44 -0700288opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700289 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700290 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700291 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700292}
293
294opts("arm64") {
295 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700296 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700297 cflags = []
298}
299
300opts("crc32") {
301 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700302 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700303 cflags = [ "-march=armv8-a+crc" ]
304}
305
mtklein9b8583d2016-08-24 17:32:30 -0700306opts("sse2") {
307 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700308 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400309 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400310 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
311 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400312 cflags = [ "-msse2" ]
313 }
mtklein9b8583d2016-08-24 17:32:30 -0700314}
mtkleinc04ff472016-06-23 10:29:30 -0700315
mtklein9b8583d2016-08-24 17:32:30 -0700316opts("ssse3") {
317 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700318 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400319 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400320 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
321 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400322 cflags = [ "-mssse3" ]
323 }
mtklein9b8583d2016-08-24 17:32:30 -0700324}
mtkleinc04ff472016-06-23 10:29:30 -0700325
mtklein9b8583d2016-08-24 17:32:30 -0700326opts("sse41") {
327 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700328 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400329 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400330 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
331 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400332 cflags = [ "-msse4.1" ]
333 }
mtklein9b8583d2016-08-24 17:32:30 -0700334}
mtklein4e976072016-08-08 09:06:27 -0700335
mtklein9b8583d2016-08-24 17:32:30 -0700336opts("sse42") {
337 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700338 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400339 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400340 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
341 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400342 cflags = [ "-msse4.2" ]
343 }
mtklein9b8583d2016-08-24 17:32:30 -0700344}
345
346opts("avx") {
347 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700348 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400349 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000350 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400351 } else {
352 cflags = [ "-mavx" ]
353 }
mtkleinc04ff472016-06-23 10:29:30 -0700354}
355
Mike Klein1b9b7d52018-02-27 10:37:40 -0500356opts("hsw") {
357 enabled = is_x86
358 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400359 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500360 cflags = [ "/arch:AVX2" ]
361 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000362 cflags = [ "-march=haswell" ]
Mike Klein1b9b7d52018-02-27 10:37:40 -0500363 }
364
365 # Oddly, clang-cl doesn't recognize this as a valid flag.
366 # If it ever does, it'd nice to move this up with -mavx2 and co.
367 if (is_clang && !is_win) {
368 # This flag lets Clang generate FMAs when it sees a mul-then-add. It's optional,
369 # but nice to have, generating slightly better code for paths without explicit FMAs.
370 cflags += [ "-ffp-contract=fast" ]
371 }
372}
373
mtkleinc095df52016-08-24 12:23:52 -0700374# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700375template("optional") {
376 if (invoker.enabled) {
377 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700378 if (defined(invoker.public_defines)) {
379 defines = invoker.public_defines
380 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600381 if (defined(invoker.public_configs)) {
382 configs = invoker.public_configs
383 }
mtklein457b42a2016-08-23 13:56:37 -0700384 }
385 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700386 forward_variables_from(invoker,
387 "*",
388 [
389 "public_defines",
390 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700391 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700392 ])
mtklein457b42a2016-08-23 13:56:37 -0700393 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700394 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700395 if (defined(invoker.configs_to_remove)) {
396 configs -= invoker.configs_to_remove
397 }
mtklein457b42a2016-08-23 13:56:37 -0700398 }
399 } else {
mtklein457b42a2016-08-23 13:56:37 -0700400 source_set(target_name) {
401 forward_variables_from(invoker,
402 "*",
403 [
404 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700405 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700406 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700407 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700408 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700409 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700410 ])
mtkleincd01b032016-08-31 04:58:19 -0700411 if (defined(invoker.sources_when_disabled)) {
412 sources = invoker.sources_when_disabled
413 }
414 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700415 }
mtkleineb3c4252016-08-23 07:38:09 -0700416 }
mtklein457b42a2016-08-23 13:56:37 -0700417}
mtklein457b42a2016-08-23 13:56:37 -0700418
Mike Kleina04bb452017-02-09 12:24:07 -0500419optional("effects") {
420 enabled = skia_enable_effects
Ethan Nicholas762466e2017-06-29 10:03:38 -0400421 deps = [
422 ":compile_processors",
423 ]
Mike Kleina04bb452017-02-09 12:24:07 -0500424 sources =
425 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
426 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
427}
428
mtkleina45be612016-08-29 15:22:10 -0700429optional("fontmgr_android") {
430 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700431
432 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500433 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700434 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700435 ]
436 sources = [
437 "src/ports/SkFontMgr_android.cpp",
438 "src/ports/SkFontMgr_android_factory.cpp",
439 "src/ports/SkFontMgr_android_parser.cpp",
440 ]
441}
442
mtkleind2e39db2016-09-07 07:52:55 -0700443optional("fontmgr_custom") {
444 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
445
446 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500447 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700448 ]
449 sources = [
450 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500451 "src/ports/SkFontMgr_custom.h",
452 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700453 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500454 "src/ports/SkFontMgr_custom_embedded.cpp",
455 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700456 ]
457}
458
Hal Canaryff2742e2018-01-30 11:35:47 -0500459optional("fontmgr_empty") {
460 enabled = skia_enable_fontmgr_empty
461 sources = [
462 "src/ports/SkFontMgr_empty_factory.cpp",
463 ]
464}
465
mtklein3cc22182016-08-29 13:26:14 -0700466optional("fontmgr_fontconfig") {
467 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700468
469 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500470 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700471 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700472 ]
473 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700474 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700475 "src/ports/SkFontConfigInterface_direct.cpp",
476 "src/ports/SkFontConfigInterface_direct_factory.cpp",
477 "src/ports/SkFontMgr_FontConfigInterface.cpp",
478 "src/ports/SkFontMgr_fontconfig.cpp",
479 "src/ports/SkFontMgr_fontconfig_factory.cpp",
480 ]
481}
482
mtkleincdedd0e2016-09-12 15:15:44 -0700483optional("fontmgr_fuchsia") {
484 enabled = is_fuchsia && skia_use_freetype
485
486 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500487 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700488 ]
489 sources = [
490 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500491 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700492 "src/ports/SkFontMgr_custom_empty_factory.cpp",
493 ]
494}
495
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700496if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400497 executable("sksllex") {
498 sources = [
499 "src/sksl/lex/Main.cpp",
500 "src/sksl/lex/NFA.cpp",
501 "src/sksl/lex/RegexNode.cpp",
502 "src/sksl/lex/RegexParser.cpp",
503 ]
504 include_dirs = [ "src/sksl/lex" ]
505 }
506
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700507 action("run_sksllex") {
508 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400509 deps = [
510 ":sksllex(//gn/toolchain:$host_toolchain)",
511 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700512 sources = [
513 "src/sksl/lex/layout.lex",
514 "src/sksl/lex/sksl.lex",
515 ]
516
517 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
518 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
519 outputs = [
520 "$target_out_dir/" +
521 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
522 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
523 # confused due to the same file being named by two different paths
524 ]
525 sksllex_path = "$root_out_dir/"
526 sksllex_path += "sksllex"
527 if (host_os == "win") {
528 sksllex_path += ".exe"
529 }
530 args = [
531 rebase_path(sksllex_path),
532 rebase_path("bin/clang-format"),
533 rebase_path("src"),
534 ]
535 }
536} else {
537 group("run_sksllex") {
538 }
539}
540
541if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400542 executable("skslc") {
543 defines = [ "SKSL_STANDALONE" ]
544 sources = [
545 "src/sksl/SkSLMain.cpp",
546 ]
547 sources += skia_sksl_sources
548 include_dirs = [
549 "src/gpu",
550 "src/sksl",
551 ]
552 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500553 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400554 "//third_party/spirv-tools",
555 ]
556 }
557
558 skia_gpu_processor_outputs = []
559 foreach(src, skia_gpu_processor_sources) {
560 dir = get_path_info(src, "dir")
561 name = get_path_info(src, "name")
562
563 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
564 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
565 skia_gpu_processor_outputs += [
566 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
567 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
568 # confused due to the same file being named by two different paths
569 ]
570 }
571
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500572 action("create_sksl_enums") {
573 script = "gn/create_sksl_enums.py"
574 sources = [
575 "include/private/GrSharedEnums.h",
576 ]
577 outputs = [
578 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500579 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500580 ]
581 args = [
582 rebase_path(sources[0]),
583 rebase_path(outputs[0]),
584 ]
585 }
586
Ethan Nicholas762466e2017-06-29 10:03:38 -0400587 action("compile_processors") {
588 script = "gn/compile_processors.py"
589 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500590 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400591 ":skslc(//gn/toolchain:$host_toolchain)",
592 ]
593 sources = skia_gpu_processor_sources
594 outputs = skia_gpu_processor_outputs
595 skslc_path = "$root_out_dir/"
596 if (host_toolchain != default_toolchain_name) {
597 skslc_path += "$host_toolchain/"
598 }
599 skslc_path += "skslc"
600 if (host_os == "win") {
601 skslc_path += ".exe"
602 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400603 args = [
604 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400605 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400606 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400607 args += rebase_path(skia_gpu_processor_sources)
608 }
609} else {
610 skia_gpu_processor_outputs = []
611 group("compile_processors") {
612 }
613}
614
mtklein06c35c02016-09-20 12:28:12 -0700615optional("gpu") {
616 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400617 deps = [
618 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700619 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400620 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700621 if (skia_generate_workarounds) {
622 deps += [ ":workaround_list" ]
623 }
mtkleine9fb3d52016-09-20 15:11:46 -0700624 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600625 public_configs = []
mtkleine9fb3d52016-09-20 15:11:46 -0700626
Brian Salomon3d6801e2017-12-11 10:06:31 -0500627 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
mtklein06c35c02016-09-20 12:28:12 -0700628
629 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500630 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700631 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400632 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700633 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400634 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400635
636 # this lib is required to link against AHardwareBuffer
637 if (defined(ndk_api) && ndk_api >= 26) {
638 libs += [ "android" ]
639 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400640 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500641 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400642 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700643 } else if (is_linux) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500644 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500645 libs += [
646 "GL",
647 "GLU",
648 ]
mtklein06c35c02016-09-20 12:28:12 -0700649 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500650 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800651 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500652 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400653 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500654 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400655 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700656 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500657 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700658 }
mtkleine9fb3d52016-09-20 15:11:46 -0700659
660 if (skia_use_vulkan) {
661 public_defines += [ "SK_VULKAN" ]
662 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700663 if (skia_enable_vulkan_debug_layers) {
664 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
665 }
Greg Danielafb7ec72017-12-07 12:48:30 -0500666 if (skia_vulkan_header != "") {
667 public_defines += [ "SK_VULKAN_HEADER=\"$skia_vulkan_header\"" ]
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600668 } else if (skia_moltenvk_path != "") {
669 public_defines += [ "SK_VULKAN_HEADER=<MoltenVK/mvk_vulkan.h>" ]
670 } else if (is_skia_dev_build) {
671 public_defines += [ "SK_VULKAN_HEADER=\"GrVulkanDefines.h\"" ]
672 }
673 if (skia_moltenvk_path != "") {
674 public_configs += [ ":moltenvk" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500675 }
mtkleine9fb3d52016-09-20 15:11:46 -0700676 }
Brian Salomon5f33a8c2018-02-26 14:32:39 -0500677 if (skia_use_legacy_gpu_pixel_ops) {
678 public_defines += [ "SK_LEGACY_GPU_PIXEL_OPS" ]
679 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400680 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400681 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400682 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
683 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400684
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400685 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400686 if (skia_use_metal) {
687 public_defines += [ "SK_METAL" ]
688 sources += skia_metal_sources
689 libs += [ "Metal.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400690 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400691 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500692
693 if (skia_enable_atlas_text) {
694 sources += skia_atlas_text_sources
695 }
mtklein06c35c02016-09-20 12:28:12 -0700696}
697
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400698optional("heif") {
699 enabled = skia_use_libheif
700 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
701
702 deps = []
703
704 sources = [
705 "src/codec/SkHeifCodec.cpp",
706 ]
707}
708
mtklein63213812016-08-24 09:55:56 -0700709optional("jpeg") {
710 enabled = skia_use_libjpeg_turbo
711 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
712
mtklein63213812016-08-24 09:55:56 -0700713 deps = [
714 "//third_party/libjpeg-turbo:libjpeg",
715 ]
716 sources = [
717 "src/codec/SkJpegCodec.cpp",
718 "src/codec/SkJpegDecoderMgr.cpp",
719 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700720 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400721 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700722 ]
723}
724
725optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500726 enabled = skia_use_zlib && skia_enable_pdf
727 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700728
mtklein63213812016-08-24 09:55:56 -0700729 deps = [
730 "//third_party/zlib",
731 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400732 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700733 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400734 }
brettwb9447282016-09-01 14:24:39 -0700735 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700736 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700737
738 if (skia_use_sfntly) {
739 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500740 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700741 }
742}
743
744optional("png") {
745 enabled = skia_use_libpng
746 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
747
mtklein63213812016-08-24 09:55:56 -0700748 deps = [
749 "//third_party/libpng",
750 ]
751 sources = [
752 "src/codec/SkIcoCodec.cpp",
753 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400754 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700755 ]
756}
757
scroggof84ad642016-10-31 09:02:57 -0700758optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400759 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700760 public_defines = [ "SK_CODEC_DECODES_RAW" ]
761
762 deps = [
763 "//third_party/dng_sdk",
764 "//third_party/libjpeg-turbo:libjpeg",
765 "//third_party/piex",
766 ]
767
768 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
769 # Skia.
770 configs_to_remove = [ "//gn:no_exceptions" ]
771
772 sources = [
773 "src/codec/SkRawAdapterCodec.cpp",
774 "src/codec/SkRawCodec.cpp",
775 ]
776}
777
Mike Klein852a8cb2018-05-15 10:46:58 -0400778import("third_party/skcms/skcms.gni")
779config("third_party_skcms_public") {
780 include_dirs = [ "third_party/skcms" ]
781}
782source_set("third_party_skcms") {
783 public_configs = [ ":third_party_skcms_public" ]
784
785 cflags = []
786 if (!is_win || is_clang) {
787 cflags += [
788 "-w",
789 "-std=c11",
790 ]
791 }
792
793 public = [
794 "third_party/skcms/skcms.h",
795 ]
796 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
797}
798
Mike Kleinfb333552018-01-25 12:49:37 -0500799optional("skcms") {
800 enabled = skia_use_skcms
801
Brian Osman094fba92018-03-26 17:05:48 -0400802 public_defines = [ "SK_USE_SKCMS" ]
Mike Kleinfb333552018-01-25 12:49:37 -0500803 deps = [
Mike Klein852a8cb2018-05-15 10:46:58 -0400804 ":third_party_skcms",
Mike Kleinfb333552018-01-25 12:49:37 -0500805 ]
806 sources = [
Brian Osman094fba92018-03-26 17:05:48 -0400807 "src/core/SkColorSpaceXform_skcms.cpp",
Mike Kleinfb333552018-01-25 12:49:37 -0500808 ]
809}
810
mtklein3cc22182016-08-29 13:26:14 -0700811optional("typeface_freetype") {
812 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700813
814 deps = [
815 "//third_party/freetype2",
816 ]
817 sources = [
818 "src/ports/SkFontHost_FreeType.cpp",
819 "src/ports/SkFontHost_FreeType_common.cpp",
820 ]
821}
822
mtklein457b42a2016-08-23 13:56:37 -0700823optional("webp") {
824 enabled = skia_use_libwebp
825 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
826
mtklein457b42a2016-08-23 13:56:37 -0700827 deps = [
828 "//third_party/libwebp",
829 ]
830 sources = [
831 "src/codec/SkWebpAdapterCodec.cpp",
832 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400833 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700834 ]
mtkleineb3c4252016-08-23 07:38:09 -0700835}
836
mtklein63213812016-08-24 09:55:56 -0700837optional("xml") {
838 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000839 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700840
mtklein63213812016-08-24 09:55:56 -0700841 deps = [
842 "//third_party/expat",
843 ]
844 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500845 "src/svg/SkSVGCanvas.cpp",
846 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700847 "src/xml/SkDOM.cpp",
848 "src/xml/SkXMLParser.cpp",
849 "src/xml/SkXMLWriter.cpp",
850 ]
851}
852
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700853if (skia_enable_gpu && skia_generate_workarounds) {
854 action("workaround_list") {
855 script = "tools/build_workaround_header.py"
856
857 inputs = [
858 "src/gpu/gpu_workaround_list.txt",
859 ]
860
861 # see comments in skia_compile_processors about out dir path shenanigans.
862 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700863 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700864
865 outputs = [
866 "$root_out_dir/$output_file",
867 ]
868 args = [
869 "--output-file",
870 "$output_file",
871 ]
872
873 foreach(file, inputs) {
874 args += [ rebase_path(file, root_build_dir) ]
875 }
876 }
877}
878
mtkleinc04ff472016-06-23 10:29:30 -0700879component("skia") {
880 public_configs = [ ":skia_public" ]
881 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700882
883 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700884 ":arm64",
885 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700886 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700887 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500888 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700889 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700890 ":fontmgr_custom",
Hal Canaryff2742e2018-01-30 11:35:47 -0500891 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700892 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700893 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700894 ":gpu",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400895 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500896 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700897 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700898 ":none",
mtklein63213812016-08-24 09:55:56 -0700899 ":pdf",
900 ":png",
scroggof84ad642016-10-31 09:02:57 -0700901 ":raw",
Mike Kleinfb333552018-01-25 12:49:37 -0500902 ":skcms",
mtklein9b8583d2016-08-24 17:32:30 -0700903 ":sse2",
904 ":sse41",
905 ":sse42",
906 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700907 ":webp",
mtklein63213812016-08-24 09:55:56 -0700908 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700909 ]
910
Chinmay Garde43f115c2016-11-16 15:04:12 -0800911 # This file (and all GN files in Skia) are designed to work with an
912 # empty sources assignment filter; we handle all that explicitly.
913 # We clear the filter here for clients who may have set up a global filter.
914 set_sources_assignment_filter([])
915
mtkleinc04ff472016-06-23 10:29:30 -0700916 sources = []
brettwb9447282016-09-01 14:24:39 -0700917 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700918 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500919 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700920 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400921 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500922 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700923 "src/android/SkBitmapRegionCodec.cpp",
924 "src/android/SkBitmapRegionDecoder.cpp",
925 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400926 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700927 "src/codec/SkBmpCodec.cpp",
928 "src/codec/SkBmpMaskCodec.cpp",
929 "src/codec/SkBmpRLECodec.cpp",
930 "src/codec/SkBmpStandardCodec.cpp",
931 "src/codec/SkCodec.cpp",
932 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700933 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700934 "src/codec/SkMaskSwizzler.cpp",
935 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700936 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700937 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700938 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700939 "src/codec/SkSwizzler.cpp",
940 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700941 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700942 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700943 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700944 "src/ports/SkMemory_malloc.cpp",
945 "src/ports/SkOSFile_stdio.cpp",
946 "src/sfnt/SkOTTable_name.cpp",
947 "src/sfnt/SkOTUtils.cpp",
948 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700949 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700950 ]
brettwb9447282016-09-01 14:24:39 -0700951
mtklein7d6fb2c2016-08-25 14:50:44 -0700952 libs = []
953
mtkleinc04ff472016-06-23 10:29:30 -0700954 if (is_win) {
955 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400956 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700957 "src/ports/SkDebug_win.cpp",
958 "src/ports/SkFontHost_win.cpp",
959 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500960 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700961 "src/ports/SkImageEncoder_WIC.cpp",
962 "src/ports/SkImageGeneratorWIC.cpp",
963 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700964 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700965 "src/ports/SkScalerContext_win_dw.cpp",
966 "src/ports/SkTLS_win.cpp",
967 "src/ports/SkTypeface_win_dw.cpp",
968 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400969 libs += [
970 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500971 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400972 "Ole32.lib",
973 "OleAut32.lib",
974 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500975 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400976 ]
mtkleinc04ff472016-06-23 10:29:30 -0700977 } else {
978 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700979 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700980 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700981 "src/ports/SkTLS_pthread.cpp",
982 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400983 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700984 }
985
mtklein7d6fb2c2016-08-25 14:50:44 -0700986 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500987 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500988 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500989 deps += [ "//third_party/cpu-features" ]
990 }
mtklein06c35c02016-09-20 12:28:12 -0700991 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700992 libs += [
993 "EGL",
994 "GLESv2",
995 "log",
996 ]
997 }
998
mtkleinc04ff472016-06-23 10:29:30 -0700999 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -07001000 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -04001001 if (skia_use_egl) {
1002 libs += [ "GLESv2" ]
1003 }
mtkleinc04ff472016-06-23 10:29:30 -07001004 }
1005
1006 if (is_mac) {
1007 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001008 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001009 "src/ports/SkFontHost_mac.cpp",
1010 "src/ports/SkImageEncoder_CG.cpp",
1011 "src/ports/SkImageGeneratorCG.cpp",
1012 ]
mtklein09e61f72016-08-23 13:35:28 -07001013 libs += [
bungeman3e306f62017-03-29 11:32:02 -04001014 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
1015 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -07001016 "ApplicationServices.framework",
1017 "OpenGL.framework",
1018 ]
mtkleinc04ff472016-06-23 10:29:30 -07001019 }
abarth6fc8ff02016-07-15 15:15:15 -07001020
Mike Klein7d302882016-11-03 14:06:31 -04001021 if (is_ios) {
1022 sources += [
1023 "src/ports/SkDebug_stdio.cpp",
1024 "src/ports/SkFontHost_mac.cpp",
1025 "src/ports/SkImageEncoder_CG.cpp",
1026 "src/ports/SkImageGeneratorCG.cpp",
1027 ]
1028 libs += [
1029 "CoreFoundation.framework",
1030 "CoreGraphics.framework",
1031 "CoreText.framework",
1032 "ImageIO.framework",
1033 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -04001034
1035 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
1036 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001037 ]
1038 }
1039
abarth6fc8ff02016-07-15 15:15:15 -07001040 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001041 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001042 }
mtkleinc04ff472016-06-23 10:29:30 -07001043}
1044
mtkleinc095df52016-08-24 12:23:52 -07001045# Targets guarded by skia_enable_tools may use //third_party freely.
1046if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -05001047 # Used by gn_to_bp.py to list our public include dirs.
1048 source_set("public") {
1049 configs += [ ":skia_public" ]
1050 }
1051
Mike Kleinc36dedf2016-11-18 09:35:28 -05001052 config("skia.h_config") {
1053 include_dirs = [ "$target_gen_dir" ]
Greg Danielafb7ec72017-12-07 12:48:30 -05001054 if (skia_use_vulkan) {
1055 # So we can get the header which includes vulkan
1056 include_dirs += [ "tools/gpu/vk" ]
1057 }
Mike Kleinc36dedf2016-11-18 09:35:28 -05001058 }
1059 action("skia.h") {
1060 public_configs = [ ":skia.h_config" ]
1061 skia_h = "$target_gen_dir/skia.h"
1062 script = "gn/find_headers.py"
Greg Danielc819e662017-04-19 16:39:45 -04001063 args = [ rebase_path(skia_h, root_build_dir) ] +
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +00001064 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001065 depfile = "$skia_h.deps"
1066 outputs = [
1067 skia_h,
1068 ]
1069 }
1070
1071 if (skia_enable_gpu && target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001072 executable("fiddle") {
1073 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001074 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001075 "tools/fiddle/draw.cpp",
1076 "tools/fiddle/fiddle_main.cpp",
1077 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001078
1079 if (skia_use_egl) {
1080 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001081 } else {
1082 sources += [ "tools/fiddle/null_context.cpp" ]
1083 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001084 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001085 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001086 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001087 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001088 ":skia",
1089 ":skia.h",
1090 ]
1091 }
1092 }
1093
1094 if (skia_enable_gpu) {
1095 source_set("public_headers_warnings_check") {
1096 sources = [
1097 "tools/public_headers_warnings_check.cpp",
1098 ]
1099 configs -= [ "//gn:warnings_except_public_headers" ]
1100 deps = [
1101 ":skia",
1102 ":skia.h",
1103 ]
1104 }
1105 }
1106
mtkleinc095df52016-08-24 12:23:52 -07001107 template("test_lib") {
1108 config(target_name + "_config") {
1109 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -07001110 if (defined(invoker.public_defines)) {
1111 defines = invoker.public_defines
1112 }
mtklein25c81d42016-07-27 13:55:26 -07001113 }
mtkleinc095df52016-08-24 12:23:52 -07001114 source_set(target_name) {
1115 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
1116 public_configs = [
1117 ":" + target_name + "_config",
1118 ":skia_private",
1119 ]
1120
1121 if (!defined(deps)) {
1122 deps = []
1123 }
1124 deps += [ ":skia" ]
1125 testonly = true
1126 }
mtklein25c81d42016-07-27 13:55:26 -07001127 }
mtklein25c81d42016-07-27 13:55:26 -07001128
Mike Kleine6682eb2017-01-05 10:54:57 -05001129 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001130 if (is_ios) {
1131 app_name = target_name
1132 gen_path = target_gen_dir
1133
1134 action("${app_name}_generate_info_plist") {
1135 script = "//gn/gen_plist_ios.py"
1136 outputs = [
1137 "$gen_path/${app_name}_Info.plist",
1138 ]
1139 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1140 }
1141
1142 bundle_data("${app_name}_bundle_info_plist") {
1143 public_deps = [
1144 ":${app_name}_generate_info_plist",
1145 ]
1146 sources = [
1147 "$gen_path/${app_name}_Info.plist",
1148 ]
1149 outputs = [
1150 "{{bundle_root_dir}}/Info.plist",
1151 ]
1152 }
1153
Jim Van Verth329c5a62017-11-29 11:42:33 -05001154 bundle_ios_data =
1155 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1156
1157 if (bundle_ios_data) {
1158 has_skps =
1159 "True" == exec_script("//gn/checkdir.py",
1160 [ rebase_path("skps", root_build_dir) ],
1161 "trim string")
1162 bundle_data("${app_name}_bundle_resources") {
1163 sources = [
1164 "resources",
1165 ]
1166 outputs = [
1167 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1168 "{{bundle_resources_dir}}/data/resources",
1169 ]
1170 }
1171
1172 if (has_skps) {
1173 bundle_data("${app_name}_bundle_skps") {
1174 sources = [
1175 "skps",
1176 ]
1177 outputs = [
1178 # Store in same folder as resources
1179 "{{bundle_resources_dir}}/data/skps",
1180 ]
1181 }
1182 }
1183 }
1184
Jim Van Verth443a9132017-11-28 09:45:26 -05001185 executable("${app_name}_generate_executable") {
1186 forward_variables_from(invoker,
1187 "*",
1188 [
1189 "output_name",
1190 "visibility",
1191 "is_shared_library",
1192 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001193 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001194 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001195 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1196 }
1197
1198 bundle_data("${app_name}_bundle_executable") {
1199 public_deps = [
1200 ":${app_name}_generate_executable",
1201 ]
1202 sources = [
1203 "$gen_path/$app_name",
1204 ]
1205 outputs = [
1206 "{{bundle_executable_dir}}/$app_name",
1207 ]
1208 testonly = true
1209 }
1210
1211 create_bundle("$app_name") {
1212 product_type = "com.apple.product-type.application"
1213 testonly = true
1214
1215 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1216 bundle_resources_dir = bundle_root_dir
1217 bundle_executable_dir = bundle_root_dir
1218 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1219
1220 deps = [
1221 ":${app_name}_bundle_executable",
1222 ":${app_name}_bundle_info_plist",
1223 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001224 if (bundle_ios_data) {
1225 deps += [ ":${app_name}_bundle_resources" ]
1226 if (has_skps) {
1227 deps += [ ":${app_name}_bundle_skps" ]
1228 }
1229 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001230
1231 # should only code sign when running on a device, not the simulator
1232 if (target_cpu != "x64") {
1233 code_signing_script = "//gn/codesign_ios.py"
1234 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1235 code_signing_outputs = [
1236 "$bundle_root_dir/_CodeSignature/CodeResources",
1237 "$bundle_root_dir/embedded.mobileprovision",
1238 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001239 code_signing_args = [
1240 rebase_path("$bundle_root_dir", root_build_dir),
1241 skia_ios_identity,
1242 skia_ios_profile,
1243 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001244 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001245 }
1246 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001247 # !is_ios
1248
1249 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1250 shared_library("lib" + target_name) {
1251 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1252 configs += [ ":skia_private" ]
1253 testonly = true
1254 }
1255 } else {
1256 _executable = target_name
1257 executable(_executable) {
1258 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1259 configs += [ ":skia_private" ]
1260 testonly = true
1261 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001262 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001263 if (is_android && skia_android_serial != "" && defined(_executable)) {
1264 action("push_" + target_name) {
1265 script = "gn/push_to_android.py"
1266 deps = [
1267 ":" + _executable,
1268 ]
1269 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1270 outputs = [
1271 _stamp,
1272 ]
1273 args = [
1274 rebase_path("$root_build_dir/$_executable"),
1275 skia_android_serial,
1276 rebase_path(_stamp),
1277 ]
1278 testonly = true
1279 }
Mike Klein7d921032017-01-05 12:20:41 -05001280 }
1281 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001282 }
1283
mtkleinc095df52016-08-24 12:23:52 -07001284 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001285 public_include_dirs = []
1286 if (skia_enable_gpu) {
1287 public_defines = []
1288 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001289
1290 deps = []
mtklein38925aa2016-09-21 10:11:25 -07001291 sources = [
1292 "tools/gpu/GrContextFactory.cpp",
1293 "tools/gpu/GrTest.cpp",
Brian Salomon58389b92018-03-07 13:01:25 -05001294 "tools/gpu/ProxyUtils.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001295 "tools/gpu/TestContext.cpp",
Brian Salomoncbcb0a12017-11-19 13:20:13 -05001296 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001297 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -07001298 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001299 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
1300 "tools/gpu/gl/debug/GrBufferObj.cpp",
1301 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
1302 "tools/gpu/gl/debug/GrProgramObj.cpp",
1303 "tools/gpu/gl/debug/GrShaderObj.cpp",
1304 "tools/gpu/gl/debug/GrTextureObj.cpp",
1305 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
1306 "tools/gpu/gl/null/NullGLTestContext.cpp",
Brian Salomoncfe910d2017-07-06 16:40:18 -04001307 "tools/gpu/mock/MockTestContext.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001308 ]
1309 libs = []
mtklein25c81d42016-07-27 13:55:26 -07001310
Kevin Lubick4a24e102017-03-29 11:19:01 -04001311 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -07001312 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -04001313 } else if (is_ios) {
1314 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1315 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -07001316 } else if (is_linux) {
1317 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001318 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -07001319 } else if (is_mac) {
1320 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001321 } else if (is_win) {
1322 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1323 libs += [
1324 "Gdi32.lib",
1325 "OpenGL32.lib",
1326 ]
mtklein38925aa2016-09-21 10:11:25 -07001327 }
mtklein6ef69992016-09-14 06:12:09 -07001328
Greg Daniel6b7e0e22017-07-12 16:21:09 -04001329 cflags_objcc = [ "-fobjc-arc" ]
1330
Mike Kleinc168a3a2016-11-14 14:53:13 +00001331 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +00001332 deps += [ "//third_party/angle2" ]
1333 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1334 }
mtkleind68f9b02016-09-23 13:18:41 -07001335 if (skia_use_vulkan) {
1336 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Greg Daniel35970ec2017-11-10 10:03:05 -05001337 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
mtkleind68f9b02016-09-23 13:18:41 -07001338 }
Greg Danielb76a72a2017-07-13 15:07:54 -04001339 if (skia_use_metal) {
1340 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
1341 }
mtkleina627b5c2016-09-20 13:36:47 -07001342 }
mtklein25c81d42016-07-27 13:55:26 -07001343 }
mtklein25c81d42016-07-27 13:55:26 -07001344
mtkleinc095df52016-08-24 12:23:52 -07001345 test_lib("flags") {
1346 public_include_dirs = [ "tools/flags" ]
1347 sources = [
1348 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001349 ]
1350 }
1351 test_lib("common_flags") {
1352 public_include_dirs = [ "tools/flags" ]
1353 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001354 "tools/flags/SkCommonFlags.cpp",
1355 "tools/flags/SkCommonFlagsConfig.cpp",
1356 ]
1357 deps = [
mtklein046cb562016-09-16 10:23:12 -07001358 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001359 ":gpu_tool_utils",
1360 ]
1361 }
mtklein25c81d42016-07-27 13:55:26 -07001362
mtkleinc095df52016-08-24 12:23:52 -07001363 test_lib("tool_utils") {
1364 public_include_dirs = [
1365 "tools",
1366 "tools/debugger",
Ben Wagner483c7722018-02-20 17:06:07 -05001367 "tools/fonts",
mtkleinc095df52016-08-24 12:23:52 -07001368 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001369 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001370 ]
1371 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001372 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001373 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001374 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001375 "tools/ProcStats.cpp",
1376 "tools/Resources.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001377 "tools/UrlDataManager.cpp",
1378 "tools/debugger/SkDebugCanvas.cpp",
1379 "tools/debugger/SkDrawCommand.cpp",
1380 "tools/debugger/SkJsonWriteBuffer.cpp",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001381 "tools/fonts/SkRandomScalerContext.cpp",
1382 "tools/fonts/SkTestFontMgr.cpp",
Ben Wagner97182cc2018-02-15 10:20:04 -05001383 "tools/fonts/SkTestFontMgr.h",
1384 "tools/fonts/SkTestSVGTypeface.cpp",
1385 "tools/fonts/SkTestSVGTypeface.h",
1386 "tools/fonts/SkTestTypeface.cpp",
1387 "tools/fonts/SkTestTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001388 "tools/fonts/sk_tool_utils_font.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001389 "tools/picture_utils.cpp",
1390 "tools/random_parse_path.cpp",
1391 "tools/sk_tool_utils.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001392 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001393 "tools/trace/SkChromeTracingTracer.cpp",
1394 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001395 "tools/trace/SkDebugfTracer.cpp",
1396 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001397 "tools/trace/SkEventTracingPriv.cpp",
1398 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001399 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001400 libs = []
1401 if (is_ios) {
1402 sources += [ "tools/ios_utils.m" ]
1403 libs += [ "Foundation.framework" ]
1404 }
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001405 defines = []
1406 if (skia_tools_require_resources) {
1407 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1408 }
mtkleinc095df52016-08-24 12:23:52 -07001409 deps = [
mtklein046cb562016-09-16 10:23:12 -07001410 ":common_flags",
Ben Wagner97182cc2018-02-15 10:20:04 -05001411 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001412 ":flags",
1413 "//third_party/libpng",
1414 ]
1415 public_deps = [
1416 "//third_party/jsoncpp",
1417 ]
1418 }
mtklein25c81d42016-07-27 13:55:26 -07001419
Mike Klein6e744122016-10-27 12:21:40 -04001420 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001421 test_lib("gm") {
1422 public_include_dirs = [ "gm" ]
1423 sources = gm_sources
1424 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001425 ":experimental_sksg",
scroggo19b91532016-10-24 09:03:26 -07001426 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001427 ":gpu_tool_utils",
1428 ":skia",
1429 ":tool_utils",
1430 ]
1431 }
mtklein25c81d42016-07-27 13:55:26 -07001432
Mike Klein6e744122016-10-27 12:21:40 -04001433 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001434 test_lib("tests") {
1435 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001436 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001437 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001438 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001439 }
mtkleinc095df52016-08-24 12:23:52 -07001440 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001441 ":experimental_sksg",
Hal Canary0f666812018-03-22 15:21:12 -04001442 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001443 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001444 ":skia",
Mike Klein852a8cb2018-05-15 10:46:58 -04001445 ":third_party_skcms",
mtkleinc095df52016-08-24 12:23:52 -07001446 ":tool_utils",
1447 "//third_party/libpng",
1448 "//third_party/zlib",
1449 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001450 public_deps = [
1451 ":gpu_tool_utils", # Test.h #includes headers from this target.
1452 ]
mtkleinc095df52016-08-24 12:23:52 -07001453 }
mtklein2f3416d2016-08-02 16:02:05 -07001454
Mike Klein6e744122016-10-27 12:21:40 -04001455 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001456 test_lib("bench") {
1457 public_include_dirs = [ "bench" ]
1458 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001459 deps = [
1460 ":flags",
1461 ":gm",
1462 ":gpu_tool_utils",
1463 ":skia",
1464 ":tool_utils",
1465 ]
1466 }
mtklein2b6870c2016-07-28 14:17:33 -07001467
Florin Malita54f65c42018-01-16 17:04:30 -05001468 test_lib("experimental_skottie") {
Florin Malita87ccf332018-05-04 12:23:24 -04001469 public_include_dirs = []
Florin Malita87ccf332018-05-04 12:23:24 -04001470 if (skia_enable_skottie) {
1471 public_include_dirs += [ "experimental/skottie" ]
1472 public_defines = [ "SK_ENABLE_SKOTTIE" ]
1473 sources = [
1474 "experimental/skottie/Skottie.cpp",
1475 "experimental/skottie/SkottieAdapter.cpp",
1476 "experimental/skottie/SkottieAnimator.cpp",
Florin Malitafa7e9a82018-05-04 15:10:54 -04001477 "experimental/skottie/SkottieJson.cpp",
Florin Malita87ccf332018-05-04 12:23:24 -04001478 "experimental/skottie/SkottieValue.cpp",
1479 ]
1480 deps = [
1481 ":experimental_sksg",
1482 ":skia",
Florin Malitafa7e9a82018-05-04 15:10:54 -04001483 "//third_party/rapidjson",
Florin Malita87ccf332018-05-04 12:23:24 -04001484 ]
1485 }
Florin Malita094ccde2017-12-30 12:27:00 -05001486 }
1487
mtkleinc095df52016-08-24 12:23:52 -07001488 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001489 public_include_dirs = []
1490 if (skia_use_expat) {
1491 public_include_dirs += [ "experimental/svg/model" ]
1492 sources = [
1493 "experimental/svg/model/SkSVGAttribute.cpp",
1494 "experimental/svg/model/SkSVGAttributeParser.cpp",
1495 "experimental/svg/model/SkSVGCircle.cpp",
1496 "experimental/svg/model/SkSVGClipPath.cpp",
1497 "experimental/svg/model/SkSVGContainer.cpp",
1498 "experimental/svg/model/SkSVGDOM.cpp",
1499 "experimental/svg/model/SkSVGEllipse.cpp",
1500 "experimental/svg/model/SkSVGGradient.cpp",
1501 "experimental/svg/model/SkSVGLine.cpp",
1502 "experimental/svg/model/SkSVGLinearGradient.cpp",
1503 "experimental/svg/model/SkSVGNode.cpp",
1504 "experimental/svg/model/SkSVGPath.cpp",
1505 "experimental/svg/model/SkSVGPattern.cpp",
1506 "experimental/svg/model/SkSVGPoly.cpp",
1507 "experimental/svg/model/SkSVGRadialGradient.cpp",
1508 "experimental/svg/model/SkSVGRect.cpp",
1509 "experimental/svg/model/SkSVGRenderContext.cpp",
1510 "experimental/svg/model/SkSVGSVG.cpp",
1511 "experimental/svg/model/SkSVGShape.cpp",
1512 "experimental/svg/model/SkSVGStop.cpp",
1513 "experimental/svg/model/SkSVGTransformableNode.cpp",
1514 "experimental/svg/model/SkSVGUse.cpp",
1515 "experimental/svg/model/SkSVGValue.cpp",
1516 ]
1517 deps = [
1518 ":skia",
1519 ":xml",
1520 ]
1521 }
mtkleinc095df52016-08-24 12:23:52 -07001522 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001523
Florin Malita4aa44412017-12-19 12:21:02 -05001524 test_lib("experimental_sksg") {
1525 public_include_dirs = [
1526 "experimental/sksg",
1527 "experimental/sksg/effects",
1528 "experimental/sksg/geometry",
1529 "experimental/sksg/paint",
1530 ]
1531 sources = [
1532 "experimental/sksg/SkSGDraw.cpp",
1533 "experimental/sksg/SkSGEffectNode.cpp",
1534 "experimental/sksg/SkSGGeometryNode.cpp",
1535 "experimental/sksg/SkSGGroup.cpp",
Florin Malita49328072018-01-08 12:51:12 -05001536 "experimental/sksg/SkSGImage.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001537 "experimental/sksg/SkSGInvalidationController.cpp",
1538 "experimental/sksg/SkSGNode.cpp",
1539 "experimental/sksg/SkSGPaintNode.cpp",
1540 "experimental/sksg/SkSGRenderNode.cpp",
Florin Malita35efaa82018-01-22 12:57:06 -05001541 "experimental/sksg/SkSGScene.cpp",
Florin Malita38ea40e2018-01-29 16:31:14 -05001542 "experimental/sksg/effects/SkSGClipEffect.cpp",
Florin Malita5f9102f2018-01-10 13:36:22 -05001543 "experimental/sksg/effects/SkSGMaskEffect.cpp",
Florin Malitac0034172018-01-08 16:42:59 -05001544 "experimental/sksg/effects/SkSGOpacityEffect.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001545 "experimental/sksg/effects/SkSGTransform.cpp",
Florin Malita16d0ad02018-01-19 15:07:29 -05001546 "experimental/sksg/geometry/SkSGGeometryTransform.cpp",
Florin Malitae6345d92018-01-03 23:37:54 -05001547 "experimental/sksg/geometry/SkSGMerge.cpp",
Florin Malita047ae272017-12-27 11:13:13 -05001548 "experimental/sksg/geometry/SkSGPath.cpp",
Florin Malita97b3d2b2018-02-20 11:26:15 -05001549 "experimental/sksg/geometry/SkSGPlane.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001550 "experimental/sksg/geometry/SkSGRect.cpp",
Florin Malita41dff6e2018-04-30 23:08:15 -04001551 "experimental/sksg/geometry/SkSGRoundEffect.cpp",
Florin Malita51012ce2018-01-31 17:06:59 -05001552 "experimental/sksg/geometry/SkSGText.cpp",
Florin Malita51b8c892018-01-07 08:54:24 -05001553 "experimental/sksg/geometry/SkSGTrimEffect.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001554 "experimental/sksg/paint/SkSGColor.cpp",
Florin Malita6aaee592018-01-12 12:25:09 -05001555 "experimental/sksg/paint/SkSGGradient.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001556 ]
1557 deps = [
1558 ":skia",
1559 ]
1560 }
1561
Kevin Lubickebf648e2017-09-21 13:45:16 -04001562 if (target_cpu != "wasm") {
1563 test_lib("views") {
1564 public_include_dirs = [ "include/views" ]
1565 sources = [
1566 "src/views/SkEvent.cpp",
1567 "src/views/SkEventSink.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001568 "src/views/SkTouchGesture.cpp",
1569 "src/views/SkView.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001570 ]
Brian Osman34755e22016-12-05 09:46:02 -05001571 }
Brian Osman16adfa32016-10-18 14:42:44 -04001572 }
1573
Mike Klein38af9432016-11-11 11:39:44 -05001574 if (skia_use_lua) {
1575 test_lib("lua") {
1576 public_include_dirs = []
1577 sources = [
1578 "src/utils/SkLua.cpp",
1579 "src/utils/SkLuaCanvas.cpp",
1580 ]
1581 deps = [
1582 "//third_party/lua",
1583 ]
1584 }
1585
Mike Kleine6682eb2017-01-05 10:54:57 -05001586 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001587 sources = [
1588 "tools/lua/lua_app.cpp",
1589 ]
1590 deps = [
1591 ":lua",
1592 ":skia",
1593 "//third_party/lua",
1594 ]
Mike Klein38af9432016-11-11 11:39:44 -05001595 }
1596
Mike Kleine6682eb2017-01-05 10:54:57 -05001597 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001598 sources = [
1599 "tools/lua/lua_pictures.cpp",
1600 ]
1601 deps = [
1602 ":flags",
1603 ":lua",
1604 ":skia",
1605 ":tool_utils",
1606 "//third_party/lua",
1607 ]
Mike Klein38af9432016-11-11 11:39:44 -05001608 }
1609 }
1610
Cary Clark8032b982017-07-28 11:04:54 -04001611 test_app("bookmaker") {
1612 sources = [
1613 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001614 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001615 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001616 "tools/bookmaker/fiddleParser.cpp",
1617 "tools/bookmaker/includeParser.cpp",
1618 "tools/bookmaker/includeWriter.cpp",
1619 "tools/bookmaker/mdOut.cpp",
1620 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001621 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001622 "tools/bookmaker/spellCheck.cpp",
1623 ]
1624 deps = [
1625 ":flags",
1626 ":skia",
1627 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001628 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001629 ]
1630 }
1631
Kevin Lubickebf648e2017-09-21 13:45:16 -04001632 if (target_cpu != "wasm") {
1633 import("gn/samples.gni")
1634 test_lib("samples") {
1635 public_include_dirs = [ "samplecode" ]
1636 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001637 sources = samples_sources
Kevin Lubickebf648e2017-09-21 13:45:16 -04001638 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001639 ":experimental_sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001640 ":experimental_svg_model",
1641 ":flags",
1642 ":gm",
Mike Reed193d3a02018-02-08 15:45:51 -05001643 ":skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001644 ":tool_utils",
1645 ":views",
1646 ":xml",
1647 ]
Mike Klein38af9432016-11-11 11:39:44 -05001648
Kevin Lubickebf648e2017-09-21 13:45:16 -04001649 if (skia_use_lua) {
1650 sources += [ "samplecode/SampleLua.cpp" ]
1651 deps += [
1652 ":lua",
1653 "//third_party/lua",
1654 ]
1655 }
1656 }
1657 test_app("dm") {
1658 sources = [
1659 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001660 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001661 "dm/DMJsonWriter.cpp",
1662 "dm/DMSrcSink.cpp",
1663 ]
1664 include_dirs = [ "tests" ]
1665 deps = [
1666 ":common_flags",
Florin Malita54f65c42018-01-16 17:04:30 -05001667 ":experimental_skottie",
Florin Malita4aa44412017-12-19 12:21:02 -05001668 ":experimental_sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001669 ":experimental_svg_model",
1670 ":flags",
1671 ":gm",
1672 ":gpu_tool_utils",
1673 ":skia",
1674 ":tests",
1675 ":tool_utils",
1676 "//third_party/jsoncpp",
1677 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001678 ]
1679 }
Brian Osman16adfa32016-10-18 14:42:44 -04001680 }
1681
Mike Kleina8a51ce2018-01-09 12:34:11 -05001682 if (!is_win) {
1683 test_app("remote_demo") {
1684 sources = [
1685 "tools/remote_demo.cpp",
1686 ]
1687 deps = [
1688 ":skia",
1689 ]
1690 }
1691 }
1692
Mike Kleine6682eb2017-01-05 10:54:57 -05001693 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001694 sources = [
1695 "bench/nanobench.cpp",
1696 ]
1697 deps = [
1698 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001699 ":common_flags",
Florin Malita4aa44412017-12-19 12:21:02 -05001700 ":experimental_sksg",
fmalita6519c212016-09-14 08:05:17 -07001701 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001702 ":flags",
1703 ":gm",
1704 ":gpu_tool_utils",
1705 ":skia",
1706 ":tool_utils",
1707 "//third_party/jsoncpp",
1708 ]
mtklein2b6870c2016-07-28 14:17:33 -07001709 }
halcanary19a97202016-08-03 15:08:04 -07001710
Ravi Mistry10d36c52017-01-31 09:49:18 -05001711 test_app("skpinfo") {
1712 sources = [
1713 "tools/skpinfo.cpp",
1714 ]
1715 deps = [
1716 ":flags",
1717 ":skia",
1718 ]
1719 }
1720
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001721 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001722 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001723 sources = [
1724 "tools/skpbench/skpbench.cpp",
1725 ]
1726 deps = [
1727 ":flags",
1728 ":gpu_tool_utils",
1729 ":skia",
1730 ":tool_utils",
1731 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001732 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001733 }
1734
Hal Canary96c57252018-02-09 11:43:05 -05001735 test_lib("skshaper") {
1736 public_include_dirs = [ "tools/shape" ]
1737 deps = [
1738 ":skia",
1739 ]
1740
Hal Canary8bb40832018-02-08 15:16:28 -05001741 if (target_cpu == "wasm") {
Hal Canary96c57252018-02-09 11:43:05 -05001742 sources = [
1743 "tools/shape/SkShaper_primitive.cpp",
1744 ]
1745 } else {
mtklein6f5df6a2016-08-29 16:01:10 -07001746 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001747 "tools/shape/SkShaper_harfbuzz.cpp",
mtklein6f5df6a2016-08-29 16:01:10 -07001748 ]
Hal Canary96c57252018-02-09 11:43:05 -05001749 deps += [
mtklein6f5df6a2016-08-29 16:01:10 -07001750 "//third_party/harfbuzz",
Ben Wagnera25fbef2017-08-30 13:56:19 -04001751 "//third_party/icu",
mtklein6f5df6a2016-08-29 16:01:10 -07001752 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001753 }
halcanary19a97202016-08-03 15:08:04 -07001754 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001755 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001756 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001757 "tools/shape/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001758 ]
1759 deps = [
1760 ":skia",
Hal Canary96c57252018-02-09 11:43:05 -05001761 ":skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001762 ]
halcanary3eee9d92016-09-10 07:01:53 -07001763 }
mtklein046cb562016-09-16 10:23:12 -07001764
Matt Sarett9f1c4032017-05-17 10:06:32 -04001765 test_app("create_flutter_test_images") {
1766 sources = [
1767 "tools/create_flutter_test_images.cpp",
1768 ]
1769 deps = [
1770 ":skia",
1771 ":tool_utils",
1772 ]
1773 }
1774
Ben Wagner219f3622017-07-17 15:32:25 -04001775 test_app("create_test_font") {
1776 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001777 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001778 ]
1779 deps = [
1780 ":skia",
1781 ]
1782 assert_no_deps = [
1783 # tool_utils requires the output of this app.
1784 ":tool_utils",
1785 ]
1786 }
1787
Ben Wagner97182cc2018-02-15 10:20:04 -05001788 test_app("create_test_font_color") {
1789 sources = [
1790 "tools/fonts/create_test_font_color.cpp",
1791 ]
1792 deps = [
1793 ":flags",
1794 ":skia",
Florin Malitac659c2c2018-04-05 11:57:21 -04001795 ":tool_utils",
Ben Wagner97182cc2018-02-15 10:20:04 -05001796 ]
1797 }
1798
Mike Kleine6682eb2017-01-05 10:54:57 -05001799 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001800 sources = [
1801 "tools/get_images_from_skps.cpp",
1802 ]
1803 deps = [
1804 ":flags",
1805 ":skia",
1806 "//third_party/jsoncpp",
1807 ]
mtklein046cb562016-09-16 10:23:12 -07001808 }
mtkleinecbc5262016-09-22 11:51:24 -07001809
Kevin Lubickebf648e2017-09-21 13:45:16 -04001810 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001811 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001812 sources = [
1813 "tools/skiaserve/Request.cpp",
1814 "tools/skiaserve/Response.cpp",
1815 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001816 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1817 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1818 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1819 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1820 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1821 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1822 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1823 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1824 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001825 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1826 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001827 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1828 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1829 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1830 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1831 ]
1832 deps = [
1833 ":flags",
1834 ":gpu_tool_utils",
1835 ":skia",
1836 ":tool_utils",
1837 "//third_party/jsoncpp",
1838 "//third_party/libmicrohttpd",
1839 "//third_party/libpng",
1840 ]
Mike Klein7d302882016-11-03 14:06:31 -04001841 }
mtkleinecbc5262016-09-22 11:51:24 -07001842 }
kjlubick14f984b2016-10-03 11:49:45 -07001843
Mike Kleine6682eb2017-01-05 10:54:57 -05001844 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001845 include_dirs = [
1846 "tools",
1847 "tools/debugger",
1848 ]
kjlubick14f984b2016-10-03 11:49:45 -07001849 sources = [
Hal Canary24ac42b2017-02-14 13:35:14 -05001850 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001851 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001852 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04001853 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001854 "fuzz/FuzzGradients.cpp",
1855 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001856 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001857 "fuzz/FuzzPathop.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04001858 "fuzz/FuzzRegionOp.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001859 "fuzz/fuzz.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001860 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1861 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001862 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
1863 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001864 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1865 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001866 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001867 "tools/UrlDataManager.cpp",
1868 "tools/debugger/SkDebugCanvas.cpp",
1869 "tools/debugger/SkDrawCommand.cpp",
1870 "tools/debugger/SkJsonWriteBuffer.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001871 "tools/picture_utils.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001872 ]
1873 deps = [
Kevin Lubick9eeede22018-05-03 16:26:10 -04001874 ":experimental_skottie",
kjlubick14f984b2016-10-03 11:49:45 -07001875 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001876 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001877 ":skia",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001878 "//third_party/jsoncpp",
1879 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001880 ]
Florin Malita0b0d93d2018-05-04 15:01:03 -04001881
1882 if (skia_enable_skottie) {
1883 sources += [ "fuzz/oss_fuzz/FuzzSkottieJSON.cpp" ]
1884 }
kjlubick14f984b2016-10-03 11:49:45 -07001885 }
Mike Klein38312422016-10-05 15:41:01 -04001886
Mike Kleine6682eb2017-01-05 10:54:57 -05001887 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001888 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001889 rebase_path("tests/skia_test.cpp"),
1890 rebase_path("tests/Test.cpp"),
1891 ]
caryclark9feb6322016-10-25 08:58:26 -07001892 deps = [
1893 ":flags",
1894 ":gpu_tool_utils",
1895 ":skia",
1896 ":tool_utils",
1897 ]
caryclark9feb6322016-10-25 08:58:26 -07001898 }
1899
Mike Kleine6682eb2017-01-05 10:54:57 -05001900 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001901 sources = [
1902 "tools/DumpRecord.cpp",
1903 "tools/dump_record.cpp",
1904 ]
1905 deps = [
1906 ":flags",
1907 ":skia",
1908 ]
Mike Klein38312422016-10-05 15:41:01 -04001909 }
bungemanfe917272016-10-13 17:36:40 -04001910
Mike Kleine6682eb2017-01-05 10:54:57 -05001911 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001912 sources = [
1913 "tools/skdiff/skdiff.cpp",
1914 "tools/skdiff/skdiff_html.cpp",
1915 "tools/skdiff/skdiff_main.cpp",
1916 "tools/skdiff/skdiff_utils.cpp",
1917 ]
1918 deps = [
1919 ":skia",
1920 ":tool_utils",
1921 ]
bungemanfe917272016-10-13 17:36:40 -04001922 }
halcanarya73d76a2016-10-17 13:19:02 -07001923
Mike Kleine6682eb2017-01-05 10:54:57 -05001924 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001925 sources = [
1926 "tools/skp_parser.cpp",
1927 ]
1928 deps = [
1929 ":skia",
1930 ":tool_utils",
1931 "//third_party/jsoncpp",
1932 ]
halcanarya73d76a2016-10-17 13:19:02 -07001933 }
Brian Osman16adfa32016-10-18 14:42:44 -04001934
Hal Canaryd7b38452017-12-11 17:46:26 -05001935 if (!is_win && skia_enable_gpu) {
1936 test_lib("skqp_lib") {
1937 public_include_dirs = [ "tools/skqp" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05001938 defines =
1939 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary4689b542018-01-31 11:54:14 -05001940 if (skia_skqp_enable_driver_correctness_workarounds) {
1941 defines += [ "SK_SKQP_ENABLE_DRIVER_CORRECTNESS_WORKAROUNDS" ]
1942 }
Hal Canary75427132017-10-11 16:00:31 -04001943 sources = [
1944 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001945 "tools/skqp/gm_knowledge.cpp",
1946 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001947 ]
1948 deps = [
1949 ":gm",
1950 ":gpu_tool_utils",
1951 ":skia",
1952 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001953 ":tool_utils",
1954 ]
1955 }
1956 test_app("skqp") {
1957 sources = [
1958 "tools/skqp/skqp.cpp",
1959 ]
1960 deps = [
1961 ":skia",
1962 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05001963 ":tool_utils",
Hal Canary75427132017-10-11 16:00:31 -04001964 "//third_party/googletest",
1965 ]
1966 }
1967 }
Hal Canary28f89382017-12-12 09:42:14 -05001968 if (is_android && skia_enable_gpu) {
1969 test_app("skqp_app") {
1970 is_shared_library = true
1971 sources = [
1972 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
1973 ]
1974 deps = [
1975 ":skia",
1976 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05001977 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05001978 ]
1979 libs = [ "android" ]
1980 }
1981 }
Hal Canary75427132017-10-11 16:00:31 -04001982
Hal Canarya9de7602018-01-19 13:08:23 -05001983 test_app("list_gms") {
1984 sources = [
1985 "tools/list_gms.cpp",
1986 ]
1987 deps = [
1988 ":gm",
1989 ":skia",
1990 ]
1991 }
1992 test_app("list_gpu_unit_tests") {
1993 sources = [
1994 "dm/DMGpuTestProcs.cpp",
1995 "tools/list_gpu_unit_tests.cpp",
1996 ]
1997 deps = [
1998 ":skia",
1999 ":tests",
2000 ]
2001 }
2002
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04002003 if (skia_enable_gpu) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002004 test_lib("sk_app") {
2005 public_include_dirs = [ "tools/sk_app" ]
Brian Osman16adfa32016-10-18 14:42:44 -04002006 sources = [
Brian Osmaneff04b52017-11-21 13:18:02 -05002007 "tools/sk_app/CommandSet.cpp",
2008 "tools/sk_app/GLWindowContext.cpp",
2009 "tools/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002010 ]
Brian Osman2dd96932016-10-18 15:33:53 -04002011 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04002012
Jim Van Verth4e56a912016-10-21 10:58:52 -04002013 if (is_android) {
2014 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05002015 "tools/sk_app/android/GLWindowContext_android.cpp",
2016 "tools/sk_app/android/RasterWindowContext_android.cpp",
2017 "tools/sk_app/android/Window_android.cpp",
2018 "tools/sk_app/android/main_android.cpp",
2019 "tools/sk_app/android/surface_glue_android.cpp",
Jim Van Verth4e56a912016-10-21 10:58:52 -04002020 ]
Brian Osman462334e2017-02-09 11:22:57 -05002021 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04002022 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04002023 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05002024 "tools/sk_app/unix/GLWindowContext_unix.cpp",
2025 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
2026 "tools/sk_app/unix/Window_unix.cpp",
Brian Osmanfa916272017-12-01 09:18:20 -05002027 "tools/sk_app/unix/keysym2ucs.c",
Brian Osmaneff04b52017-11-21 13:18:02 -05002028 "tools/sk_app/unix/main_unix.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04002029 ]
Brian Osmanfa916272017-12-01 09:18:20 -05002030 libs += [
2031 "GL",
2032 "X11",
2033 ]
Brian Osman2dd96932016-10-18 15:33:53 -04002034 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04002035 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05002036 "tools/sk_app/win/GLWindowContext_win.cpp",
2037 "tools/sk_app/win/RasterWindowContext_win.cpp",
2038 "tools/sk_app/win/Window_win.cpp",
2039 "tools/sk_app/win/main_win.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002040 ]
Brian Salomon194db172017-08-17 14:37:06 -04002041 if (skia_use_angle) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002042 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04002043 }
Mike Klein43c25262016-10-20 10:17:47 -04002044 } else if (is_mac) {
2045 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05002046 "tools/sk_app/mac/GLWindowContext_mac.cpp",
2047 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
2048 "tools/sk_app/mac/Window_mac.cpp",
2049 "tools/sk_app/mac/main_mac.cpp",
Mike Klein43c25262016-10-20 10:17:47 -04002050 ]
Brian Osmanfa916272017-12-01 09:18:20 -05002051 libs += [
2052 "QuartzCore.framework",
2053 "Cocoa.framework",
2054 "Foundation.framework",
2055 ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04002056 } else if (is_ios) {
2057 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05002058 "tools/sk_app/ios/GLWindowContext_ios.cpp",
2059 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
2060 "tools/sk_app/ios/Window_ios.cpp",
2061 "tools/sk_app/ios/main_ios.cpp",
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04002062 ]
Brian Osman16adfa32016-10-18 14:42:44 -04002063 }
2064
2065 if (skia_use_vulkan) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002066 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04002067 if (is_android) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002068 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04002069 } else if (is_linux) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002070 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
Brian Osman2dd96932016-10-18 15:33:53 -04002071 libs += [ "X11-xcb" ]
2072 } else if (is_win) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002073 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Brian Osman16adfa32016-10-18 14:42:44 -04002074 }
2075 }
2076
Brian Osman16adfa32016-10-18 14:42:44 -04002077 deps = [
Brian Osman16adfa32016-10-18 14:42:44 -04002078 ":gpu_tool_utils",
Brian Osman16adfa32016-10-18 14:42:44 -04002079 ":skia",
2080 ":tool_utils",
2081 ":views",
Brian Osman16adfa32016-10-18 14:42:44 -04002082 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04002083 if (is_android) {
2084 deps += [ "//third_party/native_app_glue" ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04002085 } else if (is_mac || is_ios) {
Mike Klein43c25262016-10-20 10:17:47 -04002086 deps += [ "//third_party/libsdl" ]
2087 }
Brian Salomon194db172017-08-17 14:37:06 -04002088 if (skia_use_angle) {
2089 deps += [ "//third_party/angle2" ]
2090 }
Mike Kleina92c3832016-12-08 09:49:39 -05002091 }
Brian Osman16adfa32016-10-18 14:42:44 -04002092 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002093
Brian Osmaneff04b52017-11-21 13:18:02 -05002094 if (skia_enable_gpu) {
2095 test_app("viewer") {
2096 is_shared_library = is_android
Jim Van Verth329c5a62017-11-29 11:42:33 -05002097 if (is_ios) {
2098 bundle_ios_data = true
2099 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002100 sources = [
Chris Dalton2d18f412018-02-20 13:23:32 -07002101 "tools/viewer/BisectSlide.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05002102 "tools/viewer/GMSlide.cpp",
Brian Osmand67e5182017-12-08 16:46:09 -05002103 "tools/viewer/ImGuiLayer.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05002104 "tools/viewer/ImageSlide.cpp",
2105 "tools/viewer/SKPSlide.cpp",
2106 "tools/viewer/SampleSlide.cpp",
Florin Malita76a076b2018-02-15 18:40:48 -05002107 "tools/viewer/SlideDir.cpp",
Brian Osman56a24812017-12-19 11:15:16 -05002108 "tools/viewer/StatsLayer.cpp",
Florin Malitac659c2c2018-04-05 11:57:21 -04002109 "tools/viewer/SvgSlide.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05002110 "tools/viewer/Viewer.cpp",
2111 ]
2112 libs = []
2113
2114 include_dirs = []
2115 deps = [
Florin Malitabcd07232018-01-31 11:08:58 -05002116 ":experimental_sksg",
Florin Malitac659c2c2018-04-05 11:57:21 -04002117 ":experimental_svg_model",
Brian Osmaneff04b52017-11-21 13:18:02 -05002118 ":flags",
2119 ":gm",
2120 ":gpu_tool_utils",
2121 ":samples",
2122 ":sk_app",
2123 ":skia",
2124 ":tool_utils",
2125 ":views",
2126 "//third_party/imgui",
2127 "//third_party/jsoncpp",
2128 ]
Florin Malita87ccf332018-05-04 12:23:24 -04002129
2130 if (skia_enable_skottie) {
2131 sources += [ "tools/viewer/SkottieSlide.cpp" ]
2132 deps += [ ":experimental_skottie" ]
2133 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002134 }
2135 }
2136
2137 if (skia_enable_gpu && !skia_use_angle && (is_linux || is_win || is_mac)) {
2138 test_app("HelloWorld") {
2139 sources = [
2140 "example/HelloWorld.cpp",
2141 ]
2142 libs = []
2143
2144 include_dirs = []
2145 deps = [
2146 ":flags",
2147 ":gpu_tool_utils",
2148 ":sk_app",
2149 ":skia",
2150 ":tool_utils",
2151 ":views",
2152 ]
2153 }
2154 }
2155
Jim Van Verthecfed2b2017-08-30 14:02:50 -04002156 if (skia_enable_gpu && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002157 test_app("SkiaSDLExample") {
2158 sources = [
2159 "example/SkiaSDLExample.cpp",
2160 ]
2161 libs = []
2162 include_dirs = []
2163 deps = [
2164 ":gpu_tool_utils",
2165 ":skia",
2166 "//third_party/libsdl",
2167 ]
2168 }
2169 }
2170
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002171 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2172 action_foreach("generate_mocs") {
2173 script = "gn/call.py"
2174 sources = [
2175 "tools/mdbviz/MainWindow.h",
2176 ]
2177 outputs = [
2178 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2179 ]
2180 args = [
2181 "$skia_qt_path" + "/bin/moc",
2182 "{{source}}",
2183 "-o",
2184 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2185 ]
2186 }
2187 action_foreach("generate_resources") {
2188 script = "gn/call.py"
2189 sources = [
2190 "tools/mdbviz/resources.qrc",
2191 ]
2192 outputs = [
2193 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2194 ]
2195 args = [
2196 "$skia_qt_path" + "/bin/rcc",
2197 "{{source}}",
2198 "-o",
2199 "gen/mdbviz/{{source_name_part}}_res.cpp",
2200 ]
2201 }
2202 test_app("mdbviz") {
2203 if (is_win) {
2204 # on Windows we need to disable some exception handling warnings due to the Qt headers
2205 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2206 }
2207 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002208 "tools/UrlDataManager.cpp",
2209 "tools/debugger/SkDebugCanvas.cpp",
2210 "tools/debugger/SkDrawCommand.cpp",
2211 "tools/debugger/SkJsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002212 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002213 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002214 "tools/mdbviz/main.cpp",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002215 "tools/picture_utils.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002216
2217 # generated files
2218 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2219 "$target_gen_dir/mdbviz/resources_res.cpp",
2220 ]
2221 lib_dirs = [ "$skia_qt_path/lib" ]
2222 libs = [
2223 "Qt5Core.lib",
2224 "Qt5Gui.lib",
2225 "Qt5Widgets.lib",
2226 ]
2227 include_dirs = [
2228 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002229 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002230 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002231 "tools",
2232 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002233 ]
2234 deps = [
2235 ":generate_mocs",
2236 ":generate_resources",
2237 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002238 "//third_party/jsoncpp",
2239 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002240 ]
2241 }
2242 }
2243
Mike Kleine459afd2017-03-03 09:21:30 -05002244 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002245 copy("gdbserver") {
2246 sources = [
2247 "$ndk/$ndk_gdbserver",
2248 ]
2249 outputs = [
2250 "$root_out_dir/gdbserver",
2251 ]
2252 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002253 }
mtklein25c81d42016-07-27 13:55:26 -07002254}