blob: 3d3a9bf424e11f7832b93bbdee7d108593c5d67f [file] [log] [blame]
mtkleinc04ff472016-06-23 10:29:30 -07001# Copyright 2016 Google Inc.
2#
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
Brian Osmanf2c90142017-07-13 15:50:03 -04006import("gn/flutter_defines.gni")
mikejurka8c24f4f2016-09-12 16:51:58 -07007import("gn/shared_sources.gni")
brettwb9447282016-09-01 14:24:39 -07008
Forrest Reiling30229ac2017-04-17 13:36:39 -07009if (is_fuchsia) {
10 import("//build/vulkan/config.gni")
11}
12
Mike Klein3669a822017-03-03 10:55:02 -050013if (!defined(is_skia_standalone)) {
14 is_skia_standalone = false
15}
16is_skia_dev_build = is_skia_standalone && !is_official_build
17
mtkleinc04ff472016-06-23 10:29:30 -070018declare_args() {
Mike Kleinc168a3a2016-11-14 14:53:13 +000019 skia_use_angle = false
Kevin Lubick4a24e102017-03-29 11:19:01 -040020 skia_use_egl = false
mtklein63213812016-08-24 09:55:56 -070021 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070022 skia_use_fontconfig = is_linux
mtkleincdedd0e2016-09-12 15:15:44 -070023 skia_use_freetype = is_android || is_fuchsia || is_linux
Mike Klein7d302882016-11-03 14:06:31 -040024 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
mtklein63213812016-08-24 09:55:56 -070025 skia_use_libjpeg_turbo = true
26 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070027 skia_use_libwebp = !is_fuchsia
Mike Kleinfae86b72018-01-08 15:49:09 -050028 skia_use_lua = is_skia_dev_build && !is_ios
Mike Klein10d665d2016-11-01 11:46:10 -040029 skia_use_piex = !is_win
mtklein63213812016-08-24 09:55:56 -070030 skia_use_zlib = true
Greg Daniele5ddff52017-07-05 16:49:36 -040031 skia_use_metal = false
Mike Klein36f182f2017-10-20 12:33:53 -040032 skia_use_libheif = is_skia_dev_build
Mike Kleinfb333552018-01-25 12:49:37 -050033 skia_use_skcms = is_skia_dev_build
mtklein1bd72ba2016-09-16 07:45:52 -070034
Mike Klein7d921032017-01-05 12:20:41 -050035 skia_android_serial = ""
Brian Osman3f375d02016-12-28 11:19:22 -050036 skia_enable_discrete_gpu = true
Mike Kleina04bb452017-02-09 12:24:07 -050037 skia_enable_effects = true
Brian Osmanf2c90142017-07-13 15:50:03 -040038 skia_enable_flutter_defines = false
Hal Canaryff2742e2018-01-30 11:35:47 -050039 skia_enable_fontmgr_empty = false
mtklein06c35c02016-09-20 12:28:12 -070040 skia_enable_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050041 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040042 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Mike Klein3669a822017-03-03 10:55:02 -050043 skia_enable_tools = is_skia_dev_build
44 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Greg Danielafb7ec72017-12-07 12:48:30 -050045 skia_vulkan_header = ""
Greg Daniel686bb212016-10-27 10:48:48 -040046 skia_vulkan_sdk = getenv("VULKAN_SDK")
Robert Phillipsa6d2d702017-09-01 12:17:03 -040047 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040048 skia_compile_processors = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070049 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040050
51 skia_jumper_clang = ""
52 skia_jumper_objdump = ""
53 skia_jumper_ccache = ""
Hal Canary4689b542018-01-31 11:54:14 -050054
55 skia_skqp_enable_driver_correctness_workarounds = false
Hal Canary2331c822018-02-01 14:06:13 -050056 skia_skqp_global_error_tolerance = 0
mtkleinc04ff472016-06-23 10:29:30 -070057}
Brian Salomon23d73ea2016-10-27 13:31:37 -040058declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040059 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040060 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050061 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Mike Klein10d665d2016-11-01 11:46:10 -040062
Mike Klein4d598a32016-10-31 13:44:49 -040063 if (is_android) {
64 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070065 } else if (is_fuchsia) {
66 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040067 } else {
68 skia_use_vulkan = skia_vulkan_sdk != ""
69 }
Jim Van Verth4e502972017-12-07 15:16:10 -050070
71 if (is_ios) {
72 skia_ios_identity = ".*Google.*"
73 skia_ios_profile = "Google Development"
74 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040075}
Greg Danielec6ae522017-04-25 13:38:26 -040076declare_args() {
Greg Danielafb7ec72017-12-07 12:48:30 -050077 skia_tools_vulkan_header_dir = ""
Greg Danielec6ae522017-04-25 13:38:26 -040078 if (skia_use_vulkan) {
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +000079 # 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 -040080 if (is_fuchsia) {
Greg Danielafb7ec72017-12-07 12:48:30 -050081 skia_tools_vulkan_header_dir = "$fuchsia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040082 } else if (is_linux || is_win) {
Greg Danielafb7ec72017-12-07 12:48:30 -050083 skia_tools_vulkan_header_dir = "$skia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040084 }
Greg Danielec6ae522017-04-25 13:38:26 -040085 }
86}
Brian Salomon789e25e2016-09-30 13:41:03 -040087
Adam Barth54ef74a2017-10-13 10:59:38 -070088if (defined(skia_settings)) {
89 import(skia_settings)
90}
91
mtklein38925aa2016-09-21 10:11:25 -070092# Our tools require static linking (they use non-exported symbols).
93skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070094
mtkleina45be612016-08-29 15:22:10 -070095fontmgr_android_enabled = skia_use_expat && skia_use_freetype
96
mtklein1211e0c2016-07-26 13:55:45 -070097skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070098 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070099 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -0700100 "include/codec",
101 "include/config",
102 "include/core",
103 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -0400104 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -0700105 "include/gpu",
106 "include/gpu/gl",
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500107 "include/atlastext",
mtklein1211e0c2016-07-26 13:55:45 -0700108 "include/pathops",
109 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -0700110 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -0700111 "include/utils",
112 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -0700113]
114
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000115if (skia_use_vulkan) {
116 skia_public_includes += [ "include/gpu/vk" ]
117}
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500118if (skia_enable_atlas_text) {
119 skia_public_includes += [ "include/atlastext" ]
120}
Greg Daniele5ddff52017-07-05 16:49:36 -0400121if (skia_use_metal) {
122 skia_public_includes += [ "include/gpu/mtl" ]
123}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000124
mtkleinc04ff472016-06-23 10:29:30 -0700125# Skia public API, generally provided by :skia.
126config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700127 include_dirs = skia_public_includes
Greg Danielafb7ec72017-12-07 12:48:30 -0500128 if (skia_tools_vulkan_header_dir != "") {
129 include_dirs += [ skia_tools_vulkan_header_dir ]
Greg Danielec6ae522017-04-25 13:38:26 -0400130 }
Mike Kleinae7e6712016-10-11 17:49:33 -0400131 defines = []
132 if (is_component_build) {
133 defines += [ "SKIA_DLL" ]
134 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400135 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700136 defines += [ "SK_SAMPLES_FOR_X" ]
137 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400138 if (skia_enable_flutter_defines) {
139 defines += flutter_defines
140 }
mtklein06c35c02016-09-20 12:28:12 -0700141 if (!skia_enable_gpu) {
142 defines += [ "SK_SUPPORT_GPU=0" ]
143 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500144 if (skia_enable_atlas_text) {
145 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
146 }
mtkleinc04ff472016-06-23 10:29:30 -0700147}
148
149# Skia internal APIs, used by Skia itself and a few test tools.
150config("skia_private") {
151 visibility = [ ":*" ]
152
153 include_dirs = [
154 "include/private",
155 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700156 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700157 "src/core",
158 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700159 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700160 "src/image",
161 "src/images",
162 "src/lazy",
163 "src/opts",
164 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700165 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700166 "src/ports",
167 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400168 "src/shaders",
169 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700170 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700171 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700172 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500173 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700174 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700175 ]
mtklein150d1132016-08-01 06:56:40 -0700176
Mike Reeda9e241d2017-05-03 10:52:00 -0400177 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700178 if (is_android) {
179 defines += [
180 "SK_GAMMA_EXPONENT=1.4",
181 "SK_GAMMA_CONTRAST=0.0",
182 ]
183 }
mtklein88a7ac02016-09-14 11:16:49 -0700184 if (is_official_build || is_android) {
185 # TODO(bsalomon): it'd be nice to make Android normal.
186 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
187 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400188 libs = []
189 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500190 if (skia_enable_gpu) {
191 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500192 if (is_skia_dev_build && skia_use_vulkan) {
193 include_dirs += [ "tools/gpu/vk" ]
194 }
Brian Salomon03e05842017-02-23 12:23:47 -0500195 }
Brian Osman34755e22016-12-05 09:46:02 -0500196 if (skia_use_angle) {
197 defines += [ "SK_ANGLE" ]
198 }
Brian Osman3f375d02016-12-28 11:19:22 -0500199 if (skia_enable_discrete_gpu) {
200 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
201 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400202 if (!is_official_build) {
203 defines += [ "GR_TEST_UTILS=1" ]
204 }
mtkleinc04ff472016-06-23 10:29:30 -0700205}
206
207# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
208config("skia_library") {
209 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700210 defines = [ "SKIA_IMPLEMENTATION=1" ]
211}
212
213skia_library_configs = [
214 ":skia_public",
215 ":skia_private",
216 ":skia_library",
217]
218
mtklein9b8583d2016-08-24 17:32:30 -0700219# Use for CPU-specific Skia code that needs particular compiler flags.
220template("opts") {
221 if (invoker.enabled) {
222 source_set(target_name) {
223 forward_variables_from(invoker, "*")
224 configs += skia_library_configs
225 }
226 } else {
227 # If not enabled, a phony empty target that swallows all otherwise unused variables.
228 source_set(target_name) {
229 forward_variables_from(invoker,
230 "*",
231 [
232 "sources",
233 "cflags",
234 ])
235 }
236 }
anmittala7eaf2e2016-08-17 13:57:26 -0700237}
238
mtklein422310d2016-08-16 18:28:43 -0700239is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700240
mtklein7d6fb2c2016-08-25 14:50:44 -0700241opts("none") {
242 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700243 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700244 cflags = []
245}
246
mtklein7d6fb2c2016-08-25 14:50:44 -0700247opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700248 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700249 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700250 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700251}
252
253opts("arm64") {
254 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700255 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700256 cflags = []
257}
258
259opts("crc32") {
260 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700261 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700262 cflags = [ "-march=armv8-a+crc" ]
263}
264
mtklein9b8583d2016-08-24 17:32:30 -0700265opts("sse2") {
266 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700267 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400268 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400269 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
270 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400271 cflags = [ "-msse2" ]
272 }
mtklein9b8583d2016-08-24 17:32:30 -0700273}
mtkleinc04ff472016-06-23 10:29:30 -0700274
mtklein9b8583d2016-08-24 17:32:30 -0700275opts("ssse3") {
276 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700277 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400278 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400279 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
280 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400281 cflags = [ "-mssse3" ]
282 }
mtklein9b8583d2016-08-24 17:32:30 -0700283}
mtkleinc04ff472016-06-23 10:29:30 -0700284
mtklein9b8583d2016-08-24 17:32:30 -0700285opts("sse41") {
286 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700287 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400288 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400289 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
290 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400291 cflags = [ "-msse4.1" ]
292 }
mtklein9b8583d2016-08-24 17:32:30 -0700293}
mtklein4e976072016-08-08 09:06:27 -0700294
mtklein9b8583d2016-08-24 17:32:30 -0700295opts("sse42") {
296 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700297 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400298 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400299 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
300 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400301 cflags = [ "-msse4.2" ]
302 }
mtklein9b8583d2016-08-24 17:32:30 -0700303}
304
305opts("avx") {
306 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700307 sources = skia_opts.avx_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400308 if (!is_clang && is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000309 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400310 } else {
311 cflags = [ "-mavx" ]
312 }
mtkleinc04ff472016-06-23 10:29:30 -0700313}
314
mtkleinc095df52016-08-24 12:23:52 -0700315# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700316template("optional") {
317 if (invoker.enabled) {
318 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700319 if (defined(invoker.public_defines)) {
320 defines = invoker.public_defines
321 }
mtklein457b42a2016-08-23 13:56:37 -0700322 }
323 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700324 forward_variables_from(invoker,
325 "*",
326 [
327 "public_defines",
328 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700329 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700330 ])
mtklein457b42a2016-08-23 13:56:37 -0700331 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700332 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700333 if (defined(invoker.configs_to_remove)) {
334 configs -= invoker.configs_to_remove
335 }
mtklein457b42a2016-08-23 13:56:37 -0700336 }
337 } else {
mtklein457b42a2016-08-23 13:56:37 -0700338 source_set(target_name) {
339 forward_variables_from(invoker,
340 "*",
341 [
342 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700343 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700344 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700345 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700346 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700347 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700348 ])
mtkleincd01b032016-08-31 04:58:19 -0700349 if (defined(invoker.sources_when_disabled)) {
350 sources = invoker.sources_when_disabled
351 }
352 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700353 }
mtkleineb3c4252016-08-23 07:38:09 -0700354 }
mtklein457b42a2016-08-23 13:56:37 -0700355}
mtklein457b42a2016-08-23 13:56:37 -0700356
Mike Kleina04bb452017-02-09 12:24:07 -0500357optional("effects") {
358 enabled = skia_enable_effects
Ethan Nicholas762466e2017-06-29 10:03:38 -0400359 deps = [
360 ":compile_processors",
361 ]
Mike Kleina04bb452017-02-09 12:24:07 -0500362 sources =
363 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
364 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
365}
366
mtkleina45be612016-08-29 15:22:10 -0700367optional("fontmgr_android") {
368 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700369
370 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500371 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700372 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700373 ]
374 sources = [
375 "src/ports/SkFontMgr_android.cpp",
376 "src/ports/SkFontMgr_android_factory.cpp",
377 "src/ports/SkFontMgr_android_parser.cpp",
378 ]
379}
380
mtkleind2e39db2016-09-07 07:52:55 -0700381optional("fontmgr_custom") {
382 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
383
384 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500385 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700386 ]
387 sources = [
388 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500389 "src/ports/SkFontMgr_custom.h",
390 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700391 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500392 "src/ports/SkFontMgr_custom_embedded.cpp",
393 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700394 ]
395}
396
Hal Canaryff2742e2018-01-30 11:35:47 -0500397optional("fontmgr_empty") {
398 enabled = skia_enable_fontmgr_empty
399 sources = [
400 "src/ports/SkFontMgr_empty_factory.cpp",
401 ]
402}
403
mtklein3cc22182016-08-29 13:26:14 -0700404optional("fontmgr_fontconfig") {
405 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700406
407 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500408 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700409 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700410 ]
411 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700412 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700413 "src/ports/SkFontConfigInterface_direct.cpp",
414 "src/ports/SkFontConfigInterface_direct_factory.cpp",
415 "src/ports/SkFontMgr_FontConfigInterface.cpp",
416 "src/ports/SkFontMgr_fontconfig.cpp",
417 "src/ports/SkFontMgr_fontconfig_factory.cpp",
418 ]
419}
420
mtkleincdedd0e2016-09-12 15:15:44 -0700421optional("fontmgr_fuchsia") {
422 enabled = is_fuchsia && skia_use_freetype
423
424 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500425 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700426 ]
427 sources = [
428 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500429 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700430 "src/ports/SkFontMgr_custom_empty_factory.cpp",
431 ]
432}
433
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700434if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400435 executable("sksllex") {
436 sources = [
437 "src/sksl/lex/Main.cpp",
438 "src/sksl/lex/NFA.cpp",
439 "src/sksl/lex/RegexNode.cpp",
440 "src/sksl/lex/RegexParser.cpp",
441 ]
442 include_dirs = [ "src/sksl/lex" ]
443 }
444
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700445 action("run_sksllex") {
446 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400447 deps = [
448 ":sksllex(//gn/toolchain:$host_toolchain)",
449 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700450 sources = [
451 "src/sksl/lex/layout.lex",
452 "src/sksl/lex/sksl.lex",
453 ]
454
455 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
456 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
457 outputs = [
458 "$target_out_dir/" +
459 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
460 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
461 # confused due to the same file being named by two different paths
462 ]
463 sksllex_path = "$root_out_dir/"
464 sksllex_path += "sksllex"
465 if (host_os == "win") {
466 sksllex_path += ".exe"
467 }
468 args = [
469 rebase_path(sksllex_path),
470 rebase_path("bin/clang-format"),
471 rebase_path("src"),
472 ]
473 }
474} else {
475 group("run_sksllex") {
476 }
477}
478
479if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400480 executable("skslc") {
481 defines = [ "SKSL_STANDALONE" ]
482 sources = [
483 "src/sksl/SkSLMain.cpp",
484 ]
485 sources += skia_sksl_sources
486 include_dirs = [
487 "src/gpu",
488 "src/sksl",
489 ]
490 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500491 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400492 "//third_party/spirv-tools",
493 ]
494 }
495
496 skia_gpu_processor_outputs = []
497 foreach(src, skia_gpu_processor_sources) {
498 dir = get_path_info(src, "dir")
499 name = get_path_info(src, "name")
500
501 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
502 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
503 skia_gpu_processor_outputs += [
504 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
505 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
506 # confused due to the same file being named by two different paths
507 ]
508 }
509
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500510 action("create_sksl_enums") {
511 script = "gn/create_sksl_enums.py"
512 sources = [
513 "include/private/GrSharedEnums.h",
514 ]
515 outputs = [
516 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500517 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500518 ]
519 args = [
520 rebase_path(sources[0]),
521 rebase_path(outputs[0]),
522 ]
523 }
524
Ethan Nicholas762466e2017-06-29 10:03:38 -0400525 action("compile_processors") {
526 script = "gn/compile_processors.py"
527 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500528 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400529 ":skslc(//gn/toolchain:$host_toolchain)",
530 ]
531 sources = skia_gpu_processor_sources
532 outputs = skia_gpu_processor_outputs
533 skslc_path = "$root_out_dir/"
534 if (host_toolchain != default_toolchain_name) {
535 skslc_path += "$host_toolchain/"
536 }
537 skslc_path += "skslc"
538 if (host_os == "win") {
539 skslc_path += ".exe"
540 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400541 args = [
542 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400543 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400544 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400545 args += rebase_path(skia_gpu_processor_sources)
546 }
547} else {
548 skia_gpu_processor_outputs = []
549 group("compile_processors") {
550 }
551}
552
mtklein06c35c02016-09-20 12:28:12 -0700553optional("gpu") {
554 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400555 deps = [
556 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700557 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400558 ]
mtkleine9fb3d52016-09-20 15:11:46 -0700559 public_defines = []
560
Brian Salomon3d6801e2017-12-11 10:06:31 -0500561 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
mtklein06c35c02016-09-20 12:28:12 -0700562
563 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500564 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700565 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400566 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700567 if (is_android) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500568 sources += [ "src/gpu/gl/android/GrGLMakeNativeInterface_android.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400569
570 # this lib is required to link against AHardwareBuffer
571 if (defined(ndk_api) && ndk_api >= 26) {
572 libs += [ "android" ]
573 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400574 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500575 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400576 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700577 } else if (is_linux) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500578 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500579 libs += [
580 "GL",
581 "GLU",
582 ]
mtklein06c35c02016-09-20 12:28:12 -0700583 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500584 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800585 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500586 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400587 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500588 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400589 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700590 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500591 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700592 }
mtkleine9fb3d52016-09-20 15:11:46 -0700593
594 if (skia_use_vulkan) {
595 public_defines += [ "SK_VULKAN" ]
596 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700597 if (skia_enable_vulkan_debug_layers) {
598 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
599 }
Greg Danielafb7ec72017-12-07 12:48:30 -0500600 if (skia_vulkan_header != "") {
601 public_defines += [ "SK_VULKAN_HEADER=\"$skia_vulkan_header\"" ]
602 } else {
603 if (is_skia_dev_build) {
604 public_defines += [ "SK_VULKAN_HEADER=\"GrVulkanDefines.h\"" ]
605 }
606 }
mtkleine9fb3d52016-09-20 15:11:46 -0700607 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400608 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400609 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400610 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
611 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400612
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400613 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400614 if (skia_use_metal) {
615 public_defines += [ "SK_METAL" ]
616 sources += skia_metal_sources
617 libs += [ "Metal.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400618 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400619 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500620
621 if (skia_enable_atlas_text) {
622 sources += skia_atlas_text_sources
623 }
mtklein06c35c02016-09-20 12:28:12 -0700624}
625
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400626optional("heif") {
627 enabled = skia_use_libheif
628 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
629
630 deps = []
631
632 sources = [
633 "src/codec/SkHeifCodec.cpp",
634 ]
635}
636
mtklein63213812016-08-24 09:55:56 -0700637optional("jpeg") {
638 enabled = skia_use_libjpeg_turbo
639 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
640
mtklein63213812016-08-24 09:55:56 -0700641 deps = [
642 "//third_party/libjpeg-turbo:libjpeg",
643 ]
644 sources = [
645 "src/codec/SkJpegCodec.cpp",
646 "src/codec/SkJpegDecoderMgr.cpp",
647 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700648 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400649 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700650 ]
651}
652
653optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500654 enabled = skia_use_zlib && skia_enable_pdf
655 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700656
mtklein63213812016-08-24 09:55:56 -0700657 deps = [
658 "//third_party/zlib",
659 ]
brettwb9447282016-09-01 14:24:39 -0700660 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700661 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700662
663 if (skia_use_sfntly) {
664 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500665 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700666 }
667}
668
669optional("png") {
670 enabled = skia_use_libpng
671 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
672
mtklein63213812016-08-24 09:55:56 -0700673 deps = [
674 "//third_party/libpng",
675 ]
676 sources = [
677 "src/codec/SkIcoCodec.cpp",
678 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400679 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700680 ]
681}
682
scroggof84ad642016-10-31 09:02:57 -0700683optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400684 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700685 public_defines = [ "SK_CODEC_DECODES_RAW" ]
686
687 deps = [
688 "//third_party/dng_sdk",
689 "//third_party/libjpeg-turbo:libjpeg",
690 "//third_party/piex",
691 ]
692
693 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
694 # Skia.
695 configs_to_remove = [ "//gn:no_exceptions" ]
696
697 sources = [
698 "src/codec/SkRawAdapterCodec.cpp",
699 "src/codec/SkRawCodec.cpp",
700 ]
701}
702
Mike Kleinfb333552018-01-25 12:49:37 -0500703optional("skcms") {
704 enabled = skia_use_skcms
705
706 deps = [
707 "//third_party/skcms",
708 ]
709 sources = [
710 # TODO
711 ]
712}
713
mtklein3cc22182016-08-29 13:26:14 -0700714optional("typeface_freetype") {
715 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700716
717 deps = [
718 "//third_party/freetype2",
719 ]
720 sources = [
721 "src/ports/SkFontHost_FreeType.cpp",
722 "src/ports/SkFontHost_FreeType_common.cpp",
723 ]
724}
725
mtklein457b42a2016-08-23 13:56:37 -0700726optional("webp") {
727 enabled = skia_use_libwebp
728 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
729
mtklein457b42a2016-08-23 13:56:37 -0700730 deps = [
731 "//third_party/libwebp",
732 ]
733 sources = [
734 "src/codec/SkWebpAdapterCodec.cpp",
735 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400736 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700737 ]
mtkleineb3c4252016-08-23 07:38:09 -0700738}
739
mtklein63213812016-08-24 09:55:56 -0700740optional("xml") {
741 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000742 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700743
mtklein63213812016-08-24 09:55:56 -0700744 deps = [
745 "//third_party/expat",
746 ]
747 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500748 "src/svg/SkSVGCanvas.cpp",
749 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700750 "src/xml/SkDOM.cpp",
751 "src/xml/SkXMLParser.cpp",
752 "src/xml/SkXMLWriter.cpp",
753 ]
754}
755
mtkleinc04ff472016-06-23 10:29:30 -0700756component("skia") {
757 public_configs = [ ":skia_public" ]
758 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700759
760 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700761 ":arm64",
762 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700763 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700764 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500765 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700766 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700767 ":fontmgr_custom",
Hal Canaryff2742e2018-01-30 11:35:47 -0500768 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700769 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700770 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700771 ":gpu",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400772 ":heif",
mtklein63213812016-08-24 09:55:56 -0700773 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700774 ":none",
mtklein63213812016-08-24 09:55:56 -0700775 ":pdf",
776 ":png",
scroggof84ad642016-10-31 09:02:57 -0700777 ":raw",
Mike Kleinfb333552018-01-25 12:49:37 -0500778 ":skcms",
mtklein9b8583d2016-08-24 17:32:30 -0700779 ":sse2",
780 ":sse41",
781 ":sse42",
782 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700783 ":webp",
mtklein63213812016-08-24 09:55:56 -0700784 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700785 ]
786
Chinmay Garde43f115c2016-11-16 15:04:12 -0800787 # This file (and all GN files in Skia) are designed to work with an
788 # empty sources assignment filter; we handle all that explicitly.
789 # We clear the filter here for clients who may have set up a global filter.
790 set_sources_assignment_filter([])
791
mtkleinc04ff472016-06-23 10:29:30 -0700792 sources = []
brettwb9447282016-09-01 14:24:39 -0700793 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700794 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500795 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700796 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400797 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500798 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700799 "src/android/SkBitmapRegionCodec.cpp",
800 "src/android/SkBitmapRegionDecoder.cpp",
801 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400802 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700803 "src/codec/SkBmpCodec.cpp",
804 "src/codec/SkBmpMaskCodec.cpp",
805 "src/codec/SkBmpRLECodec.cpp",
806 "src/codec/SkBmpStandardCodec.cpp",
807 "src/codec/SkCodec.cpp",
808 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700809 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700810 "src/codec/SkMaskSwizzler.cpp",
811 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700812 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700813 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700814 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700815 "src/codec/SkSwizzler.cpp",
816 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700817 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700818 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700819 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700820 "src/ports/SkMemory_malloc.cpp",
821 "src/ports/SkOSFile_stdio.cpp",
822 "src/sfnt/SkOTTable_name.cpp",
823 "src/sfnt/SkOTUtils.cpp",
824 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700825 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700826 ]
brettwb9447282016-09-01 14:24:39 -0700827
mtklein7d6fb2c2016-08-25 14:50:44 -0700828 libs = []
829
mtkleinc04ff472016-06-23 10:29:30 -0700830 if (is_win) {
831 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400832 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700833 "src/ports/SkDebug_win.cpp",
834 "src/ports/SkFontHost_win.cpp",
835 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500836 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700837 "src/ports/SkImageEncoder_WIC.cpp",
838 "src/ports/SkImageGeneratorWIC.cpp",
839 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700840 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700841 "src/ports/SkScalerContext_win_dw.cpp",
842 "src/ports/SkTLS_win.cpp",
843 "src/ports/SkTypeface_win_dw.cpp",
844 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400845 libs += [
846 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500847 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400848 "Ole32.lib",
849 "OleAut32.lib",
850 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500851 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400852 ]
mtkleinc04ff472016-06-23 10:29:30 -0700853 } else {
854 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700855 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700856 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700857 "src/ports/SkTLS_pthread.cpp",
858 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400859 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700860 }
861
mtklein7d6fb2c2016-08-25 14:50:44 -0700862 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500863 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500864 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500865 deps += [ "//third_party/cpu-features" ]
866 }
mtklein06c35c02016-09-20 12:28:12 -0700867 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700868 libs += [
869 "EGL",
870 "GLESv2",
871 "log",
872 ]
873 }
874
mtkleinc04ff472016-06-23 10:29:30 -0700875 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700876 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700877 }
878
879 if (is_mac) {
880 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700881 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700882 "src/ports/SkFontHost_mac.cpp",
883 "src/ports/SkImageEncoder_CG.cpp",
884 "src/ports/SkImageGeneratorCG.cpp",
885 ]
mtklein09e61f72016-08-23 13:35:28 -0700886 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400887 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
888 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700889 "ApplicationServices.framework",
890 "OpenGL.framework",
891 ]
mtkleinc04ff472016-06-23 10:29:30 -0700892 }
abarth6fc8ff02016-07-15 15:15:15 -0700893
Mike Klein7d302882016-11-03 14:06:31 -0400894 if (is_ios) {
895 sources += [
896 "src/ports/SkDebug_stdio.cpp",
897 "src/ports/SkFontHost_mac.cpp",
898 "src/ports/SkImageEncoder_CG.cpp",
899 "src/ports/SkImageGeneratorCG.cpp",
900 ]
901 libs += [
902 "CoreFoundation.framework",
903 "CoreGraphics.framework",
904 "CoreText.framework",
905 "ImageIO.framework",
906 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400907
908 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
909 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400910 ]
911 }
912
abarth6fc8ff02016-07-15 15:15:15 -0700913 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700914 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700915 }
mtkleinc04ff472016-06-23 10:29:30 -0700916}
917
mtkleinc095df52016-08-24 12:23:52 -0700918# Targets guarded by skia_enable_tools may use //third_party freely.
919if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500920 # Used by gn_to_bp.py to list our public include dirs.
921 source_set("public") {
922 configs += [ ":skia_public" ]
923 }
924
Mike Kleinc36dedf2016-11-18 09:35:28 -0500925 config("skia.h_config") {
926 include_dirs = [ "$target_gen_dir" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500927 if (skia_use_vulkan) {
928 # So we can get the header which includes vulkan
929 include_dirs += [ "tools/gpu/vk" ]
930 }
Mike Kleinc36dedf2016-11-18 09:35:28 -0500931 }
932 action("skia.h") {
933 public_configs = [ ":skia.h_config" ]
934 skia_h = "$target_gen_dir/skia.h"
935 script = "gn/find_headers.py"
Greg Danielc819e662017-04-19 16:39:45 -0400936 args = [ rebase_path(skia_h, root_build_dir) ] +
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000937 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -0500938 depfile = "$skia_h.deps"
939 outputs = [
940 skia_h,
941 ]
942 }
943
944 if (skia_enable_gpu && target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -0500945 executable("fiddle") {
946 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -0500947 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500948 "tools/fiddle/draw.cpp",
949 "tools/fiddle/fiddle_main.cpp",
950 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400951
952 if (skia_use_egl) {
953 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400954 } else {
955 sources += [ "tools/fiddle/null_context.cpp" ]
956 }
Joe Gregorio1e735c02017-04-19 14:05:14 -0400957 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -0500958 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -0400959 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -0500960 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -0500961 ":skia",
962 ":skia.h",
963 ]
964 }
965 }
966
967 if (skia_enable_gpu) {
968 source_set("public_headers_warnings_check") {
969 sources = [
970 "tools/public_headers_warnings_check.cpp",
971 ]
972 configs -= [ "//gn:warnings_except_public_headers" ]
973 deps = [
974 ":skia",
975 ":skia.h",
976 ]
977 }
978 }
979
mtkleinc095df52016-08-24 12:23:52 -0700980 template("test_lib") {
981 config(target_name + "_config") {
982 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700983 if (defined(invoker.public_defines)) {
984 defines = invoker.public_defines
985 }
mtklein25c81d42016-07-27 13:55:26 -0700986 }
mtkleinc095df52016-08-24 12:23:52 -0700987 source_set(target_name) {
988 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
989 public_configs = [
990 ":" + target_name + "_config",
991 ":skia_private",
992 ]
993
994 if (!defined(deps)) {
995 deps = []
996 }
997 deps += [ ":skia" ]
998 testonly = true
999 }
mtklein25c81d42016-07-27 13:55:26 -07001000 }
mtklein25c81d42016-07-27 13:55:26 -07001001
Mike Kleine6682eb2017-01-05 10:54:57 -05001002 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001003 if (is_ios) {
1004 app_name = target_name
1005 gen_path = target_gen_dir
1006
1007 action("${app_name}_generate_info_plist") {
1008 script = "//gn/gen_plist_ios.py"
1009 outputs = [
1010 "$gen_path/${app_name}_Info.plist",
1011 ]
1012 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1013 }
1014
1015 bundle_data("${app_name}_bundle_info_plist") {
1016 public_deps = [
1017 ":${app_name}_generate_info_plist",
1018 ]
1019 sources = [
1020 "$gen_path/${app_name}_Info.plist",
1021 ]
1022 outputs = [
1023 "{{bundle_root_dir}}/Info.plist",
1024 ]
1025 }
1026
Jim Van Verth329c5a62017-11-29 11:42:33 -05001027 bundle_ios_data =
1028 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1029
1030 if (bundle_ios_data) {
1031 has_skps =
1032 "True" == exec_script("//gn/checkdir.py",
1033 [ rebase_path("skps", root_build_dir) ],
1034 "trim string")
1035 bundle_data("${app_name}_bundle_resources") {
1036 sources = [
1037 "resources",
1038 ]
1039 outputs = [
1040 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1041 "{{bundle_resources_dir}}/data/resources",
1042 ]
1043 }
1044
1045 if (has_skps) {
1046 bundle_data("${app_name}_bundle_skps") {
1047 sources = [
1048 "skps",
1049 ]
1050 outputs = [
1051 # Store in same folder as resources
1052 "{{bundle_resources_dir}}/data/skps",
1053 ]
1054 }
1055 }
1056 }
1057
Jim Van Verth443a9132017-11-28 09:45:26 -05001058 executable("${app_name}_generate_executable") {
1059 forward_variables_from(invoker,
1060 "*",
1061 [
1062 "output_name",
1063 "visibility",
1064 "is_shared_library",
1065 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001066 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001067 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001068 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1069 }
1070
1071 bundle_data("${app_name}_bundle_executable") {
1072 public_deps = [
1073 ":${app_name}_generate_executable",
1074 ]
1075 sources = [
1076 "$gen_path/$app_name",
1077 ]
1078 outputs = [
1079 "{{bundle_executable_dir}}/$app_name",
1080 ]
1081 testonly = true
1082 }
1083
1084 create_bundle("$app_name") {
1085 product_type = "com.apple.product-type.application"
1086 testonly = true
1087
1088 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1089 bundle_resources_dir = bundle_root_dir
1090 bundle_executable_dir = bundle_root_dir
1091 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1092
1093 deps = [
1094 ":${app_name}_bundle_executable",
1095 ":${app_name}_bundle_info_plist",
1096 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001097 if (bundle_ios_data) {
1098 deps += [ ":${app_name}_bundle_resources" ]
1099 if (has_skps) {
1100 deps += [ ":${app_name}_bundle_skps" ]
1101 }
1102 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001103
1104 # should only code sign when running on a device, not the simulator
1105 if (target_cpu != "x64") {
1106 code_signing_script = "//gn/codesign_ios.py"
1107 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1108 code_signing_outputs = [
1109 "$bundle_root_dir/_CodeSignature/CodeResources",
1110 "$bundle_root_dir/embedded.mobileprovision",
1111 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001112 code_signing_args = [
1113 rebase_path("$bundle_root_dir", root_build_dir),
1114 skia_ios_identity,
1115 skia_ios_profile,
1116 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001117 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001118 }
1119 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001120 # !is_ios
1121
1122 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1123 shared_library("lib" + target_name) {
1124 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1125 configs += [ ":skia_private" ]
1126 testonly = true
1127 }
1128 } else {
1129 _executable = target_name
1130 executable(_executable) {
1131 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1132 configs += [ ":skia_private" ]
1133 testonly = true
1134 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001135 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001136 if (is_android && skia_android_serial != "" && defined(_executable)) {
1137 action("push_" + target_name) {
1138 script = "gn/push_to_android.py"
1139 deps = [
1140 ":" + _executable,
1141 ]
1142 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1143 outputs = [
1144 _stamp,
1145 ]
1146 args = [
1147 rebase_path("$root_build_dir/$_executable"),
1148 skia_android_serial,
1149 rebase_path(_stamp),
1150 ]
1151 testonly = true
1152 }
Mike Klein7d921032017-01-05 12:20:41 -05001153 }
1154 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001155 }
1156
mtkleinc095df52016-08-24 12:23:52 -07001157 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001158 public_include_dirs = []
1159 if (skia_enable_gpu) {
1160 public_defines = []
1161 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001162
1163 deps = []
mtklein38925aa2016-09-21 10:11:25 -07001164 sources = [
1165 "tools/gpu/GrContextFactory.cpp",
1166 "tools/gpu/GrTest.cpp",
1167 "tools/gpu/TestContext.cpp",
Brian Salomoncbcb0a12017-11-19 13:20:13 -05001168 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001169 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -07001170 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001171 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
1172 "tools/gpu/gl/debug/GrBufferObj.cpp",
1173 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
1174 "tools/gpu/gl/debug/GrProgramObj.cpp",
1175 "tools/gpu/gl/debug/GrShaderObj.cpp",
1176 "tools/gpu/gl/debug/GrTextureObj.cpp",
1177 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
1178 "tools/gpu/gl/null/NullGLTestContext.cpp",
Brian Salomoncfe910d2017-07-06 16:40:18 -04001179 "tools/gpu/mock/MockTestContext.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001180 ]
1181 libs = []
mtklein25c81d42016-07-27 13:55:26 -07001182
Kevin Lubick4a24e102017-03-29 11:19:01 -04001183 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -07001184 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -04001185 } else if (is_ios) {
1186 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1187 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -07001188 } else if (is_linux) {
1189 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001190 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -07001191 } else if (is_mac) {
1192 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001193 } else if (is_win) {
1194 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1195 libs += [
1196 "Gdi32.lib",
1197 "OpenGL32.lib",
1198 ]
mtklein38925aa2016-09-21 10:11:25 -07001199 }
mtklein6ef69992016-09-14 06:12:09 -07001200
Greg Daniel6b7e0e22017-07-12 16:21:09 -04001201 cflags_objcc = [ "-fobjc-arc" ]
1202
Mike Kleinc168a3a2016-11-14 14:53:13 +00001203 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +00001204 deps += [ "//third_party/angle2" ]
1205 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1206 }
mtkleind68f9b02016-09-23 13:18:41 -07001207 if (skia_use_vulkan) {
1208 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Greg Daniel35970ec2017-11-10 10:03:05 -05001209 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
mtkleind68f9b02016-09-23 13:18:41 -07001210 }
Greg Danielb76a72a2017-07-13 15:07:54 -04001211 if (skia_use_metal) {
1212 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
1213 }
mtkleina627b5c2016-09-20 13:36:47 -07001214 }
mtklein25c81d42016-07-27 13:55:26 -07001215 }
mtklein25c81d42016-07-27 13:55:26 -07001216
mtkleinc095df52016-08-24 12:23:52 -07001217 test_lib("flags") {
1218 public_include_dirs = [ "tools/flags" ]
1219 sources = [
1220 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001221 ]
1222 }
1223 test_lib("common_flags") {
1224 public_include_dirs = [ "tools/flags" ]
1225 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001226 "tools/flags/SkCommonFlags.cpp",
1227 "tools/flags/SkCommonFlagsConfig.cpp",
1228 ]
1229 deps = [
mtklein046cb562016-09-16 10:23:12 -07001230 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001231 ":gpu_tool_utils",
1232 ]
1233 }
mtklein25c81d42016-07-27 13:55:26 -07001234
mtkleinc095df52016-08-24 12:23:52 -07001235 test_lib("tool_utils") {
1236 public_include_dirs = [
1237 "tools",
1238 "tools/debugger",
1239 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001240 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001241 ]
1242 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001243 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001244 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001245 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001246 "tools/ProcStats.cpp",
1247 "tools/Resources.cpp",
Mike Klein10d66cc2017-11-10 11:33:43 -05001248 "tools/SkRandomScalerContext.cpp",
1249 "tools/SkTestScalerContext.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001250 "tools/UrlDataManager.cpp",
1251 "tools/debugger/SkDebugCanvas.cpp",
1252 "tools/debugger/SkDrawCommand.cpp",
1253 "tools/debugger/SkJsonWriteBuffer.cpp",
1254 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001255 "tools/picture_utils.cpp",
1256 "tools/random_parse_path.cpp",
1257 "tools/sk_tool_utils.cpp",
1258 "tools/sk_tool_utils_font.cpp",
1259 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001260 "tools/trace/SkChromeTracingTracer.cpp",
1261 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001262 "tools/trace/SkDebugfTracer.cpp",
1263 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001264 "tools/trace/SkEventTracingPriv.cpp",
1265 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001266 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001267 libs = []
1268 if (is_ios) {
1269 sources += [ "tools/ios_utils.m" ]
1270 libs += [ "Foundation.framework" ]
1271 }
mtkleinc095df52016-08-24 12:23:52 -07001272 deps = [
mtklein046cb562016-09-16 10:23:12 -07001273 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001274 ":flags",
1275 "//third_party/libpng",
1276 ]
1277 public_deps = [
1278 "//third_party/jsoncpp",
1279 ]
1280 }
mtklein25c81d42016-07-27 13:55:26 -07001281
Mike Klein6e744122016-10-27 12:21:40 -04001282 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001283 test_lib("gm") {
1284 public_include_dirs = [ "gm" ]
1285 sources = gm_sources
1286 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001287 ":experimental_sksg",
scroggo19b91532016-10-24 09:03:26 -07001288 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001289 ":gpu_tool_utils",
1290 ":skia",
1291 ":tool_utils",
1292 ]
1293 }
mtklein25c81d42016-07-27 13:55:26 -07001294
Mike Klein6e744122016-10-27 12:21:40 -04001295 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001296 test_lib("tests") {
1297 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001298 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001299 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001300 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001301 }
mtkleinc095df52016-08-24 12:23:52 -07001302 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001303 ":experimental_sksg",
mtkleinc095df52016-08-24 12:23:52 -07001304 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001305 ":skia",
1306 ":tool_utils",
1307 "//third_party/libpng",
1308 "//third_party/zlib",
1309 ]
Hal Canaryff2742e2018-01-30 11:35:47 -05001310 if (skia_use_expat) {
1311 deps += [ ":experimental_svg_model" ]
1312 }
Mike Kleind63442d2017-03-27 14:16:04 -04001313 public_deps = [
1314 ":gpu_tool_utils", # Test.h #includes headers from this target.
1315 ]
mtkleinc095df52016-08-24 12:23:52 -07001316 }
mtklein2f3416d2016-08-02 16:02:05 -07001317
Mike Klein6e744122016-10-27 12:21:40 -04001318 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001319 test_lib("bench") {
1320 public_include_dirs = [ "bench" ]
1321 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001322 deps = [
1323 ":flags",
1324 ":gm",
1325 ":gpu_tool_utils",
1326 ":skia",
1327 ":tool_utils",
1328 ]
1329 }
mtklein2b6870c2016-07-28 14:17:33 -07001330
Florin Malita54f65c42018-01-16 17:04:30 -05001331 test_lib("experimental_skottie") {
1332 public_include_dirs = [ "experimental/skottie" ]
Florin Malita094ccde2017-12-30 12:27:00 -05001333 include_dirs = [ "tools" ]
1334 sources = [
Florin Malita54f65c42018-01-16 17:04:30 -05001335 "experimental/skottie/Skottie.cpp",
1336 "experimental/skottie/SkottieAnimator.cpp",
Florin Malitacf8ed522018-01-25 15:27:33 -05001337 "experimental/skottie/SkottieParser.cpp",
Florin Malita54f65c42018-01-16 17:04:30 -05001338 "experimental/skottie/SkottieProperties.cpp",
Florin Malita094ccde2017-12-30 12:27:00 -05001339 ]
1340 deps = [
1341 ":experimental_sksg",
1342 ":skia",
1343 "//third_party/jsoncpp",
1344 ]
1345 }
1346
mtkleinc095df52016-08-24 12:23:52 -07001347 test_lib("experimental_svg_model") {
1348 public_include_dirs = [ "experimental/svg/model" ]
1349 sources = [
1350 "experimental/svg/model/SkSVGAttribute.cpp",
1351 "experimental/svg/model/SkSVGAttributeParser.cpp",
1352 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -05001353 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001354 "experimental/svg/model/SkSVGContainer.cpp",
1355 "experimental/svg/model/SkSVGDOM.cpp",
1356 "experimental/svg/model/SkSVGEllipse.cpp",
Florin Malitadf007e12017-10-09 15:14:13 -04001357 "experimental/svg/model/SkSVGGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001358 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001359 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001360 "experimental/svg/model/SkSVGNode.cpp",
1361 "experimental/svg/model/SkSVGPath.cpp",
Florin Malita1aa1bb62017-10-11 14:34:33 -04001362 "experimental/svg/model/SkSVGPattern.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001363 "experimental/svg/model/SkSVGPoly.cpp",
Florin Malitacc6cc292017-10-09 16:05:30 -04001364 "experimental/svg/model/SkSVGRadialGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001365 "experimental/svg/model/SkSVGRect.cpp",
1366 "experimental/svg/model/SkSVGRenderContext.cpp",
1367 "experimental/svg/model/SkSVGSVG.cpp",
1368 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001369 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001370 "experimental/svg/model/SkSVGTransformableNode.cpp",
Florin Malita6a69c052017-10-11 14:02:11 -04001371 "experimental/svg/model/SkSVGUse.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001372 "experimental/svg/model/SkSVGValue.cpp",
1373 ]
1374 deps = [
1375 ":skia",
1376 ]
1377 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001378
Florin Malita4aa44412017-12-19 12:21:02 -05001379 test_lib("experimental_sksg") {
1380 public_include_dirs = [
1381 "experimental/sksg",
1382 "experimental/sksg/effects",
1383 "experimental/sksg/geometry",
1384 "experimental/sksg/paint",
1385 ]
1386 sources = [
1387 "experimental/sksg/SkSGDraw.cpp",
1388 "experimental/sksg/SkSGEffectNode.cpp",
1389 "experimental/sksg/SkSGGeometryNode.cpp",
1390 "experimental/sksg/SkSGGroup.cpp",
Florin Malita49328072018-01-08 12:51:12 -05001391 "experimental/sksg/SkSGImage.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001392 "experimental/sksg/SkSGInvalidationController.cpp",
1393 "experimental/sksg/SkSGNode.cpp",
1394 "experimental/sksg/SkSGPaintNode.cpp",
1395 "experimental/sksg/SkSGRenderNode.cpp",
Florin Malita35efaa82018-01-22 12:57:06 -05001396 "experimental/sksg/SkSGScene.cpp",
Florin Malita38ea40e2018-01-29 16:31:14 -05001397 "experimental/sksg/effects/SkSGClipEffect.cpp",
Florin Malita5f9102f2018-01-10 13:36:22 -05001398 "experimental/sksg/effects/SkSGMaskEffect.cpp",
Florin Malitac0034172018-01-08 16:42:59 -05001399 "experimental/sksg/effects/SkSGOpacityEffect.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001400 "experimental/sksg/effects/SkSGTransform.cpp",
Florin Malita16d0ad02018-01-19 15:07:29 -05001401 "experimental/sksg/geometry/SkSGGeometryTransform.cpp",
Florin Malitae6345d92018-01-03 23:37:54 -05001402 "experimental/sksg/geometry/SkSGMerge.cpp",
Florin Malita047ae272017-12-27 11:13:13 -05001403 "experimental/sksg/geometry/SkSGPath.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001404 "experimental/sksg/geometry/SkSGRect.cpp",
Florin Malita51012ce2018-01-31 17:06:59 -05001405 "experimental/sksg/geometry/SkSGText.cpp",
Florin Malita51b8c892018-01-07 08:54:24 -05001406 "experimental/sksg/geometry/SkSGTrimEffect.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001407 "experimental/sksg/paint/SkSGColor.cpp",
Florin Malita6aaee592018-01-12 12:25:09 -05001408 "experimental/sksg/paint/SkSGGradient.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001409 ]
1410 deps = [
1411 ":skia",
1412 ]
1413 }
1414
Kevin Lubickebf648e2017-09-21 13:45:16 -04001415 if (target_cpu != "wasm") {
1416 test_lib("views") {
1417 public_include_dirs = [ "include/views" ]
1418 sources = [
1419 "src/views/SkEvent.cpp",
1420 "src/views/SkEventSink.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001421 "src/views/SkTouchGesture.cpp",
1422 "src/views/SkView.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001423 ]
Brian Osman34755e22016-12-05 09:46:02 -05001424 }
Brian Osman16adfa32016-10-18 14:42:44 -04001425 }
1426
Mike Klein38af9432016-11-11 11:39:44 -05001427 if (skia_use_lua) {
1428 test_lib("lua") {
1429 public_include_dirs = []
1430 sources = [
1431 "src/utils/SkLua.cpp",
1432 "src/utils/SkLuaCanvas.cpp",
1433 ]
1434 deps = [
1435 "//third_party/lua",
1436 ]
1437 }
1438
Mike Kleine6682eb2017-01-05 10:54:57 -05001439 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001440 sources = [
1441 "tools/lua/lua_app.cpp",
1442 ]
1443 deps = [
1444 ":lua",
1445 ":skia",
1446 "//third_party/lua",
1447 ]
Mike Klein38af9432016-11-11 11:39:44 -05001448 }
1449
Mike Kleine6682eb2017-01-05 10:54:57 -05001450 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001451 sources = [
1452 "tools/lua/lua_pictures.cpp",
1453 ]
1454 deps = [
1455 ":flags",
1456 ":lua",
1457 ":skia",
1458 ":tool_utils",
1459 "//third_party/lua",
1460 ]
Mike Klein38af9432016-11-11 11:39:44 -05001461 }
1462 }
1463
Cary Clark8032b982017-07-28 11:04:54 -04001464 test_app("bookmaker") {
1465 sources = [
1466 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001467 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001468 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001469 "tools/bookmaker/fiddleParser.cpp",
1470 "tools/bookmaker/includeParser.cpp",
1471 "tools/bookmaker/includeWriter.cpp",
1472 "tools/bookmaker/mdOut.cpp",
1473 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001474 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001475 "tools/bookmaker/spellCheck.cpp",
1476 ]
1477 deps = [
1478 ":flags",
1479 ":skia",
1480 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001481 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001482 ]
1483 }
1484
Kevin Lubickebf648e2017-09-21 13:45:16 -04001485 if (target_cpu != "wasm") {
1486 import("gn/samples.gni")
1487 test_lib("samples") {
1488 public_include_dirs = [ "samplecode" ]
1489 include_dirs = [ "experimental" ]
1490 sources = samples_sources + [
Kevin Lubickebf648e2017-09-21 13:45:16 -04001491 # Relocating these files here, so that clients don't try to build them while they're
1492 # still in active development. Clang's thread safety analysis gets tripped up by
1493 # conditional locks.
1494 "src/core/SkThreadedBMPDevice.cpp",
1495 "src/core/SkThreadedBMPDevice.h",
1496 ]
1497 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001498 ":experimental_sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001499 ":experimental_svg_model",
1500 ":flags",
1501 ":gm",
1502 ":tool_utils",
1503 ":views",
1504 ":xml",
1505 ]
Mike Klein38af9432016-11-11 11:39:44 -05001506
Kevin Lubickebf648e2017-09-21 13:45:16 -04001507 if (skia_use_lua) {
1508 sources += [ "samplecode/SampleLua.cpp" ]
1509 deps += [
1510 ":lua",
1511 "//third_party/lua",
1512 ]
1513 }
1514 }
1515 test_app("dm") {
1516 sources = [
1517 "dm/DM.cpp",
Mike Klein31868212017-11-06 12:02:47 -05001518 "dm/DMFontMgr.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001519 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001520 "dm/DMJsonWriter.cpp",
1521 "dm/DMSrcSink.cpp",
1522 ]
1523 include_dirs = [ "tests" ]
1524 deps = [
1525 ":common_flags",
Florin Malita54f65c42018-01-16 17:04:30 -05001526 ":experimental_skottie",
Florin Malita4aa44412017-12-19 12:21:02 -05001527 ":experimental_sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001528 ":experimental_svg_model",
1529 ":flags",
1530 ":gm",
1531 ":gpu_tool_utils",
1532 ":skia",
1533 ":tests",
1534 ":tool_utils",
1535 "//third_party/jsoncpp",
1536 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001537 ]
1538 }
Brian Osman16adfa32016-10-18 14:42:44 -04001539 }
1540
Mike Kleina8a51ce2018-01-09 12:34:11 -05001541 if (!is_win) {
1542 test_app("remote_demo") {
1543 sources = [
1544 "tools/remote_demo.cpp",
1545 ]
1546 deps = [
1547 ":skia",
1548 ]
1549 }
1550 }
1551
Mike Klein06432b22017-03-21 13:14:33 -04001552 test_app("ok") {
1553 sources = [
Mike Klein361dde02017-11-07 08:14:52 -05001554 "dm/DMFontMgr.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001555 "tools/ok.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001556 "tools/ok_dsts.cpp",
Mike Klein154e6da2017-07-26 15:13:47 -04001557 "tools/ok_engines.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001558 "tools/ok_srcs.cpp",
Mike Kleind63442d2017-03-27 14:16:04 -04001559 "tools/ok_test.cpp",
Mike Kleinf5d1a552017-03-25 12:32:22 -04001560 "tools/ok_vias.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001561 ]
1562 deps = [
Mike Klein4f6e2712017-08-11 10:37:35 -04001563 ":bench",
Mike Klein06432b22017-03-21 13:14:33 -04001564 ":gm",
1565 ":skia",
Mike Kleind63442d2017-03-27 14:16:04 -04001566 ":tests",
Mike Klein62669ad2017-05-09 16:03:07 -04001567 ":tool_utils",
Mike Klein06432b22017-03-21 13:14:33 -04001568 ]
1569 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001570 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001571 sources = [
1572 "bench/nanobench.cpp",
1573 ]
1574 deps = [
1575 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001576 ":common_flags",
Florin Malita4aa44412017-12-19 12:21:02 -05001577 ":experimental_sksg",
fmalita6519c212016-09-14 08:05:17 -07001578 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001579 ":flags",
1580 ":gm",
1581 ":gpu_tool_utils",
1582 ":skia",
1583 ":tool_utils",
1584 "//third_party/jsoncpp",
1585 ]
mtklein2b6870c2016-07-28 14:17:33 -07001586 }
halcanary19a97202016-08-03 15:08:04 -07001587
Ravi Mistry10d36c52017-01-31 09:49:18 -05001588 test_app("skpinfo") {
1589 sources = [
1590 "tools/skpinfo.cpp",
1591 ]
1592 deps = [
1593 ":flags",
1594 ":skia",
1595 ]
1596 }
1597
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001598 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001599 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001600 sources = [
1601 "tools/skpbench/skpbench.cpp",
1602 ]
1603 deps = [
1604 ":flags",
1605 ":gpu_tool_utils",
1606 ":skia",
1607 ":tool_utils",
1608 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001609 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001610 }
1611
Mike Klein7d302882016-11-03 14:06:31 -04001612 # We can't yet build ICU on iOS or Windows.
Kevin Lubickebf648e2017-09-21 13:45:16 -04001613 if (!is_ios && !is_win && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001614 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001615 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001616 "tools/shape/SkShaper_harfbuzz.cpp",
1617 "tools/shape/using_skia_and_harfbuzz.cpp",
mtklein6f5df6a2016-08-29 16:01:10 -07001618 ]
1619 deps = [
1620 ":skia",
1621 "//third_party/harfbuzz",
Ben Wagnera25fbef2017-08-30 13:56:19 -04001622 "//third_party/icu",
mtklein6f5df6a2016-08-29 16:01:10 -07001623 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001624 }
halcanary19a97202016-08-03 15:08:04 -07001625 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001626 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001627 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001628 "tools/shape/SkShaper_primitive.cpp",
1629 "tools/shape/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001630 ]
1631 deps = [
1632 ":skia",
1633 ]
halcanary3eee9d92016-09-10 07:01:53 -07001634 }
mtklein046cb562016-09-16 10:23:12 -07001635
Matt Sarett9f1c4032017-05-17 10:06:32 -04001636 test_app("create_flutter_test_images") {
1637 sources = [
1638 "tools/create_flutter_test_images.cpp",
1639 ]
1640 deps = [
1641 ":skia",
1642 ":tool_utils",
1643 ]
1644 }
1645
Ben Wagner219f3622017-07-17 15:32:25 -04001646 test_app("create_test_font") {
1647 sources = [
1648 "tools/create_test_font.cpp",
1649 ]
1650 deps = [
1651 ":skia",
1652 ]
1653 assert_no_deps = [
1654 # tool_utils requires the output of this app.
1655 ":tool_utils",
1656 ]
1657 }
1658
Mike Kleine6682eb2017-01-05 10:54:57 -05001659 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001660 sources = [
1661 "tools/get_images_from_skps.cpp",
1662 ]
1663 deps = [
1664 ":flags",
1665 ":skia",
1666 "//third_party/jsoncpp",
1667 ]
mtklein046cb562016-09-16 10:23:12 -07001668 }
mtkleinecbc5262016-09-22 11:51:24 -07001669
Mike Kleine6682eb2017-01-05 10:54:57 -05001670 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001671 sources = [
1672 "tools/colorspaceinfo.cpp",
1673 ]
1674 deps = [
1675 ":flags",
1676 ":skia",
1677 ":tool_utils",
1678 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001679 }
1680
Kevin Lubickebf648e2017-09-21 13:45:16 -04001681 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001682 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001683 sources = [
1684 "tools/skiaserve/Request.cpp",
1685 "tools/skiaserve/Response.cpp",
1686 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001687 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1688 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1689 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1690 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1691 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1692 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1693 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1694 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1695 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001696 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1697 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001698 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1699 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1700 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1701 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1702 ]
1703 deps = [
1704 ":flags",
1705 ":gpu_tool_utils",
1706 ":skia",
1707 ":tool_utils",
1708 "//third_party/jsoncpp",
1709 "//third_party/libmicrohttpd",
1710 "//third_party/libpng",
1711 ]
Mike Klein7d302882016-11-03 14:06:31 -04001712 }
mtkleinecbc5262016-09-22 11:51:24 -07001713 }
kjlubick14f984b2016-10-03 11:49:45 -07001714
Mike Kleine6682eb2017-01-05 10:54:57 -05001715 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001716 include_dirs = [
1717 "tools",
1718 "tools/debugger",
1719 ]
kjlubick14f984b2016-10-03 11:49:45 -07001720 sources = [
Hal Canary24ac42b2017-02-14 13:35:14 -05001721 "fuzz/FuzzCanvas.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001722 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001723 "fuzz/FuzzGradients.cpp",
1724 "fuzz/FuzzParsePath.cpp",
1725 "fuzz/FuzzPathop.cpp",
1726 "fuzz/FuzzScaleToSides.cpp",
1727 "fuzz/fuzz.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001728 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1729 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001730 "tools/UrlDataManager.cpp",
1731 "tools/debugger/SkDebugCanvas.cpp",
1732 "tools/debugger/SkDrawCommand.cpp",
1733 "tools/debugger/SkJsonWriteBuffer.cpp",
1734 "tools/debugger/SkObjectParser.cpp",
1735 "tools/picture_utils.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001736 ]
1737 deps = [
1738 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001739 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001740 ":skia",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001741 "//third_party/jsoncpp",
1742 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001743 ]
kjlubick14f984b2016-10-03 11:49:45 -07001744 }
Mike Klein38312422016-10-05 15:41:01 -04001745
Mike Kleine6682eb2017-01-05 10:54:57 -05001746 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001747 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001748 rebase_path("tests/skia_test.cpp"),
1749 rebase_path("tests/Test.cpp"),
1750 ]
caryclark9feb6322016-10-25 08:58:26 -07001751 deps = [
1752 ":flags",
1753 ":gpu_tool_utils",
1754 ":skia",
1755 ":tool_utils",
1756 ]
caryclark9feb6322016-10-25 08:58:26 -07001757 }
1758
Mike Kleine6682eb2017-01-05 10:54:57 -05001759 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001760 sources = [
1761 "tools/DumpRecord.cpp",
1762 "tools/dump_record.cpp",
1763 ]
1764 deps = [
1765 ":flags",
1766 ":skia",
1767 ]
Mike Klein38312422016-10-05 15:41:01 -04001768 }
bungemanfe917272016-10-13 17:36:40 -04001769
Mike Kleine6682eb2017-01-05 10:54:57 -05001770 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001771 sources = [
1772 "tools/skdiff/skdiff.cpp",
1773 "tools/skdiff/skdiff_html.cpp",
1774 "tools/skdiff/skdiff_main.cpp",
1775 "tools/skdiff/skdiff_utils.cpp",
1776 ]
1777 deps = [
1778 ":skia",
1779 ":tool_utils",
1780 ]
bungemanfe917272016-10-13 17:36:40 -04001781 }
halcanarya73d76a2016-10-17 13:19:02 -07001782
Mike Kleine6682eb2017-01-05 10:54:57 -05001783 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001784 sources = [
1785 "tools/skp_parser.cpp",
1786 ]
1787 deps = [
1788 ":skia",
1789 ":tool_utils",
1790 "//third_party/jsoncpp",
1791 ]
halcanarya73d76a2016-10-17 13:19:02 -07001792 }
Brian Osman16adfa32016-10-18 14:42:44 -04001793
Hal Canaryd7b38452017-12-11 17:46:26 -05001794 if (!is_win && skia_enable_gpu) {
1795 test_lib("skqp_lib") {
1796 public_include_dirs = [ "tools/skqp" ]
Hal Canary2331c822018-02-01 14:06:13 -05001797 defines = [
1798 "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance"
1799 ]
Hal Canary4689b542018-01-31 11:54:14 -05001800 if (skia_skqp_enable_driver_correctness_workarounds) {
1801 defines += [ "SK_SKQP_ENABLE_DRIVER_CORRECTNESS_WORKAROUNDS" ]
1802 }
Hal Canary75427132017-10-11 16:00:31 -04001803 sources = [
Hal Canaryd7b38452017-12-11 17:46:26 -05001804 "dm/DMFontMgr.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001805 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001806 "tools/skqp/gm_knowledge.cpp",
1807 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001808 ]
1809 deps = [
1810 ":gm",
1811 ":gpu_tool_utils",
1812 ":skia",
1813 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001814 ":tool_utils",
1815 ]
1816 }
1817 test_app("skqp") {
1818 sources = [
1819 "tools/skqp/skqp.cpp",
1820 ]
1821 deps = [
1822 ":skia",
1823 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05001824 ":tool_utils",
Hal Canary75427132017-10-11 16:00:31 -04001825 "//third_party/googletest",
1826 ]
1827 }
1828 }
Hal Canary28f89382017-12-12 09:42:14 -05001829 if (is_android && skia_enable_gpu) {
1830 test_app("skqp_app") {
1831 is_shared_library = true
1832 sources = [
1833 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
1834 ]
1835 deps = [
1836 ":skia",
1837 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05001838 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05001839 ]
1840 libs = [ "android" ]
1841 }
1842 }
Hal Canary75427132017-10-11 16:00:31 -04001843
Hal Canarya9de7602018-01-19 13:08:23 -05001844 test_app("list_gms") {
1845 sources = [
1846 "tools/list_gms.cpp",
1847 ]
1848 deps = [
1849 ":gm",
1850 ":skia",
1851 ]
1852 }
1853 test_app("list_gpu_unit_tests") {
1854 sources = [
1855 "dm/DMGpuTestProcs.cpp",
1856 "tools/list_gpu_unit_tests.cpp",
1857 ]
1858 deps = [
1859 ":skia",
1860 ":tests",
1861 ]
1862 }
1863
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001864 if (skia_enable_gpu) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001865 test_lib("sk_app") {
1866 public_include_dirs = [ "tools/sk_app" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001867 sources = [
Brian Osmaneff04b52017-11-21 13:18:02 -05001868 "tools/sk_app/CommandSet.cpp",
1869 "tools/sk_app/GLWindowContext.cpp",
1870 "tools/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001871 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001872 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001873
Jim Van Verth4e56a912016-10-21 10:58:52 -04001874 if (is_android) {
1875 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001876 "tools/sk_app/android/GLWindowContext_android.cpp",
1877 "tools/sk_app/android/RasterWindowContext_android.cpp",
1878 "tools/sk_app/android/Window_android.cpp",
1879 "tools/sk_app/android/main_android.cpp",
1880 "tools/sk_app/android/surface_glue_android.cpp",
Jim Van Verth4e56a912016-10-21 10:58:52 -04001881 ]
Brian Osman462334e2017-02-09 11:22:57 -05001882 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001883 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001884 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001885 "tools/sk_app/unix/GLWindowContext_unix.cpp",
1886 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
1887 "tools/sk_app/unix/Window_unix.cpp",
Brian Osmanfa916272017-12-01 09:18:20 -05001888 "tools/sk_app/unix/keysym2ucs.c",
Brian Osmaneff04b52017-11-21 13:18:02 -05001889 "tools/sk_app/unix/main_unix.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001890 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001891 libs += [
1892 "GL",
1893 "X11",
1894 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001895 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001896 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001897 "tools/sk_app/win/GLWindowContext_win.cpp",
1898 "tools/sk_app/win/RasterWindowContext_win.cpp",
1899 "tools/sk_app/win/Window_win.cpp",
1900 "tools/sk_app/win/main_win.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001901 ]
Brian Salomon194db172017-08-17 14:37:06 -04001902 if (skia_use_angle) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001903 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04001904 }
Mike Klein43c25262016-10-20 10:17:47 -04001905 } else if (is_mac) {
1906 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001907 "tools/sk_app/mac/GLWindowContext_mac.cpp",
1908 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
1909 "tools/sk_app/mac/Window_mac.cpp",
1910 "tools/sk_app/mac/main_mac.cpp",
Mike Klein43c25262016-10-20 10:17:47 -04001911 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001912 libs += [
1913 "QuartzCore.framework",
1914 "Cocoa.framework",
1915 "Foundation.framework",
1916 ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001917 } else if (is_ios) {
1918 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001919 "tools/sk_app/ios/GLWindowContext_ios.cpp",
1920 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
1921 "tools/sk_app/ios/Window_ios.cpp",
1922 "tools/sk_app/ios/main_ios.cpp",
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001923 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001924 }
1925
1926 if (skia_use_vulkan) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001927 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001928 if (is_android) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001929 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001930 } else if (is_linux) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001931 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
Brian Osman2dd96932016-10-18 15:33:53 -04001932 libs += [ "X11-xcb" ]
1933 } else if (is_win) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001934 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001935 }
1936 }
1937
Brian Osman16adfa32016-10-18 14:42:44 -04001938 deps = [
Brian Osman16adfa32016-10-18 14:42:44 -04001939 ":gpu_tool_utils",
Brian Osman16adfa32016-10-18 14:42:44 -04001940 ":skia",
1941 ":tool_utils",
1942 ":views",
Brian Osman16adfa32016-10-18 14:42:44 -04001943 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001944 if (is_android) {
1945 deps += [ "//third_party/native_app_glue" ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001946 } else if (is_mac || is_ios) {
Mike Klein43c25262016-10-20 10:17:47 -04001947 deps += [ "//third_party/libsdl" ]
1948 }
Brian Salomon194db172017-08-17 14:37:06 -04001949 if (skia_use_angle) {
1950 deps += [ "//third_party/angle2" ]
1951 }
Mike Kleina92c3832016-12-08 09:49:39 -05001952 }
Brian Osman16adfa32016-10-18 14:42:44 -04001953 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001954
Brian Osmaneff04b52017-11-21 13:18:02 -05001955 if (skia_enable_gpu) {
1956 test_app("viewer") {
1957 is_shared_library = is_android
Jim Van Verth329c5a62017-11-29 11:42:33 -05001958 if (is_ios) {
1959 bundle_ios_data = true
1960 }
Brian Osmaneff04b52017-11-21 13:18:02 -05001961 sources = [
1962 "tools/viewer/GMSlide.cpp",
Brian Osmand67e5182017-12-08 16:46:09 -05001963 "tools/viewer/ImGuiLayer.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05001964 "tools/viewer/ImageSlide.cpp",
1965 "tools/viewer/SKPSlide.cpp",
1966 "tools/viewer/SampleSlide.cpp",
Florin Malita54f65c42018-01-16 17:04:30 -05001967 "tools/viewer/SkottieSlide.cpp",
1968 "tools/viewer/SkottieSlide2.cpp",
Brian Osman56a24812017-12-19 11:15:16 -05001969 "tools/viewer/StatsLayer.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05001970 "tools/viewer/Viewer.cpp",
1971 ]
1972 libs = []
1973
1974 include_dirs = []
1975 deps = [
Florin Malita54f65c42018-01-16 17:04:30 -05001976 ":experimental_skottie",
Florin Malitabcd07232018-01-31 11:08:58 -05001977 ":experimental_sksg",
Brian Osmaneff04b52017-11-21 13:18:02 -05001978 ":flags",
1979 ":gm",
1980 ":gpu_tool_utils",
1981 ":samples",
1982 ":sk_app",
1983 ":skia",
1984 ":tool_utils",
1985 ":views",
1986 "//third_party/imgui",
1987 "//third_party/jsoncpp",
1988 ]
1989 }
1990 }
1991
1992 if (skia_enable_gpu && !skia_use_angle && (is_linux || is_win || is_mac)) {
1993 test_app("HelloWorld") {
1994 sources = [
1995 "example/HelloWorld.cpp",
1996 ]
1997 libs = []
1998
1999 include_dirs = []
2000 deps = [
2001 ":flags",
2002 ":gpu_tool_utils",
2003 ":sk_app",
2004 ":skia",
2005 ":tool_utils",
2006 ":views",
2007 ]
2008 }
2009 }
2010
Jim Van Verthecfed2b2017-08-30 14:02:50 -04002011 if (skia_enable_gpu && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002012 test_app("SkiaSDLExample") {
2013 sources = [
2014 "example/SkiaSDLExample.cpp",
2015 ]
2016 libs = []
2017 include_dirs = []
2018 deps = [
2019 ":gpu_tool_utils",
2020 ":skia",
2021 "//third_party/libsdl",
2022 ]
2023 }
2024 }
2025
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002026 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2027 action_foreach("generate_mocs") {
2028 script = "gn/call.py"
2029 sources = [
2030 "tools/mdbviz/MainWindow.h",
2031 ]
2032 outputs = [
2033 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2034 ]
2035 args = [
2036 "$skia_qt_path" + "/bin/moc",
2037 "{{source}}",
2038 "-o",
2039 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2040 ]
2041 }
2042 action_foreach("generate_resources") {
2043 script = "gn/call.py"
2044 sources = [
2045 "tools/mdbviz/resources.qrc",
2046 ]
2047 outputs = [
2048 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2049 ]
2050 args = [
2051 "$skia_qt_path" + "/bin/rcc",
2052 "{{source}}",
2053 "-o",
2054 "gen/mdbviz/{{source_name_part}}_res.cpp",
2055 ]
2056 }
2057 test_app("mdbviz") {
2058 if (is_win) {
2059 # on Windows we need to disable some exception handling warnings due to the Qt headers
2060 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2061 }
2062 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002063 "tools/UrlDataManager.cpp",
2064 "tools/debugger/SkDebugCanvas.cpp",
2065 "tools/debugger/SkDrawCommand.cpp",
2066 "tools/debugger/SkJsonWriteBuffer.cpp",
2067 "tools/debugger/SkObjectParser.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002068 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002069 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002070 "tools/mdbviz/main.cpp",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002071 "tools/picture_utils.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002072
2073 # generated files
2074 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2075 "$target_gen_dir/mdbviz/resources_res.cpp",
2076 ]
2077 lib_dirs = [ "$skia_qt_path/lib" ]
2078 libs = [
2079 "Qt5Core.lib",
2080 "Qt5Gui.lib",
2081 "Qt5Widgets.lib",
2082 ]
2083 include_dirs = [
2084 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002085 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002086 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002087 "tools",
2088 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002089 ]
2090 deps = [
2091 ":generate_mocs",
2092 ":generate_resources",
2093 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002094 "//third_party/jsoncpp",
2095 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002096 ]
2097 }
2098 }
2099
Mike Kleine459afd2017-03-03 09:21:30 -05002100 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002101 copy("gdbserver") {
2102 sources = [
2103 "$ndk/$ndk_gdbserver",
2104 ]
2105 outputs = [
2106 "$root_out_dir/gdbserver",
2107 ]
2108 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002109 }
mtklein25c81d42016-07-27 13:55:26 -07002110}
Mike Kleinc55a6cb2017-06-28 13:21:47 -04002111
2112if (skia_jumper_clang != "") {
2113 action("regen_jumper") {
2114 script = "src/jumper/build_stages.py"
2115
2116 inputs = [
2117 "src/jumper/SkJumper_stages.cpp",
Mike Klein9b2f69b2017-09-12 16:40:53 -04002118 "src/jumper/SkJumper_stages_lowp.cpp",
Mike Kleinc55a6cb2017-06-28 13:21:47 -04002119 ]
2120
2121 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it.
2122 outputs = [
2123 "$target_out_dir/" +
2124 rebase_path("src/jumper/SkJumper_generated.S", target_out_dir),
2125 "$target_out_dir/" +
2126 rebase_path("src/jumper/SkJumper_generated_win.S", target_out_dir),
2127 ]
2128
2129 args = [
2130 skia_jumper_clang,
2131 skia_jumper_objdump,
2132 skia_jumper_ccache,
2133 ] + rebase_path(inputs) + rebase_path(outputs)
2134 }
2135}