blob: 416a42d3c5afc2e2d97672cf7a987fe62cf21591 [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
Jim Van Verth329c5a62017-11-29 11:42:33 -0500986 bundle_ios_data =
987 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
988
989 if (bundle_ios_data) {
990 has_skps =
991 "True" == exec_script("//gn/checkdir.py",
992 [ rebase_path("skps", root_build_dir) ],
993 "trim string")
994 bundle_data("${app_name}_bundle_resources") {
995 sources = [
996 "resources",
997 ]
998 outputs = [
999 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1000 "{{bundle_resources_dir}}/data/resources",
1001 ]
1002 }
1003
1004 if (has_skps) {
1005 bundle_data("${app_name}_bundle_skps") {
1006 sources = [
1007 "skps",
1008 ]
1009 outputs = [
1010 # Store in same folder as resources
1011 "{{bundle_resources_dir}}/data/skps",
1012 ]
1013 }
1014 }
1015 }
1016
Jim Van Verth443a9132017-11-28 09:45:26 -05001017 executable("${app_name}_generate_executable") {
1018 forward_variables_from(invoker,
1019 "*",
1020 [
1021 "output_name",
1022 "visibility",
1023 "is_shared_library",
1024 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001025 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001026 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001027 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1028 }
1029
1030 bundle_data("${app_name}_bundle_executable") {
1031 public_deps = [
1032 ":${app_name}_generate_executable",
1033 ]
1034 sources = [
1035 "$gen_path/$app_name",
1036 ]
1037 outputs = [
1038 "{{bundle_executable_dir}}/$app_name",
1039 ]
1040 testonly = true
1041 }
1042
1043 create_bundle("$app_name") {
1044 product_type = "com.apple.product-type.application"
1045 testonly = true
1046
1047 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1048 bundle_resources_dir = bundle_root_dir
1049 bundle_executable_dir = bundle_root_dir
1050 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1051
1052 deps = [
1053 ":${app_name}_bundle_executable",
1054 ":${app_name}_bundle_info_plist",
1055 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001056 if (bundle_ios_data) {
1057 deps += [ ":${app_name}_bundle_resources" ]
1058 if (has_skps) {
1059 deps += [ ":${app_name}_bundle_skps" ]
1060 }
1061 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001062
1063 # should only code sign when running on a device, not the simulator
1064 if (target_cpu != "x64") {
1065 code_signing_script = "//gn/codesign_ios.py"
1066 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1067 code_signing_outputs = [
1068 "$bundle_root_dir/_CodeSignature/CodeResources",
1069 "$bundle_root_dir/embedded.mobileprovision",
1070 ]
1071 code_signing_args =
1072 [ rebase_path("$bundle_root_dir", root_build_dir) ]
1073 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001074 }
1075 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001076 # !is_ios
1077
1078 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1079 shared_library("lib" + target_name) {
1080 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1081 configs += [ ":skia_private" ]
1082 testonly = true
1083 }
1084 } else {
1085 _executable = target_name
1086 executable(_executable) {
1087 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1088 configs += [ ":skia_private" ]
1089 testonly = true
1090 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001091 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001092 if (is_android && skia_android_serial != "" && defined(_executable)) {
1093 action("push_" + target_name) {
1094 script = "gn/push_to_android.py"
1095 deps = [
1096 ":" + _executable,
1097 ]
1098 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1099 outputs = [
1100 _stamp,
1101 ]
1102 args = [
1103 rebase_path("$root_build_dir/$_executable"),
1104 skia_android_serial,
1105 rebase_path(_stamp),
1106 ]
1107 testonly = true
1108 }
Mike Klein7d921032017-01-05 12:20:41 -05001109 }
1110 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001111 }
1112
mtkleinc095df52016-08-24 12:23:52 -07001113 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001114 public_include_dirs = []
1115 if (skia_enable_gpu) {
1116 public_defines = []
1117 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001118
1119 deps = []
mtklein38925aa2016-09-21 10:11:25 -07001120 sources = [
1121 "tools/gpu/GrContextFactory.cpp",
1122 "tools/gpu/GrTest.cpp",
1123 "tools/gpu/TestContext.cpp",
Brian Salomoncbcb0a12017-11-19 13:20:13 -05001124 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001125 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -07001126 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001127 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
1128 "tools/gpu/gl/debug/GrBufferObj.cpp",
1129 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
1130 "tools/gpu/gl/debug/GrProgramObj.cpp",
1131 "tools/gpu/gl/debug/GrShaderObj.cpp",
1132 "tools/gpu/gl/debug/GrTextureObj.cpp",
1133 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
1134 "tools/gpu/gl/null/NullGLTestContext.cpp",
Brian Salomoncfe910d2017-07-06 16:40:18 -04001135 "tools/gpu/mock/MockTestContext.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001136 ]
1137 libs = []
mtklein25c81d42016-07-27 13:55:26 -07001138
Kevin Lubick4a24e102017-03-29 11:19:01 -04001139 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -07001140 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -04001141 } else if (is_ios) {
1142 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1143 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -07001144 } else if (is_linux) {
1145 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001146 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -07001147 } else if (is_mac) {
1148 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001149 } else if (is_win) {
1150 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1151 libs += [
1152 "Gdi32.lib",
1153 "OpenGL32.lib",
1154 ]
mtklein38925aa2016-09-21 10:11:25 -07001155 }
mtklein6ef69992016-09-14 06:12:09 -07001156
Greg Daniel6b7e0e22017-07-12 16:21:09 -04001157 cflags_objcc = [ "-fobjc-arc" ]
1158
Mike Kleinc168a3a2016-11-14 14:53:13 +00001159 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +00001160 deps += [ "//third_party/angle2" ]
1161 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1162 }
mtkleind68f9b02016-09-23 13:18:41 -07001163 if (skia_use_vulkan) {
1164 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Greg Daniel35970ec2017-11-10 10:03:05 -05001165 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
mtkleind68f9b02016-09-23 13:18:41 -07001166 }
Greg Danielb76a72a2017-07-13 15:07:54 -04001167 if (skia_use_metal) {
1168 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
1169 }
mtkleina627b5c2016-09-20 13:36:47 -07001170 }
mtklein25c81d42016-07-27 13:55:26 -07001171 }
mtklein25c81d42016-07-27 13:55:26 -07001172
mtkleinc095df52016-08-24 12:23:52 -07001173 test_lib("flags") {
1174 public_include_dirs = [ "tools/flags" ]
1175 sources = [
1176 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001177 ]
1178 }
1179 test_lib("common_flags") {
1180 public_include_dirs = [ "tools/flags" ]
1181 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001182 "tools/flags/SkCommonFlags.cpp",
1183 "tools/flags/SkCommonFlagsConfig.cpp",
1184 ]
1185 deps = [
mtklein046cb562016-09-16 10:23:12 -07001186 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001187 ":gpu_tool_utils",
1188 ]
1189 }
mtklein25c81d42016-07-27 13:55:26 -07001190
mtkleinc095df52016-08-24 12:23:52 -07001191 test_lib("tool_utils") {
1192 public_include_dirs = [
1193 "tools",
1194 "tools/debugger",
1195 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001196 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001197 ]
1198 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001199 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001200 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001201 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001202 "tools/ProcStats.cpp",
1203 "tools/Resources.cpp",
Mike Klein10d66cc2017-11-10 11:33:43 -05001204 "tools/SkRandomScalerContext.cpp",
1205 "tools/SkTestScalerContext.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001206 "tools/ThermalManager.cpp",
1207 "tools/UrlDataManager.cpp",
1208 "tools/debugger/SkDebugCanvas.cpp",
1209 "tools/debugger/SkDrawCommand.cpp",
1210 "tools/debugger/SkJsonWriteBuffer.cpp",
1211 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001212 "tools/picture_utils.cpp",
1213 "tools/random_parse_path.cpp",
1214 "tools/sk_tool_utils.cpp",
1215 "tools/sk_tool_utils_font.cpp",
1216 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001217 "tools/trace/SkChromeTracingTracer.cpp",
1218 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001219 "tools/trace/SkDebugfTracer.cpp",
1220 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001221 "tools/trace/SkEventTracingPriv.cpp",
1222 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001223 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001224 libs = []
1225 if (is_ios) {
1226 sources += [ "tools/ios_utils.m" ]
1227 libs += [ "Foundation.framework" ]
1228 }
mtkleinc095df52016-08-24 12:23:52 -07001229 deps = [
mtklein046cb562016-09-16 10:23:12 -07001230 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001231 ":flags",
1232 "//third_party/libpng",
1233 ]
1234 public_deps = [
1235 "//third_party/jsoncpp",
1236 ]
1237 }
mtklein25c81d42016-07-27 13:55:26 -07001238
Mike Klein6e744122016-10-27 12:21:40 -04001239 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001240 test_lib("gm") {
1241 public_include_dirs = [ "gm" ]
1242 sources = gm_sources
1243 deps = [
scroggo19b91532016-10-24 09:03:26 -07001244 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001245 ":gpu_tool_utils",
1246 ":skia",
1247 ":tool_utils",
1248 ]
1249 }
mtklein25c81d42016-07-27 13:55:26 -07001250
Mike Klein6e744122016-10-27 12:21:40 -04001251 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001252 test_lib("tests") {
1253 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001254 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001255 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001256 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001257 }
mtkleinc095df52016-08-24 12:23:52 -07001258 deps = [
fmalita6cf896d2016-08-25 08:44:35 -07001259 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001260 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001261 ":skia",
1262 ":tool_utils",
1263 "//third_party/libpng",
1264 "//third_party/zlib",
1265 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001266 public_deps = [
1267 ":gpu_tool_utils", # Test.h #includes headers from this target.
1268 ]
mtkleinc095df52016-08-24 12:23:52 -07001269 }
mtklein2f3416d2016-08-02 16:02:05 -07001270
Mike Klein6e744122016-10-27 12:21:40 -04001271 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001272 test_lib("bench") {
1273 public_include_dirs = [ "bench" ]
1274 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001275 deps = [
1276 ":flags",
1277 ":gm",
1278 ":gpu_tool_utils",
1279 ":skia",
1280 ":tool_utils",
1281 ]
1282 }
mtklein2b6870c2016-07-28 14:17:33 -07001283
mtkleinc095df52016-08-24 12:23:52 -07001284 test_lib("experimental_svg_model") {
1285 public_include_dirs = [ "experimental/svg/model" ]
1286 sources = [
1287 "experimental/svg/model/SkSVGAttribute.cpp",
1288 "experimental/svg/model/SkSVGAttributeParser.cpp",
1289 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -05001290 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001291 "experimental/svg/model/SkSVGContainer.cpp",
1292 "experimental/svg/model/SkSVGDOM.cpp",
1293 "experimental/svg/model/SkSVGEllipse.cpp",
Florin Malitadf007e12017-10-09 15:14:13 -04001294 "experimental/svg/model/SkSVGGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001295 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001296 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001297 "experimental/svg/model/SkSVGNode.cpp",
1298 "experimental/svg/model/SkSVGPath.cpp",
Florin Malita1aa1bb62017-10-11 14:34:33 -04001299 "experimental/svg/model/SkSVGPattern.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001300 "experimental/svg/model/SkSVGPoly.cpp",
Florin Malitacc6cc292017-10-09 16:05:30 -04001301 "experimental/svg/model/SkSVGRadialGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001302 "experimental/svg/model/SkSVGRect.cpp",
1303 "experimental/svg/model/SkSVGRenderContext.cpp",
1304 "experimental/svg/model/SkSVGSVG.cpp",
1305 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001306 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001307 "experimental/svg/model/SkSVGTransformableNode.cpp",
Florin Malita6a69c052017-10-11 14:02:11 -04001308 "experimental/svg/model/SkSVGUse.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001309 "experimental/svg/model/SkSVGValue.cpp",
1310 ]
1311 deps = [
1312 ":skia",
1313 ]
1314 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001315
Kevin Lubickebf648e2017-09-21 13:45:16 -04001316 if (target_cpu != "wasm") {
1317 test_lib("views") {
1318 public_include_dirs = [ "include/views" ]
1319 sources = [
1320 "src/views/SkEvent.cpp",
1321 "src/views/SkEventSink.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001322 "src/views/SkTouchGesture.cpp",
1323 "src/views/SkView.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001324 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001325 libs = []
1326 deps = []
Kevin Lubickebf648e2017-09-21 13:45:16 -04001327 if (is_linux) {
1328 public_include_dirs += [ "src/views/unix" ]
Brian Osman4f99e582017-11-22 13:23:35 -05001329 sources += [ "src/views/unix/keysym2ucs.c" ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001330 libs += [
1331 "GL",
1332 "X11",
1333 ]
1334 } else if (is_mac) {
Kevin Lubickebf648e2017-09-21 13:45:16 -04001335 libs += [
1336 "QuartzCore.framework",
1337 "Cocoa.framework",
1338 "Foundation.framework",
1339 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001340 }
1341 if (skia_use_angle) {
1342 deps += [ "//third_party/angle2" ]
1343 }
Brian Osman34755e22016-12-05 09:46:02 -05001344 }
Brian Osman16adfa32016-10-18 14:42:44 -04001345 }
1346
Mike Klein38af9432016-11-11 11:39:44 -05001347 if (skia_use_lua) {
1348 test_lib("lua") {
1349 public_include_dirs = []
1350 sources = [
1351 "src/utils/SkLua.cpp",
1352 "src/utils/SkLuaCanvas.cpp",
1353 ]
1354 deps = [
1355 "//third_party/lua",
1356 ]
1357 }
1358
Mike Kleine6682eb2017-01-05 10:54:57 -05001359 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001360 sources = [
1361 "tools/lua/lua_app.cpp",
1362 ]
1363 deps = [
1364 ":lua",
1365 ":skia",
1366 "//third_party/lua",
1367 ]
Mike Klein38af9432016-11-11 11:39:44 -05001368 }
1369
Mike Kleine6682eb2017-01-05 10:54:57 -05001370 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001371 sources = [
1372 "tools/lua/lua_pictures.cpp",
1373 ]
1374 deps = [
1375 ":flags",
1376 ":lua",
1377 ":skia",
1378 ":tool_utils",
1379 "//third_party/lua",
1380 ]
Mike Klein38af9432016-11-11 11:39:44 -05001381 }
1382 }
1383
Cary Clark8032b982017-07-28 11:04:54 -04001384 test_app("bookmaker") {
1385 sources = [
1386 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001387 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001388 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001389 "tools/bookmaker/fiddleParser.cpp",
1390 "tools/bookmaker/includeParser.cpp",
1391 "tools/bookmaker/includeWriter.cpp",
1392 "tools/bookmaker/mdOut.cpp",
1393 "tools/bookmaker/parserCommon.cpp",
1394 "tools/bookmaker/spellCheck.cpp",
1395 ]
1396 deps = [
1397 ":flags",
1398 ":skia",
1399 ":tool_utils",
1400 ]
1401 }
1402
Kevin Lubickebf648e2017-09-21 13:45:16 -04001403 if (target_cpu != "wasm") {
1404 import("gn/samples.gni")
1405 test_lib("samples") {
1406 public_include_dirs = [ "samplecode" ]
1407 include_dirs = [ "experimental" ]
1408 sources = samples_sources + [
Kevin Lubickebf648e2017-09-21 13:45:16 -04001409 # Relocating these files here, so that clients don't try to build them while they're
1410 # still in active development. Clang's thread safety analysis gets tripped up by
1411 # conditional locks.
1412 "src/core/SkThreadedBMPDevice.cpp",
1413 "src/core/SkThreadedBMPDevice.h",
1414 ]
1415 deps = [
1416 ":experimental_svg_model",
1417 ":flags",
1418 ":gm",
1419 ":tool_utils",
1420 ":views",
1421 ":xml",
1422 ]
Mike Klein38af9432016-11-11 11:39:44 -05001423
Kevin Lubickebf648e2017-09-21 13:45:16 -04001424 if (skia_use_lua) {
1425 sources += [ "samplecode/SampleLua.cpp" ]
1426 deps += [
1427 ":lua",
1428 "//third_party/lua",
1429 ]
1430 }
1431 }
1432 test_app("dm") {
1433 sources = [
1434 "dm/DM.cpp",
Mike Klein31868212017-11-06 12:02:47 -05001435 "dm/DMFontMgr.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001436 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001437 "dm/DMJsonWriter.cpp",
1438 "dm/DMSrcSink.cpp",
1439 ]
1440 include_dirs = [ "tests" ]
1441 deps = [
1442 ":common_flags",
1443 ":experimental_svg_model",
1444 ":flags",
1445 ":gm",
1446 ":gpu_tool_utils",
1447 ":skia",
1448 ":tests",
1449 ":tool_utils",
1450 "//third_party/jsoncpp",
1451 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001452 ]
1453 }
Brian Osman16adfa32016-10-18 14:42:44 -04001454 }
1455
Mike Klein06432b22017-03-21 13:14:33 -04001456 test_app("ok") {
1457 sources = [
Mike Klein361dde02017-11-07 08:14:52 -05001458 "dm/DMFontMgr.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001459 "tools/ok.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001460 "tools/ok_dsts.cpp",
Mike Klein154e6da2017-07-26 15:13:47 -04001461 "tools/ok_engines.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001462 "tools/ok_srcs.cpp",
Mike Kleind63442d2017-03-27 14:16:04 -04001463 "tools/ok_test.cpp",
Mike Kleinf5d1a552017-03-25 12:32:22 -04001464 "tools/ok_vias.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001465 ]
1466 deps = [
Mike Klein4f6e2712017-08-11 10:37:35 -04001467 ":bench",
Mike Klein06432b22017-03-21 13:14:33 -04001468 ":gm",
1469 ":skia",
Mike Kleind63442d2017-03-27 14:16:04 -04001470 ":tests",
Mike Klein62669ad2017-05-09 16:03:07 -04001471 ":tool_utils",
Mike Klein06432b22017-03-21 13:14:33 -04001472 ]
1473 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001474 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001475 sources = [
1476 "bench/nanobench.cpp",
1477 ]
1478 deps = [
1479 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001480 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001481 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001482 ":flags",
1483 ":gm",
1484 ":gpu_tool_utils",
1485 ":skia",
1486 ":tool_utils",
1487 "//third_party/jsoncpp",
1488 ]
mtklein2b6870c2016-07-28 14:17:33 -07001489 }
halcanary19a97202016-08-03 15:08:04 -07001490
Ravi Mistry10d36c52017-01-31 09:49:18 -05001491 test_app("skpinfo") {
1492 sources = [
1493 "tools/skpinfo.cpp",
1494 ]
1495 deps = [
1496 ":flags",
1497 ":skia",
1498 ]
1499 }
1500
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001501 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001502 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001503 sources = [
1504 "tools/skpbench/skpbench.cpp",
1505 ]
1506 deps = [
1507 ":flags",
1508 ":gpu_tool_utils",
1509 ":skia",
1510 ":tool_utils",
1511 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001512 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001513 }
1514
Mike Klein7d302882016-11-03 14:06:31 -04001515 # We can't yet build ICU on iOS or Windows.
Kevin Lubickebf648e2017-09-21 13:45:16 -04001516 if (!is_ios && !is_win && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001517 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001518 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001519 "tools/shape/SkShaper_harfbuzz.cpp",
1520 "tools/shape/using_skia_and_harfbuzz.cpp",
mtklein6f5df6a2016-08-29 16:01:10 -07001521 ]
1522 deps = [
1523 ":skia",
1524 "//third_party/harfbuzz",
Ben Wagnera25fbef2017-08-30 13:56:19 -04001525 "//third_party/icu",
mtklein6f5df6a2016-08-29 16:01:10 -07001526 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001527 }
halcanary19a97202016-08-03 15:08:04 -07001528 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001529 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001530 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001531 "tools/shape/SkShaper_primitive.cpp",
1532 "tools/shape/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001533 ]
1534 deps = [
1535 ":skia",
1536 ]
halcanary3eee9d92016-09-10 07:01:53 -07001537 }
mtklein046cb562016-09-16 10:23:12 -07001538
Matt Sarett9f1c4032017-05-17 10:06:32 -04001539 test_app("create_flutter_test_images") {
1540 sources = [
1541 "tools/create_flutter_test_images.cpp",
1542 ]
1543 deps = [
1544 ":skia",
1545 ":tool_utils",
1546 ]
1547 }
1548
Ben Wagner219f3622017-07-17 15:32:25 -04001549 test_app("create_test_font") {
1550 sources = [
1551 "tools/create_test_font.cpp",
1552 ]
1553 deps = [
1554 ":skia",
1555 ]
1556 assert_no_deps = [
1557 # tool_utils requires the output of this app.
1558 ":tool_utils",
1559 ]
1560 }
1561
Mike Kleine6682eb2017-01-05 10:54:57 -05001562 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001563 sources = [
1564 "tools/get_images_from_skps.cpp",
1565 ]
1566 deps = [
1567 ":flags",
1568 ":skia",
1569 "//third_party/jsoncpp",
1570 ]
mtklein046cb562016-09-16 10:23:12 -07001571 }
mtkleinecbc5262016-09-22 11:51:24 -07001572
Mike Kleine6682eb2017-01-05 10:54:57 -05001573 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001574 sources = [
1575 "tools/colorspaceinfo.cpp",
1576 ]
1577 deps = [
1578 ":flags",
1579 ":skia",
1580 ":tool_utils",
1581 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001582 }
1583
Kevin Lubickebf648e2017-09-21 13:45:16 -04001584 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001585 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001586 sources = [
1587 "tools/skiaserve/Request.cpp",
1588 "tools/skiaserve/Response.cpp",
1589 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001590 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1591 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1592 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1593 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1594 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1595 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1596 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1597 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1598 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001599 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1600 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001601 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1602 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1603 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1604 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1605 ]
1606 deps = [
1607 ":flags",
1608 ":gpu_tool_utils",
1609 ":skia",
1610 ":tool_utils",
1611 "//third_party/jsoncpp",
1612 "//third_party/libmicrohttpd",
1613 "//third_party/libpng",
1614 ]
Mike Klein7d302882016-11-03 14:06:31 -04001615 }
mtkleinecbc5262016-09-22 11:51:24 -07001616 }
kjlubick14f984b2016-10-03 11:49:45 -07001617
Mike Kleine6682eb2017-01-05 10:54:57 -05001618 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07001619 sources = [
1620 "fuzz/FilterFuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001621 "fuzz/FuzzCanvas.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001622 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001623 "fuzz/FuzzGradients.cpp",
1624 "fuzz/FuzzParsePath.cpp",
1625 "fuzz/FuzzPathop.cpp",
1626 "fuzz/FuzzScaleToSides.cpp",
1627 "fuzz/fuzz.cpp",
1628 ]
1629 deps = [
1630 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001631 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001632 ":skia",
Hal Canarydb683012016-11-23 08:55:18 -07001633 ":tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001634 ]
kjlubick14f984b2016-10-03 11:49:45 -07001635 }
Mike Klein38312422016-10-05 15:41:01 -04001636
Mike Kleine6682eb2017-01-05 10:54:57 -05001637 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001638 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001639 rebase_path("tests/skia_test.cpp"),
1640 rebase_path("tests/Test.cpp"),
1641 ]
caryclark9feb6322016-10-25 08:58:26 -07001642 deps = [
1643 ":flags",
1644 ":gpu_tool_utils",
1645 ":skia",
1646 ":tool_utils",
1647 ]
caryclark9feb6322016-10-25 08:58:26 -07001648 }
1649
Mike Kleine6682eb2017-01-05 10:54:57 -05001650 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001651 sources = [
1652 "tools/DumpRecord.cpp",
1653 "tools/dump_record.cpp",
1654 ]
1655 deps = [
1656 ":flags",
1657 ":skia",
1658 ]
Mike Klein38312422016-10-05 15:41:01 -04001659 }
bungemanfe917272016-10-13 17:36:40 -04001660
Mike Kleine6682eb2017-01-05 10:54:57 -05001661 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001662 sources = [
1663 "tools/skdiff/skdiff.cpp",
1664 "tools/skdiff/skdiff_html.cpp",
1665 "tools/skdiff/skdiff_main.cpp",
1666 "tools/skdiff/skdiff_utils.cpp",
1667 ]
1668 deps = [
1669 ":skia",
1670 ":tool_utils",
1671 ]
bungemanfe917272016-10-13 17:36:40 -04001672 }
halcanarya73d76a2016-10-17 13:19:02 -07001673
Mike Kleine6682eb2017-01-05 10:54:57 -05001674 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001675 sources = [
1676 "tools/skp_parser.cpp",
1677 ]
1678 deps = [
1679 ":skia",
1680 ":tool_utils",
1681 "//third_party/jsoncpp",
1682 ]
halcanarya73d76a2016-10-17 13:19:02 -07001683 }
Brian Osman16adfa32016-10-18 14:42:44 -04001684
Hal Canary75427132017-10-11 16:00:31 -04001685 if (!is_win) {
1686 test_app("gpucts") {
1687 sources = [
1688 "dm/DMGpuTestProcs.cpp",
1689 "tools/gpucts/gm_knowledge.c",
1690 "tools/gpucts/gm_runner.cpp",
1691 "tools/gpucts/gpucts.cpp",
1692 ]
1693 deps = [
1694 ":gm",
1695 ":gpu_tool_utils",
1696 ":skia",
1697 ":tests",
1698 "//third_party/googletest",
1699 ]
1700 }
1701 }
1702
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001703 if (skia_enable_gpu) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001704 test_lib("sk_app") {
1705 public_include_dirs = [ "tools/sk_app" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001706 sources = [
Brian Osmaneff04b52017-11-21 13:18:02 -05001707 "tools/sk_app/CommandSet.cpp",
1708 "tools/sk_app/GLWindowContext.cpp",
1709 "tools/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001710 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001711 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001712
Jim Van Verth4e56a912016-10-21 10:58:52 -04001713 if (is_android) {
1714 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001715 "tools/sk_app/android/GLWindowContext_android.cpp",
1716 "tools/sk_app/android/RasterWindowContext_android.cpp",
1717 "tools/sk_app/android/Window_android.cpp",
1718 "tools/sk_app/android/main_android.cpp",
1719 "tools/sk_app/android/surface_glue_android.cpp",
Jim Van Verth4e56a912016-10-21 10:58:52 -04001720 ]
Brian Osman462334e2017-02-09 11:22:57 -05001721 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001722 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001723 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001724 "tools/sk_app/unix/GLWindowContext_unix.cpp",
1725 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
1726 "tools/sk_app/unix/Window_unix.cpp",
1727 "tools/sk_app/unix/main_unix.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001728 ]
1729 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001730 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001731 "tools/sk_app/win/GLWindowContext_win.cpp",
1732 "tools/sk_app/win/RasterWindowContext_win.cpp",
1733 "tools/sk_app/win/Window_win.cpp",
1734 "tools/sk_app/win/main_win.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001735 ]
Brian Salomon194db172017-08-17 14:37:06 -04001736 if (skia_use_angle) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001737 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04001738 }
Mike Klein43c25262016-10-20 10:17:47 -04001739 } else if (is_mac) {
1740 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001741 "tools/sk_app/mac/GLWindowContext_mac.cpp",
1742 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
1743 "tools/sk_app/mac/Window_mac.cpp",
1744 "tools/sk_app/mac/main_mac.cpp",
Mike Klein43c25262016-10-20 10:17:47 -04001745 ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001746 } else if (is_ios) {
1747 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001748 "tools/sk_app/ios/GLWindowContext_ios.cpp",
1749 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
1750 "tools/sk_app/ios/Window_ios.cpp",
1751 "tools/sk_app/ios/main_ios.cpp",
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001752 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001753 }
1754
1755 if (skia_use_vulkan) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001756 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001757 if (is_android) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001758 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001759 } else if (is_linux) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001760 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
Brian Osman2dd96932016-10-18 15:33:53 -04001761 libs += [ "X11-xcb" ]
1762 } else if (is_win) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001763 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001764 }
1765 }
1766
Brian Osman16adfa32016-10-18 14:42:44 -04001767 deps = [
Brian Osman16adfa32016-10-18 14:42:44 -04001768 ":gpu_tool_utils",
Brian Osman16adfa32016-10-18 14:42:44 -04001769 ":skia",
1770 ":tool_utils",
1771 ":views",
Brian Osman16adfa32016-10-18 14:42:44 -04001772 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001773 if (is_android) {
1774 deps += [ "//third_party/native_app_glue" ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001775 } else if (is_mac || is_ios) {
Mike Klein43c25262016-10-20 10:17:47 -04001776 deps += [ "//third_party/libsdl" ]
1777 }
Brian Salomon194db172017-08-17 14:37:06 -04001778 if (skia_use_angle) {
1779 deps += [ "//third_party/angle2" ]
1780 }
Mike Kleina92c3832016-12-08 09:49:39 -05001781 }
Brian Osman16adfa32016-10-18 14:42:44 -04001782 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001783
Brian Osmaneff04b52017-11-21 13:18:02 -05001784 if (skia_enable_gpu) {
1785 test_app("viewer") {
1786 is_shared_library = is_android
Jim Van Verth329c5a62017-11-29 11:42:33 -05001787 if (is_ios) {
1788 bundle_ios_data = true
1789 }
Brian Osmaneff04b52017-11-21 13:18:02 -05001790 sources = [
1791 "tools/viewer/GMSlide.cpp",
1792 "tools/viewer/ImageSlide.cpp",
1793 "tools/viewer/SKPSlide.cpp",
1794 "tools/viewer/SampleSlide.cpp",
1795 "tools/viewer/Viewer.cpp",
1796 ]
1797 libs = []
1798
1799 include_dirs = []
1800 deps = [
1801 ":flags",
1802 ":gm",
1803 ":gpu_tool_utils",
1804 ":samples",
1805 ":sk_app",
1806 ":skia",
1807 ":tool_utils",
1808 ":views",
1809 "//third_party/imgui",
1810 "//third_party/jsoncpp",
1811 ]
1812 }
1813 }
1814
1815 if (skia_enable_gpu && !skia_use_angle && (is_linux || is_win || is_mac)) {
1816 test_app("HelloWorld") {
1817 sources = [
1818 "example/HelloWorld.cpp",
1819 ]
1820 libs = []
1821
1822 include_dirs = []
1823 deps = [
1824 ":flags",
1825 ":gpu_tool_utils",
1826 ":sk_app",
1827 ":skia",
1828 ":tool_utils",
1829 ":views",
1830 ]
1831 }
1832 }
1833
Jim Van Verthecfed2b2017-08-30 14:02:50 -04001834 if (skia_enable_gpu && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04001835 test_app("SkiaSDLExample") {
1836 sources = [
1837 "example/SkiaSDLExample.cpp",
1838 ]
1839 libs = []
1840 include_dirs = []
1841 deps = [
1842 ":gpu_tool_utils",
1843 ":skia",
1844 "//third_party/libsdl",
1845 ]
1846 }
1847 }
1848
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001849 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
1850 action_foreach("generate_mocs") {
1851 script = "gn/call.py"
1852 sources = [
1853 "tools/mdbviz/MainWindow.h",
1854 ]
1855 outputs = [
1856 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
1857 ]
1858 args = [
1859 "$skia_qt_path" + "/bin/moc",
1860 "{{source}}",
1861 "-o",
1862 "gen/mdbviz/{{source_name_part}}_moc.cpp",
1863 ]
1864 }
1865 action_foreach("generate_resources") {
1866 script = "gn/call.py"
1867 sources = [
1868 "tools/mdbviz/resources.qrc",
1869 ]
1870 outputs = [
1871 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
1872 ]
1873 args = [
1874 "$skia_qt_path" + "/bin/rcc",
1875 "{{source}}",
1876 "-o",
1877 "gen/mdbviz/{{source_name_part}}_res.cpp",
1878 ]
1879 }
1880 test_app("mdbviz") {
1881 if (is_win) {
1882 # on Windows we need to disable some exception handling warnings due to the Qt headers
1883 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
1884 }
1885 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001886 "tools/UrlDataManager.cpp",
1887 "tools/debugger/SkDebugCanvas.cpp",
1888 "tools/debugger/SkDrawCommand.cpp",
1889 "tools/debugger/SkJsonWriteBuffer.cpp",
1890 "tools/debugger/SkObjectParser.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001891 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04001892 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001893 "tools/mdbviz/main.cpp",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001894 "tools/picture_utils.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001895
1896 # generated files
1897 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
1898 "$target_gen_dir/mdbviz/resources_res.cpp",
1899 ]
1900 lib_dirs = [ "$skia_qt_path/lib" ]
1901 libs = [
1902 "Qt5Core.lib",
1903 "Qt5Gui.lib",
1904 "Qt5Widgets.lib",
1905 ]
1906 include_dirs = [
1907 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04001908 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001909 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001910 "tools",
1911 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001912 ]
1913 deps = [
1914 ":generate_mocs",
1915 ":generate_resources",
1916 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04001917 "//third_party/jsoncpp",
1918 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04001919 ]
1920 }
1921 }
1922
Mike Kleine459afd2017-03-03 09:21:30 -05001923 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05001924 copy("gdbserver") {
1925 sources = [
1926 "$ndk/$ndk_gdbserver",
1927 ]
1928 outputs = [
1929 "$root_out_dir/gdbserver",
1930 ]
1931 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05001932 }
mtklein25c81d42016-07-27 13:55:26 -07001933}
Mike Kleinc55a6cb2017-06-28 13:21:47 -04001934
1935if (skia_jumper_clang != "") {
1936 action("regen_jumper") {
1937 script = "src/jumper/build_stages.py"
1938
1939 inputs = [
1940 "src/jumper/SkJumper_stages.cpp",
Mike Klein9b2f69b2017-09-12 16:40:53 -04001941 "src/jumper/SkJumper_stages_lowp.cpp",
Mike Kleinc55a6cb2017-06-28 13:21:47 -04001942 ]
1943
1944 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it.
1945 outputs = [
1946 "$target_out_dir/" +
1947 rebase_path("src/jumper/SkJumper_generated.S", target_out_dir),
1948 "$target_out_dir/" +
1949 rebase_path("src/jumper/SkJumper_generated_win.S", target_out_dir),
1950 ]
1951
1952 args = [
1953 skia_jumper_clang,
1954 skia_jumper_objdump,
1955 skia_jumper_ccache,
1956 ] + rebase_path(inputs) + rebase_path(outputs)
1957 }
1958}