blob: dcecf2184ef2e91b224a2c3031a58a38145d89a1 [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 Klein69f6ed42016-10-13 15:45:07 -040024 skia_use_gdi = false
Mike Klein7d302882016-11-03 14:06:31 -040025 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
mtklein63213812016-08-24 09:55:56 -070026 skia_use_libjpeg_turbo = true
27 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070028 skia_use_libwebp = !is_fuchsia
Mike Klein38af9432016-11-11 11:39:44 -050029 skia_use_lua = false
mtkleina627b5c2016-09-20 13:36:47 -070030 skia_use_mesa = false
Mike Klein10d665d2016-11-01 11:46:10 -040031 skia_use_piex = !is_win
mtklein63213812016-08-24 09:55:56 -070032 skia_use_zlib = true
Greg Daniele5ddff52017-07-05 16:49:36 -040033 skia_use_metal = false
Mike Klein36f182f2017-10-20 12:33:53 -040034 skia_use_libheif = is_skia_dev_build
mtklein1bd72ba2016-09-16 07:45:52 -070035
Mike Klein7d921032017-01-05 12:20:41 -050036 skia_android_serial = ""
Brian Osman3f375d02016-12-28 11:19:22 -050037 skia_enable_discrete_gpu = true
Mike Kleina04bb452017-02-09 12:24:07 -050038 skia_enable_effects = true
Brian Osmanf2c90142017-07-13 15:50:03 -040039 skia_enable_flutter_defines = false
mtklein06c35c02016-09-20 12:28:12 -070040 skia_enable_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050041 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040042 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Mike Klein3669a822017-03-03 10:55:02 -050043 skia_enable_tools = is_skia_dev_build
44 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Greg Daniel686bb212016-10-27 10:48:48 -040045 skia_vulkan_sdk = getenv("VULKAN_SDK")
Robert Phillipsa6d2d702017-09-01 12:17:03 -040046 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040047 skia_compile_processors = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070048 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040049
50 skia_jumper_clang = ""
51 skia_jumper_objdump = ""
52 skia_jumper_ccache = ""
mtkleinc04ff472016-06-23 10:29:30 -070053}
Brian Salomon23d73ea2016-10-27 13:31:37 -040054declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040055 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040056 skia_use_sfntly = skia_use_icu
57
Mike Klein4d598a32016-10-31 13:44:49 -040058 if (is_android) {
59 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070060 } else if (is_fuchsia) {
61 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040062 } else {
63 skia_use_vulkan = skia_vulkan_sdk != ""
64 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040065}
Greg Danielec6ae522017-04-25 13:38:26 -040066declare_args() {
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +000067 skia_vulkan_headers = ""
Greg Danielec6ae522017-04-25 13:38:26 -040068 if (skia_use_vulkan) {
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +000069 # 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 -040070 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 Danielec6ae522017-04-25 13:38:26 -040074 }
Greg Danielec6ae522017-04-25 13:38:26 -040075 }
76}
Brian Salomon789e25e2016-09-30 13:41:03 -040077
Adam Barth54ef74a2017-10-13 10:59:38 -070078if (defined(skia_settings)) {
79 import(skia_settings)
80}
81
mtklein38925aa2016-09-21 10:11:25 -070082# Our tools require static linking (they use non-exported symbols).
83skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070084
mtkleina45be612016-08-29 15:22:10 -070085fontmgr_android_enabled = skia_use_expat && skia_use_freetype
86
mtklein1211e0c2016-07-26 13:55:45 -070087skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070088 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070089 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070090 "include/codec",
91 "include/config",
92 "include/core",
93 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -040094 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -070095 "include/gpu",
96 "include/gpu/gl",
mtklein1211e0c2016-07-26 13:55:45 -070097 "include/pathops",
98 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070099 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -0700100 "include/utils",
101 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -0700102]
103
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000104if (skia_use_vulkan) {
105 skia_public_includes += [ "include/gpu/vk" ]
106}
Greg Daniele5ddff52017-07-05 16:49:36 -0400107if (skia_use_metal) {
108 skia_public_includes += [ "include/gpu/mtl" ]
109}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000110
mtkleinc04ff472016-06-23 10:29:30 -0700111# Skia public API, generally provided by :skia.
112config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700113 include_dirs = skia_public_includes
Greg Danielec6ae522017-04-25 13:38:26 -0400114 if (skia_vulkan_headers != "") {
115 include_dirs += [ skia_vulkan_headers ]
116 }
Mike Kleinae7e6712016-10-11 17:49:33 -0400117 defines = []
118 if (is_component_build) {
119 defines += [ "SKIA_DLL" ]
120 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400121 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700122 defines += [ "SK_SAMPLES_FOR_X" ]
123 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400124 if (skia_enable_flutter_defines) {
125 defines += flutter_defines
126 }
mtklein06c35c02016-09-20 12:28:12 -0700127 if (!skia_enable_gpu) {
128 defines += [ "SK_SUPPORT_GPU=0" ]
129 }
mtkleinc04ff472016-06-23 10:29:30 -0700130}
131
132# Skia internal APIs, used by Skia itself and a few test tools.
133config("skia_private") {
134 visibility = [ ":*" ]
135
136 include_dirs = [
137 "include/private",
138 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700139 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700140 "src/core",
141 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700142 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700143 "src/image",
144 "src/images",
145 "src/lazy",
146 "src/opts",
147 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700148 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700149 "src/ports",
150 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400151 "src/shaders",
152 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700153 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700154 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700155 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500156 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700157 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700158 ]
mtklein150d1132016-08-01 06:56:40 -0700159
Mike Reeda9e241d2017-05-03 10:52:00 -0400160 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700161 if (is_android) {
162 defines += [
163 "SK_GAMMA_EXPONENT=1.4",
164 "SK_GAMMA_CONTRAST=0.0",
165 ]
166 }
mtklein88a7ac02016-09-14 11:16:49 -0700167 if (is_official_build || is_android) {
168 # TODO(bsalomon): it'd be nice to make Android normal.
169 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
170 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400171 libs = []
172 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500173 if (skia_enable_gpu) {
174 include_dirs += [ "src/gpu" ]
175 }
Brian Osman34755e22016-12-05 09:46:02 -0500176 if (skia_use_angle) {
177 defines += [ "SK_ANGLE" ]
178 }
Brian Osman3f375d02016-12-28 11:19:22 -0500179 if (skia_enable_discrete_gpu) {
180 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
181 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400182 if (!is_official_build) {
183 defines += [ "GR_TEST_UTILS=1" ]
184 }
mtkleinc04ff472016-06-23 10:29:30 -0700185}
186
187# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
188config("skia_library") {
189 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700190 defines = [ "SKIA_IMPLEMENTATION=1" ]
191}
192
193skia_library_configs = [
194 ":skia_public",
195 ":skia_private",
196 ":skia_library",
197]
198
mtklein9b8583d2016-08-24 17:32:30 -0700199# Use for CPU-specific Skia code that needs particular compiler flags.
200template("opts") {
201 if (invoker.enabled) {
202 source_set(target_name) {
203 forward_variables_from(invoker, "*")
204 configs += skia_library_configs
205 }
206 } else {
207 # If not enabled, a phony empty target that swallows all otherwise unused variables.
208 source_set(target_name) {
209 forward_variables_from(invoker,
210 "*",
211 [
212 "sources",
213 "cflags",
214 ])
215 }
216 }
anmittala7eaf2e2016-08-17 13:57:26 -0700217}
218
mtklein422310d2016-08-16 18:28:43 -0700219is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700220
mtklein7d6fb2c2016-08-25 14:50:44 -0700221opts("none") {
222 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700223 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700224 cflags = []
225}
226
mtklein7d6fb2c2016-08-25 14:50:44 -0700227opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700228 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700229 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700230 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700231}
232
233opts("arm64") {
234 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700235 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700236 cflags = []
237}
238
239opts("crc32") {
240 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700241 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700242 cflags = [ "-march=armv8-a+crc" ]
243}
244
mtklein9b8583d2016-08-24 17:32:30 -0700245opts("sse2") {
246 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700247 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400248 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400249 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
250 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400251 cflags = [ "-msse2" ]
252 }
mtklein9b8583d2016-08-24 17:32:30 -0700253}
mtkleinc04ff472016-06-23 10:29:30 -0700254
mtklein9b8583d2016-08-24 17:32:30 -0700255opts("ssse3") {
256 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700257 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400258 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400259 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
260 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400261 cflags = [ "-mssse3" ]
262 }
mtklein9b8583d2016-08-24 17:32:30 -0700263}
mtkleinc04ff472016-06-23 10:29:30 -0700264
mtklein9b8583d2016-08-24 17:32:30 -0700265opts("sse41") {
266 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700267 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400268 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400269 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
270 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400271 cflags = [ "-msse4.1" ]
272 }
mtklein9b8583d2016-08-24 17:32:30 -0700273}
mtklein4e976072016-08-08 09:06:27 -0700274
mtklein9b8583d2016-08-24 17:32:30 -0700275opts("sse42") {
276 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700277 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400278 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400279 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
280 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400281 cflags = [ "-msse4.2" ]
282 }
mtklein9b8583d2016-08-24 17:32:30 -0700283}
284
285opts("avx") {
286 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700287 sources = skia_opts.avx_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400288 if (!is_clang && is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000289 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400290 } else {
291 cflags = [ "-mavx" ]
292 }
mtkleinc04ff472016-06-23 10:29:30 -0700293}
294
mtkleinc095df52016-08-24 12:23:52 -0700295# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700296template("optional") {
297 if (invoker.enabled) {
298 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700299 if (defined(invoker.public_defines)) {
300 defines = invoker.public_defines
301 }
mtklein457b42a2016-08-23 13:56:37 -0700302 }
303 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700304 forward_variables_from(invoker,
305 "*",
306 [
307 "public_defines",
308 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700309 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700310 ])
mtklein457b42a2016-08-23 13:56:37 -0700311 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700312 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700313 if (defined(invoker.configs_to_remove)) {
314 configs -= invoker.configs_to_remove
315 }
mtklein457b42a2016-08-23 13:56:37 -0700316 }
317 } else {
mtklein457b42a2016-08-23 13:56:37 -0700318 source_set(target_name) {
319 forward_variables_from(invoker,
320 "*",
321 [
322 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700323 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700324 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700325 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700326 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700327 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700328 ])
mtkleincd01b032016-08-31 04:58:19 -0700329 if (defined(invoker.sources_when_disabled)) {
330 sources = invoker.sources_when_disabled
331 }
332 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700333 }
mtkleineb3c4252016-08-23 07:38:09 -0700334 }
mtklein457b42a2016-08-23 13:56:37 -0700335}
mtklein457b42a2016-08-23 13:56:37 -0700336
Mike Kleina04bb452017-02-09 12:24:07 -0500337optional("effects") {
338 enabled = skia_enable_effects
Ethan Nicholas762466e2017-06-29 10:03:38 -0400339 deps = [
340 ":compile_processors",
341 ]
Mike Kleina04bb452017-02-09 12:24:07 -0500342 sources =
343 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
344 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
345}
346
mtkleina45be612016-08-29 15:22:10 -0700347optional("fontmgr_android") {
348 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700349
350 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500351 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700352 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700353 ]
354 sources = [
355 "src/ports/SkFontMgr_android.cpp",
356 "src/ports/SkFontMgr_android_factory.cpp",
357 "src/ports/SkFontMgr_android_parser.cpp",
358 ]
359}
360
mtkleind2e39db2016-09-07 07:52:55 -0700361optional("fontmgr_custom") {
362 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
363
364 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500365 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700366 ]
367 sources = [
368 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500369 "src/ports/SkFontMgr_custom.h",
370 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700371 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500372 "src/ports/SkFontMgr_custom_embedded.cpp",
373 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700374 ]
375}
376
mtklein3cc22182016-08-29 13:26:14 -0700377optional("fontmgr_fontconfig") {
378 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700379
380 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500381 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700382 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700383 ]
384 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700385 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700386 "src/ports/SkFontConfigInterface_direct.cpp",
387 "src/ports/SkFontConfigInterface_direct_factory.cpp",
388 "src/ports/SkFontMgr_FontConfigInterface.cpp",
389 "src/ports/SkFontMgr_fontconfig.cpp",
390 "src/ports/SkFontMgr_fontconfig_factory.cpp",
391 ]
392}
393
mtkleincdedd0e2016-09-12 15:15:44 -0700394optional("fontmgr_fuchsia") {
395 enabled = is_fuchsia && skia_use_freetype
396
397 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500398 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700399 ]
400 sources = [
401 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500402 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700403 "src/ports/SkFontMgr_custom_empty_factory.cpp",
404 ]
405}
406
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700407if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400408 executable("sksllex") {
409 sources = [
410 "src/sksl/lex/Main.cpp",
411 "src/sksl/lex/NFA.cpp",
412 "src/sksl/lex/RegexNode.cpp",
413 "src/sksl/lex/RegexParser.cpp",
414 ]
415 include_dirs = [ "src/sksl/lex" ]
416 }
417
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700418 action("run_sksllex") {
419 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400420 deps = [
421 ":sksllex(//gn/toolchain:$host_toolchain)",
422 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700423 sources = [
424 "src/sksl/lex/layout.lex",
425 "src/sksl/lex/sksl.lex",
426 ]
427
428 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
429 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
430 outputs = [
431 "$target_out_dir/" +
432 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
433 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
434 # confused due to the same file being named by two different paths
435 ]
436 sksllex_path = "$root_out_dir/"
437 sksllex_path += "sksllex"
438 if (host_os == "win") {
439 sksllex_path += ".exe"
440 }
441 args = [
442 rebase_path(sksllex_path),
443 rebase_path("bin/clang-format"),
444 rebase_path("src"),
445 ]
446 }
447} else {
448 group("run_sksllex") {
449 }
450}
451
452if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400453 executable("skslc") {
454 defines = [ "SKSL_STANDALONE" ]
455 sources = [
456 "src/sksl/SkSLMain.cpp",
457 ]
458 sources += skia_sksl_sources
459 include_dirs = [
460 "src/gpu",
461 "src/sksl",
462 ]
463 deps = [
464 "//third_party/spirv-tools",
465 ]
466 }
467
468 skia_gpu_processor_outputs = []
469 foreach(src, skia_gpu_processor_sources) {
470 dir = get_path_info(src, "dir")
471 name = get_path_info(src, "name")
472
473 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
474 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
475 skia_gpu_processor_outputs += [
476 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
477 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
478 # confused due to the same file being named by two different paths
479 ]
480 }
481
482 action("compile_processors") {
483 script = "gn/compile_processors.py"
484 deps = [
485 ":skslc(//gn/toolchain:$host_toolchain)",
486 ]
487 sources = skia_gpu_processor_sources
488 outputs = skia_gpu_processor_outputs
489 skslc_path = "$root_out_dir/"
490 if (host_toolchain != default_toolchain_name) {
491 skslc_path += "$host_toolchain/"
492 }
493 skslc_path += "skslc"
494 if (host_os == "win") {
495 skslc_path += ".exe"
496 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400497 args = [
498 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400499 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400500 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400501 args += rebase_path(skia_gpu_processor_sources)
502 }
503} else {
504 skia_gpu_processor_outputs = []
505 group("compile_processors") {
506 }
507}
508
mtklein06c35c02016-09-20 12:28:12 -0700509optional("gpu") {
510 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400511 deps = [
512 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700513 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400514 ]
mtkleine9fb3d52016-09-20 15:11:46 -0700515 public_defines = []
516
Mike Klein29b3e582017-02-09 11:57:32 -0500517 sources = skia_gpu_sources + skia_sksl_sources +
Ethan Nicholas762466e2017-06-29 10:03:38 -0400518 [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ] +
519 skia_gpu_processor_outputs
mtklein06c35c02016-09-20 12:28:12 -0700520
521 # These paths need to be absolute to match the ones produced by shared_sources.gni.
522 sources -= get_path_info([
523 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
524 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
525 ],
526 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400527 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700528 if (is_android) {
529 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400530
531 # this lib is required to link against AHardwareBuffer
532 if (defined(ndk_api) && ndk_api >= 26) {
533 libs += [ "android" ]
534 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400535 } else if (skia_use_egl) {
536 sources += [ "src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp" ]
537 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700538 } else if (is_linux) {
539 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500540 libs += [
541 "GL",
542 "GLU",
543 ]
mtklein06c35c02016-09-20 12:28:12 -0700544 } else if (is_mac) {
545 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800546 } else if (is_ios) {
547 sources += [ "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400548 } else if (is_win) {
549 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
550 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700551 } else {
552 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
553 }
mtkleine9fb3d52016-09-20 15:11:46 -0700554
555 if (skia_use_vulkan) {
556 public_defines += [ "SK_VULKAN" ]
557 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700558 if (skia_enable_vulkan_debug_layers) {
559 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
560 }
mtkleine9fb3d52016-09-20 15:11:46 -0700561 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400562 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400563 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400564 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
565 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400566
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400567 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400568 if (skia_use_metal) {
569 public_defines += [ "SK_METAL" ]
570 sources += skia_metal_sources
571 libs += [ "Metal.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400572 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400573 }
mtklein06c35c02016-09-20 12:28:12 -0700574}
575
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400576optional("heif") {
577 enabled = skia_use_libheif
578 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
579
580 deps = []
581
582 sources = [
583 "src/codec/SkHeifCodec.cpp",
584 ]
585}
586
mtklein63213812016-08-24 09:55:56 -0700587optional("jpeg") {
588 enabled = skia_use_libjpeg_turbo
589 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
590
mtklein63213812016-08-24 09:55:56 -0700591 deps = [
592 "//third_party/libjpeg-turbo:libjpeg",
593 ]
594 sources = [
595 "src/codec/SkJpegCodec.cpp",
596 "src/codec/SkJpegDecoderMgr.cpp",
597 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700598 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400599 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700600 ]
601}
602
603optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500604 enabled = skia_use_zlib && skia_enable_pdf
605 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700606
mtklein63213812016-08-24 09:55:56 -0700607 deps = [
608 "//third_party/zlib",
609 ]
brettwb9447282016-09-01 14:24:39 -0700610 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700611 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700612
613 if (skia_use_sfntly) {
614 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500615 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700616 }
617}
618
619optional("png") {
620 enabled = skia_use_libpng
621 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
622
mtklein63213812016-08-24 09:55:56 -0700623 deps = [
624 "//third_party/libpng",
625 ]
626 sources = [
627 "src/codec/SkIcoCodec.cpp",
628 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400629 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700630 ]
631}
632
scroggof84ad642016-10-31 09:02:57 -0700633optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400634 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700635 public_defines = [ "SK_CODEC_DECODES_RAW" ]
636
637 deps = [
638 "//third_party/dng_sdk",
639 "//third_party/libjpeg-turbo:libjpeg",
640 "//third_party/piex",
641 ]
642
643 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
644 # Skia.
645 configs_to_remove = [ "//gn:no_exceptions" ]
646
647 sources = [
648 "src/codec/SkRawAdapterCodec.cpp",
649 "src/codec/SkRawCodec.cpp",
650 ]
651}
652
mtklein3cc22182016-08-29 13:26:14 -0700653optional("typeface_freetype") {
654 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700655
656 deps = [
657 "//third_party/freetype2",
658 ]
659 sources = [
660 "src/ports/SkFontHost_FreeType.cpp",
661 "src/ports/SkFontHost_FreeType_common.cpp",
662 ]
663}
664
mtklein457b42a2016-08-23 13:56:37 -0700665optional("webp") {
666 enabled = skia_use_libwebp
667 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
668
mtklein457b42a2016-08-23 13:56:37 -0700669 deps = [
670 "//third_party/libwebp",
671 ]
672 sources = [
673 "src/codec/SkWebpAdapterCodec.cpp",
674 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400675 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700676 ]
mtkleineb3c4252016-08-23 07:38:09 -0700677}
678
mtklein63213812016-08-24 09:55:56 -0700679optional("xml") {
680 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000681 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700682
mtklein63213812016-08-24 09:55:56 -0700683 deps = [
684 "//third_party/expat",
685 ]
686 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500687 "src/svg/SkSVGCanvas.cpp",
688 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700689 "src/xml/SkDOM.cpp",
690 "src/xml/SkXMLParser.cpp",
691 "src/xml/SkXMLWriter.cpp",
692 ]
693}
694
mtkleinc04ff472016-06-23 10:29:30 -0700695component("skia") {
696 public_configs = [ ":skia_public" ]
697 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700698
699 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700700 ":arm64",
701 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700702 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700703 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500704 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700705 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700706 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700707 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700708 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700709 ":gpu",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400710 ":heif",
mtklein63213812016-08-24 09:55:56 -0700711 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700712 ":none",
mtklein63213812016-08-24 09:55:56 -0700713 ":pdf",
714 ":png",
scroggof84ad642016-10-31 09:02:57 -0700715 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700716 ":sse2",
717 ":sse41",
718 ":sse42",
719 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700720 ":webp",
mtklein63213812016-08-24 09:55:56 -0700721 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700722 ]
723
Chinmay Garde43f115c2016-11-16 15:04:12 -0800724 # This file (and all GN files in Skia) are designed to work with an
725 # empty sources assignment filter; we handle all that explicitly.
726 # We clear the filter here for clients who may have set up a global filter.
727 set_sources_assignment_filter([])
728
mtkleinc04ff472016-06-23 10:29:30 -0700729 sources = []
brettwb9447282016-09-01 14:24:39 -0700730 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700731 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500732 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700733 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400734 "src/android/SkAndroidFrameworkUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700735 "src/android/SkBitmapRegionCodec.cpp",
736 "src/android/SkBitmapRegionDecoder.cpp",
737 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400738 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700739 "src/codec/SkBmpCodec.cpp",
740 "src/codec/SkBmpMaskCodec.cpp",
741 "src/codec/SkBmpRLECodec.cpp",
742 "src/codec/SkBmpStandardCodec.cpp",
743 "src/codec/SkCodec.cpp",
744 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700745 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700746 "src/codec/SkMaskSwizzler.cpp",
747 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700748 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700749 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700750 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700751 "src/codec/SkSwizzler.cpp",
752 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700753 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700754 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700755 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700756 "src/ports/SkMemory_malloc.cpp",
757 "src/ports/SkOSFile_stdio.cpp",
758 "src/sfnt/SkOTTable_name.cpp",
759 "src/sfnt/SkOTUtils.cpp",
760 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700761 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700762 ]
brettwb9447282016-09-01 14:24:39 -0700763
mtklein7d6fb2c2016-08-25 14:50:44 -0700764 libs = []
765
mtkleinc04ff472016-06-23 10:29:30 -0700766 if (is_win) {
767 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400768 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700769 "src/ports/SkDebug_win.cpp",
770 "src/ports/SkFontHost_win.cpp",
771 "src/ports/SkFontMgr_win_dw.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700772 "src/ports/SkImageEncoder_WIC.cpp",
773 "src/ports/SkImageGeneratorWIC.cpp",
774 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700775 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700776 "src/ports/SkScalerContext_win_dw.cpp",
777 "src/ports/SkTLS_win.cpp",
778 "src/ports/SkTypeface_win_dw.cpp",
779 ]
Mike Klein69f6ed42016-10-13 15:45:07 -0400780 if (skia_use_gdi) {
781 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
782 libs += [
783 "Gdi32.lib",
784 "Usp10.lib",
785 ]
786 } else {
787 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
788 }
Mike Klein4b167fc2016-10-11 18:13:53 -0400789 libs += [
790 "FontSub.lib",
791 "Ole32.lib",
792 "OleAut32.lib",
793 "User32.lib",
794 ]
mtkleinc04ff472016-06-23 10:29:30 -0700795 } else {
796 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700797 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700798 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700799 "src/ports/SkTLS_pthread.cpp",
800 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400801 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700802 }
803
mtklein7d6fb2c2016-08-25 14:50:44 -0700804 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500805 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500806 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500807 deps += [ "//third_party/cpu-features" ]
808 }
mtklein06c35c02016-09-20 12:28:12 -0700809 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700810 libs += [
811 "EGL",
812 "GLESv2",
813 "log",
814 ]
815 }
816
mtkleinc04ff472016-06-23 10:29:30 -0700817 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700818 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700819 }
820
821 if (is_mac) {
822 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700823 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700824 "src/ports/SkFontHost_mac.cpp",
825 "src/ports/SkImageEncoder_CG.cpp",
826 "src/ports/SkImageGeneratorCG.cpp",
827 ]
mtklein09e61f72016-08-23 13:35:28 -0700828 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400829 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
830 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700831 "ApplicationServices.framework",
832 "OpenGL.framework",
833 ]
mtkleinc04ff472016-06-23 10:29:30 -0700834 }
abarth6fc8ff02016-07-15 15:15:15 -0700835
Mike Klein7d302882016-11-03 14:06:31 -0400836 if (is_ios) {
837 sources += [
838 "src/ports/SkDebug_stdio.cpp",
839 "src/ports/SkFontHost_mac.cpp",
840 "src/ports/SkImageEncoder_CG.cpp",
841 "src/ports/SkImageGeneratorCG.cpp",
842 ]
843 libs += [
844 "CoreFoundation.framework",
845 "CoreGraphics.framework",
846 "CoreText.framework",
847 "ImageIO.framework",
848 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400849
850 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
851 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400852 ]
853 }
854
abarth6fc8ff02016-07-15 15:15:15 -0700855 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700856 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700857 }
mtkleinc04ff472016-06-23 10:29:30 -0700858}
859
mtkleinc095df52016-08-24 12:23:52 -0700860# Targets guarded by skia_enable_tools may use //third_party freely.
861if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500862 # Used by gn_to_bp.py to list our public include dirs.
863 source_set("public") {
864 configs += [ ":skia_public" ]
865 }
866
Mike Kleinc36dedf2016-11-18 09:35:28 -0500867 config("skia.h_config") {
868 include_dirs = [ "$target_gen_dir" ]
869 }
870 action("skia.h") {
871 public_configs = [ ":skia.h_config" ]
872 skia_h = "$target_gen_dir/skia.h"
873 script = "gn/find_headers.py"
Greg Danielc819e662017-04-19 16:39:45 -0400874 args = [ rebase_path(skia_h, root_build_dir) ] +
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000875 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -0500876 depfile = "$skia_h.deps"
877 outputs = [
878 skia_h,
879 ]
880 }
881
882 if (skia_enable_gpu && target_cpu == "x64") {
883 # Our bots only have 64-bit libOSMesa installed.
884 # TODO: worth fixing?
885 executable("fiddle") {
886 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -0500887 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500888 "tools/fiddle/draw.cpp",
889 "tools/fiddle/fiddle_main.cpp",
890 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400891
892 if (skia_use_egl) {
893 sources += [ "tools/fiddle/egl_context.cpp" ]
894 } else if (skia_use_mesa) {
895 sources += [ "tools/fiddle/mesa_context.cpp" ]
896 if (is_linux) {
897 libs += [ "OSMesa" ]
898 }
899 } else {
900 sources += [ "tools/fiddle/null_context.cpp" ]
901 }
Joe Gregorio1e735c02017-04-19 14:05:14 -0400902 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -0500903 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -0400904 ":flags",
Mike Kleinc36dedf2016-11-18 09:35:28 -0500905 ":skia",
906 ":skia.h",
907 ]
908 }
909 }
910
911 if (skia_enable_gpu) {
912 source_set("public_headers_warnings_check") {
913 sources = [
914 "tools/public_headers_warnings_check.cpp",
915 ]
916 configs -= [ "//gn:warnings_except_public_headers" ]
917 deps = [
918 ":skia",
919 ":skia.h",
920 ]
921 }
922 }
923
mtkleinc095df52016-08-24 12:23:52 -0700924 template("test_lib") {
925 config(target_name + "_config") {
926 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700927 if (defined(invoker.public_defines)) {
928 defines = invoker.public_defines
929 }
mtklein25c81d42016-07-27 13:55:26 -0700930 }
mtkleinc095df52016-08-24 12:23:52 -0700931 source_set(target_name) {
932 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
933 public_configs = [
934 ":" + target_name + "_config",
935 ":skia_private",
936 ]
937
938 if (!defined(deps)) {
939 deps = []
940 }
941 deps += [ ":skia" ]
942 testonly = true
943 }
mtklein25c81d42016-07-27 13:55:26 -0700944 }
mtklein25c81d42016-07-27 13:55:26 -0700945
Mike Kleine6682eb2017-01-05 10:54:57 -0500946 template("test_app") {
947 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
948 shared_library("lib" + target_name) {
949 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Mike Klein154e6da2017-07-26 15:13:47 -0400950 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -0500951 testonly = true
952 }
953 } else {
Mike Klein7d921032017-01-05 12:20:41 -0500954 _executable = target_name
955 executable(_executable) {
Mike Kleine6682eb2017-01-05 10:54:57 -0500956 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Mike Klein154e6da2017-07-26 15:13:47 -0400957 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -0500958 testonly = true
959 }
960 }
Mike Klein7d921032017-01-05 12:20:41 -0500961 if (is_android && skia_android_serial != "" && defined(_executable)) {
962 action("push_" + target_name) {
963 script = "gn/push_to_android.py"
964 deps = [
965 ":" + _executable,
966 ]
967 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
968 outputs = [
969 _stamp,
970 ]
971 args = [
972 rebase_path("$root_build_dir/$_executable"),
973 skia_android_serial,
974 rebase_path(_stamp),
975 ]
976 testonly = true
977 }
978 }
Mike Kleine6682eb2017-01-05 10:54:57 -0500979 }
980
mtkleinc095df52016-08-24 12:23:52 -0700981 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700982 public_include_dirs = []
983 if (skia_enable_gpu) {
984 public_defines = []
985 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700986
987 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700988 sources = [
989 "tools/gpu/GrContextFactory.cpp",
990 "tools/gpu/GrTest.cpp",
991 "tools/gpu/TestContext.cpp",
992 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -0700993 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700994 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
995 "tools/gpu/gl/debug/GrBufferObj.cpp",
996 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
997 "tools/gpu/gl/debug/GrProgramObj.cpp",
998 "tools/gpu/gl/debug/GrShaderObj.cpp",
999 "tools/gpu/gl/debug/GrTextureObj.cpp",
1000 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
1001 "tools/gpu/gl/null/NullGLTestContext.cpp",
Brian Salomoncfe910d2017-07-06 16:40:18 -04001002 "tools/gpu/mock/MockTestContext.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001003 ]
1004 libs = []
mtklein25c81d42016-07-27 13:55:26 -07001005
Kevin Lubick4a24e102017-03-29 11:19:01 -04001006 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -07001007 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -04001008 } else if (is_ios) {
1009 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1010 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -07001011 } else if (is_linux) {
1012 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001013 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -07001014 } else if (is_mac) {
1015 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001016 } else if (is_win) {
1017 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1018 libs += [
1019 "Gdi32.lib",
1020 "OpenGL32.lib",
1021 ]
mtklein38925aa2016-09-21 10:11:25 -07001022 }
mtklein6ef69992016-09-14 06:12:09 -07001023
Greg Daniel6b7e0e22017-07-12 16:21:09 -04001024 cflags_objcc = [ "-fobjc-arc" ]
1025
Mike Kleinc168a3a2016-11-14 14:53:13 +00001026 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +00001027 deps += [ "//third_party/angle2" ]
1028 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1029 }
mtklein38925aa2016-09-21 10:11:25 -07001030 if (skia_use_mesa) {
1031 public_defines += [ "SK_MESA" ]
1032 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
1033 libs += [ "OSMesa" ]
1034 }
mtkleind68f9b02016-09-23 13:18:41 -07001035 if (skia_use_vulkan) {
1036 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Greg Daniel35970ec2017-11-10 10:03:05 -05001037 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
mtkleind68f9b02016-09-23 13:18:41 -07001038 }
Greg Danielb76a72a2017-07-13 15:07:54 -04001039 if (skia_use_metal) {
1040 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
1041 }
mtkleina627b5c2016-09-20 13:36:47 -07001042 }
mtklein25c81d42016-07-27 13:55:26 -07001043 }
mtklein25c81d42016-07-27 13:55:26 -07001044
mtkleinc095df52016-08-24 12:23:52 -07001045 test_lib("flags") {
1046 public_include_dirs = [ "tools/flags" ]
1047 sources = [
1048 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001049 ]
1050 }
1051 test_lib("common_flags") {
1052 public_include_dirs = [ "tools/flags" ]
1053 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001054 "tools/flags/SkCommonFlags.cpp",
1055 "tools/flags/SkCommonFlagsConfig.cpp",
1056 ]
1057 deps = [
mtklein046cb562016-09-16 10:23:12 -07001058 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001059 ":gpu_tool_utils",
1060 ]
1061 }
mtklein25c81d42016-07-27 13:55:26 -07001062
mtkleinc095df52016-08-24 12:23:52 -07001063 test_lib("tool_utils") {
1064 public_include_dirs = [
1065 "tools",
1066 "tools/debugger",
1067 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001068 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001069 ]
1070 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001071 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001072 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001073 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001074 "tools/ProcStats.cpp",
1075 "tools/Resources.cpp",
Mike Klein10d66cc2017-11-10 11:33:43 -05001076 "tools/SkRandomScalerContext.cpp",
1077 "tools/SkTestScalerContext.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001078 "tools/ThermalManager.cpp",
1079 "tools/UrlDataManager.cpp",
1080 "tools/debugger/SkDebugCanvas.cpp",
1081 "tools/debugger/SkDrawCommand.cpp",
1082 "tools/debugger/SkJsonWriteBuffer.cpp",
1083 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001084 "tools/picture_utils.cpp",
1085 "tools/random_parse_path.cpp",
1086 "tools/sk_tool_utils.cpp",
1087 "tools/sk_tool_utils_font.cpp",
1088 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001089 "tools/trace/SkChromeTracingTracer.cpp",
1090 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001091 "tools/trace/SkDebugfTracer.cpp",
1092 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001093 "tools/trace/SkEventTracingPriv.cpp",
1094 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001095 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001096 libs = []
1097 if (is_ios) {
1098 sources += [ "tools/ios_utils.m" ]
1099 libs += [ "Foundation.framework" ]
1100 }
mtkleinc095df52016-08-24 12:23:52 -07001101 deps = [
mtklein046cb562016-09-16 10:23:12 -07001102 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001103 ":flags",
1104 "//third_party/libpng",
1105 ]
1106 public_deps = [
1107 "//third_party/jsoncpp",
1108 ]
1109 }
mtklein25c81d42016-07-27 13:55:26 -07001110
Mike Klein6e744122016-10-27 12:21:40 -04001111 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001112 test_lib("gm") {
1113 public_include_dirs = [ "gm" ]
1114 sources = gm_sources
1115 deps = [
scroggo19b91532016-10-24 09:03:26 -07001116 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001117 ":gpu_tool_utils",
1118 ":skia",
1119 ":tool_utils",
1120 ]
1121 }
mtklein25c81d42016-07-27 13:55:26 -07001122
Mike Klein6e744122016-10-27 12:21:40 -04001123 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001124 test_lib("tests") {
1125 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001126 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001127 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001128 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001129 }
mtkleinc095df52016-08-24 12:23:52 -07001130 deps = [
fmalita6cf896d2016-08-25 08:44:35 -07001131 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001132 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001133 ":skia",
1134 ":tool_utils",
1135 "//third_party/libpng",
1136 "//third_party/zlib",
1137 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001138 public_deps = [
1139 ":gpu_tool_utils", # Test.h #includes headers from this target.
1140 ]
mtkleinc095df52016-08-24 12:23:52 -07001141 }
mtklein2f3416d2016-08-02 16:02:05 -07001142
Mike Klein6e744122016-10-27 12:21:40 -04001143 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001144 test_lib("bench") {
1145 public_include_dirs = [ "bench" ]
1146 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001147 deps = [
1148 ":flags",
1149 ":gm",
1150 ":gpu_tool_utils",
1151 ":skia",
1152 ":tool_utils",
1153 ]
1154 }
mtklein2b6870c2016-07-28 14:17:33 -07001155
mtkleinc095df52016-08-24 12:23:52 -07001156 test_lib("experimental_svg_model") {
1157 public_include_dirs = [ "experimental/svg/model" ]
1158 sources = [
1159 "experimental/svg/model/SkSVGAttribute.cpp",
1160 "experimental/svg/model/SkSVGAttributeParser.cpp",
1161 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -05001162 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001163 "experimental/svg/model/SkSVGContainer.cpp",
1164 "experimental/svg/model/SkSVGDOM.cpp",
1165 "experimental/svg/model/SkSVGEllipse.cpp",
Florin Malitadf007e12017-10-09 15:14:13 -04001166 "experimental/svg/model/SkSVGGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001167 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001168 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001169 "experimental/svg/model/SkSVGNode.cpp",
1170 "experimental/svg/model/SkSVGPath.cpp",
Florin Malita1aa1bb62017-10-11 14:34:33 -04001171 "experimental/svg/model/SkSVGPattern.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001172 "experimental/svg/model/SkSVGPoly.cpp",
Florin Malitacc6cc292017-10-09 16:05:30 -04001173 "experimental/svg/model/SkSVGRadialGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001174 "experimental/svg/model/SkSVGRect.cpp",
1175 "experimental/svg/model/SkSVGRenderContext.cpp",
1176 "experimental/svg/model/SkSVGSVG.cpp",
1177 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001178 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001179 "experimental/svg/model/SkSVGTransformableNode.cpp",
Florin Malita6a69c052017-10-11 14:02:11 -04001180 "experimental/svg/model/SkSVGUse.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001181 "experimental/svg/model/SkSVGValue.cpp",
1182 ]
1183 deps = [
1184 ":skia",
1185 ]
1186 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001187
Kevin Lubickebf648e2017-09-21 13:45:16 -04001188 if (target_cpu != "wasm") {
1189 test_lib("views") {
1190 public_include_dirs = [ "include/views" ]
1191 sources = [
1192 "src/views/SkEvent.cpp",
1193 "src/views/SkEventSink.cpp",
1194 "src/views/SkOSMenu.cpp",
1195 "src/views/SkTagList.cpp",
1196 "src/views/SkTouchGesture.cpp",
1197 "src/views/SkView.cpp",
1198 "src/views/SkViewPriv.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001199 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001200 libs = []
1201 deps = []
1202 if (!is_android) {
1203 sources += [ "src/views/SkWindow.cpp" ]
1204 }
1205 if (is_linux) {
1206 public_include_dirs += [ "src/views/unix" ]
1207 sources += [
1208 "src/views/unix/SkOSWindow_Unix.cpp",
1209 "src/views/unix/keysym2ucs.c",
1210 ]
1211 libs += [
1212 "GL",
1213 "X11",
1214 ]
1215 } else if (is_mac) {
1216 sources += [
1217 "src/views/mac/SkEventNotifier.mm",
1218 "src/views/mac/SkNSView.mm",
1219 "src/views/mac/SkOSWindow_Mac.mm",
1220 "src/views/mac/SkTextFieldCell.m",
1221 ]
1222 libs += [
1223 "QuartzCore.framework",
1224 "Cocoa.framework",
1225 "Foundation.framework",
1226 ]
1227 } else if (is_win) {
1228 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
1229 } else if (is_ios) {
1230 sources += [ "src/views/mac/SkEventNotifier.mm" ]
1231 }
1232 if (skia_use_angle) {
1233 deps += [ "//third_party/angle2" ]
1234 }
Brian Osman34755e22016-12-05 09:46:02 -05001235 }
Brian Osman16adfa32016-10-18 14:42:44 -04001236 }
1237
Mike Klein38af9432016-11-11 11:39:44 -05001238 if (skia_use_lua) {
1239 test_lib("lua") {
1240 public_include_dirs = []
1241 sources = [
1242 "src/utils/SkLua.cpp",
1243 "src/utils/SkLuaCanvas.cpp",
1244 ]
1245 deps = [
1246 "//third_party/lua",
1247 ]
1248 }
1249
Mike Kleine6682eb2017-01-05 10:54:57 -05001250 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001251 sources = [
1252 "tools/lua/lua_app.cpp",
1253 ]
1254 deps = [
1255 ":lua",
1256 ":skia",
1257 "//third_party/lua",
1258 ]
Mike Klein38af9432016-11-11 11:39:44 -05001259 }
1260
Mike Kleine6682eb2017-01-05 10:54:57 -05001261 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001262 sources = [
1263 "tools/lua/lua_pictures.cpp",
1264 ]
1265 deps = [
1266 ":flags",
1267 ":lua",
1268 ":skia",
1269 ":tool_utils",
1270 "//third_party/lua",
1271 ]
Mike Klein38af9432016-11-11 11:39:44 -05001272 }
1273 }
1274
Cary Clark8032b982017-07-28 11:04:54 -04001275 test_app("bookmaker") {
1276 sources = [
1277 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001278 "tools/bookmaker/cataloger.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001279 "tools/bookmaker/fiddleParser.cpp",
1280 "tools/bookmaker/includeParser.cpp",
1281 "tools/bookmaker/includeWriter.cpp",
1282 "tools/bookmaker/mdOut.cpp",
1283 "tools/bookmaker/parserCommon.cpp",
1284 "tools/bookmaker/spellCheck.cpp",
1285 ]
1286 deps = [
1287 ":flags",
1288 ":skia",
1289 ":tool_utils",
1290 ]
1291 }
1292
Kevin Lubickebf648e2017-09-21 13:45:16 -04001293 if (target_cpu != "wasm") {
1294 import("gn/samples.gni")
1295 test_lib("samples") {
1296 public_include_dirs = [ "samplecode" ]
1297 include_dirs = [ "experimental" ]
1298 sources = samples_sources + [
1299 "experimental/SkSetPoly3To3.cpp",
1300 "experimental/SkSetPoly3To3_A.cpp",
1301 "experimental/SkSetPoly3To3_D.cpp",
Brian Osmancff94e42017-06-26 13:12:37 -04001302
Kevin Lubickebf648e2017-09-21 13:45:16 -04001303 # Relocating these files here, so that clients don't try to build them while they're
1304 # still in active development. Clang's thread safety analysis gets tripped up by
1305 # conditional locks.
1306 "src/core/SkThreadedBMPDevice.cpp",
1307 "src/core/SkThreadedBMPDevice.h",
1308 ]
1309 deps = [
1310 ":experimental_svg_model",
1311 ":flags",
1312 ":gm",
1313 ":tool_utils",
1314 ":views",
1315 ":xml",
1316 ]
Mike Klein38af9432016-11-11 11:39:44 -05001317
Kevin Lubickebf648e2017-09-21 13:45:16 -04001318 if (skia_use_lua) {
1319 sources += [ "samplecode/SampleLua.cpp" ]
1320 deps += [
1321 ":lua",
1322 "//third_party/lua",
1323 ]
1324 }
1325 }
1326 test_app("dm") {
1327 sources = [
1328 "dm/DM.cpp",
Mike Klein31868212017-11-06 12:02:47 -05001329 "dm/DMFontMgr.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001330 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001331 "dm/DMJsonWriter.cpp",
1332 "dm/DMSrcSink.cpp",
1333 ]
1334 include_dirs = [ "tests" ]
1335 deps = [
1336 ":common_flags",
1337 ":experimental_svg_model",
1338 ":flags",
1339 ":gm",
1340 ":gpu_tool_utils",
1341 ":skia",
1342 ":tests",
1343 ":tool_utils",
1344 "//third_party/jsoncpp",
1345 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001346 ]
1347 }
Brian Osman16adfa32016-10-18 14:42:44 -04001348 }
1349
Mike Klein06432b22017-03-21 13:14:33 -04001350 test_app("ok") {
1351 sources = [
Mike Klein361dde02017-11-07 08:14:52 -05001352 "dm/DMFontMgr.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001353 "tools/ok.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001354 "tools/ok_dsts.cpp",
Mike Klein154e6da2017-07-26 15:13:47 -04001355 "tools/ok_engines.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001356 "tools/ok_srcs.cpp",
Mike Kleind63442d2017-03-27 14:16:04 -04001357 "tools/ok_test.cpp",
Mike Kleinf5d1a552017-03-25 12:32:22 -04001358 "tools/ok_vias.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001359 ]
1360 deps = [
Mike Klein4f6e2712017-08-11 10:37:35 -04001361 ":bench",
Mike Klein06432b22017-03-21 13:14:33 -04001362 ":gm",
1363 ":skia",
Mike Kleind63442d2017-03-27 14:16:04 -04001364 ":tests",
Mike Klein62669ad2017-05-09 16:03:07 -04001365 ":tool_utils",
Mike Klein06432b22017-03-21 13:14:33 -04001366 ]
1367 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001368 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001369 sources = [
1370 "bench/nanobench.cpp",
1371 ]
1372 deps = [
1373 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001374 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001375 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001376 ":flags",
1377 ":gm",
1378 ":gpu_tool_utils",
1379 ":skia",
1380 ":tool_utils",
1381 "//third_party/jsoncpp",
1382 ]
mtklein2b6870c2016-07-28 14:17:33 -07001383 }
halcanary19a97202016-08-03 15:08:04 -07001384
Ravi Mistry10d36c52017-01-31 09:49:18 -05001385 test_app("skpinfo") {
1386 sources = [
1387 "tools/skpinfo.cpp",
1388 ]
1389 deps = [
1390 ":flags",
1391 ":skia",
1392 ]
1393 }
1394
Jim Van Verth57a98fc2016-10-28 13:35:50 -04001395 if (is_linux || is_win || is_mac) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001396 test_app("SampleApp") {
mtklein38925aa2016-09-21 10:11:25 -07001397 sources = [
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001398 "samplecode/SampleApp.cpp",
1399 "samplecode/SamplePictFile.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001400 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001401 if (is_mac) {
1402 sources += [ "src/views/mac/skia_mac.mm" ]
1403 } else if (is_win) {
1404 sources += [ "src/views/win/skia_win.cpp" ]
1405 } else if (is_linux) {
1406 sources += [ "src/views/unix/skia_unix.cpp" ]
1407 }
mtklein38925aa2016-09-21 10:11:25 -07001408 deps = [
1409 ":flags",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001410 ":gm",
mtklein38925aa2016-09-21 10:11:25 -07001411 ":gpu_tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001412 ":samples",
mtklein38925aa2016-09-21 10:11:25 -07001413 ":skia",
1414 ":tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001415 ":views",
mtklein38925aa2016-09-21 10:11:25 -07001416 ]
Mike Kleinc168a3a2016-11-14 14:53:13 +00001417 if (skia_use_angle) {
1418 deps += [ "//third_party/angle2" ]
1419 }
mtklein38925aa2016-09-21 10:11:25 -07001420 }
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001421 }
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001422
Jim Van Verthc1720d42017-10-09 10:16:01 -04001423 if (skia_enable_gpu && !skia_use_angle && (is_linux || is_win || is_mac)) {
1424 test_app("HelloWorld") {
1425 sources = [
1426 "example/HelloWorld.cpp",
1427 ]
1428 if (is_mac) {
1429 sources += [ "src/views/mac/skia_mac.mm" ]
1430 } else if (is_win) {
1431 sources += [ "src/views/win/skia_win.cpp" ]
1432 } else if (is_linux) {
1433 sources += [ "src/views/unix/skia_unix.cpp" ]
1434 }
1435 deps = [
1436 ":gpu_tool_utils",
1437 ":skia",
1438 ":views",
1439 ]
1440 }
1441 }
1442
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001443 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001444 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001445 sources = [
1446 "tools/skpbench/skpbench.cpp",
1447 ]
1448 deps = [
1449 ":flags",
1450 ":gpu_tool_utils",
1451 ":skia",
1452 ":tool_utils",
1453 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001454 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001455 }
1456
Mike Klein7d302882016-11-03 14:06:31 -04001457 # We can't yet build ICU on iOS or Windows.
Kevin Lubickebf648e2017-09-21 13:45:16 -04001458 if (!is_ios && !is_win && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001459 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001460 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001461 "tools/shape/SkShaper_harfbuzz.cpp",
1462 "tools/shape/using_skia_and_harfbuzz.cpp",
mtklein6f5df6a2016-08-29 16:01:10 -07001463 ]
1464 deps = [
1465 ":skia",
1466 "//third_party/harfbuzz",
Ben Wagnera25fbef2017-08-30 13:56:19 -04001467 "//third_party/icu",
mtklein6f5df6a2016-08-29 16:01:10 -07001468 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001469 }
halcanary19a97202016-08-03 15:08:04 -07001470 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001471 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001472 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001473 "tools/shape/SkShaper_primitive.cpp",
1474 "tools/shape/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001475 ]
1476 deps = [
1477 ":skia",
1478 ]
halcanary3eee9d92016-09-10 07:01:53 -07001479 }
mtklein046cb562016-09-16 10:23:12 -07001480
Matt Sarett9f1c4032017-05-17 10:06:32 -04001481 test_app("create_flutter_test_images") {
1482 sources = [
1483 "tools/create_flutter_test_images.cpp",
1484 ]
1485 deps = [
1486 ":skia",
1487 ":tool_utils",
1488 ]
1489 }
1490
Ben Wagner219f3622017-07-17 15:32:25 -04001491 test_app("create_test_font") {
1492 sources = [
1493 "tools/create_test_font.cpp",
1494 ]
1495 deps = [
1496 ":skia",
1497 ]
1498 assert_no_deps = [
1499 # tool_utils requires the output of this app.
1500 ":tool_utils",
1501 ]
1502 }
1503
Mike Kleine6682eb2017-01-05 10:54:57 -05001504 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001505 sources = [
1506 "tools/get_images_from_skps.cpp",
1507 ]
1508 deps = [
1509 ":flags",
1510 ":skia",
1511 "//third_party/jsoncpp",
1512 ]
mtklein046cb562016-09-16 10:23:12 -07001513 }
mtkleinecbc5262016-09-22 11:51:24 -07001514
Mike Kleine6682eb2017-01-05 10:54:57 -05001515 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001516 sources = [
1517 "tools/colorspaceinfo.cpp",
1518 ]
1519 deps = [
1520 ":flags",
1521 ":skia",
1522 ":tool_utils",
1523 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001524 }
1525
Kevin Lubickebf648e2017-09-21 13:45:16 -04001526 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001527 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001528 sources = [
1529 "tools/skiaserve/Request.cpp",
1530 "tools/skiaserve/Response.cpp",
1531 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001532 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1533 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1534 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1535 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1536 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1537 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1538 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1539 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1540 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001541 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1542 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001543 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1544 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1545 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1546 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1547 ]
1548 deps = [
1549 ":flags",
1550 ":gpu_tool_utils",
1551 ":skia",
1552 ":tool_utils",
1553 "//third_party/jsoncpp",
1554 "//third_party/libmicrohttpd",
1555 "//third_party/libpng",
1556 ]
Mike Klein7d302882016-11-03 14:06:31 -04001557 }
mtkleinecbc5262016-09-22 11:51:24 -07001558 }
kjlubick14f984b2016-10-03 11:49:45 -07001559
Mike Kleine6682eb2017-01-05 10:54:57 -05001560 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07001561 sources = [
1562 "fuzz/FilterFuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001563 "fuzz/FuzzCanvas.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001564 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001565 "fuzz/FuzzGradients.cpp",
1566 "fuzz/FuzzParsePath.cpp",
1567 "fuzz/FuzzPathop.cpp",
1568 "fuzz/FuzzScaleToSides.cpp",
1569 "fuzz/fuzz.cpp",
1570 ]
1571 deps = [
1572 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001573 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001574 ":skia",
Hal Canarydb683012016-11-23 08:55:18 -07001575 ":tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001576 ]
kjlubick14f984b2016-10-03 11:49:45 -07001577 }
Mike Klein38312422016-10-05 15:41:01 -04001578
Mike Kleine6682eb2017-01-05 10:54:57 -05001579 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001580 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001581 rebase_path("tests/skia_test.cpp"),
1582 rebase_path("tests/Test.cpp"),
1583 ]
caryclark9feb6322016-10-25 08:58:26 -07001584 deps = [
1585 ":flags",
1586 ":gpu_tool_utils",
1587 ":skia",
1588 ":tool_utils",
1589 ]
caryclark9feb6322016-10-25 08:58:26 -07001590 }
1591
Mike Kleine6682eb2017-01-05 10:54:57 -05001592 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001593 sources = [
1594 "tools/DumpRecord.cpp",
1595 "tools/dump_record.cpp",
1596 ]
1597 deps = [
1598 ":flags",
1599 ":skia",
1600 ]
Mike Klein38312422016-10-05 15:41:01 -04001601 }
bungemanfe917272016-10-13 17:36:40 -04001602
Mike Kleine6682eb2017-01-05 10:54:57 -05001603 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001604 sources = [
1605 "tools/skdiff/skdiff.cpp",
1606 "tools/skdiff/skdiff_html.cpp",
1607 "tools/skdiff/skdiff_main.cpp",
1608 "tools/skdiff/skdiff_utils.cpp",
1609 ]
1610 deps = [
1611 ":skia",
1612 ":tool_utils",
1613 ]
bungemanfe917272016-10-13 17:36:40 -04001614 }
halcanarya73d76a2016-10-17 13:19:02 -07001615
Mike Kleine6682eb2017-01-05 10:54:57 -05001616 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001617 sources = [
1618 "tools/skp_parser.cpp",
1619 ]
1620 deps = [
1621 ":skia",
1622 ":tool_utils",
1623 "//third_party/jsoncpp",
1624 ]
halcanarya73d76a2016-10-17 13:19:02 -07001625 }
Brian Osman16adfa32016-10-18 14:42:44 -04001626
Hal Canary75427132017-10-11 16:00:31 -04001627 if (!is_win) {
1628 test_app("gpucts") {
1629 sources = [
1630 "dm/DMGpuTestProcs.cpp",
1631 "tools/gpucts/gm_knowledge.c",
1632 "tools/gpucts/gm_runner.cpp",
1633 "tools/gpucts/gpucts.cpp",
1634 ]
1635 deps = [
1636 ":gm",
1637 ":gpu_tool_utils",
1638 ":skia",
1639 ":tests",
1640 "//third_party/googletest",
1641 ]
1642 }
1643 }
1644
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001645 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001646 test_app("viewer") {
1647 is_shared_library = is_android
Brian Osman16adfa32016-10-18 14:42:44 -04001648 sources = [
1649 "tools/viewer/GMSlide.cpp",
1650 "tools/viewer/ImageSlide.cpp",
1651 "tools/viewer/SKPSlide.cpp",
1652 "tools/viewer/SampleSlide.cpp",
1653 "tools/viewer/Viewer.cpp",
1654 "tools/viewer/sk_app/CommandSet.cpp",
1655 "tools/viewer/sk_app/GLWindowContext.cpp",
1656 "tools/viewer/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001657 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001658 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001659
Jim Van Verth4e56a912016-10-21 10:58:52 -04001660 if (is_android) {
1661 sources += [
1662 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1663 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1664 "tools/viewer/sk_app/android/Window_android.cpp",
1665 "tools/viewer/sk_app/android/main_android.cpp",
1666 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1667 ]
Brian Osman462334e2017-02-09 11:22:57 -05001668 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001669 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001670 sources += [
1671 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1672 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1673 "tools/viewer/sk_app/unix/Window_unix.cpp",
1674 "tools/viewer/sk_app/unix/main_unix.cpp",
1675 ]
1676 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001677 sources += [
1678 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1679 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1680 "tools/viewer/sk_app/win/Window_win.cpp",
1681 "tools/viewer/sk_app/win/main_win.cpp",
1682 ]
Brian Salomon194db172017-08-17 14:37:06 -04001683 if (skia_use_angle) {
1684 sources += [ "tools/viewer/sk_app/win/ANGLEWindowContext_win.cpp" ]
1685 }
Mike Klein43c25262016-10-20 10:17:47 -04001686 } else if (is_mac) {
1687 sources += [
1688 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1689 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1690 "tools/viewer/sk_app/mac/Window_mac.cpp",
1691 "tools/viewer/sk_app/mac/main_mac.cpp",
1692 ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001693 } else if (is_ios) {
1694 sources += [
1695 "tools/viewer/sk_app/ios/GLWindowContext_ios.cpp",
1696 "tools/viewer/sk_app/ios/RasterWindowContext_ios.cpp",
1697 "tools/viewer/sk_app/ios/Window_ios.cpp",
1698 "tools/viewer/sk_app/ios/main_ios.cpp",
1699 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001700 }
1701
1702 if (skia_use_vulkan) {
1703 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001704 if (is_android) {
1705 sources +=
1706 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001707 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001708 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1709 libs += [ "X11-xcb" ]
1710 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001711 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1712 }
1713 }
1714
1715 include_dirs = []
1716 deps = [
1717 ":flags",
1718 ":gm",
1719 ":gpu_tool_utils",
1720 ":samples",
1721 ":skia",
1722 ":tool_utils",
1723 ":views",
Brian Osman79086b92017-02-10 13:36:16 -05001724 "//third_party/imgui",
Brian Osman16adfa32016-10-18 14:42:44 -04001725 "//third_party/jsoncpp",
1726 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001727 if (is_android) {
1728 deps += [ "//third_party/native_app_glue" ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001729 } else if (is_mac || is_ios) {
Mike Klein43c25262016-10-20 10:17:47 -04001730 deps += [ "//third_party/libsdl" ]
1731 }
Brian Salomon194db172017-08-17 14:37:06 -04001732 if (skia_use_angle) {
1733 deps += [ "//third_party/angle2" ]
1734 }
Mike Kleina92c3832016-12-08 09:49:39 -05001735 }
Brian Osman16adfa32016-10-18 14:42:44 -04001736 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001737
Jim Van Verthecfed2b2017-08-30 14:02:50 -04001738 if (skia_enable_gpu && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04001739 test_app("SkiaSDLExample") {
1740 sources = [
1741 "example/SkiaSDLExample.cpp",
1742 ]
1743 libs = []
1744 include_dirs = []
1745 deps = [
1746 ":gpu_tool_utils",
1747 ":skia",
1748 "//third_party/libsdl",
1749 ]
1750 }
1751 }
1752
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001753 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
1754 action_foreach("generate_mocs") {
1755 script = "gn/call.py"
1756 sources = [
1757 "tools/mdbviz/MainWindow.h",
1758 ]
1759 outputs = [
1760 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
1761 ]
1762 args = [
1763 "$skia_qt_path" + "/bin/moc",
1764 "{{source}}",
1765 "-o",
1766 "gen/mdbviz/{{source_name_part}}_moc.cpp",
1767 ]
1768 }
1769 action_foreach("generate_resources") {
1770 script = "gn/call.py"
1771 sources = [
1772 "tools/mdbviz/resources.qrc",
1773 ]
1774 outputs = [
1775 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
1776 ]
1777 args = [
1778 "$skia_qt_path" + "/bin/rcc",
1779 "{{source}}",
1780 "-o",
1781 "gen/mdbviz/{{source_name_part}}_res.cpp",
1782 ]
1783 }
1784 test_app("mdbviz") {
1785 if (is_win) {
1786 # on Windows we need to disable some exception handling warnings due to the Qt headers
1787 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
1788 }
1789 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001790 "tools/UrlDataManager.cpp",
1791 "tools/debugger/SkDebugCanvas.cpp",
1792 "tools/debugger/SkDrawCommand.cpp",
1793 "tools/debugger/SkJsonWriteBuffer.cpp",
1794 "tools/debugger/SkObjectParser.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001795 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04001796 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001797 "tools/mdbviz/main.cpp",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001798 "tools/picture_utils.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001799
1800 # generated files
1801 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
1802 "$target_gen_dir/mdbviz/resources_res.cpp",
1803 ]
1804 lib_dirs = [ "$skia_qt_path/lib" ]
1805 libs = [
1806 "Qt5Core.lib",
1807 "Qt5Gui.lib",
1808 "Qt5Widgets.lib",
1809 ]
1810 include_dirs = [
1811 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04001812 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001813 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001814 "tools",
1815 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001816 ]
1817 deps = [
1818 ":generate_mocs",
1819 ":generate_resources",
1820 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001821 "//third_party/jsoncpp",
1822 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001823 ]
1824 }
1825 }
1826
Mike Kleine459afd2017-03-03 09:21:30 -05001827 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05001828 copy("gdbserver") {
1829 sources = [
1830 "$ndk/$ndk_gdbserver",
1831 ]
1832 outputs = [
1833 "$root_out_dir/gdbserver",
1834 ]
1835 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05001836 }
mtklein25c81d42016-07-27 13:55:26 -07001837}
Mike Kleinc55a6cb2017-06-28 13:21:47 -04001838
1839if (skia_jumper_clang != "") {
1840 action("regen_jumper") {
1841 script = "src/jumper/build_stages.py"
1842
1843 inputs = [
1844 "src/jumper/SkJumper_stages.cpp",
Mike Klein9b2f69b2017-09-12 16:40:53 -04001845 "src/jumper/SkJumper_stages_lowp.cpp",
Mike Kleinc55a6cb2017-06-28 13:21:47 -04001846 ]
1847
1848 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it.
1849 outputs = [
1850 "$target_out_dir/" +
1851 rebase_path("src/jumper/SkJumper_generated.S", target_out_dir),
1852 "$target_out_dir/" +
1853 rebase_path("src/jumper/SkJumper_generated_win.S", target_out_dir),
1854 ]
1855
1856 args = [
1857 skia_jumper_clang,
1858 skia_jumper_objdump,
1859 skia_jumper_ccache,
1860 ] + rebase_path(inputs) + rebase_path(outputs)
1861 }
1862}