blob: f37f4c6552df2da199753fa195e71672f7c31507 [file] [log] [blame]
mtkleinc04ff472016-06-23 10:29:30 -07001# Copyright 2016 Google Inc.
2#
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
Brian Osmanf2c90142017-07-13 15:50:03 -04006import("gn/flutter_defines.gni")
mikejurka8c24f4f2016-09-12 16:51:58 -07007import("gn/shared_sources.gni")
brettwb9447282016-09-01 14:24:39 -07008
Forrest Reiling30229ac2017-04-17 13:36:39 -07009if (is_fuchsia) {
10 import("//build/vulkan/config.gni")
11}
12
Mike Klein3669a822017-03-03 10:55:02 -050013if (!defined(is_skia_standalone)) {
14 is_skia_standalone = false
15}
16is_skia_dev_build = is_skia_standalone && !is_official_build
17
mtkleinc04ff472016-06-23 10:29:30 -070018declare_args() {
Mike Kleinc168a3a2016-11-14 14:53:13 +000019 skia_use_angle = false
Kevin Lubick4a24e102017-03-29 11:19:01 -040020 skia_use_egl = false
mtklein63213812016-08-24 09:55:56 -070021 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070022 skia_use_fontconfig = is_linux
mtkleincdedd0e2016-09-12 15:15:44 -070023 skia_use_freetype = is_android || is_fuchsia || is_linux
Mike Klein7d302882016-11-03 14:06:31 -040024 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
mtklein63213812016-08-24 09:55:56 -070025 skia_use_libjpeg_turbo = true
26 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070027 skia_use_libwebp = !is_fuchsia
Mike Klein38af9432016-11-11 11:39:44 -050028 skia_use_lua = false
Mike Klein10d665d2016-11-01 11:46:10 -040029 skia_use_piex = !is_win
mtklein63213812016-08-24 09:55:56 -070030 skia_use_zlib = true
Greg Daniele5ddff52017-07-05 16:49:36 -040031 skia_use_metal = false
Mike Klein36f182f2017-10-20 12:33:53 -040032 skia_use_libheif = is_skia_dev_build
mtklein1bd72ba2016-09-16 07:45:52 -070033
Mike Klein7d921032017-01-05 12:20:41 -050034 skia_android_serial = ""
Brian Osman3f375d02016-12-28 11:19:22 -050035 skia_enable_discrete_gpu = true
Mike Kleina04bb452017-02-09 12:24:07 -050036 skia_enable_effects = true
Brian Osmanf2c90142017-07-13 15:50:03 -040037 skia_enable_flutter_defines = false
mtklein06c35c02016-09-20 12:28:12 -070038 skia_enable_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050039 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040040 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Mike Klein3669a822017-03-03 10:55:02 -050041 skia_enable_tools = is_skia_dev_build
42 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Greg Daniel686bb212016-10-27 10:48:48 -040043 skia_vulkan_sdk = getenv("VULKAN_SDK")
Robert Phillipsa6d2d702017-09-01 12:17:03 -040044 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040045 skia_compile_processors = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070046 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040047
48 skia_jumper_clang = ""
49 skia_jumper_objdump = ""
50 skia_jumper_ccache = ""
mtkleinc04ff472016-06-23 10:29:30 -070051}
Brian Salomon23d73ea2016-10-27 13:31:37 -040052declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040053 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040054 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050055 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Mike Klein10d665d2016-11-01 11:46:10 -040056
Mike Klein4d598a32016-10-31 13:44:49 -040057 if (is_android) {
58 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070059 } else if (is_fuchsia) {
60 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040061 } else {
62 skia_use_vulkan = skia_vulkan_sdk != ""
63 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040064}
Greg Danielec6ae522017-04-25 13:38:26 -040065declare_args() {
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +000066 skia_vulkan_headers = ""
Greg Danielec6ae522017-04-25 13:38:26 -040067 if (skia_use_vulkan) {
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +000068 # 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 -040069 if (is_fuchsia) {
70 skia_vulkan_headers = "$fuchsia_vulkan_sdk/include"
71 } else if (is_linux || is_win) {
72 skia_vulkan_headers = "$skia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040073 }
Greg Danielec6ae522017-04-25 13:38:26 -040074 }
75}
Brian Salomon789e25e2016-09-30 13:41:03 -040076
Adam Barth54ef74a2017-10-13 10:59:38 -070077if (defined(skia_settings)) {
78 import(skia_settings)
79}
80
mtklein38925aa2016-09-21 10:11:25 -070081# Our tools require static linking (they use non-exported symbols).
82skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070083
mtkleina45be612016-08-29 15:22:10 -070084fontmgr_android_enabled = skia_use_expat && skia_use_freetype
85
mtklein1211e0c2016-07-26 13:55:45 -070086skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070087 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070088 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070089 "include/codec",
90 "include/config",
91 "include/core",
92 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -040093 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -070094 "include/gpu",
95 "include/gpu/gl",
Brian Salomoncbcb0a12017-11-19 13:20:13 -050096 "include/atlastext",
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}
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500107if (skia_enable_atlas_text) {
108 skia_public_includes += [ "include/atlastext" ]
109}
Greg Daniele5ddff52017-07-05 16:49:36 -0400110if (skia_use_metal) {
111 skia_public_includes += [ "include/gpu/mtl" ]
112}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000113
mtkleinc04ff472016-06-23 10:29:30 -0700114# Skia public API, generally provided by :skia.
115config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700116 include_dirs = skia_public_includes
Greg Danielec6ae522017-04-25 13:38:26 -0400117 if (skia_vulkan_headers != "") {
118 include_dirs += [ skia_vulkan_headers ]
119 }
Mike Kleinae7e6712016-10-11 17:49:33 -0400120 defines = []
121 if (is_component_build) {
122 defines += [ "SKIA_DLL" ]
123 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400124 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700125 defines += [ "SK_SAMPLES_FOR_X" ]
126 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400127 if (skia_enable_flutter_defines) {
128 defines += flutter_defines
129 }
mtklein06c35c02016-09-20 12:28:12 -0700130 if (!skia_enable_gpu) {
131 defines += [ "SK_SUPPORT_GPU=0" ]
132 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500133 if (skia_enable_atlas_text) {
134 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
135 }
mtkleinc04ff472016-06-23 10:29:30 -0700136}
137
138# Skia internal APIs, used by Skia itself and a few test tools.
139config("skia_private") {
140 visibility = [ ":*" ]
141
142 include_dirs = [
143 "include/private",
144 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700145 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700146 "src/core",
147 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700148 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700149 "src/image",
150 "src/images",
151 "src/lazy",
152 "src/opts",
153 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700154 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700155 "src/ports",
156 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400157 "src/shaders",
158 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700159 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700160 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700161 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500162 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700163 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700164 ]
mtklein150d1132016-08-01 06:56:40 -0700165
Mike Reeda9e241d2017-05-03 10:52:00 -0400166 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700167 if (is_android) {
168 defines += [
169 "SK_GAMMA_EXPONENT=1.4",
170 "SK_GAMMA_CONTRAST=0.0",
171 ]
172 }
mtklein88a7ac02016-09-14 11:16:49 -0700173 if (is_official_build || is_android) {
174 # TODO(bsalomon): it'd be nice to make Android normal.
175 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
176 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400177 libs = []
178 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500179 if (skia_enable_gpu) {
180 include_dirs += [ "src/gpu" ]
181 }
Brian Osman34755e22016-12-05 09:46:02 -0500182 if (skia_use_angle) {
183 defines += [ "SK_ANGLE" ]
184 }
Brian Osman3f375d02016-12-28 11:19:22 -0500185 if (skia_enable_discrete_gpu) {
186 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
187 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400188 if (!is_official_build) {
189 defines += [ "GR_TEST_UTILS=1" ]
190 }
mtkleinc04ff472016-06-23 10:29:30 -0700191}
192
193# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
194config("skia_library") {
195 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700196 defines = [ "SKIA_IMPLEMENTATION=1" ]
197}
198
199skia_library_configs = [
200 ":skia_public",
201 ":skia_private",
202 ":skia_library",
203]
204
mtklein9b8583d2016-08-24 17:32:30 -0700205# Use for CPU-specific Skia code that needs particular compiler flags.
206template("opts") {
207 if (invoker.enabled) {
208 source_set(target_name) {
209 forward_variables_from(invoker, "*")
210 configs += skia_library_configs
211 }
212 } else {
213 # If not enabled, a phony empty target that swallows all otherwise unused variables.
214 source_set(target_name) {
215 forward_variables_from(invoker,
216 "*",
217 [
218 "sources",
219 "cflags",
220 ])
221 }
222 }
anmittala7eaf2e2016-08-17 13:57:26 -0700223}
224
mtklein422310d2016-08-16 18:28:43 -0700225is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700226
mtklein7d6fb2c2016-08-25 14:50:44 -0700227opts("none") {
228 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700229 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700230 cflags = []
231}
232
mtklein7d6fb2c2016-08-25 14:50:44 -0700233opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700234 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700235 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700236 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700237}
238
239opts("arm64") {
240 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700241 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700242 cflags = []
243}
244
245opts("crc32") {
246 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700247 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700248 cflags = [ "-march=armv8-a+crc" ]
249}
250
mtklein9b8583d2016-08-24 17:32:30 -0700251opts("sse2") {
252 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700253 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400254 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400255 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
256 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400257 cflags = [ "-msse2" ]
258 }
mtklein9b8583d2016-08-24 17:32:30 -0700259}
mtkleinc04ff472016-06-23 10:29:30 -0700260
mtklein9b8583d2016-08-24 17:32:30 -0700261opts("ssse3") {
262 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700263 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400264 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400265 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
266 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400267 cflags = [ "-mssse3" ]
268 }
mtklein9b8583d2016-08-24 17:32:30 -0700269}
mtkleinc04ff472016-06-23 10:29:30 -0700270
mtklein9b8583d2016-08-24 17:32:30 -0700271opts("sse41") {
272 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700273 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400274 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400275 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
276 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400277 cflags = [ "-msse4.1" ]
278 }
mtklein9b8583d2016-08-24 17:32:30 -0700279}
mtklein4e976072016-08-08 09:06:27 -0700280
mtklein9b8583d2016-08-24 17:32:30 -0700281opts("sse42") {
282 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700283 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400284 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400285 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
286 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400287 cflags = [ "-msse4.2" ]
288 }
mtklein9b8583d2016-08-24 17:32:30 -0700289}
290
291opts("avx") {
292 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700293 sources = skia_opts.avx_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400294 if (!is_clang && is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000295 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400296 } else {
297 cflags = [ "-mavx" ]
298 }
mtkleinc04ff472016-06-23 10:29:30 -0700299}
300
mtkleinc095df52016-08-24 12:23:52 -0700301# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700302template("optional") {
303 if (invoker.enabled) {
304 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700305 if (defined(invoker.public_defines)) {
306 defines = invoker.public_defines
307 }
mtklein457b42a2016-08-23 13:56:37 -0700308 }
309 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700310 forward_variables_from(invoker,
311 "*",
312 [
313 "public_defines",
314 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700315 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700316 ])
mtklein457b42a2016-08-23 13:56:37 -0700317 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700318 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700319 if (defined(invoker.configs_to_remove)) {
320 configs -= invoker.configs_to_remove
321 }
mtklein457b42a2016-08-23 13:56:37 -0700322 }
323 } else {
mtklein457b42a2016-08-23 13:56:37 -0700324 source_set(target_name) {
325 forward_variables_from(invoker,
326 "*",
327 [
328 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700329 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700330 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700331 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700332 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700333 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700334 ])
mtkleincd01b032016-08-31 04:58:19 -0700335 if (defined(invoker.sources_when_disabled)) {
336 sources = invoker.sources_when_disabled
337 }
338 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700339 }
mtkleineb3c4252016-08-23 07:38:09 -0700340 }
mtklein457b42a2016-08-23 13:56:37 -0700341}
mtklein457b42a2016-08-23 13:56:37 -0700342
Mike Kleina04bb452017-02-09 12:24:07 -0500343optional("effects") {
344 enabled = skia_enable_effects
Ethan Nicholas762466e2017-06-29 10:03:38 -0400345 deps = [
346 ":compile_processors",
347 ]
Mike Kleina04bb452017-02-09 12:24:07 -0500348 sources =
349 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
350 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
351}
352
mtkleina45be612016-08-29 15:22:10 -0700353optional("fontmgr_android") {
354 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700355
356 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500357 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700358 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700359 ]
360 sources = [
361 "src/ports/SkFontMgr_android.cpp",
362 "src/ports/SkFontMgr_android_factory.cpp",
363 "src/ports/SkFontMgr_android_parser.cpp",
364 ]
365}
366
mtkleind2e39db2016-09-07 07:52:55 -0700367optional("fontmgr_custom") {
368 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
369
370 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500371 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700372 ]
373 sources = [
374 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500375 "src/ports/SkFontMgr_custom.h",
376 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700377 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500378 "src/ports/SkFontMgr_custom_embedded.cpp",
379 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700380 ]
381}
382
mtklein3cc22182016-08-29 13:26:14 -0700383optional("fontmgr_fontconfig") {
384 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700385
386 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500387 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700388 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700389 ]
390 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700391 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700392 "src/ports/SkFontConfigInterface_direct.cpp",
393 "src/ports/SkFontConfigInterface_direct_factory.cpp",
394 "src/ports/SkFontMgr_FontConfigInterface.cpp",
395 "src/ports/SkFontMgr_fontconfig.cpp",
396 "src/ports/SkFontMgr_fontconfig_factory.cpp",
397 ]
398}
399
mtkleincdedd0e2016-09-12 15:15:44 -0700400optional("fontmgr_fuchsia") {
401 enabled = is_fuchsia && skia_use_freetype
402
403 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500404 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700405 ]
406 sources = [
407 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500408 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700409 "src/ports/SkFontMgr_custom_empty_factory.cpp",
410 ]
411}
412
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700413if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400414 executable("sksllex") {
415 sources = [
416 "src/sksl/lex/Main.cpp",
417 "src/sksl/lex/NFA.cpp",
418 "src/sksl/lex/RegexNode.cpp",
419 "src/sksl/lex/RegexParser.cpp",
420 ]
421 include_dirs = [ "src/sksl/lex" ]
422 }
423
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700424 action("run_sksllex") {
425 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400426 deps = [
427 ":sksllex(//gn/toolchain:$host_toolchain)",
428 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700429 sources = [
430 "src/sksl/lex/layout.lex",
431 "src/sksl/lex/sksl.lex",
432 ]
433
434 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
435 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
436 outputs = [
437 "$target_out_dir/" +
438 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
439 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
440 # confused due to the same file being named by two different paths
441 ]
442 sksllex_path = "$root_out_dir/"
443 sksllex_path += "sksllex"
444 if (host_os == "win") {
445 sksllex_path += ".exe"
446 }
447 args = [
448 rebase_path(sksllex_path),
449 rebase_path("bin/clang-format"),
450 rebase_path("src"),
451 ]
452 }
453} else {
454 group("run_sksllex") {
455 }
456}
457
458if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400459 executable("skslc") {
460 defines = [ "SKSL_STANDALONE" ]
461 sources = [
462 "src/sksl/SkSLMain.cpp",
463 ]
464 sources += skia_sksl_sources
465 include_dirs = [
466 "src/gpu",
467 "src/sksl",
468 ]
469 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500470 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400471 "//third_party/spirv-tools",
472 ]
473 }
474
475 skia_gpu_processor_outputs = []
476 foreach(src, skia_gpu_processor_sources) {
477 dir = get_path_info(src, "dir")
478 name = get_path_info(src, "name")
479
480 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
481 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
482 skia_gpu_processor_outputs += [
483 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
484 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
485 # confused due to the same file being named by two different paths
486 ]
487 }
488
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500489 action("create_sksl_enums") {
490 script = "gn/create_sksl_enums.py"
491 sources = [
492 "include/private/GrSharedEnums.h",
493 ]
494 outputs = [
495 "$target_out_dir/" +
496 rebase_path("src/sksl/sksl_enums.include", target_out_dir),
497 ]
498 args = [
499 rebase_path(sources[0]),
500 rebase_path(outputs[0]),
501 ]
502 }
503
Ethan Nicholas762466e2017-06-29 10:03:38 -0400504 action("compile_processors") {
505 script = "gn/compile_processors.py"
506 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500507 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400508 ":skslc(//gn/toolchain:$host_toolchain)",
509 ]
510 sources = skia_gpu_processor_sources
511 outputs = skia_gpu_processor_outputs
512 skslc_path = "$root_out_dir/"
513 if (host_toolchain != default_toolchain_name) {
514 skslc_path += "$host_toolchain/"
515 }
516 skslc_path += "skslc"
517 if (host_os == "win") {
518 skslc_path += ".exe"
519 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400520 args = [
521 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400522 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400523 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400524 args += rebase_path(skia_gpu_processor_sources)
525 }
526} else {
527 skia_gpu_processor_outputs = []
528 group("compile_processors") {
529 }
530}
531
mtklein06c35c02016-09-20 12:28:12 -0700532optional("gpu") {
533 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400534 deps = [
535 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700536 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400537 ]
mtkleine9fb3d52016-09-20 15:11:46 -0700538 public_defines = []
539
Mike Klein29b3e582017-02-09 11:57:32 -0500540 sources = skia_gpu_sources + skia_sksl_sources +
Ethan Nicholas762466e2017-06-29 10:03:38 -0400541 [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ] +
542 skia_gpu_processor_outputs
mtklein06c35c02016-09-20 12:28:12 -0700543
544 # These paths need to be absolute to match the ones produced by shared_sources.gni.
545 sources -= get_path_info([
546 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
547 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
548 ],
549 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400550 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700551 if (is_android) {
552 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400553
554 # this lib is required to link against AHardwareBuffer
555 if (defined(ndk_api) && ndk_api >= 26) {
556 libs += [ "android" ]
557 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400558 } else if (skia_use_egl) {
559 sources += [ "src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp" ]
560 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700561 } else if (is_linux) {
562 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500563 libs += [
564 "GL",
565 "GLU",
566 ]
mtklein06c35c02016-09-20 12:28:12 -0700567 } else if (is_mac) {
568 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800569 } else if (is_ios) {
570 sources += [ "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400571 } else if (is_win) {
572 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
573 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700574 } else {
575 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
576 }
mtkleine9fb3d52016-09-20 15:11:46 -0700577
578 if (skia_use_vulkan) {
579 public_defines += [ "SK_VULKAN" ]
580 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700581 if (skia_enable_vulkan_debug_layers) {
582 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
583 }
mtkleine9fb3d52016-09-20 15:11:46 -0700584 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400585 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400586 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400587 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
588 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400589
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400590 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400591 if (skia_use_metal) {
592 public_defines += [ "SK_METAL" ]
593 sources += skia_metal_sources
594 libs += [ "Metal.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400595 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400596 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500597
598 if (skia_enable_atlas_text) {
599 sources += skia_atlas_text_sources
600 }
mtklein06c35c02016-09-20 12:28:12 -0700601}
602
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400603optional("heif") {
604 enabled = skia_use_libheif
605 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
606
607 deps = []
608
609 sources = [
610 "src/codec/SkHeifCodec.cpp",
611 ]
612}
613
mtklein63213812016-08-24 09:55:56 -0700614optional("jpeg") {
615 enabled = skia_use_libjpeg_turbo
616 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
617
mtklein63213812016-08-24 09:55:56 -0700618 deps = [
619 "//third_party/libjpeg-turbo:libjpeg",
620 ]
621 sources = [
622 "src/codec/SkJpegCodec.cpp",
623 "src/codec/SkJpegDecoderMgr.cpp",
624 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700625 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400626 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700627 ]
628}
629
630optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500631 enabled = skia_use_zlib && skia_enable_pdf
632 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700633
mtklein63213812016-08-24 09:55:56 -0700634 deps = [
635 "//third_party/zlib",
636 ]
brettwb9447282016-09-01 14:24:39 -0700637 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700638 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700639
640 if (skia_use_sfntly) {
641 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500642 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700643 }
644}
645
646optional("png") {
647 enabled = skia_use_libpng
648 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
649
mtklein63213812016-08-24 09:55:56 -0700650 deps = [
651 "//third_party/libpng",
652 ]
653 sources = [
654 "src/codec/SkIcoCodec.cpp",
655 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400656 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700657 ]
658}
659
scroggof84ad642016-10-31 09:02:57 -0700660optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400661 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700662 public_defines = [ "SK_CODEC_DECODES_RAW" ]
663
664 deps = [
665 "//third_party/dng_sdk",
666 "//third_party/libjpeg-turbo:libjpeg",
667 "//third_party/piex",
668 ]
669
670 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
671 # Skia.
672 configs_to_remove = [ "//gn:no_exceptions" ]
673
674 sources = [
675 "src/codec/SkRawAdapterCodec.cpp",
676 "src/codec/SkRawCodec.cpp",
677 ]
678}
679
mtklein3cc22182016-08-29 13:26:14 -0700680optional("typeface_freetype") {
681 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700682
683 deps = [
684 "//third_party/freetype2",
685 ]
686 sources = [
687 "src/ports/SkFontHost_FreeType.cpp",
688 "src/ports/SkFontHost_FreeType_common.cpp",
689 ]
690}
691
mtklein457b42a2016-08-23 13:56:37 -0700692optional("webp") {
693 enabled = skia_use_libwebp
694 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
695
mtklein457b42a2016-08-23 13:56:37 -0700696 deps = [
697 "//third_party/libwebp",
698 ]
699 sources = [
700 "src/codec/SkWebpAdapterCodec.cpp",
701 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400702 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700703 ]
mtkleineb3c4252016-08-23 07:38:09 -0700704}
705
mtklein63213812016-08-24 09:55:56 -0700706optional("xml") {
707 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000708 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700709
mtklein63213812016-08-24 09:55:56 -0700710 deps = [
711 "//third_party/expat",
712 ]
713 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500714 "src/svg/SkSVGCanvas.cpp",
715 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700716 "src/xml/SkDOM.cpp",
717 "src/xml/SkXMLParser.cpp",
718 "src/xml/SkXMLWriter.cpp",
719 ]
720}
721
mtkleinc04ff472016-06-23 10:29:30 -0700722component("skia") {
723 public_configs = [ ":skia_public" ]
724 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700725
726 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700727 ":arm64",
728 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700729 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700730 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500731 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700732 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700733 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700734 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700735 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700736 ":gpu",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400737 ":heif",
mtklein63213812016-08-24 09:55:56 -0700738 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700739 ":none",
mtklein63213812016-08-24 09:55:56 -0700740 ":pdf",
741 ":png",
scroggof84ad642016-10-31 09:02:57 -0700742 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700743 ":sse2",
744 ":sse41",
745 ":sse42",
746 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700747 ":webp",
mtklein63213812016-08-24 09:55:56 -0700748 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700749 ]
750
Chinmay Garde43f115c2016-11-16 15:04:12 -0800751 # This file (and all GN files in Skia) are designed to work with an
752 # empty sources assignment filter; we handle all that explicitly.
753 # We clear the filter here for clients who may have set up a global filter.
754 set_sources_assignment_filter([])
755
mtkleinc04ff472016-06-23 10:29:30 -0700756 sources = []
brettwb9447282016-09-01 14:24:39 -0700757 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700758 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500759 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700760 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400761 "src/android/SkAndroidFrameworkUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700762 "src/android/SkBitmapRegionCodec.cpp",
763 "src/android/SkBitmapRegionDecoder.cpp",
764 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400765 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700766 "src/codec/SkBmpCodec.cpp",
767 "src/codec/SkBmpMaskCodec.cpp",
768 "src/codec/SkBmpRLECodec.cpp",
769 "src/codec/SkBmpStandardCodec.cpp",
770 "src/codec/SkCodec.cpp",
771 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700772 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700773 "src/codec/SkMaskSwizzler.cpp",
774 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700775 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700776 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700777 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700778 "src/codec/SkSwizzler.cpp",
779 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700780 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700781 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700782 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700783 "src/ports/SkMemory_malloc.cpp",
784 "src/ports/SkOSFile_stdio.cpp",
785 "src/sfnt/SkOTTable_name.cpp",
786 "src/sfnt/SkOTUtils.cpp",
787 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700788 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700789 ]
brettwb9447282016-09-01 14:24:39 -0700790
mtklein7d6fb2c2016-08-25 14:50:44 -0700791 libs = []
792
mtkleinc04ff472016-06-23 10:29:30 -0700793 if (is_win) {
794 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400795 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700796 "src/ports/SkDebug_win.cpp",
797 "src/ports/SkFontHost_win.cpp",
798 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500799 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700800 "src/ports/SkImageEncoder_WIC.cpp",
801 "src/ports/SkImageGeneratorWIC.cpp",
802 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700803 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700804 "src/ports/SkScalerContext_win_dw.cpp",
805 "src/ports/SkTLS_win.cpp",
806 "src/ports/SkTypeface_win_dw.cpp",
807 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400808 libs += [
809 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500810 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400811 "Ole32.lib",
812 "OleAut32.lib",
813 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500814 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400815 ]
mtkleinc04ff472016-06-23 10:29:30 -0700816 } else {
817 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700818 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700819 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700820 "src/ports/SkTLS_pthread.cpp",
821 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400822 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700823 }
824
mtklein7d6fb2c2016-08-25 14:50:44 -0700825 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500826 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500827 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500828 deps += [ "//third_party/cpu-features" ]
829 }
mtklein06c35c02016-09-20 12:28:12 -0700830 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700831 libs += [
832 "EGL",
833 "GLESv2",
834 "log",
835 ]
836 }
837
mtkleinc04ff472016-06-23 10:29:30 -0700838 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700839 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700840 }
841
842 if (is_mac) {
843 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700844 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700845 "src/ports/SkFontHost_mac.cpp",
846 "src/ports/SkImageEncoder_CG.cpp",
847 "src/ports/SkImageGeneratorCG.cpp",
848 ]
mtklein09e61f72016-08-23 13:35:28 -0700849 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400850 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
851 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700852 "ApplicationServices.framework",
853 "OpenGL.framework",
854 ]
mtkleinc04ff472016-06-23 10:29:30 -0700855 }
abarth6fc8ff02016-07-15 15:15:15 -0700856
Mike Klein7d302882016-11-03 14:06:31 -0400857 if (is_ios) {
858 sources += [
859 "src/ports/SkDebug_stdio.cpp",
860 "src/ports/SkFontHost_mac.cpp",
861 "src/ports/SkImageEncoder_CG.cpp",
862 "src/ports/SkImageGeneratorCG.cpp",
863 ]
864 libs += [
865 "CoreFoundation.framework",
866 "CoreGraphics.framework",
867 "CoreText.framework",
868 "ImageIO.framework",
869 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400870
871 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
872 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400873 ]
874 }
875
abarth6fc8ff02016-07-15 15:15:15 -0700876 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700877 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700878 }
mtkleinc04ff472016-06-23 10:29:30 -0700879}
880
mtkleinc095df52016-08-24 12:23:52 -0700881# Targets guarded by skia_enable_tools may use //third_party freely.
882if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500883 # Used by gn_to_bp.py to list our public include dirs.
884 source_set("public") {
885 configs += [ ":skia_public" ]
886 }
887
Mike Kleinc36dedf2016-11-18 09:35:28 -0500888 config("skia.h_config") {
889 include_dirs = [ "$target_gen_dir" ]
890 }
891 action("skia.h") {
892 public_configs = [ ":skia.h_config" ]
893 skia_h = "$target_gen_dir/skia.h"
894 script = "gn/find_headers.py"
Greg Danielc819e662017-04-19 16:39:45 -0400895 args = [ rebase_path(skia_h, root_build_dir) ] +
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000896 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -0500897 depfile = "$skia_h.deps"
898 outputs = [
899 skia_h,
900 ]
901 }
902
903 if (skia_enable_gpu && target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -0500904 executable("fiddle") {
905 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -0500906 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500907 "tools/fiddle/draw.cpp",
908 "tools/fiddle/fiddle_main.cpp",
909 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400910
911 if (skia_use_egl) {
912 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400913 } else {
914 sources += [ "tools/fiddle/null_context.cpp" ]
915 }
Joe Gregorio1e735c02017-04-19 14:05:14 -0400916 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -0500917 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -0400918 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -0500919 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -0500920 ":skia",
921 ":skia.h",
922 ]
923 }
924 }
925
926 if (skia_enable_gpu) {
927 source_set("public_headers_warnings_check") {
928 sources = [
929 "tools/public_headers_warnings_check.cpp",
930 ]
931 configs -= [ "//gn:warnings_except_public_headers" ]
932 deps = [
933 ":skia",
934 ":skia.h",
935 ]
936 }
937 }
938
mtkleinc095df52016-08-24 12:23:52 -0700939 template("test_lib") {
940 config(target_name + "_config") {
941 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700942 if (defined(invoker.public_defines)) {
943 defines = invoker.public_defines
944 }
mtklein25c81d42016-07-27 13:55:26 -0700945 }
mtkleinc095df52016-08-24 12:23:52 -0700946 source_set(target_name) {
947 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
948 public_configs = [
949 ":" + target_name + "_config",
950 ":skia_private",
951 ]
952
953 if (!defined(deps)) {
954 deps = []
955 }
956 deps += [ ":skia" ]
957 testonly = true
958 }
mtklein25c81d42016-07-27 13:55:26 -0700959 }
mtklein25c81d42016-07-27 13:55:26 -0700960
Mike Kleine6682eb2017-01-05 10:54:57 -0500961 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -0500962 if (is_ios) {
963 app_name = target_name
964 gen_path = target_gen_dir
965
966 action("${app_name}_generate_info_plist") {
967 script = "//gn/gen_plist_ios.py"
968 outputs = [
969 "$gen_path/${app_name}_Info.plist",
970 ]
971 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
972 }
973
974 bundle_data("${app_name}_bundle_info_plist") {
975 public_deps = [
976 ":${app_name}_generate_info_plist",
977 ]
978 sources = [
979 "$gen_path/${app_name}_Info.plist",
980 ]
981 outputs = [
982 "{{bundle_root_dir}}/Info.plist",
983 ]
984 }
985
986 executable("${app_name}_generate_executable") {
987 forward_variables_from(invoker,
988 "*",
989 [
990 "output_name",
991 "visibility",
992 "is_shared_library",
993 ])
Mike Klein154e6da2017-07-26 15:13:47 -0400994 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -0500995 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -0500996 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
997 }
998
999 bundle_data("${app_name}_bundle_executable") {
1000 public_deps = [
1001 ":${app_name}_generate_executable",
1002 ]
1003 sources = [
1004 "$gen_path/$app_name",
1005 ]
1006 outputs = [
1007 "{{bundle_executable_dir}}/$app_name",
1008 ]
1009 testonly = true
1010 }
1011
1012 create_bundle("$app_name") {
1013 product_type = "com.apple.product-type.application"
1014 testonly = true
1015
1016 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1017 bundle_resources_dir = bundle_root_dir
1018 bundle_executable_dir = bundle_root_dir
1019 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1020
1021 deps = [
1022 ":${app_name}_bundle_executable",
1023 ":${app_name}_bundle_info_plist",
1024 ]
1025
1026 # should only code sign when running on a device, not the simulator
1027 if (target_cpu != "x64") {
1028 code_signing_script = "//gn/codesign_ios.py"
1029 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1030 code_signing_outputs = [
1031 "$bundle_root_dir/_CodeSignature/CodeResources",
1032 "$bundle_root_dir/embedded.mobileprovision",
1033 ]
1034 code_signing_args =
1035 [ rebase_path("$bundle_root_dir", root_build_dir) ]
1036 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001037 }
1038 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001039 # !is_ios
1040
1041 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1042 shared_library("lib" + target_name) {
1043 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1044 configs += [ ":skia_private" ]
1045 testonly = true
1046 }
1047 } else {
1048 _executable = target_name
1049 executable(_executable) {
1050 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1051 configs += [ ":skia_private" ]
1052 testonly = true
1053 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001054 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001055 if (is_android && skia_android_serial != "" && defined(_executable)) {
1056 action("push_" + target_name) {
1057 script = "gn/push_to_android.py"
1058 deps = [
1059 ":" + _executable,
1060 ]
1061 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1062 outputs = [
1063 _stamp,
1064 ]
1065 args = [
1066 rebase_path("$root_build_dir/$_executable"),
1067 skia_android_serial,
1068 rebase_path(_stamp),
1069 ]
1070 testonly = true
1071 }
Mike Klein7d921032017-01-05 12:20:41 -05001072 }
1073 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001074 }
1075
mtkleinc095df52016-08-24 12:23:52 -07001076 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001077 public_include_dirs = []
1078 if (skia_enable_gpu) {
1079 public_defines = []
1080 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001081
1082 deps = []
mtklein38925aa2016-09-21 10:11:25 -07001083 sources = [
1084 "tools/gpu/GrContextFactory.cpp",
1085 "tools/gpu/GrTest.cpp",
1086 "tools/gpu/TestContext.cpp",
Brian Salomoncbcb0a12017-11-19 13:20:13 -05001087 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001088 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -07001089 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001090 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
1091 "tools/gpu/gl/debug/GrBufferObj.cpp",
1092 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
1093 "tools/gpu/gl/debug/GrProgramObj.cpp",
1094 "tools/gpu/gl/debug/GrShaderObj.cpp",
1095 "tools/gpu/gl/debug/GrTextureObj.cpp",
1096 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
1097 "tools/gpu/gl/null/NullGLTestContext.cpp",
Brian Salomoncfe910d2017-07-06 16:40:18 -04001098 "tools/gpu/mock/MockTestContext.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001099 ]
1100 libs = []
mtklein25c81d42016-07-27 13:55:26 -07001101
Kevin Lubick4a24e102017-03-29 11:19:01 -04001102 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -07001103 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -04001104 } else if (is_ios) {
1105 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1106 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -07001107 } else if (is_linux) {
1108 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001109 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -07001110 } else if (is_mac) {
1111 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001112 } else if (is_win) {
1113 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1114 libs += [
1115 "Gdi32.lib",
1116 "OpenGL32.lib",
1117 ]
mtklein38925aa2016-09-21 10:11:25 -07001118 }
mtklein6ef69992016-09-14 06:12:09 -07001119
Greg Daniel6b7e0e22017-07-12 16:21:09 -04001120 cflags_objcc = [ "-fobjc-arc" ]
1121
Mike Kleinc168a3a2016-11-14 14:53:13 +00001122 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +00001123 deps += [ "//third_party/angle2" ]
1124 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1125 }
mtkleind68f9b02016-09-23 13:18:41 -07001126 if (skia_use_vulkan) {
1127 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Greg Daniel35970ec2017-11-10 10:03:05 -05001128 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
mtkleind68f9b02016-09-23 13:18:41 -07001129 }
Greg Danielb76a72a2017-07-13 15:07:54 -04001130 if (skia_use_metal) {
1131 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
1132 }
mtkleina627b5c2016-09-20 13:36:47 -07001133 }
mtklein25c81d42016-07-27 13:55:26 -07001134 }
mtklein25c81d42016-07-27 13:55:26 -07001135
mtkleinc095df52016-08-24 12:23:52 -07001136 test_lib("flags") {
1137 public_include_dirs = [ "tools/flags" ]
1138 sources = [
1139 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001140 ]
1141 }
1142 test_lib("common_flags") {
1143 public_include_dirs = [ "tools/flags" ]
1144 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001145 "tools/flags/SkCommonFlags.cpp",
1146 "tools/flags/SkCommonFlagsConfig.cpp",
1147 ]
1148 deps = [
mtklein046cb562016-09-16 10:23:12 -07001149 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001150 ":gpu_tool_utils",
1151 ]
1152 }
mtklein25c81d42016-07-27 13:55:26 -07001153
mtkleinc095df52016-08-24 12:23:52 -07001154 test_lib("tool_utils") {
1155 public_include_dirs = [
1156 "tools",
1157 "tools/debugger",
1158 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001159 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001160 ]
1161 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001162 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001163 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001164 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001165 "tools/ProcStats.cpp",
1166 "tools/Resources.cpp",
Mike Klein10d66cc2017-11-10 11:33:43 -05001167 "tools/SkRandomScalerContext.cpp",
1168 "tools/SkTestScalerContext.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001169 "tools/ThermalManager.cpp",
1170 "tools/UrlDataManager.cpp",
1171 "tools/debugger/SkDebugCanvas.cpp",
1172 "tools/debugger/SkDrawCommand.cpp",
1173 "tools/debugger/SkJsonWriteBuffer.cpp",
1174 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001175 "tools/picture_utils.cpp",
1176 "tools/random_parse_path.cpp",
1177 "tools/sk_tool_utils.cpp",
1178 "tools/sk_tool_utils_font.cpp",
1179 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001180 "tools/trace/SkChromeTracingTracer.cpp",
1181 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001182 "tools/trace/SkDebugfTracer.cpp",
1183 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001184 "tools/trace/SkEventTracingPriv.cpp",
1185 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001186 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001187 libs = []
1188 if (is_ios) {
1189 sources += [ "tools/ios_utils.m" ]
1190 libs += [ "Foundation.framework" ]
1191 }
mtkleinc095df52016-08-24 12:23:52 -07001192 deps = [
mtklein046cb562016-09-16 10:23:12 -07001193 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001194 ":flags",
1195 "//third_party/libpng",
1196 ]
1197 public_deps = [
1198 "//third_party/jsoncpp",
1199 ]
1200 }
mtklein25c81d42016-07-27 13:55:26 -07001201
Mike Klein6e744122016-10-27 12:21:40 -04001202 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001203 test_lib("gm") {
1204 public_include_dirs = [ "gm" ]
1205 sources = gm_sources
1206 deps = [
scroggo19b91532016-10-24 09:03:26 -07001207 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001208 ":gpu_tool_utils",
1209 ":skia",
1210 ":tool_utils",
1211 ]
1212 }
mtklein25c81d42016-07-27 13:55:26 -07001213
Mike Klein6e744122016-10-27 12:21:40 -04001214 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001215 test_lib("tests") {
1216 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001217 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001218 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001219 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001220 }
mtkleinc095df52016-08-24 12:23:52 -07001221 deps = [
fmalita6cf896d2016-08-25 08:44:35 -07001222 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001223 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001224 ":skia",
1225 ":tool_utils",
1226 "//third_party/libpng",
1227 "//third_party/zlib",
1228 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001229 public_deps = [
1230 ":gpu_tool_utils", # Test.h #includes headers from this target.
1231 ]
mtkleinc095df52016-08-24 12:23:52 -07001232 }
mtklein2f3416d2016-08-02 16:02:05 -07001233
Mike Klein6e744122016-10-27 12:21:40 -04001234 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001235 test_lib("bench") {
1236 public_include_dirs = [ "bench" ]
1237 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001238 deps = [
1239 ":flags",
1240 ":gm",
1241 ":gpu_tool_utils",
1242 ":skia",
1243 ":tool_utils",
1244 ]
1245 }
mtklein2b6870c2016-07-28 14:17:33 -07001246
mtkleinc095df52016-08-24 12:23:52 -07001247 test_lib("experimental_svg_model") {
1248 public_include_dirs = [ "experimental/svg/model" ]
1249 sources = [
1250 "experimental/svg/model/SkSVGAttribute.cpp",
1251 "experimental/svg/model/SkSVGAttributeParser.cpp",
1252 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -05001253 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001254 "experimental/svg/model/SkSVGContainer.cpp",
1255 "experimental/svg/model/SkSVGDOM.cpp",
1256 "experimental/svg/model/SkSVGEllipse.cpp",
Florin Malitadf007e12017-10-09 15:14:13 -04001257 "experimental/svg/model/SkSVGGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001258 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001259 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001260 "experimental/svg/model/SkSVGNode.cpp",
1261 "experimental/svg/model/SkSVGPath.cpp",
Florin Malita1aa1bb62017-10-11 14:34:33 -04001262 "experimental/svg/model/SkSVGPattern.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001263 "experimental/svg/model/SkSVGPoly.cpp",
Florin Malitacc6cc292017-10-09 16:05:30 -04001264 "experimental/svg/model/SkSVGRadialGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001265 "experimental/svg/model/SkSVGRect.cpp",
1266 "experimental/svg/model/SkSVGRenderContext.cpp",
1267 "experimental/svg/model/SkSVGSVG.cpp",
1268 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001269 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001270 "experimental/svg/model/SkSVGTransformableNode.cpp",
Florin Malita6a69c052017-10-11 14:02:11 -04001271 "experimental/svg/model/SkSVGUse.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001272 "experimental/svg/model/SkSVGValue.cpp",
1273 ]
1274 deps = [
1275 ":skia",
1276 ]
1277 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001278
Kevin Lubickebf648e2017-09-21 13:45:16 -04001279 if (target_cpu != "wasm") {
1280 test_lib("views") {
1281 public_include_dirs = [ "include/views" ]
1282 sources = [
1283 "src/views/SkEvent.cpp",
1284 "src/views/SkEventSink.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001285 "src/views/SkTouchGesture.cpp",
1286 "src/views/SkView.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001287 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001288 libs = []
1289 deps = []
Kevin Lubickebf648e2017-09-21 13:45:16 -04001290 if (is_linux) {
1291 public_include_dirs += [ "src/views/unix" ]
Brian Osman4f99e582017-11-22 13:23:35 -05001292 sources += [ "src/views/unix/keysym2ucs.c" ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001293 libs += [
1294 "GL",
1295 "X11",
1296 ]
1297 } else if (is_mac) {
Kevin Lubickebf648e2017-09-21 13:45:16 -04001298 libs += [
1299 "QuartzCore.framework",
1300 "Cocoa.framework",
1301 "Foundation.framework",
1302 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001303 }
1304 if (skia_use_angle) {
1305 deps += [ "//third_party/angle2" ]
1306 }
Brian Osman34755e22016-12-05 09:46:02 -05001307 }
Brian Osman16adfa32016-10-18 14:42:44 -04001308 }
1309
Mike Klein38af9432016-11-11 11:39:44 -05001310 if (skia_use_lua) {
1311 test_lib("lua") {
1312 public_include_dirs = []
1313 sources = [
1314 "src/utils/SkLua.cpp",
1315 "src/utils/SkLuaCanvas.cpp",
1316 ]
1317 deps = [
1318 "//third_party/lua",
1319 ]
1320 }
1321
Mike Kleine6682eb2017-01-05 10:54:57 -05001322 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001323 sources = [
1324 "tools/lua/lua_app.cpp",
1325 ]
1326 deps = [
1327 ":lua",
1328 ":skia",
1329 "//third_party/lua",
1330 ]
Mike Klein38af9432016-11-11 11:39:44 -05001331 }
1332
Mike Kleine6682eb2017-01-05 10:54:57 -05001333 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001334 sources = [
1335 "tools/lua/lua_pictures.cpp",
1336 ]
1337 deps = [
1338 ":flags",
1339 ":lua",
1340 ":skia",
1341 ":tool_utils",
1342 "//third_party/lua",
1343 ]
Mike Klein38af9432016-11-11 11:39:44 -05001344 }
1345 }
1346
Cary Clark8032b982017-07-28 11:04:54 -04001347 test_app("bookmaker") {
1348 sources = [
1349 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001350 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001351 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001352 "tools/bookmaker/fiddleParser.cpp",
1353 "tools/bookmaker/includeParser.cpp",
1354 "tools/bookmaker/includeWriter.cpp",
1355 "tools/bookmaker/mdOut.cpp",
1356 "tools/bookmaker/parserCommon.cpp",
1357 "tools/bookmaker/spellCheck.cpp",
1358 ]
1359 deps = [
1360 ":flags",
1361 ":skia",
1362 ":tool_utils",
1363 ]
1364 }
1365
Kevin Lubickebf648e2017-09-21 13:45:16 -04001366 if (target_cpu != "wasm") {
1367 import("gn/samples.gni")
1368 test_lib("samples") {
1369 public_include_dirs = [ "samplecode" ]
1370 include_dirs = [ "experimental" ]
1371 sources = samples_sources + [
Kevin Lubickebf648e2017-09-21 13:45:16 -04001372 # Relocating these files here, so that clients don't try to build them while they're
1373 # still in active development. Clang's thread safety analysis gets tripped up by
1374 # conditional locks.
1375 "src/core/SkThreadedBMPDevice.cpp",
1376 "src/core/SkThreadedBMPDevice.h",
1377 ]
1378 deps = [
1379 ":experimental_svg_model",
1380 ":flags",
1381 ":gm",
1382 ":tool_utils",
1383 ":views",
1384 ":xml",
1385 ]
Mike Klein38af9432016-11-11 11:39:44 -05001386
Kevin Lubickebf648e2017-09-21 13:45:16 -04001387 if (skia_use_lua) {
1388 sources += [ "samplecode/SampleLua.cpp" ]
1389 deps += [
1390 ":lua",
1391 "//third_party/lua",
1392 ]
1393 }
1394 }
1395 test_app("dm") {
1396 sources = [
1397 "dm/DM.cpp",
Mike Klein31868212017-11-06 12:02:47 -05001398 "dm/DMFontMgr.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001399 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001400 "dm/DMJsonWriter.cpp",
1401 "dm/DMSrcSink.cpp",
1402 ]
1403 include_dirs = [ "tests" ]
1404 deps = [
1405 ":common_flags",
1406 ":experimental_svg_model",
1407 ":flags",
1408 ":gm",
1409 ":gpu_tool_utils",
1410 ":skia",
1411 ":tests",
1412 ":tool_utils",
1413 "//third_party/jsoncpp",
1414 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001415 ]
1416 }
Brian Osman16adfa32016-10-18 14:42:44 -04001417 }
1418
Mike Klein06432b22017-03-21 13:14:33 -04001419 test_app("ok") {
1420 sources = [
Mike Klein361dde02017-11-07 08:14:52 -05001421 "dm/DMFontMgr.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001422 "tools/ok.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001423 "tools/ok_dsts.cpp",
Mike Klein154e6da2017-07-26 15:13:47 -04001424 "tools/ok_engines.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001425 "tools/ok_srcs.cpp",
Mike Kleind63442d2017-03-27 14:16:04 -04001426 "tools/ok_test.cpp",
Mike Kleinf5d1a552017-03-25 12:32:22 -04001427 "tools/ok_vias.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001428 ]
1429 deps = [
Mike Klein4f6e2712017-08-11 10:37:35 -04001430 ":bench",
Mike Klein06432b22017-03-21 13:14:33 -04001431 ":gm",
1432 ":skia",
Mike Kleind63442d2017-03-27 14:16:04 -04001433 ":tests",
Mike Klein62669ad2017-05-09 16:03:07 -04001434 ":tool_utils",
Mike Klein06432b22017-03-21 13:14:33 -04001435 ]
1436 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001437 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001438 sources = [
1439 "bench/nanobench.cpp",
1440 ]
1441 deps = [
1442 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001443 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001444 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001445 ":flags",
1446 ":gm",
1447 ":gpu_tool_utils",
1448 ":skia",
1449 ":tool_utils",
1450 "//third_party/jsoncpp",
1451 ]
mtklein2b6870c2016-07-28 14:17:33 -07001452 }
halcanary19a97202016-08-03 15:08:04 -07001453
Ravi Mistry10d36c52017-01-31 09:49:18 -05001454 test_app("skpinfo") {
1455 sources = [
1456 "tools/skpinfo.cpp",
1457 ]
1458 deps = [
1459 ":flags",
1460 ":skia",
1461 ]
1462 }
1463
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001464 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001465 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001466 sources = [
1467 "tools/skpbench/skpbench.cpp",
1468 ]
1469 deps = [
1470 ":flags",
1471 ":gpu_tool_utils",
1472 ":skia",
1473 ":tool_utils",
1474 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001475 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001476 }
1477
Mike Klein7d302882016-11-03 14:06:31 -04001478 # We can't yet build ICU on iOS or Windows.
Kevin Lubickebf648e2017-09-21 13:45:16 -04001479 if (!is_ios && !is_win && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001480 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001481 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001482 "tools/shape/SkShaper_harfbuzz.cpp",
1483 "tools/shape/using_skia_and_harfbuzz.cpp",
mtklein6f5df6a2016-08-29 16:01:10 -07001484 ]
1485 deps = [
1486 ":skia",
1487 "//third_party/harfbuzz",
Ben Wagnera25fbef2017-08-30 13:56:19 -04001488 "//third_party/icu",
mtklein6f5df6a2016-08-29 16:01:10 -07001489 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001490 }
halcanary19a97202016-08-03 15:08:04 -07001491 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001492 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001493 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001494 "tools/shape/SkShaper_primitive.cpp",
1495 "tools/shape/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001496 ]
1497 deps = [
1498 ":skia",
1499 ]
halcanary3eee9d92016-09-10 07:01:53 -07001500 }
mtklein046cb562016-09-16 10:23:12 -07001501
Matt Sarett9f1c4032017-05-17 10:06:32 -04001502 test_app("create_flutter_test_images") {
1503 sources = [
1504 "tools/create_flutter_test_images.cpp",
1505 ]
1506 deps = [
1507 ":skia",
1508 ":tool_utils",
1509 ]
1510 }
1511
Ben Wagner219f3622017-07-17 15:32:25 -04001512 test_app("create_test_font") {
1513 sources = [
1514 "tools/create_test_font.cpp",
1515 ]
1516 deps = [
1517 ":skia",
1518 ]
1519 assert_no_deps = [
1520 # tool_utils requires the output of this app.
1521 ":tool_utils",
1522 ]
1523 }
1524
Mike Kleine6682eb2017-01-05 10:54:57 -05001525 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001526 sources = [
1527 "tools/get_images_from_skps.cpp",
1528 ]
1529 deps = [
1530 ":flags",
1531 ":skia",
1532 "//third_party/jsoncpp",
1533 ]
mtklein046cb562016-09-16 10:23:12 -07001534 }
mtkleinecbc5262016-09-22 11:51:24 -07001535
Mike Kleine6682eb2017-01-05 10:54:57 -05001536 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001537 sources = [
1538 "tools/colorspaceinfo.cpp",
1539 ]
1540 deps = [
1541 ":flags",
1542 ":skia",
1543 ":tool_utils",
1544 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001545 }
1546
Kevin Lubickebf648e2017-09-21 13:45:16 -04001547 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001548 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001549 sources = [
1550 "tools/skiaserve/Request.cpp",
1551 "tools/skiaserve/Response.cpp",
1552 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001553 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1554 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1555 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1556 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1557 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1558 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1559 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1560 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1561 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001562 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1563 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001564 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1565 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1566 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1567 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1568 ]
1569 deps = [
1570 ":flags",
1571 ":gpu_tool_utils",
1572 ":skia",
1573 ":tool_utils",
1574 "//third_party/jsoncpp",
1575 "//third_party/libmicrohttpd",
1576 "//third_party/libpng",
1577 ]
Mike Klein7d302882016-11-03 14:06:31 -04001578 }
mtkleinecbc5262016-09-22 11:51:24 -07001579 }
kjlubick14f984b2016-10-03 11:49:45 -07001580
Mike Kleine6682eb2017-01-05 10:54:57 -05001581 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07001582 sources = [
1583 "fuzz/FilterFuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001584 "fuzz/FuzzCanvas.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001585 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001586 "fuzz/FuzzGradients.cpp",
1587 "fuzz/FuzzParsePath.cpp",
1588 "fuzz/FuzzPathop.cpp",
1589 "fuzz/FuzzScaleToSides.cpp",
1590 "fuzz/fuzz.cpp",
1591 ]
1592 deps = [
1593 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001594 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001595 ":skia",
Hal Canarydb683012016-11-23 08:55:18 -07001596 ":tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001597 ]
kjlubick14f984b2016-10-03 11:49:45 -07001598 }
Mike Klein38312422016-10-05 15:41:01 -04001599
Mike Kleine6682eb2017-01-05 10:54:57 -05001600 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001601 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001602 rebase_path("tests/skia_test.cpp"),
1603 rebase_path("tests/Test.cpp"),
1604 ]
caryclark9feb6322016-10-25 08:58:26 -07001605 deps = [
1606 ":flags",
1607 ":gpu_tool_utils",
1608 ":skia",
1609 ":tool_utils",
1610 ]
caryclark9feb6322016-10-25 08:58:26 -07001611 }
1612
Mike Kleine6682eb2017-01-05 10:54:57 -05001613 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001614 sources = [
1615 "tools/DumpRecord.cpp",
1616 "tools/dump_record.cpp",
1617 ]
1618 deps = [
1619 ":flags",
1620 ":skia",
1621 ]
Mike Klein38312422016-10-05 15:41:01 -04001622 }
bungemanfe917272016-10-13 17:36:40 -04001623
Mike Kleine6682eb2017-01-05 10:54:57 -05001624 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001625 sources = [
1626 "tools/skdiff/skdiff.cpp",
1627 "tools/skdiff/skdiff_html.cpp",
1628 "tools/skdiff/skdiff_main.cpp",
1629 "tools/skdiff/skdiff_utils.cpp",
1630 ]
1631 deps = [
1632 ":skia",
1633 ":tool_utils",
1634 ]
bungemanfe917272016-10-13 17:36:40 -04001635 }
halcanarya73d76a2016-10-17 13:19:02 -07001636
Mike Kleine6682eb2017-01-05 10:54:57 -05001637 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001638 sources = [
1639 "tools/skp_parser.cpp",
1640 ]
1641 deps = [
1642 ":skia",
1643 ":tool_utils",
1644 "//third_party/jsoncpp",
1645 ]
halcanarya73d76a2016-10-17 13:19:02 -07001646 }
Brian Osman16adfa32016-10-18 14:42:44 -04001647
Hal Canary75427132017-10-11 16:00:31 -04001648 if (!is_win) {
1649 test_app("gpucts") {
1650 sources = [
1651 "dm/DMGpuTestProcs.cpp",
1652 "tools/gpucts/gm_knowledge.c",
1653 "tools/gpucts/gm_runner.cpp",
1654 "tools/gpucts/gpucts.cpp",
1655 ]
1656 deps = [
1657 ":gm",
1658 ":gpu_tool_utils",
1659 ":skia",
1660 ":tests",
1661 "//third_party/googletest",
1662 ]
1663 }
1664 }
1665
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001666 if (skia_enable_gpu) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001667 test_lib("sk_app") {
1668 public_include_dirs = [ "tools/sk_app" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001669 sources = [
Brian Osmaneff04b52017-11-21 13:18:02 -05001670 "tools/sk_app/CommandSet.cpp",
1671 "tools/sk_app/GLWindowContext.cpp",
1672 "tools/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001673 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001674 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001675
Jim Van Verth4e56a912016-10-21 10:58:52 -04001676 if (is_android) {
1677 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001678 "tools/sk_app/android/GLWindowContext_android.cpp",
1679 "tools/sk_app/android/RasterWindowContext_android.cpp",
1680 "tools/sk_app/android/Window_android.cpp",
1681 "tools/sk_app/android/main_android.cpp",
1682 "tools/sk_app/android/surface_glue_android.cpp",
Jim Van Verth4e56a912016-10-21 10:58:52 -04001683 ]
Brian Osman462334e2017-02-09 11:22:57 -05001684 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001685 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001686 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001687 "tools/sk_app/unix/GLWindowContext_unix.cpp",
1688 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
1689 "tools/sk_app/unix/Window_unix.cpp",
1690 "tools/sk_app/unix/main_unix.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001691 ]
1692 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001693 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001694 "tools/sk_app/win/GLWindowContext_win.cpp",
1695 "tools/sk_app/win/RasterWindowContext_win.cpp",
1696 "tools/sk_app/win/Window_win.cpp",
1697 "tools/sk_app/win/main_win.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001698 ]
Brian Salomon194db172017-08-17 14:37:06 -04001699 if (skia_use_angle) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001700 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04001701 }
Mike Klein43c25262016-10-20 10:17:47 -04001702 } else if (is_mac) {
1703 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001704 "tools/sk_app/mac/GLWindowContext_mac.cpp",
1705 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
1706 "tools/sk_app/mac/Window_mac.cpp",
1707 "tools/sk_app/mac/main_mac.cpp",
Mike Klein43c25262016-10-20 10:17:47 -04001708 ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001709 } else if (is_ios) {
1710 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001711 "tools/sk_app/ios/GLWindowContext_ios.cpp",
1712 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
1713 "tools/sk_app/ios/Window_ios.cpp",
1714 "tools/sk_app/ios/main_ios.cpp",
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001715 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001716 }
1717
1718 if (skia_use_vulkan) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001719 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001720 if (is_android) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001721 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001722 } else if (is_linux) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001723 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
Brian Osman2dd96932016-10-18 15:33:53 -04001724 libs += [ "X11-xcb" ]
1725 } else if (is_win) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001726 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001727 }
1728 }
1729
Brian Osman16adfa32016-10-18 14:42:44 -04001730 deps = [
Brian Osman16adfa32016-10-18 14:42:44 -04001731 ":gpu_tool_utils",
Brian Osman16adfa32016-10-18 14:42:44 -04001732 ":skia",
1733 ":tool_utils",
1734 ":views",
Brian Osman16adfa32016-10-18 14:42:44 -04001735 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001736 if (is_android) {
1737 deps += [ "//third_party/native_app_glue" ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001738 } else if (is_mac || is_ios) {
Mike Klein43c25262016-10-20 10:17:47 -04001739 deps += [ "//third_party/libsdl" ]
1740 }
Brian Salomon194db172017-08-17 14:37:06 -04001741 if (skia_use_angle) {
1742 deps += [ "//third_party/angle2" ]
1743 }
Mike Kleina92c3832016-12-08 09:49:39 -05001744 }
Brian Osman16adfa32016-10-18 14:42:44 -04001745 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001746
Brian Osmaneff04b52017-11-21 13:18:02 -05001747 if (skia_enable_gpu) {
1748 test_app("viewer") {
1749 is_shared_library = is_android
1750 sources = [
1751 "tools/viewer/GMSlide.cpp",
1752 "tools/viewer/ImageSlide.cpp",
1753 "tools/viewer/SKPSlide.cpp",
1754 "tools/viewer/SampleSlide.cpp",
1755 "tools/viewer/Viewer.cpp",
1756 ]
1757 libs = []
1758
1759 include_dirs = []
1760 deps = [
1761 ":flags",
1762 ":gm",
1763 ":gpu_tool_utils",
1764 ":samples",
1765 ":sk_app",
1766 ":skia",
1767 ":tool_utils",
1768 ":views",
1769 "//third_party/imgui",
1770 "//third_party/jsoncpp",
1771 ]
1772 }
1773 }
1774
1775 if (skia_enable_gpu && !skia_use_angle && (is_linux || is_win || is_mac)) {
1776 test_app("HelloWorld") {
1777 sources = [
1778 "example/HelloWorld.cpp",
1779 ]
1780 libs = []
1781
1782 include_dirs = []
1783 deps = [
1784 ":flags",
1785 ":gpu_tool_utils",
1786 ":sk_app",
1787 ":skia",
1788 ":tool_utils",
1789 ":views",
1790 ]
1791 }
1792 }
1793
Jim Van Verthecfed2b2017-08-30 14:02:50 -04001794 if (skia_enable_gpu && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04001795 test_app("SkiaSDLExample") {
1796 sources = [
1797 "example/SkiaSDLExample.cpp",
1798 ]
1799 libs = []
1800 include_dirs = []
1801 deps = [
1802 ":gpu_tool_utils",
1803 ":skia",
1804 "//third_party/libsdl",
1805 ]
1806 }
1807 }
1808
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001809 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
1810 action_foreach("generate_mocs") {
1811 script = "gn/call.py"
1812 sources = [
1813 "tools/mdbviz/MainWindow.h",
1814 ]
1815 outputs = [
1816 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
1817 ]
1818 args = [
1819 "$skia_qt_path" + "/bin/moc",
1820 "{{source}}",
1821 "-o",
1822 "gen/mdbviz/{{source_name_part}}_moc.cpp",
1823 ]
1824 }
1825 action_foreach("generate_resources") {
1826 script = "gn/call.py"
1827 sources = [
1828 "tools/mdbviz/resources.qrc",
1829 ]
1830 outputs = [
1831 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
1832 ]
1833 args = [
1834 "$skia_qt_path" + "/bin/rcc",
1835 "{{source}}",
1836 "-o",
1837 "gen/mdbviz/{{source_name_part}}_res.cpp",
1838 ]
1839 }
1840 test_app("mdbviz") {
1841 if (is_win) {
1842 # on Windows we need to disable some exception handling warnings due to the Qt headers
1843 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
1844 }
1845 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001846 "tools/UrlDataManager.cpp",
1847 "tools/debugger/SkDebugCanvas.cpp",
1848 "tools/debugger/SkDrawCommand.cpp",
1849 "tools/debugger/SkJsonWriteBuffer.cpp",
1850 "tools/debugger/SkObjectParser.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001851 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04001852 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001853 "tools/mdbviz/main.cpp",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001854 "tools/picture_utils.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001855
1856 # generated files
1857 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
1858 "$target_gen_dir/mdbviz/resources_res.cpp",
1859 ]
1860 lib_dirs = [ "$skia_qt_path/lib" ]
1861 libs = [
1862 "Qt5Core.lib",
1863 "Qt5Gui.lib",
1864 "Qt5Widgets.lib",
1865 ]
1866 include_dirs = [
1867 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04001868 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001869 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001870 "tools",
1871 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001872 ]
1873 deps = [
1874 ":generate_mocs",
1875 ":generate_resources",
1876 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001877 "//third_party/jsoncpp",
1878 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001879 ]
1880 }
1881 }
1882
Mike Kleine459afd2017-03-03 09:21:30 -05001883 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05001884 copy("gdbserver") {
1885 sources = [
1886 "$ndk/$ndk_gdbserver",
1887 ]
1888 outputs = [
1889 "$root_out_dir/gdbserver",
1890 ]
1891 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05001892 }
mtklein25c81d42016-07-27 13:55:26 -07001893}
Mike Kleinc55a6cb2017-06-28 13:21:47 -04001894
1895if (skia_jumper_clang != "") {
1896 action("regen_jumper") {
1897 script = "src/jumper/build_stages.py"
1898
1899 inputs = [
1900 "src/jumper/SkJumper_stages.cpp",
Mike Klein9b2f69b2017-09-12 16:40:53 -04001901 "src/jumper/SkJumper_stages_lowp.cpp",
Mike Kleinc55a6cb2017-06-28 13:21:47 -04001902 ]
1903
1904 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it.
1905 outputs = [
1906 "$target_out_dir/" +
1907 rebase_path("src/jumper/SkJumper_generated.S", target_out_dir),
1908 "$target_out_dir/" +
1909 rebase_path("src/jumper/SkJumper_generated_win.S", target_out_dir),
1910 ]
1911
1912 args = [
1913 skia_jumper_clang,
1914 skia_jumper_objdump,
1915 skia_jumper_ccache,
1916 ] + rebase_path(inputs) + rebase_path(outputs)
1917 }
1918}