blob: bd3e9b8092d012a04591902be2b815328c3dab4f [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 = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500464 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400465 "//third_party/spirv-tools",
466 ]
467 }
468
469 skia_gpu_processor_outputs = []
470 foreach(src, skia_gpu_processor_sources) {
471 dir = get_path_info(src, "dir")
472 name = get_path_info(src, "name")
473
474 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
475 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
476 skia_gpu_processor_outputs += [
477 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
478 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
479 # confused due to the same file being named by two different paths
480 ]
481 }
482
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500483 action("create_sksl_enums") {
484 script = "gn/create_sksl_enums.py"
485 sources = [
486 "include/private/GrSharedEnums.h",
487 ]
488 outputs = [
489 "$target_out_dir/" +
490 rebase_path("src/sksl/sksl_enums.include", target_out_dir),
491 ]
492 args = [
493 rebase_path(sources[0]),
494 rebase_path(outputs[0]),
495 ]
496 }
497
Ethan Nicholas762466e2017-06-29 10:03:38 -0400498 action("compile_processors") {
499 script = "gn/compile_processors.py"
500 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500501 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400502 ":skslc(//gn/toolchain:$host_toolchain)",
503 ]
504 sources = skia_gpu_processor_sources
505 outputs = skia_gpu_processor_outputs
506 skslc_path = "$root_out_dir/"
507 if (host_toolchain != default_toolchain_name) {
508 skslc_path += "$host_toolchain/"
509 }
510 skslc_path += "skslc"
511 if (host_os == "win") {
512 skslc_path += ".exe"
513 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400514 args = [
515 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400516 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400517 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400518 args += rebase_path(skia_gpu_processor_sources)
519 }
520} else {
521 skia_gpu_processor_outputs = []
522 group("compile_processors") {
523 }
524}
525
mtklein06c35c02016-09-20 12:28:12 -0700526optional("gpu") {
527 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400528 deps = [
529 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700530 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400531 ]
mtkleine9fb3d52016-09-20 15:11:46 -0700532 public_defines = []
533
Mike Klein29b3e582017-02-09 11:57:32 -0500534 sources = skia_gpu_sources + skia_sksl_sources +
Ethan Nicholas762466e2017-06-29 10:03:38 -0400535 [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ] +
536 skia_gpu_processor_outputs
mtklein06c35c02016-09-20 12:28:12 -0700537
538 # These paths need to be absolute to match the ones produced by shared_sources.gni.
539 sources -= get_path_info([
540 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
541 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
542 ],
543 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400544 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700545 if (is_android) {
546 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400547
548 # this lib is required to link against AHardwareBuffer
549 if (defined(ndk_api) && ndk_api >= 26) {
550 libs += [ "android" ]
551 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400552 } else if (skia_use_egl) {
553 sources += [ "src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp" ]
554 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700555 } else if (is_linux) {
556 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500557 libs += [
558 "GL",
559 "GLU",
560 ]
mtklein06c35c02016-09-20 12:28:12 -0700561 } else if (is_mac) {
562 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800563 } else if (is_ios) {
564 sources += [ "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400565 } else if (is_win) {
566 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
567 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700568 } else {
569 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
570 }
mtkleine9fb3d52016-09-20 15:11:46 -0700571
572 if (skia_use_vulkan) {
573 public_defines += [ "SK_VULKAN" ]
574 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700575 if (skia_enable_vulkan_debug_layers) {
576 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
577 }
mtkleine9fb3d52016-09-20 15:11:46 -0700578 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400579 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400580 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400581 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
582 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400583
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400584 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400585 if (skia_use_metal) {
586 public_defines += [ "SK_METAL" ]
587 sources += skia_metal_sources
588 libs += [ "Metal.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400589 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400590 }
mtklein06c35c02016-09-20 12:28:12 -0700591}
592
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400593optional("heif") {
594 enabled = skia_use_libheif
595 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
596
597 deps = []
598
599 sources = [
600 "src/codec/SkHeifCodec.cpp",
601 ]
602}
603
mtklein63213812016-08-24 09:55:56 -0700604optional("jpeg") {
605 enabled = skia_use_libjpeg_turbo
606 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
607
mtklein63213812016-08-24 09:55:56 -0700608 deps = [
609 "//third_party/libjpeg-turbo:libjpeg",
610 ]
611 sources = [
612 "src/codec/SkJpegCodec.cpp",
613 "src/codec/SkJpegDecoderMgr.cpp",
614 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700615 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400616 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700617 ]
618}
619
620optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500621 enabled = skia_use_zlib && skia_enable_pdf
622 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700623
mtklein63213812016-08-24 09:55:56 -0700624 deps = [
625 "//third_party/zlib",
626 ]
brettwb9447282016-09-01 14:24:39 -0700627 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700628 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700629
630 if (skia_use_sfntly) {
631 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500632 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700633 }
634}
635
636optional("png") {
637 enabled = skia_use_libpng
638 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
639
mtklein63213812016-08-24 09:55:56 -0700640 deps = [
641 "//third_party/libpng",
642 ]
643 sources = [
644 "src/codec/SkIcoCodec.cpp",
645 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400646 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700647 ]
648}
649
scroggof84ad642016-10-31 09:02:57 -0700650optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400651 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700652 public_defines = [ "SK_CODEC_DECODES_RAW" ]
653
654 deps = [
655 "//third_party/dng_sdk",
656 "//third_party/libjpeg-turbo:libjpeg",
657 "//third_party/piex",
658 ]
659
660 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
661 # Skia.
662 configs_to_remove = [ "//gn:no_exceptions" ]
663
664 sources = [
665 "src/codec/SkRawAdapterCodec.cpp",
666 "src/codec/SkRawCodec.cpp",
667 ]
668}
669
mtklein3cc22182016-08-29 13:26:14 -0700670optional("typeface_freetype") {
671 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700672
673 deps = [
674 "//third_party/freetype2",
675 ]
676 sources = [
677 "src/ports/SkFontHost_FreeType.cpp",
678 "src/ports/SkFontHost_FreeType_common.cpp",
679 ]
680}
681
mtklein457b42a2016-08-23 13:56:37 -0700682optional("webp") {
683 enabled = skia_use_libwebp
684 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
685
mtklein457b42a2016-08-23 13:56:37 -0700686 deps = [
687 "//third_party/libwebp",
688 ]
689 sources = [
690 "src/codec/SkWebpAdapterCodec.cpp",
691 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400692 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700693 ]
mtkleineb3c4252016-08-23 07:38:09 -0700694}
695
mtklein63213812016-08-24 09:55:56 -0700696optional("xml") {
697 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000698 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700699
mtklein63213812016-08-24 09:55:56 -0700700 deps = [
701 "//third_party/expat",
702 ]
703 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500704 "src/svg/SkSVGCanvas.cpp",
705 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700706 "src/xml/SkDOM.cpp",
707 "src/xml/SkXMLParser.cpp",
708 "src/xml/SkXMLWriter.cpp",
709 ]
710}
711
mtkleinc04ff472016-06-23 10:29:30 -0700712component("skia") {
713 public_configs = [ ":skia_public" ]
714 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700715
716 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700717 ":arm64",
718 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700719 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700720 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500721 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700722 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700723 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700724 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700725 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700726 ":gpu",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400727 ":heif",
mtklein63213812016-08-24 09:55:56 -0700728 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700729 ":none",
mtklein63213812016-08-24 09:55:56 -0700730 ":pdf",
731 ":png",
scroggof84ad642016-10-31 09:02:57 -0700732 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700733 ":sse2",
734 ":sse41",
735 ":sse42",
736 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700737 ":webp",
mtklein63213812016-08-24 09:55:56 -0700738 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700739 ]
740
Chinmay Garde43f115c2016-11-16 15:04:12 -0800741 # This file (and all GN files in Skia) are designed to work with an
742 # empty sources assignment filter; we handle all that explicitly.
743 # We clear the filter here for clients who may have set up a global filter.
744 set_sources_assignment_filter([])
745
mtkleinc04ff472016-06-23 10:29:30 -0700746 sources = []
brettwb9447282016-09-01 14:24:39 -0700747 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700748 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500749 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700750 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400751 "src/android/SkAndroidFrameworkUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700752 "src/android/SkBitmapRegionCodec.cpp",
753 "src/android/SkBitmapRegionDecoder.cpp",
754 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400755 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700756 "src/codec/SkBmpCodec.cpp",
757 "src/codec/SkBmpMaskCodec.cpp",
758 "src/codec/SkBmpRLECodec.cpp",
759 "src/codec/SkBmpStandardCodec.cpp",
760 "src/codec/SkCodec.cpp",
761 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700762 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700763 "src/codec/SkMaskSwizzler.cpp",
764 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700765 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700766 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700767 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700768 "src/codec/SkSwizzler.cpp",
769 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700770 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700771 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700772 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700773 "src/ports/SkMemory_malloc.cpp",
774 "src/ports/SkOSFile_stdio.cpp",
775 "src/sfnt/SkOTTable_name.cpp",
776 "src/sfnt/SkOTUtils.cpp",
777 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700778 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700779 ]
brettwb9447282016-09-01 14:24:39 -0700780
mtklein7d6fb2c2016-08-25 14:50:44 -0700781 libs = []
782
mtkleinc04ff472016-06-23 10:29:30 -0700783 if (is_win) {
784 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400785 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700786 "src/ports/SkDebug_win.cpp",
787 "src/ports/SkFontHost_win.cpp",
788 "src/ports/SkFontMgr_win_dw.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700789 "src/ports/SkImageEncoder_WIC.cpp",
790 "src/ports/SkImageGeneratorWIC.cpp",
791 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700792 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700793 "src/ports/SkScalerContext_win_dw.cpp",
794 "src/ports/SkTLS_win.cpp",
795 "src/ports/SkTypeface_win_dw.cpp",
796 ]
Mike Klein69f6ed42016-10-13 15:45:07 -0400797 if (skia_use_gdi) {
798 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
799 libs += [
800 "Gdi32.lib",
801 "Usp10.lib",
802 ]
803 } else {
804 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
805 }
Mike Klein4b167fc2016-10-11 18:13:53 -0400806 libs += [
807 "FontSub.lib",
808 "Ole32.lib",
809 "OleAut32.lib",
810 "User32.lib",
811 ]
mtkleinc04ff472016-06-23 10:29:30 -0700812 } else {
813 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700814 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700815 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700816 "src/ports/SkTLS_pthread.cpp",
817 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400818 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700819 }
820
mtklein7d6fb2c2016-08-25 14:50:44 -0700821 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500822 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500823 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500824 deps += [ "//third_party/cpu-features" ]
825 }
mtklein06c35c02016-09-20 12:28:12 -0700826 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700827 libs += [
828 "EGL",
829 "GLESv2",
830 "log",
831 ]
832 }
833
mtkleinc04ff472016-06-23 10:29:30 -0700834 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700835 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700836 }
837
838 if (is_mac) {
839 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700840 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700841 "src/ports/SkFontHost_mac.cpp",
842 "src/ports/SkImageEncoder_CG.cpp",
843 "src/ports/SkImageGeneratorCG.cpp",
844 ]
mtklein09e61f72016-08-23 13:35:28 -0700845 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400846 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
847 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700848 "ApplicationServices.framework",
849 "OpenGL.framework",
850 ]
mtkleinc04ff472016-06-23 10:29:30 -0700851 }
abarth6fc8ff02016-07-15 15:15:15 -0700852
Mike Klein7d302882016-11-03 14:06:31 -0400853 if (is_ios) {
854 sources += [
855 "src/ports/SkDebug_stdio.cpp",
856 "src/ports/SkFontHost_mac.cpp",
857 "src/ports/SkImageEncoder_CG.cpp",
858 "src/ports/SkImageGeneratorCG.cpp",
859 ]
860 libs += [
861 "CoreFoundation.framework",
862 "CoreGraphics.framework",
863 "CoreText.framework",
864 "ImageIO.framework",
865 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400866
867 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
868 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400869 ]
870 }
871
abarth6fc8ff02016-07-15 15:15:15 -0700872 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700873 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700874 }
mtkleinc04ff472016-06-23 10:29:30 -0700875}
876
mtkleinc095df52016-08-24 12:23:52 -0700877# Targets guarded by skia_enable_tools may use //third_party freely.
878if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500879 # Used by gn_to_bp.py to list our public include dirs.
880 source_set("public") {
881 configs += [ ":skia_public" ]
882 }
883
Mike Kleinc36dedf2016-11-18 09:35:28 -0500884 config("skia.h_config") {
885 include_dirs = [ "$target_gen_dir" ]
886 }
887 action("skia.h") {
888 public_configs = [ ":skia.h_config" ]
889 skia_h = "$target_gen_dir/skia.h"
890 script = "gn/find_headers.py"
Greg Danielc819e662017-04-19 16:39:45 -0400891 args = [ rebase_path(skia_h, root_build_dir) ] +
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000892 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -0500893 depfile = "$skia_h.deps"
894 outputs = [
895 skia_h,
896 ]
897 }
898
899 if (skia_enable_gpu && target_cpu == "x64") {
900 # Our bots only have 64-bit libOSMesa installed.
901 # TODO: worth fixing?
902 executable("fiddle") {
903 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -0500904 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500905 "tools/fiddle/draw.cpp",
906 "tools/fiddle/fiddle_main.cpp",
907 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400908
909 if (skia_use_egl) {
910 sources += [ "tools/fiddle/egl_context.cpp" ]
911 } else if (skia_use_mesa) {
912 sources += [ "tools/fiddle/mesa_context.cpp" ]
913 if (is_linux) {
914 libs += [ "OSMesa" ]
915 }
916 } else {
917 sources += [ "tools/fiddle/null_context.cpp" ]
918 }
Joe Gregorio1e735c02017-04-19 14:05:14 -0400919 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -0500920 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -0400921 ":flags",
Mike Kleinc36dedf2016-11-18 09:35:28 -0500922 ":skia",
923 ":skia.h",
924 ]
925 }
926 }
927
928 if (skia_enable_gpu) {
929 source_set("public_headers_warnings_check") {
930 sources = [
931 "tools/public_headers_warnings_check.cpp",
932 ]
933 configs -= [ "//gn:warnings_except_public_headers" ]
934 deps = [
935 ":skia",
936 ":skia.h",
937 ]
938 }
939 }
940
mtkleinc095df52016-08-24 12:23:52 -0700941 template("test_lib") {
942 config(target_name + "_config") {
943 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700944 if (defined(invoker.public_defines)) {
945 defines = invoker.public_defines
946 }
mtklein25c81d42016-07-27 13:55:26 -0700947 }
mtkleinc095df52016-08-24 12:23:52 -0700948 source_set(target_name) {
949 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
950 public_configs = [
951 ":" + target_name + "_config",
952 ":skia_private",
953 ]
954
955 if (!defined(deps)) {
956 deps = []
957 }
958 deps += [ ":skia" ]
959 testonly = true
960 }
mtklein25c81d42016-07-27 13:55:26 -0700961 }
mtklein25c81d42016-07-27 13:55:26 -0700962
Mike Kleine6682eb2017-01-05 10:54:57 -0500963 template("test_app") {
964 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
965 shared_library("lib" + target_name) {
966 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Mike Klein154e6da2017-07-26 15:13:47 -0400967 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -0500968 testonly = true
969 }
970 } else {
Mike Klein7d921032017-01-05 12:20:41 -0500971 _executable = target_name
972 executable(_executable) {
Mike Kleine6682eb2017-01-05 10:54:57 -0500973 forward_variables_from(invoker, "*", [ "is_shared_library" ])
Mike Klein154e6da2017-07-26 15:13:47 -0400974 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -0500975 testonly = true
976 }
977 }
Mike Klein7d921032017-01-05 12:20:41 -0500978 if (is_android && skia_android_serial != "" && defined(_executable)) {
979 action("push_" + target_name) {
980 script = "gn/push_to_android.py"
981 deps = [
982 ":" + _executable,
983 ]
984 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
985 outputs = [
986 _stamp,
987 ]
988 args = [
989 rebase_path("$root_build_dir/$_executable"),
990 skia_android_serial,
991 rebase_path(_stamp),
992 ]
993 testonly = true
994 }
995 }
Mike Kleine6682eb2017-01-05 10:54:57 -0500996 }
997
mtkleinc095df52016-08-24 12:23:52 -0700998 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700999 public_include_dirs = []
1000 if (skia_enable_gpu) {
1001 public_defines = []
1002 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001003
1004 deps = []
mtklein38925aa2016-09-21 10:11:25 -07001005 sources = [
1006 "tools/gpu/GrContextFactory.cpp",
1007 "tools/gpu/GrTest.cpp",
1008 "tools/gpu/TestContext.cpp",
1009 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -07001010 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001011 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
1012 "tools/gpu/gl/debug/GrBufferObj.cpp",
1013 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
1014 "tools/gpu/gl/debug/GrProgramObj.cpp",
1015 "tools/gpu/gl/debug/GrShaderObj.cpp",
1016 "tools/gpu/gl/debug/GrTextureObj.cpp",
1017 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
1018 "tools/gpu/gl/null/NullGLTestContext.cpp",
Brian Salomoncfe910d2017-07-06 16:40:18 -04001019 "tools/gpu/mock/MockTestContext.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001020 ]
1021 libs = []
mtklein25c81d42016-07-27 13:55:26 -07001022
Kevin Lubick4a24e102017-03-29 11:19:01 -04001023 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -07001024 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -04001025 } else if (is_ios) {
1026 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1027 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -07001028 } else if (is_linux) {
1029 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001030 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -07001031 } else if (is_mac) {
1032 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001033 } else if (is_win) {
1034 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1035 libs += [
1036 "Gdi32.lib",
1037 "OpenGL32.lib",
1038 ]
mtklein38925aa2016-09-21 10:11:25 -07001039 }
mtklein6ef69992016-09-14 06:12:09 -07001040
Greg Daniel6b7e0e22017-07-12 16:21:09 -04001041 cflags_objcc = [ "-fobjc-arc" ]
1042
Mike Kleinc168a3a2016-11-14 14:53:13 +00001043 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +00001044 deps += [ "//third_party/angle2" ]
1045 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1046 }
mtklein38925aa2016-09-21 10:11:25 -07001047 if (skia_use_mesa) {
1048 public_defines += [ "SK_MESA" ]
1049 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
1050 libs += [ "OSMesa" ]
1051 }
mtkleind68f9b02016-09-23 13:18:41 -07001052 if (skia_use_vulkan) {
1053 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Greg Daniel35970ec2017-11-10 10:03:05 -05001054 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
mtkleind68f9b02016-09-23 13:18:41 -07001055 }
Greg Danielb76a72a2017-07-13 15:07:54 -04001056 if (skia_use_metal) {
1057 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
1058 }
mtkleina627b5c2016-09-20 13:36:47 -07001059 }
mtklein25c81d42016-07-27 13:55:26 -07001060 }
mtklein25c81d42016-07-27 13:55:26 -07001061
mtkleinc095df52016-08-24 12:23:52 -07001062 test_lib("flags") {
1063 public_include_dirs = [ "tools/flags" ]
1064 sources = [
1065 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001066 ]
1067 }
1068 test_lib("common_flags") {
1069 public_include_dirs = [ "tools/flags" ]
1070 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001071 "tools/flags/SkCommonFlags.cpp",
1072 "tools/flags/SkCommonFlagsConfig.cpp",
1073 ]
1074 deps = [
mtklein046cb562016-09-16 10:23:12 -07001075 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001076 ":gpu_tool_utils",
1077 ]
1078 }
mtklein25c81d42016-07-27 13:55:26 -07001079
mtkleinc095df52016-08-24 12:23:52 -07001080 test_lib("tool_utils") {
1081 public_include_dirs = [
1082 "tools",
1083 "tools/debugger",
1084 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001085 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001086 ]
1087 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001088 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001089 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001090 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001091 "tools/ProcStats.cpp",
1092 "tools/Resources.cpp",
Mike Klein10d66cc2017-11-10 11:33:43 -05001093 "tools/SkRandomScalerContext.cpp",
1094 "tools/SkTestScalerContext.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001095 "tools/ThermalManager.cpp",
1096 "tools/UrlDataManager.cpp",
1097 "tools/debugger/SkDebugCanvas.cpp",
1098 "tools/debugger/SkDrawCommand.cpp",
1099 "tools/debugger/SkJsonWriteBuffer.cpp",
1100 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001101 "tools/picture_utils.cpp",
1102 "tools/random_parse_path.cpp",
1103 "tools/sk_tool_utils.cpp",
1104 "tools/sk_tool_utils_font.cpp",
1105 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001106 "tools/trace/SkChromeTracingTracer.cpp",
1107 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001108 "tools/trace/SkDebugfTracer.cpp",
1109 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001110 "tools/trace/SkEventTracingPriv.cpp",
1111 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001112 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001113 libs = []
1114 if (is_ios) {
1115 sources += [ "tools/ios_utils.m" ]
1116 libs += [ "Foundation.framework" ]
1117 }
mtkleinc095df52016-08-24 12:23:52 -07001118 deps = [
mtklein046cb562016-09-16 10:23:12 -07001119 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001120 ":flags",
1121 "//third_party/libpng",
1122 ]
1123 public_deps = [
1124 "//third_party/jsoncpp",
1125 ]
1126 }
mtklein25c81d42016-07-27 13:55:26 -07001127
Mike Klein6e744122016-10-27 12:21:40 -04001128 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001129 test_lib("gm") {
1130 public_include_dirs = [ "gm" ]
1131 sources = gm_sources
1132 deps = [
scroggo19b91532016-10-24 09:03:26 -07001133 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001134 ":gpu_tool_utils",
1135 ":skia",
1136 ":tool_utils",
1137 ]
1138 }
mtklein25c81d42016-07-27 13:55:26 -07001139
Mike Klein6e744122016-10-27 12:21:40 -04001140 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001141 test_lib("tests") {
1142 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001143 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001144 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001145 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001146 }
mtkleinc095df52016-08-24 12:23:52 -07001147 deps = [
fmalita6cf896d2016-08-25 08:44:35 -07001148 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001149 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001150 ":skia",
1151 ":tool_utils",
1152 "//third_party/libpng",
1153 "//third_party/zlib",
1154 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001155 public_deps = [
1156 ":gpu_tool_utils", # Test.h #includes headers from this target.
1157 ]
mtkleinc095df52016-08-24 12:23:52 -07001158 }
mtklein2f3416d2016-08-02 16:02:05 -07001159
Mike Klein6e744122016-10-27 12:21:40 -04001160 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001161 test_lib("bench") {
1162 public_include_dirs = [ "bench" ]
1163 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001164 deps = [
1165 ":flags",
1166 ":gm",
1167 ":gpu_tool_utils",
1168 ":skia",
1169 ":tool_utils",
1170 ]
1171 }
mtklein2b6870c2016-07-28 14:17:33 -07001172
mtkleinc095df52016-08-24 12:23:52 -07001173 test_lib("experimental_svg_model") {
1174 public_include_dirs = [ "experimental/svg/model" ]
1175 sources = [
1176 "experimental/svg/model/SkSVGAttribute.cpp",
1177 "experimental/svg/model/SkSVGAttributeParser.cpp",
1178 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -05001179 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001180 "experimental/svg/model/SkSVGContainer.cpp",
1181 "experimental/svg/model/SkSVGDOM.cpp",
1182 "experimental/svg/model/SkSVGEllipse.cpp",
Florin Malitadf007e12017-10-09 15:14:13 -04001183 "experimental/svg/model/SkSVGGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001184 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001185 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001186 "experimental/svg/model/SkSVGNode.cpp",
1187 "experimental/svg/model/SkSVGPath.cpp",
Florin Malita1aa1bb62017-10-11 14:34:33 -04001188 "experimental/svg/model/SkSVGPattern.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001189 "experimental/svg/model/SkSVGPoly.cpp",
Florin Malitacc6cc292017-10-09 16:05:30 -04001190 "experimental/svg/model/SkSVGRadialGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001191 "experimental/svg/model/SkSVGRect.cpp",
1192 "experimental/svg/model/SkSVGRenderContext.cpp",
1193 "experimental/svg/model/SkSVGSVG.cpp",
1194 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001195 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001196 "experimental/svg/model/SkSVGTransformableNode.cpp",
Florin Malita6a69c052017-10-11 14:02:11 -04001197 "experimental/svg/model/SkSVGUse.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001198 "experimental/svg/model/SkSVGValue.cpp",
1199 ]
1200 deps = [
1201 ":skia",
1202 ]
1203 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001204
Kevin Lubickebf648e2017-09-21 13:45:16 -04001205 if (target_cpu != "wasm") {
1206 test_lib("views") {
1207 public_include_dirs = [ "include/views" ]
1208 sources = [
1209 "src/views/SkEvent.cpp",
1210 "src/views/SkEventSink.cpp",
1211 "src/views/SkOSMenu.cpp",
1212 "src/views/SkTagList.cpp",
1213 "src/views/SkTouchGesture.cpp",
1214 "src/views/SkView.cpp",
1215 "src/views/SkViewPriv.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001216 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001217 libs = []
1218 deps = []
1219 if (!is_android) {
1220 sources += [ "src/views/SkWindow.cpp" ]
1221 }
1222 if (is_linux) {
1223 public_include_dirs += [ "src/views/unix" ]
1224 sources += [
1225 "src/views/unix/SkOSWindow_Unix.cpp",
1226 "src/views/unix/keysym2ucs.c",
1227 ]
1228 libs += [
1229 "GL",
1230 "X11",
1231 ]
1232 } else if (is_mac) {
1233 sources += [
1234 "src/views/mac/SkEventNotifier.mm",
1235 "src/views/mac/SkNSView.mm",
1236 "src/views/mac/SkOSWindow_Mac.mm",
1237 "src/views/mac/SkTextFieldCell.m",
1238 ]
1239 libs += [
1240 "QuartzCore.framework",
1241 "Cocoa.framework",
1242 "Foundation.framework",
1243 ]
1244 } else if (is_win) {
1245 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
1246 } else if (is_ios) {
1247 sources += [ "src/views/mac/SkEventNotifier.mm" ]
1248 }
1249 if (skia_use_angle) {
1250 deps += [ "//third_party/angle2" ]
1251 }
Brian Osman34755e22016-12-05 09:46:02 -05001252 }
Brian Osman16adfa32016-10-18 14:42:44 -04001253 }
1254
Mike Klein38af9432016-11-11 11:39:44 -05001255 if (skia_use_lua) {
1256 test_lib("lua") {
1257 public_include_dirs = []
1258 sources = [
1259 "src/utils/SkLua.cpp",
1260 "src/utils/SkLuaCanvas.cpp",
1261 ]
1262 deps = [
1263 "//third_party/lua",
1264 ]
1265 }
1266
Mike Kleine6682eb2017-01-05 10:54:57 -05001267 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001268 sources = [
1269 "tools/lua/lua_app.cpp",
1270 ]
1271 deps = [
1272 ":lua",
1273 ":skia",
1274 "//third_party/lua",
1275 ]
Mike Klein38af9432016-11-11 11:39:44 -05001276 }
1277
Mike Kleine6682eb2017-01-05 10:54:57 -05001278 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001279 sources = [
1280 "tools/lua/lua_pictures.cpp",
1281 ]
1282 deps = [
1283 ":flags",
1284 ":lua",
1285 ":skia",
1286 ":tool_utils",
1287 "//third_party/lua",
1288 ]
Mike Klein38af9432016-11-11 11:39:44 -05001289 }
1290 }
1291
Cary Clark8032b982017-07-28 11:04:54 -04001292 test_app("bookmaker") {
1293 sources = [
1294 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001295 "tools/bookmaker/cataloger.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001296 "tools/bookmaker/fiddleParser.cpp",
1297 "tools/bookmaker/includeParser.cpp",
1298 "tools/bookmaker/includeWriter.cpp",
1299 "tools/bookmaker/mdOut.cpp",
1300 "tools/bookmaker/parserCommon.cpp",
1301 "tools/bookmaker/spellCheck.cpp",
1302 ]
1303 deps = [
1304 ":flags",
1305 ":skia",
1306 ":tool_utils",
1307 ]
1308 }
1309
Kevin Lubickebf648e2017-09-21 13:45:16 -04001310 if (target_cpu != "wasm") {
1311 import("gn/samples.gni")
1312 test_lib("samples") {
1313 public_include_dirs = [ "samplecode" ]
1314 include_dirs = [ "experimental" ]
1315 sources = samples_sources + [
1316 "experimental/SkSetPoly3To3.cpp",
1317 "experimental/SkSetPoly3To3_A.cpp",
1318 "experimental/SkSetPoly3To3_D.cpp",
Brian Osmancff94e42017-06-26 13:12:37 -04001319
Kevin Lubickebf648e2017-09-21 13:45:16 -04001320 # Relocating these files here, so that clients don't try to build them while they're
1321 # still in active development. Clang's thread safety analysis gets tripped up by
1322 # conditional locks.
1323 "src/core/SkThreadedBMPDevice.cpp",
1324 "src/core/SkThreadedBMPDevice.h",
1325 ]
1326 deps = [
1327 ":experimental_svg_model",
1328 ":flags",
1329 ":gm",
1330 ":tool_utils",
1331 ":views",
1332 ":xml",
1333 ]
Mike Klein38af9432016-11-11 11:39:44 -05001334
Kevin Lubickebf648e2017-09-21 13:45:16 -04001335 if (skia_use_lua) {
1336 sources += [ "samplecode/SampleLua.cpp" ]
1337 deps += [
1338 ":lua",
1339 "//third_party/lua",
1340 ]
1341 }
1342 }
1343 test_app("dm") {
1344 sources = [
1345 "dm/DM.cpp",
Mike Klein31868212017-11-06 12:02:47 -05001346 "dm/DMFontMgr.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001347 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001348 "dm/DMJsonWriter.cpp",
1349 "dm/DMSrcSink.cpp",
1350 ]
1351 include_dirs = [ "tests" ]
1352 deps = [
1353 ":common_flags",
1354 ":experimental_svg_model",
1355 ":flags",
1356 ":gm",
1357 ":gpu_tool_utils",
1358 ":skia",
1359 ":tests",
1360 ":tool_utils",
1361 "//third_party/jsoncpp",
1362 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001363 ]
1364 }
Brian Osman16adfa32016-10-18 14:42:44 -04001365 }
1366
Mike Klein06432b22017-03-21 13:14:33 -04001367 test_app("ok") {
1368 sources = [
Mike Klein361dde02017-11-07 08:14:52 -05001369 "dm/DMFontMgr.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001370 "tools/ok.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001371 "tools/ok_dsts.cpp",
Mike Klein154e6da2017-07-26 15:13:47 -04001372 "tools/ok_engines.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001373 "tools/ok_srcs.cpp",
Mike Kleind63442d2017-03-27 14:16:04 -04001374 "tools/ok_test.cpp",
Mike Kleinf5d1a552017-03-25 12:32:22 -04001375 "tools/ok_vias.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001376 ]
1377 deps = [
Mike Klein4f6e2712017-08-11 10:37:35 -04001378 ":bench",
Mike Klein06432b22017-03-21 13:14:33 -04001379 ":gm",
1380 ":skia",
Mike Kleind63442d2017-03-27 14:16:04 -04001381 ":tests",
Mike Klein62669ad2017-05-09 16:03:07 -04001382 ":tool_utils",
Mike Klein06432b22017-03-21 13:14:33 -04001383 ]
1384 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001385 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001386 sources = [
1387 "bench/nanobench.cpp",
1388 ]
1389 deps = [
1390 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001391 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001392 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001393 ":flags",
1394 ":gm",
1395 ":gpu_tool_utils",
1396 ":skia",
1397 ":tool_utils",
1398 "//third_party/jsoncpp",
1399 ]
mtklein2b6870c2016-07-28 14:17:33 -07001400 }
halcanary19a97202016-08-03 15:08:04 -07001401
Ravi Mistry10d36c52017-01-31 09:49:18 -05001402 test_app("skpinfo") {
1403 sources = [
1404 "tools/skpinfo.cpp",
1405 ]
1406 deps = [
1407 ":flags",
1408 ":skia",
1409 ]
1410 }
1411
Jim Van Verth57a98fc2016-10-28 13:35:50 -04001412 if (is_linux || is_win || is_mac) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001413 test_app("SampleApp") {
mtklein38925aa2016-09-21 10:11:25 -07001414 sources = [
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001415 "samplecode/SampleApp.cpp",
1416 "samplecode/SamplePictFile.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001417 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001418 if (is_mac) {
1419 sources += [ "src/views/mac/skia_mac.mm" ]
1420 } else if (is_win) {
1421 sources += [ "src/views/win/skia_win.cpp" ]
1422 } else if (is_linux) {
1423 sources += [ "src/views/unix/skia_unix.cpp" ]
1424 }
mtklein38925aa2016-09-21 10:11:25 -07001425 deps = [
1426 ":flags",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001427 ":gm",
mtklein38925aa2016-09-21 10:11:25 -07001428 ":gpu_tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001429 ":samples",
mtklein38925aa2016-09-21 10:11:25 -07001430 ":skia",
1431 ":tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001432 ":views",
mtklein38925aa2016-09-21 10:11:25 -07001433 ]
Mike Kleinc168a3a2016-11-14 14:53:13 +00001434 if (skia_use_angle) {
1435 deps += [ "//third_party/angle2" ]
1436 }
mtklein38925aa2016-09-21 10:11:25 -07001437 }
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001438 }
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001439
Jim Van Verthc1720d42017-10-09 10:16:01 -04001440 if (skia_enable_gpu && !skia_use_angle && (is_linux || is_win || is_mac)) {
1441 test_app("HelloWorld") {
1442 sources = [
1443 "example/HelloWorld.cpp",
1444 ]
1445 if (is_mac) {
1446 sources += [ "src/views/mac/skia_mac.mm" ]
1447 } else if (is_win) {
1448 sources += [ "src/views/win/skia_win.cpp" ]
1449 } else if (is_linux) {
1450 sources += [ "src/views/unix/skia_unix.cpp" ]
1451 }
1452 deps = [
1453 ":gpu_tool_utils",
1454 ":skia",
1455 ":views",
1456 ]
1457 }
1458 }
1459
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001460 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001461 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001462 sources = [
1463 "tools/skpbench/skpbench.cpp",
1464 ]
1465 deps = [
1466 ":flags",
1467 ":gpu_tool_utils",
1468 ":skia",
1469 ":tool_utils",
1470 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001471 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001472 }
1473
Mike Klein7d302882016-11-03 14:06:31 -04001474 # We can't yet build ICU on iOS or Windows.
Kevin Lubickebf648e2017-09-21 13:45:16 -04001475 if (!is_ios && !is_win && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001476 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001477 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001478 "tools/shape/SkShaper_harfbuzz.cpp",
1479 "tools/shape/using_skia_and_harfbuzz.cpp",
mtklein6f5df6a2016-08-29 16:01:10 -07001480 ]
1481 deps = [
1482 ":skia",
1483 "//third_party/harfbuzz",
Ben Wagnera25fbef2017-08-30 13:56:19 -04001484 "//third_party/icu",
mtklein6f5df6a2016-08-29 16:01:10 -07001485 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001486 }
halcanary19a97202016-08-03 15:08:04 -07001487 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001488 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001489 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001490 "tools/shape/SkShaper_primitive.cpp",
1491 "tools/shape/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001492 ]
1493 deps = [
1494 ":skia",
1495 ]
halcanary3eee9d92016-09-10 07:01:53 -07001496 }
mtklein046cb562016-09-16 10:23:12 -07001497
Matt Sarett9f1c4032017-05-17 10:06:32 -04001498 test_app("create_flutter_test_images") {
1499 sources = [
1500 "tools/create_flutter_test_images.cpp",
1501 ]
1502 deps = [
1503 ":skia",
1504 ":tool_utils",
1505 ]
1506 }
1507
Ben Wagner219f3622017-07-17 15:32:25 -04001508 test_app("create_test_font") {
1509 sources = [
1510 "tools/create_test_font.cpp",
1511 ]
1512 deps = [
1513 ":skia",
1514 ]
1515 assert_no_deps = [
1516 # tool_utils requires the output of this app.
1517 ":tool_utils",
1518 ]
1519 }
1520
Mike Kleine6682eb2017-01-05 10:54:57 -05001521 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001522 sources = [
1523 "tools/get_images_from_skps.cpp",
1524 ]
1525 deps = [
1526 ":flags",
1527 ":skia",
1528 "//third_party/jsoncpp",
1529 ]
mtklein046cb562016-09-16 10:23:12 -07001530 }
mtkleinecbc5262016-09-22 11:51:24 -07001531
Mike Kleine6682eb2017-01-05 10:54:57 -05001532 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001533 sources = [
1534 "tools/colorspaceinfo.cpp",
1535 ]
1536 deps = [
1537 ":flags",
1538 ":skia",
1539 ":tool_utils",
1540 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001541 }
1542
Kevin Lubickebf648e2017-09-21 13:45:16 -04001543 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001544 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001545 sources = [
1546 "tools/skiaserve/Request.cpp",
1547 "tools/skiaserve/Response.cpp",
1548 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001549 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1550 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1551 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1552 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1553 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1554 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1555 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1556 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1557 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001558 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1559 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001560 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1561 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1562 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1563 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1564 ]
1565 deps = [
1566 ":flags",
1567 ":gpu_tool_utils",
1568 ":skia",
1569 ":tool_utils",
1570 "//third_party/jsoncpp",
1571 "//third_party/libmicrohttpd",
1572 "//third_party/libpng",
1573 ]
Mike Klein7d302882016-11-03 14:06:31 -04001574 }
mtkleinecbc5262016-09-22 11:51:24 -07001575 }
kjlubick14f984b2016-10-03 11:49:45 -07001576
Mike Kleine6682eb2017-01-05 10:54:57 -05001577 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07001578 sources = [
1579 "fuzz/FilterFuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001580 "fuzz/FuzzCanvas.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001581 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001582 "fuzz/FuzzGradients.cpp",
1583 "fuzz/FuzzParsePath.cpp",
1584 "fuzz/FuzzPathop.cpp",
1585 "fuzz/FuzzScaleToSides.cpp",
1586 "fuzz/fuzz.cpp",
1587 ]
1588 deps = [
1589 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001590 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001591 ":skia",
Hal Canarydb683012016-11-23 08:55:18 -07001592 ":tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001593 ]
kjlubick14f984b2016-10-03 11:49:45 -07001594 }
Mike Klein38312422016-10-05 15:41:01 -04001595
Mike Kleine6682eb2017-01-05 10:54:57 -05001596 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001597 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001598 rebase_path("tests/skia_test.cpp"),
1599 rebase_path("tests/Test.cpp"),
1600 ]
caryclark9feb6322016-10-25 08:58:26 -07001601 deps = [
1602 ":flags",
1603 ":gpu_tool_utils",
1604 ":skia",
1605 ":tool_utils",
1606 ]
caryclark9feb6322016-10-25 08:58:26 -07001607 }
1608
Mike Kleine6682eb2017-01-05 10:54:57 -05001609 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001610 sources = [
1611 "tools/DumpRecord.cpp",
1612 "tools/dump_record.cpp",
1613 ]
1614 deps = [
1615 ":flags",
1616 ":skia",
1617 ]
Mike Klein38312422016-10-05 15:41:01 -04001618 }
bungemanfe917272016-10-13 17:36:40 -04001619
Mike Kleine6682eb2017-01-05 10:54:57 -05001620 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001621 sources = [
1622 "tools/skdiff/skdiff.cpp",
1623 "tools/skdiff/skdiff_html.cpp",
1624 "tools/skdiff/skdiff_main.cpp",
1625 "tools/skdiff/skdiff_utils.cpp",
1626 ]
1627 deps = [
1628 ":skia",
1629 ":tool_utils",
1630 ]
bungemanfe917272016-10-13 17:36:40 -04001631 }
halcanarya73d76a2016-10-17 13:19:02 -07001632
Mike Kleine6682eb2017-01-05 10:54:57 -05001633 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001634 sources = [
1635 "tools/skp_parser.cpp",
1636 ]
1637 deps = [
1638 ":skia",
1639 ":tool_utils",
1640 "//third_party/jsoncpp",
1641 ]
halcanarya73d76a2016-10-17 13:19:02 -07001642 }
Brian Osman16adfa32016-10-18 14:42:44 -04001643
Hal Canary75427132017-10-11 16:00:31 -04001644 if (!is_win) {
1645 test_app("gpucts") {
1646 sources = [
1647 "dm/DMGpuTestProcs.cpp",
1648 "tools/gpucts/gm_knowledge.c",
1649 "tools/gpucts/gm_runner.cpp",
1650 "tools/gpucts/gpucts.cpp",
1651 ]
1652 deps = [
1653 ":gm",
1654 ":gpu_tool_utils",
1655 ":skia",
1656 ":tests",
1657 "//third_party/googletest",
1658 ]
1659 }
1660 }
1661
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001662 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001663 test_app("viewer") {
1664 is_shared_library = is_android
Brian Osman16adfa32016-10-18 14:42:44 -04001665 sources = [
1666 "tools/viewer/GMSlide.cpp",
1667 "tools/viewer/ImageSlide.cpp",
1668 "tools/viewer/SKPSlide.cpp",
1669 "tools/viewer/SampleSlide.cpp",
1670 "tools/viewer/Viewer.cpp",
1671 "tools/viewer/sk_app/CommandSet.cpp",
1672 "tools/viewer/sk_app/GLWindowContext.cpp",
1673 "tools/viewer/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001674 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001675 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001676
Jim Van Verth4e56a912016-10-21 10:58:52 -04001677 if (is_android) {
1678 sources += [
1679 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1680 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1681 "tools/viewer/sk_app/android/Window_android.cpp",
1682 "tools/viewer/sk_app/android/main_android.cpp",
1683 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1684 ]
Brian Osman462334e2017-02-09 11:22:57 -05001685 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001686 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001687 sources += [
1688 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1689 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1690 "tools/viewer/sk_app/unix/Window_unix.cpp",
1691 "tools/viewer/sk_app/unix/main_unix.cpp",
1692 ]
1693 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001694 sources += [
1695 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1696 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1697 "tools/viewer/sk_app/win/Window_win.cpp",
1698 "tools/viewer/sk_app/win/main_win.cpp",
1699 ]
Brian Salomon194db172017-08-17 14:37:06 -04001700 if (skia_use_angle) {
1701 sources += [ "tools/viewer/sk_app/win/ANGLEWindowContext_win.cpp" ]
1702 }
Mike Klein43c25262016-10-20 10:17:47 -04001703 } else if (is_mac) {
1704 sources += [
1705 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1706 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1707 "tools/viewer/sk_app/mac/Window_mac.cpp",
1708 "tools/viewer/sk_app/mac/main_mac.cpp",
1709 ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001710 } else if (is_ios) {
1711 sources += [
1712 "tools/viewer/sk_app/ios/GLWindowContext_ios.cpp",
1713 "tools/viewer/sk_app/ios/RasterWindowContext_ios.cpp",
1714 "tools/viewer/sk_app/ios/Window_ios.cpp",
1715 "tools/viewer/sk_app/ios/main_ios.cpp",
1716 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001717 }
1718
1719 if (skia_use_vulkan) {
1720 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001721 if (is_android) {
1722 sources +=
1723 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001724 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001725 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1726 libs += [ "X11-xcb" ]
1727 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001728 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1729 }
1730 }
1731
1732 include_dirs = []
1733 deps = [
1734 ":flags",
1735 ":gm",
1736 ":gpu_tool_utils",
1737 ":samples",
1738 ":skia",
1739 ":tool_utils",
1740 ":views",
Brian Osman79086b92017-02-10 13:36:16 -05001741 "//third_party/imgui",
Brian Osman16adfa32016-10-18 14:42:44 -04001742 "//third_party/jsoncpp",
1743 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001744 if (is_android) {
1745 deps += [ "//third_party/native_app_glue" ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001746 } else if (is_mac || is_ios) {
Mike Klein43c25262016-10-20 10:17:47 -04001747 deps += [ "//third_party/libsdl" ]
1748 }
Brian Salomon194db172017-08-17 14:37:06 -04001749 if (skia_use_angle) {
1750 deps += [ "//third_party/angle2" ]
1751 }
Mike Kleina92c3832016-12-08 09:49:39 -05001752 }
Brian Osman16adfa32016-10-18 14:42:44 -04001753 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001754
Jim Van Verthecfed2b2017-08-30 14:02:50 -04001755 if (skia_enable_gpu && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04001756 test_app("SkiaSDLExample") {
1757 sources = [
1758 "example/SkiaSDLExample.cpp",
1759 ]
1760 libs = []
1761 include_dirs = []
1762 deps = [
1763 ":gpu_tool_utils",
1764 ":skia",
1765 "//third_party/libsdl",
1766 ]
1767 }
1768 }
1769
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001770 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
1771 action_foreach("generate_mocs") {
1772 script = "gn/call.py"
1773 sources = [
1774 "tools/mdbviz/MainWindow.h",
1775 ]
1776 outputs = [
1777 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
1778 ]
1779 args = [
1780 "$skia_qt_path" + "/bin/moc",
1781 "{{source}}",
1782 "-o",
1783 "gen/mdbviz/{{source_name_part}}_moc.cpp",
1784 ]
1785 }
1786 action_foreach("generate_resources") {
1787 script = "gn/call.py"
1788 sources = [
1789 "tools/mdbviz/resources.qrc",
1790 ]
1791 outputs = [
1792 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
1793 ]
1794 args = [
1795 "$skia_qt_path" + "/bin/rcc",
1796 "{{source}}",
1797 "-o",
1798 "gen/mdbviz/{{source_name_part}}_res.cpp",
1799 ]
1800 }
1801 test_app("mdbviz") {
1802 if (is_win) {
1803 # on Windows we need to disable some exception handling warnings due to the Qt headers
1804 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
1805 }
1806 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001807 "tools/UrlDataManager.cpp",
1808 "tools/debugger/SkDebugCanvas.cpp",
1809 "tools/debugger/SkDrawCommand.cpp",
1810 "tools/debugger/SkJsonWriteBuffer.cpp",
1811 "tools/debugger/SkObjectParser.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001812 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04001813 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001814 "tools/mdbviz/main.cpp",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001815 "tools/picture_utils.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001816
1817 # generated files
1818 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
1819 "$target_gen_dir/mdbviz/resources_res.cpp",
1820 ]
1821 lib_dirs = [ "$skia_qt_path/lib" ]
1822 libs = [
1823 "Qt5Core.lib",
1824 "Qt5Gui.lib",
1825 "Qt5Widgets.lib",
1826 ]
1827 include_dirs = [
1828 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04001829 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001830 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001831 "tools",
1832 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001833 ]
1834 deps = [
1835 ":generate_mocs",
1836 ":generate_resources",
1837 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001838 "//third_party/jsoncpp",
1839 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001840 ]
1841 }
1842 }
1843
Mike Kleine459afd2017-03-03 09:21:30 -05001844 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05001845 copy("gdbserver") {
1846 sources = [
1847 "$ndk/$ndk_gdbserver",
1848 ]
1849 outputs = [
1850 "$root_out_dir/gdbserver",
1851 ]
1852 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05001853 }
mtklein25c81d42016-07-27 13:55:26 -07001854}
Mike Kleinc55a6cb2017-06-28 13:21:47 -04001855
1856if (skia_jumper_clang != "") {
1857 action("regen_jumper") {
1858 script = "src/jumper/build_stages.py"
1859
1860 inputs = [
1861 "src/jumper/SkJumper_stages.cpp",
Mike Klein9b2f69b2017-09-12 16:40:53 -04001862 "src/jumper/SkJumper_stages_lowp.cpp",
Mike Kleinc55a6cb2017-06-28 13:21:47 -04001863 ]
1864
1865 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it.
1866 outputs = [
1867 "$target_out_dir/" +
1868 rebase_path("src/jumper/SkJumper_generated.S", target_out_dir),
1869 "$target_out_dir/" +
1870 rebase_path("src/jumper/SkJumper_generated_win.S", target_out_dir),
1871 ]
1872
1873 args = [
1874 skia_jumper_clang,
1875 skia_jumper_objdump,
1876 skia_jumper_ccache,
1877 ] + rebase_path(inputs) + rebase_path(outputs)
1878 }
1879}