blob: 110cb0ede92cb7678a99ec1a71f4d62a95fe5509 [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
Hal Canarya4935102017-12-08 13:35:47 -050034 skia_embed_resources = false
mtklein1bd72ba2016-09-16 07:45:52 -070035
Mike Klein7d921032017-01-05 12:20:41 -050036 skia_android_serial = ""
Brian Osman3f375d02016-12-28 11:19:22 -050037 skia_enable_discrete_gpu = true
Mike Kleina04bb452017-02-09 12:24:07 -050038 skia_enable_effects = true
Brian Osmanf2c90142017-07-13 15:50:03 -040039 skia_enable_flutter_defines = false
Hal Canaryff2742e2018-01-30 11:35:47 -050040 skia_enable_fontmgr_empty = false
mtklein06c35c02016-09-20 12:28:12 -070041 skia_enable_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050042 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040043 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Mike Klein3669a822017-03-03 10:55:02 -050044 skia_enable_tools = is_skia_dev_build
45 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Greg Danielafb7ec72017-12-07 12:48:30 -050046 skia_vulkan_header = ""
Greg Daniel686bb212016-10-27 10:48:48 -040047 skia_vulkan_sdk = getenv("VULKAN_SDK")
Robert Phillipsa6d2d702017-09-01 12:17:03 -040048 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040049 skia_compile_processors = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070050 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040051
52 skia_jumper_clang = ""
53 skia_jumper_objdump = ""
54 skia_jumper_ccache = ""
mtkleinc04ff472016-06-23 10:29:30 -070055}
Brian Salomon23d73ea2016-10-27 13:31:37 -040056declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040057 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040058 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050059 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Mike Klein10d665d2016-11-01 11:46:10 -040060
Mike Klein4d598a32016-10-31 13:44:49 -040061 if (is_android) {
62 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070063 } else if (is_fuchsia) {
64 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040065 } else {
66 skia_use_vulkan = skia_vulkan_sdk != ""
67 }
Jim Van Verth4e502972017-12-07 15:16:10 -050068
69 if (is_ios) {
70 skia_ios_identity = ".*Google.*"
71 skia_ios_profile = "Google Development"
72 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040073}
Greg Danielec6ae522017-04-25 13:38:26 -040074declare_args() {
Greg Danielafb7ec72017-12-07 12:48:30 -050075 skia_tools_vulkan_header_dir = ""
Greg Danielec6ae522017-04-25 13:38:26 -040076 if (skia_use_vulkan) {
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +000077 # 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 -040078 if (is_fuchsia) {
Greg Danielafb7ec72017-12-07 12:48:30 -050079 skia_tools_vulkan_header_dir = "$fuchsia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040080 } else if (is_linux || is_win) {
Greg Danielafb7ec72017-12-07 12:48:30 -050081 skia_tools_vulkan_header_dir = "$skia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040082 }
Greg Danielec6ae522017-04-25 13:38:26 -040083 }
84}
Brian Salomon789e25e2016-09-30 13:41:03 -040085
Adam Barth54ef74a2017-10-13 10:59:38 -070086if (defined(skia_settings)) {
87 import(skia_settings)
88}
89
mtklein38925aa2016-09-21 10:11:25 -070090# Our tools require static linking (they use non-exported symbols).
91skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070092
mtkleina45be612016-08-29 15:22:10 -070093fontmgr_android_enabled = skia_use_expat && skia_use_freetype
94
mtklein1211e0c2016-07-26 13:55:45 -070095skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070096 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070097 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070098 "include/codec",
99 "include/config",
100 "include/core",
101 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -0400102 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -0700103 "include/gpu",
104 "include/gpu/gl",
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500105 "include/atlastext",
mtklein1211e0c2016-07-26 13:55:45 -0700106 "include/pathops",
107 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -0700108 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -0700109 "include/utils",
110 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -0700111]
112
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000113if (skia_use_vulkan) {
114 skia_public_includes += [ "include/gpu/vk" ]
115}
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500116if (skia_enable_atlas_text) {
117 skia_public_includes += [ "include/atlastext" ]
118}
Greg Daniele5ddff52017-07-05 16:49:36 -0400119if (skia_use_metal) {
120 skia_public_includes += [ "include/gpu/mtl" ]
121}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000122
mtkleinc04ff472016-06-23 10:29:30 -0700123# Skia public API, generally provided by :skia.
124config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700125 include_dirs = skia_public_includes
Greg Danielafb7ec72017-12-07 12:48:30 -0500126 if (skia_tools_vulkan_header_dir != "") {
127 include_dirs += [ skia_tools_vulkan_header_dir ]
Greg Danielec6ae522017-04-25 13:38:26 -0400128 }
Mike Kleinae7e6712016-10-11 17:49:33 -0400129 defines = []
130 if (is_component_build) {
131 defines += [ "SKIA_DLL" ]
132 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400133 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700134 defines += [ "SK_SAMPLES_FOR_X" ]
135 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400136 if (skia_enable_flutter_defines) {
137 defines += flutter_defines
138 }
mtklein06c35c02016-09-20 12:28:12 -0700139 if (!skia_enable_gpu) {
140 defines += [ "SK_SUPPORT_GPU=0" ]
141 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500142 if (skia_enable_atlas_text) {
143 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
144 }
mtkleinc04ff472016-06-23 10:29:30 -0700145}
146
147# Skia internal APIs, used by Skia itself and a few test tools.
148config("skia_private") {
149 visibility = [ ":*" ]
150
151 include_dirs = [
152 "include/private",
153 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700154 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700155 "src/core",
156 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700157 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700158 "src/image",
159 "src/images",
160 "src/lazy",
161 "src/opts",
162 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700163 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700164 "src/ports",
165 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400166 "src/shaders",
167 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700168 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700169 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700170 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500171 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700172 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700173 ]
mtklein150d1132016-08-01 06:56:40 -0700174
Mike Reeda9e241d2017-05-03 10:52:00 -0400175 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700176 if (is_android) {
177 defines += [
178 "SK_GAMMA_EXPONENT=1.4",
179 "SK_GAMMA_CONTRAST=0.0",
180 ]
181 }
mtklein88a7ac02016-09-14 11:16:49 -0700182 if (is_official_build || is_android) {
183 # TODO(bsalomon): it'd be nice to make Android normal.
184 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
185 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400186 libs = []
187 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500188 if (skia_enable_gpu) {
189 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500190 if (is_skia_dev_build && skia_use_vulkan) {
191 include_dirs += [ "tools/gpu/vk" ]
192 }
Brian Salomon03e05842017-02-23 12:23:47 -0500193 }
Brian Osman34755e22016-12-05 09:46:02 -0500194 if (skia_use_angle) {
195 defines += [ "SK_ANGLE" ]
196 }
Brian Osman3f375d02016-12-28 11:19:22 -0500197 if (skia_enable_discrete_gpu) {
198 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
199 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400200 if (!is_official_build) {
201 defines += [ "GR_TEST_UTILS=1" ]
202 }
mtkleinc04ff472016-06-23 10:29:30 -0700203}
204
205# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
206config("skia_library") {
207 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700208 defines = [ "SKIA_IMPLEMENTATION=1" ]
209}
210
211skia_library_configs = [
212 ":skia_public",
213 ":skia_private",
214 ":skia_library",
215]
216
mtklein9b8583d2016-08-24 17:32:30 -0700217# Use for CPU-specific Skia code that needs particular compiler flags.
218template("opts") {
219 if (invoker.enabled) {
220 source_set(target_name) {
221 forward_variables_from(invoker, "*")
222 configs += skia_library_configs
223 }
224 } else {
225 # If not enabled, a phony empty target that swallows all otherwise unused variables.
226 source_set(target_name) {
227 forward_variables_from(invoker,
228 "*",
229 [
230 "sources",
231 "cflags",
232 ])
233 }
234 }
anmittala7eaf2e2016-08-17 13:57:26 -0700235}
236
mtklein422310d2016-08-16 18:28:43 -0700237is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700238
mtklein7d6fb2c2016-08-25 14:50:44 -0700239opts("none") {
240 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700241 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700242 cflags = []
243}
244
mtklein7d6fb2c2016-08-25 14:50:44 -0700245opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700246 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700247 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700248 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700249}
250
251opts("arm64") {
252 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700253 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700254 cflags = []
255}
256
257opts("crc32") {
258 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700259 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700260 cflags = [ "-march=armv8-a+crc" ]
261}
262
mtklein9b8583d2016-08-24 17:32:30 -0700263opts("sse2") {
264 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700265 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400266 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400267 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
268 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400269 cflags = [ "-msse2" ]
270 }
mtklein9b8583d2016-08-24 17:32:30 -0700271}
mtkleinc04ff472016-06-23 10:29:30 -0700272
mtklein9b8583d2016-08-24 17:32:30 -0700273opts("ssse3") {
274 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700275 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400276 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400277 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
278 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400279 cflags = [ "-mssse3" ]
280 }
mtklein9b8583d2016-08-24 17:32:30 -0700281}
mtkleinc04ff472016-06-23 10:29:30 -0700282
mtklein9b8583d2016-08-24 17:32:30 -0700283opts("sse41") {
284 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700285 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400286 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400287 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
288 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400289 cflags = [ "-msse4.1" ]
290 }
mtklein9b8583d2016-08-24 17:32:30 -0700291}
mtklein4e976072016-08-08 09:06:27 -0700292
mtklein9b8583d2016-08-24 17:32:30 -0700293opts("sse42") {
294 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700295 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400296 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400297 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
298 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400299 cflags = [ "-msse4.2" ]
300 }
mtklein9b8583d2016-08-24 17:32:30 -0700301}
302
303opts("avx") {
304 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700305 sources = skia_opts.avx_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400306 if (!is_clang && is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000307 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400308 } else {
309 cflags = [ "-mavx" ]
310 }
mtkleinc04ff472016-06-23 10:29:30 -0700311}
312
mtkleinc095df52016-08-24 12:23:52 -0700313# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700314template("optional") {
315 if (invoker.enabled) {
316 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700317 if (defined(invoker.public_defines)) {
318 defines = invoker.public_defines
319 }
mtklein457b42a2016-08-23 13:56:37 -0700320 }
321 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700322 forward_variables_from(invoker,
323 "*",
324 [
325 "public_defines",
326 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700327 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700328 ])
mtklein457b42a2016-08-23 13:56:37 -0700329 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700330 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700331 if (defined(invoker.configs_to_remove)) {
332 configs -= invoker.configs_to_remove
333 }
mtklein457b42a2016-08-23 13:56:37 -0700334 }
335 } else {
mtklein457b42a2016-08-23 13:56:37 -0700336 source_set(target_name) {
337 forward_variables_from(invoker,
338 "*",
339 [
340 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700341 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700342 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700343 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700344 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700345 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700346 ])
mtkleincd01b032016-08-31 04:58:19 -0700347 if (defined(invoker.sources_when_disabled)) {
348 sources = invoker.sources_when_disabled
349 }
350 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700351 }
mtkleineb3c4252016-08-23 07:38:09 -0700352 }
mtklein457b42a2016-08-23 13:56:37 -0700353}
mtklein457b42a2016-08-23 13:56:37 -0700354
Mike Kleina04bb452017-02-09 12:24:07 -0500355optional("effects") {
356 enabled = skia_enable_effects
Ethan Nicholas762466e2017-06-29 10:03:38 -0400357 deps = [
358 ":compile_processors",
359 ]
Mike Kleina04bb452017-02-09 12:24:07 -0500360 sources =
361 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
362 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
363}
364
mtkleina45be612016-08-29 15:22:10 -0700365optional("fontmgr_android") {
366 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700367
368 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500369 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700370 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700371 ]
372 sources = [
373 "src/ports/SkFontMgr_android.cpp",
374 "src/ports/SkFontMgr_android_factory.cpp",
375 "src/ports/SkFontMgr_android_parser.cpp",
376 ]
377}
378
mtkleind2e39db2016-09-07 07:52:55 -0700379optional("fontmgr_custom") {
380 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
381
382 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500383 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700384 ]
385 sources = [
386 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500387 "src/ports/SkFontMgr_custom.h",
388 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700389 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500390 "src/ports/SkFontMgr_custom_embedded.cpp",
391 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700392 ]
393}
394
Hal Canaryff2742e2018-01-30 11:35:47 -0500395optional("fontmgr_empty") {
396 enabled = skia_enable_fontmgr_empty
397 sources = [
398 "src/ports/SkFontMgr_empty_factory.cpp",
399 ]
400}
401
mtklein3cc22182016-08-29 13:26:14 -0700402optional("fontmgr_fontconfig") {
403 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700404
405 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500406 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700407 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700408 ]
409 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700410 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700411 "src/ports/SkFontConfigInterface_direct.cpp",
412 "src/ports/SkFontConfigInterface_direct_factory.cpp",
413 "src/ports/SkFontMgr_FontConfigInterface.cpp",
414 "src/ports/SkFontMgr_fontconfig.cpp",
415 "src/ports/SkFontMgr_fontconfig_factory.cpp",
416 ]
417}
418
mtkleincdedd0e2016-09-12 15:15:44 -0700419optional("fontmgr_fuchsia") {
420 enabled = is_fuchsia && skia_use_freetype
421
422 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500423 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700424 ]
425 sources = [
426 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500427 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700428 "src/ports/SkFontMgr_custom_empty_factory.cpp",
429 ]
430}
431
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700432if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400433 executable("sksllex") {
434 sources = [
435 "src/sksl/lex/Main.cpp",
436 "src/sksl/lex/NFA.cpp",
437 "src/sksl/lex/RegexNode.cpp",
438 "src/sksl/lex/RegexParser.cpp",
439 ]
440 include_dirs = [ "src/sksl/lex" ]
441 }
442
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700443 action("run_sksllex") {
444 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400445 deps = [
446 ":sksllex(//gn/toolchain:$host_toolchain)",
447 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700448 sources = [
449 "src/sksl/lex/layout.lex",
450 "src/sksl/lex/sksl.lex",
451 ]
452
453 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
454 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
455 outputs = [
456 "$target_out_dir/" +
457 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
458 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
459 # confused due to the same file being named by two different paths
460 ]
461 sksllex_path = "$root_out_dir/"
462 sksllex_path += "sksllex"
463 if (host_os == "win") {
464 sksllex_path += ".exe"
465 }
466 args = [
467 rebase_path(sksllex_path),
468 rebase_path("bin/clang-format"),
469 rebase_path("src"),
470 ]
471 }
472} else {
473 group("run_sksllex") {
474 }
475}
476
477if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400478 executable("skslc") {
479 defines = [ "SKSL_STANDALONE" ]
480 sources = [
481 "src/sksl/SkSLMain.cpp",
482 ]
483 sources += skia_sksl_sources
484 include_dirs = [
485 "src/gpu",
486 "src/sksl",
487 ]
488 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500489 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400490 "//third_party/spirv-tools",
491 ]
492 }
493
494 skia_gpu_processor_outputs = []
495 foreach(src, skia_gpu_processor_sources) {
496 dir = get_path_info(src, "dir")
497 name = get_path_info(src, "name")
498
499 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
500 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
501 skia_gpu_processor_outputs += [
502 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
503 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
504 # confused due to the same file being named by two different paths
505 ]
506 }
507
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500508 action("create_sksl_enums") {
509 script = "gn/create_sksl_enums.py"
510 sources = [
511 "include/private/GrSharedEnums.h",
512 ]
513 outputs = [
514 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500515 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500516 ]
517 args = [
518 rebase_path(sources[0]),
519 rebase_path(outputs[0]),
520 ]
521 }
522
Ethan Nicholas762466e2017-06-29 10:03:38 -0400523 action("compile_processors") {
524 script = "gn/compile_processors.py"
525 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500526 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400527 ":skslc(//gn/toolchain:$host_toolchain)",
528 ]
529 sources = skia_gpu_processor_sources
530 outputs = skia_gpu_processor_outputs
531 skslc_path = "$root_out_dir/"
532 if (host_toolchain != default_toolchain_name) {
533 skslc_path += "$host_toolchain/"
534 }
535 skslc_path += "skslc"
536 if (host_os == "win") {
537 skslc_path += ".exe"
538 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400539 args = [
540 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400541 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400542 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400543 args += rebase_path(skia_gpu_processor_sources)
544 }
545} else {
546 skia_gpu_processor_outputs = []
547 group("compile_processors") {
548 }
549}
550
mtklein06c35c02016-09-20 12:28:12 -0700551optional("gpu") {
552 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400553 deps = [
554 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700555 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400556 ]
mtkleine9fb3d52016-09-20 15:11:46 -0700557 public_defines = []
558
Brian Salomon3d6801e2017-12-11 10:06:31 -0500559 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
mtklein06c35c02016-09-20 12:28:12 -0700560
561 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500562 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700563 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400564 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700565 if (is_android) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500566 sources += [ "src/gpu/gl/android/GrGLMakeNativeInterface_android.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400567
568 # this lib is required to link against AHardwareBuffer
569 if (defined(ndk_api) && ndk_api >= 26) {
570 libs += [ "android" ]
571 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400572 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500573 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400574 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700575 } else if (is_linux) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500576 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500577 libs += [
578 "GL",
579 "GLU",
580 ]
mtklein06c35c02016-09-20 12:28:12 -0700581 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500582 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800583 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500584 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400585 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500586 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400587 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700588 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500589 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700590 }
mtkleine9fb3d52016-09-20 15:11:46 -0700591
592 if (skia_use_vulkan) {
593 public_defines += [ "SK_VULKAN" ]
594 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700595 if (skia_enable_vulkan_debug_layers) {
596 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
597 }
Greg Danielafb7ec72017-12-07 12:48:30 -0500598 if (skia_vulkan_header != "") {
599 public_defines += [ "SK_VULKAN_HEADER=\"$skia_vulkan_header\"" ]
600 } else {
601 if (is_skia_dev_build) {
602 public_defines += [ "SK_VULKAN_HEADER=\"GrVulkanDefines.h\"" ]
603 }
604 }
mtkleine9fb3d52016-09-20 15:11:46 -0700605 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400606 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400607 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400608 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
609 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400610
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400611 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400612 if (skia_use_metal) {
613 public_defines += [ "SK_METAL" ]
614 sources += skia_metal_sources
615 libs += [ "Metal.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400616 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400617 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500618
619 if (skia_enable_atlas_text) {
620 sources += skia_atlas_text_sources
621 }
mtklein06c35c02016-09-20 12:28:12 -0700622}
623
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400624optional("heif") {
625 enabled = skia_use_libheif
626 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
627
628 deps = []
629
630 sources = [
631 "src/codec/SkHeifCodec.cpp",
632 ]
633}
634
mtklein63213812016-08-24 09:55:56 -0700635optional("jpeg") {
636 enabled = skia_use_libjpeg_turbo
637 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
638
mtklein63213812016-08-24 09:55:56 -0700639 deps = [
640 "//third_party/libjpeg-turbo:libjpeg",
641 ]
642 sources = [
643 "src/codec/SkJpegCodec.cpp",
644 "src/codec/SkJpegDecoderMgr.cpp",
645 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700646 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400647 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700648 ]
649}
650
651optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500652 enabled = skia_use_zlib && skia_enable_pdf
653 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700654
mtklein63213812016-08-24 09:55:56 -0700655 deps = [
656 "//third_party/zlib",
657 ]
brettwb9447282016-09-01 14:24:39 -0700658 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700659 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700660
661 if (skia_use_sfntly) {
662 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500663 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700664 }
665}
666
667optional("png") {
668 enabled = skia_use_libpng
669 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
670
mtklein63213812016-08-24 09:55:56 -0700671 deps = [
672 "//third_party/libpng",
673 ]
674 sources = [
675 "src/codec/SkIcoCodec.cpp",
676 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400677 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700678 ]
679}
680
scroggof84ad642016-10-31 09:02:57 -0700681optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400682 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700683 public_defines = [ "SK_CODEC_DECODES_RAW" ]
684
685 deps = [
686 "//third_party/dng_sdk",
687 "//third_party/libjpeg-turbo:libjpeg",
688 "//third_party/piex",
689 ]
690
691 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
692 # Skia.
693 configs_to_remove = [ "//gn:no_exceptions" ]
694
695 sources = [
696 "src/codec/SkRawAdapterCodec.cpp",
697 "src/codec/SkRawCodec.cpp",
698 ]
699}
700
Mike Kleinfb333552018-01-25 12:49:37 -0500701optional("skcms") {
702 enabled = skia_use_skcms
703
704 deps = [
705 "//third_party/skcms",
706 ]
707 sources = [
708 # TODO
709 ]
710}
711
mtklein3cc22182016-08-29 13:26:14 -0700712optional("typeface_freetype") {
713 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700714
715 deps = [
716 "//third_party/freetype2",
717 ]
718 sources = [
719 "src/ports/SkFontHost_FreeType.cpp",
720 "src/ports/SkFontHost_FreeType_common.cpp",
721 ]
722}
723
mtklein457b42a2016-08-23 13:56:37 -0700724optional("webp") {
725 enabled = skia_use_libwebp
726 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
727
mtklein457b42a2016-08-23 13:56:37 -0700728 deps = [
729 "//third_party/libwebp",
730 ]
731 sources = [
732 "src/codec/SkWebpAdapterCodec.cpp",
733 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400734 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700735 ]
mtkleineb3c4252016-08-23 07:38:09 -0700736}
737
mtklein63213812016-08-24 09:55:56 -0700738optional("xml") {
739 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000740 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700741
mtklein63213812016-08-24 09:55:56 -0700742 deps = [
743 "//third_party/expat",
744 ]
745 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500746 "src/svg/SkSVGCanvas.cpp",
747 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700748 "src/xml/SkDOM.cpp",
749 "src/xml/SkXMLParser.cpp",
750 "src/xml/SkXMLWriter.cpp",
751 ]
752}
753
mtkleinc04ff472016-06-23 10:29:30 -0700754component("skia") {
755 public_configs = [ ":skia_public" ]
756 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700757
758 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700759 ":arm64",
760 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700761 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700762 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500763 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700764 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700765 ":fontmgr_custom",
Hal Canaryff2742e2018-01-30 11:35:47 -0500766 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700767 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700768 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700769 ":gpu",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400770 ":heif",
mtklein63213812016-08-24 09:55:56 -0700771 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700772 ":none",
mtklein63213812016-08-24 09:55:56 -0700773 ":pdf",
774 ":png",
scroggof84ad642016-10-31 09:02:57 -0700775 ":raw",
Mike Kleinfb333552018-01-25 12:49:37 -0500776 ":skcms",
mtklein9b8583d2016-08-24 17:32:30 -0700777 ":sse2",
778 ":sse41",
779 ":sse42",
780 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700781 ":webp",
mtklein63213812016-08-24 09:55:56 -0700782 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700783 ]
784
Chinmay Garde43f115c2016-11-16 15:04:12 -0800785 # This file (and all GN files in Skia) are designed to work with an
786 # empty sources assignment filter; we handle all that explicitly.
787 # We clear the filter here for clients who may have set up a global filter.
788 set_sources_assignment_filter([])
789
mtkleinc04ff472016-06-23 10:29:30 -0700790 sources = []
brettwb9447282016-09-01 14:24:39 -0700791 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700792 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500793 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700794 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400795 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500796 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700797 "src/android/SkBitmapRegionCodec.cpp",
798 "src/android/SkBitmapRegionDecoder.cpp",
799 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400800 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700801 "src/codec/SkBmpCodec.cpp",
802 "src/codec/SkBmpMaskCodec.cpp",
803 "src/codec/SkBmpRLECodec.cpp",
804 "src/codec/SkBmpStandardCodec.cpp",
805 "src/codec/SkCodec.cpp",
806 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700807 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700808 "src/codec/SkMaskSwizzler.cpp",
809 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700810 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700811 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700812 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700813 "src/codec/SkSwizzler.cpp",
814 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700815 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700816 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700817 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700818 "src/ports/SkMemory_malloc.cpp",
819 "src/ports/SkOSFile_stdio.cpp",
820 "src/sfnt/SkOTTable_name.cpp",
821 "src/sfnt/SkOTUtils.cpp",
822 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700823 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700824 ]
brettwb9447282016-09-01 14:24:39 -0700825
mtklein7d6fb2c2016-08-25 14:50:44 -0700826 libs = []
827
mtkleinc04ff472016-06-23 10:29:30 -0700828 if (is_win) {
829 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400830 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700831 "src/ports/SkDebug_win.cpp",
832 "src/ports/SkFontHost_win.cpp",
833 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500834 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700835 "src/ports/SkImageEncoder_WIC.cpp",
836 "src/ports/SkImageGeneratorWIC.cpp",
837 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700838 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700839 "src/ports/SkScalerContext_win_dw.cpp",
840 "src/ports/SkTLS_win.cpp",
841 "src/ports/SkTypeface_win_dw.cpp",
842 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400843 libs += [
844 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500845 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400846 "Ole32.lib",
847 "OleAut32.lib",
848 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500849 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400850 ]
mtkleinc04ff472016-06-23 10:29:30 -0700851 } else {
852 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700853 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700854 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700855 "src/ports/SkTLS_pthread.cpp",
856 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400857 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700858 }
859
mtklein7d6fb2c2016-08-25 14:50:44 -0700860 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500861 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500862 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500863 deps += [ "//third_party/cpu-features" ]
864 }
mtklein06c35c02016-09-20 12:28:12 -0700865 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700866 libs += [
867 "EGL",
868 "GLESv2",
869 "log",
870 ]
871 }
872
mtkleinc04ff472016-06-23 10:29:30 -0700873 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700874 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700875 }
876
877 if (is_mac) {
878 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700879 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700880 "src/ports/SkFontHost_mac.cpp",
881 "src/ports/SkImageEncoder_CG.cpp",
882 "src/ports/SkImageGeneratorCG.cpp",
883 ]
mtklein09e61f72016-08-23 13:35:28 -0700884 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400885 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
886 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700887 "ApplicationServices.framework",
888 "OpenGL.framework",
889 ]
mtkleinc04ff472016-06-23 10:29:30 -0700890 }
abarth6fc8ff02016-07-15 15:15:15 -0700891
Mike Klein7d302882016-11-03 14:06:31 -0400892 if (is_ios) {
893 sources += [
894 "src/ports/SkDebug_stdio.cpp",
895 "src/ports/SkFontHost_mac.cpp",
896 "src/ports/SkImageEncoder_CG.cpp",
897 "src/ports/SkImageGeneratorCG.cpp",
898 ]
899 libs += [
900 "CoreFoundation.framework",
901 "CoreGraphics.framework",
902 "CoreText.framework",
903 "ImageIO.framework",
904 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400905
906 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
907 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400908 ]
909 }
910
abarth6fc8ff02016-07-15 15:15:15 -0700911 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700912 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700913 }
mtkleinc04ff472016-06-23 10:29:30 -0700914}
915
mtkleinc095df52016-08-24 12:23:52 -0700916# Targets guarded by skia_enable_tools may use //third_party freely.
917if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500918 # Used by gn_to_bp.py to list our public include dirs.
919 source_set("public") {
920 configs += [ ":skia_public" ]
921 }
922
Mike Kleinc36dedf2016-11-18 09:35:28 -0500923 config("skia.h_config") {
924 include_dirs = [ "$target_gen_dir" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500925 if (skia_use_vulkan) {
926 # So we can get the header which includes vulkan
927 include_dirs += [ "tools/gpu/vk" ]
928 }
Mike Kleinc36dedf2016-11-18 09:35:28 -0500929 }
930 action("skia.h") {
931 public_configs = [ ":skia.h_config" ]
932 skia_h = "$target_gen_dir/skia.h"
933 script = "gn/find_headers.py"
Greg Danielc819e662017-04-19 16:39:45 -0400934 args = [ rebase_path(skia_h, root_build_dir) ] +
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000935 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -0500936 depfile = "$skia_h.deps"
937 outputs = [
938 skia_h,
939 ]
940 }
941
Hal Canary316b7462017-12-13 12:39:19 -0500942 if (skia_embed_resources) {
943 action("binary_resources.cpp") {
944 script = "gn/generate_binary_asset.py"
945 args = [
946 rebase_path("resources"),
947 "gResources",
948 rebase_path("$target_gen_dir/binary_resources.cpp", root_build_dir),
949 ]
950 outputs = [
951 "$target_gen_dir/binary_resources.cpp",
952 ]
953 }
954 }
955
Mike Kleinc36dedf2016-11-18 09:35:28 -0500956 if (skia_enable_gpu && target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -0500957 executable("fiddle") {
958 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -0500959 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500960 "tools/fiddle/draw.cpp",
961 "tools/fiddle/fiddle_main.cpp",
962 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400963
964 if (skia_use_egl) {
965 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400966 } else {
967 sources += [ "tools/fiddle/null_context.cpp" ]
968 }
Joe Gregorio1e735c02017-04-19 14:05:14 -0400969 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -0500970 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -0400971 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -0500972 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -0500973 ":skia",
974 ":skia.h",
975 ]
976 }
977 }
978
979 if (skia_enable_gpu) {
980 source_set("public_headers_warnings_check") {
981 sources = [
982 "tools/public_headers_warnings_check.cpp",
983 ]
984 configs -= [ "//gn:warnings_except_public_headers" ]
985 deps = [
986 ":skia",
987 ":skia.h",
988 ]
989 }
990 }
991
mtkleinc095df52016-08-24 12:23:52 -0700992 template("test_lib") {
993 config(target_name + "_config") {
994 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700995 if (defined(invoker.public_defines)) {
996 defines = invoker.public_defines
997 }
mtklein25c81d42016-07-27 13:55:26 -0700998 }
mtkleinc095df52016-08-24 12:23:52 -0700999 source_set(target_name) {
1000 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
1001 public_configs = [
1002 ":" + target_name + "_config",
1003 ":skia_private",
1004 ]
1005
1006 if (!defined(deps)) {
1007 deps = []
1008 }
1009 deps += [ ":skia" ]
1010 testonly = true
1011 }
mtklein25c81d42016-07-27 13:55:26 -07001012 }
mtklein25c81d42016-07-27 13:55:26 -07001013
Mike Kleine6682eb2017-01-05 10:54:57 -05001014 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001015 if (is_ios) {
1016 app_name = target_name
1017 gen_path = target_gen_dir
1018
1019 action("${app_name}_generate_info_plist") {
1020 script = "//gn/gen_plist_ios.py"
1021 outputs = [
1022 "$gen_path/${app_name}_Info.plist",
1023 ]
1024 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1025 }
1026
1027 bundle_data("${app_name}_bundle_info_plist") {
1028 public_deps = [
1029 ":${app_name}_generate_info_plist",
1030 ]
1031 sources = [
1032 "$gen_path/${app_name}_Info.plist",
1033 ]
1034 outputs = [
1035 "{{bundle_root_dir}}/Info.plist",
1036 ]
1037 }
1038
Jim Van Verth329c5a62017-11-29 11:42:33 -05001039 bundle_ios_data =
1040 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1041
1042 if (bundle_ios_data) {
1043 has_skps =
1044 "True" == exec_script("//gn/checkdir.py",
1045 [ rebase_path("skps", root_build_dir) ],
1046 "trim string")
1047 bundle_data("${app_name}_bundle_resources") {
1048 sources = [
1049 "resources",
1050 ]
1051 outputs = [
1052 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1053 "{{bundle_resources_dir}}/data/resources",
1054 ]
1055 }
1056
1057 if (has_skps) {
1058 bundle_data("${app_name}_bundle_skps") {
1059 sources = [
1060 "skps",
1061 ]
1062 outputs = [
1063 # Store in same folder as resources
1064 "{{bundle_resources_dir}}/data/skps",
1065 ]
1066 }
1067 }
1068 }
1069
Jim Van Verth443a9132017-11-28 09:45:26 -05001070 executable("${app_name}_generate_executable") {
1071 forward_variables_from(invoker,
1072 "*",
1073 [
1074 "output_name",
1075 "visibility",
1076 "is_shared_library",
1077 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001078 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001079 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001080 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1081 }
1082
1083 bundle_data("${app_name}_bundle_executable") {
1084 public_deps = [
1085 ":${app_name}_generate_executable",
1086 ]
1087 sources = [
1088 "$gen_path/$app_name",
1089 ]
1090 outputs = [
1091 "{{bundle_executable_dir}}/$app_name",
1092 ]
1093 testonly = true
1094 }
1095
1096 create_bundle("$app_name") {
1097 product_type = "com.apple.product-type.application"
1098 testonly = true
1099
1100 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1101 bundle_resources_dir = bundle_root_dir
1102 bundle_executable_dir = bundle_root_dir
1103 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1104
1105 deps = [
1106 ":${app_name}_bundle_executable",
1107 ":${app_name}_bundle_info_plist",
1108 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001109 if (bundle_ios_data) {
1110 deps += [ ":${app_name}_bundle_resources" ]
1111 if (has_skps) {
1112 deps += [ ":${app_name}_bundle_skps" ]
1113 }
1114 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001115
1116 # should only code sign when running on a device, not the simulator
1117 if (target_cpu != "x64") {
1118 code_signing_script = "//gn/codesign_ios.py"
1119 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1120 code_signing_outputs = [
1121 "$bundle_root_dir/_CodeSignature/CodeResources",
1122 "$bundle_root_dir/embedded.mobileprovision",
1123 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001124 code_signing_args = [
1125 rebase_path("$bundle_root_dir", root_build_dir),
1126 skia_ios_identity,
1127 skia_ios_profile,
1128 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001129 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001130 }
1131 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001132 # !is_ios
1133
1134 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1135 shared_library("lib" + target_name) {
1136 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1137 configs += [ ":skia_private" ]
1138 testonly = true
1139 }
1140 } else {
1141 _executable = target_name
1142 executable(_executable) {
1143 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1144 configs += [ ":skia_private" ]
1145 testonly = true
1146 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001147 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001148 if (is_android && skia_android_serial != "" && defined(_executable)) {
1149 action("push_" + target_name) {
1150 script = "gn/push_to_android.py"
1151 deps = [
1152 ":" + _executable,
1153 ]
1154 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1155 outputs = [
1156 _stamp,
1157 ]
1158 args = [
1159 rebase_path("$root_build_dir/$_executable"),
1160 skia_android_serial,
1161 rebase_path(_stamp),
1162 ]
1163 testonly = true
1164 }
Mike Klein7d921032017-01-05 12:20:41 -05001165 }
1166 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001167 }
1168
mtkleinc095df52016-08-24 12:23:52 -07001169 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001170 public_include_dirs = []
1171 if (skia_enable_gpu) {
1172 public_defines = []
1173 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001174
1175 deps = []
mtklein38925aa2016-09-21 10:11:25 -07001176 sources = [
1177 "tools/gpu/GrContextFactory.cpp",
1178 "tools/gpu/GrTest.cpp",
1179 "tools/gpu/TestContext.cpp",
Brian Salomoncbcb0a12017-11-19 13:20:13 -05001180 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001181 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -07001182 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001183 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
1184 "tools/gpu/gl/debug/GrBufferObj.cpp",
1185 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
1186 "tools/gpu/gl/debug/GrProgramObj.cpp",
1187 "tools/gpu/gl/debug/GrShaderObj.cpp",
1188 "tools/gpu/gl/debug/GrTextureObj.cpp",
1189 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
1190 "tools/gpu/gl/null/NullGLTestContext.cpp",
Brian Salomoncfe910d2017-07-06 16:40:18 -04001191 "tools/gpu/mock/MockTestContext.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001192 ]
1193 libs = []
mtklein25c81d42016-07-27 13:55:26 -07001194
Kevin Lubick4a24e102017-03-29 11:19:01 -04001195 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -07001196 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -04001197 } else if (is_ios) {
1198 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1199 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -07001200 } else if (is_linux) {
1201 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001202 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -07001203 } else if (is_mac) {
1204 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001205 } else if (is_win) {
1206 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1207 libs += [
1208 "Gdi32.lib",
1209 "OpenGL32.lib",
1210 ]
mtklein38925aa2016-09-21 10:11:25 -07001211 }
mtklein6ef69992016-09-14 06:12:09 -07001212
Greg Daniel6b7e0e22017-07-12 16:21:09 -04001213 cflags_objcc = [ "-fobjc-arc" ]
1214
Mike Kleinc168a3a2016-11-14 14:53:13 +00001215 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +00001216 deps += [ "//third_party/angle2" ]
1217 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1218 }
mtkleind68f9b02016-09-23 13:18:41 -07001219 if (skia_use_vulkan) {
1220 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Greg Daniel35970ec2017-11-10 10:03:05 -05001221 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
mtkleind68f9b02016-09-23 13:18:41 -07001222 }
Greg Danielb76a72a2017-07-13 15:07:54 -04001223 if (skia_use_metal) {
1224 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
1225 }
mtkleina627b5c2016-09-20 13:36:47 -07001226 }
mtklein25c81d42016-07-27 13:55:26 -07001227 }
mtklein25c81d42016-07-27 13:55:26 -07001228
mtkleinc095df52016-08-24 12:23:52 -07001229 test_lib("flags") {
1230 public_include_dirs = [ "tools/flags" ]
1231 sources = [
1232 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001233 ]
1234 }
1235 test_lib("common_flags") {
1236 public_include_dirs = [ "tools/flags" ]
1237 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001238 "tools/flags/SkCommonFlags.cpp",
1239 "tools/flags/SkCommonFlagsConfig.cpp",
1240 ]
1241 deps = [
mtklein046cb562016-09-16 10:23:12 -07001242 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001243 ":gpu_tool_utils",
1244 ]
1245 }
mtklein25c81d42016-07-27 13:55:26 -07001246
mtkleinc095df52016-08-24 12:23:52 -07001247 test_lib("tool_utils") {
1248 public_include_dirs = [
1249 "tools",
1250 "tools/debugger",
1251 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001252 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001253 ]
1254 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001255 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001256 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001257 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001258 "tools/ProcStats.cpp",
1259 "tools/Resources.cpp",
Mike Klein10d66cc2017-11-10 11:33:43 -05001260 "tools/SkRandomScalerContext.cpp",
1261 "tools/SkTestScalerContext.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001262 "tools/UrlDataManager.cpp",
1263 "tools/debugger/SkDebugCanvas.cpp",
1264 "tools/debugger/SkDrawCommand.cpp",
1265 "tools/debugger/SkJsonWriteBuffer.cpp",
1266 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001267 "tools/picture_utils.cpp",
1268 "tools/random_parse_path.cpp",
1269 "tools/sk_tool_utils.cpp",
1270 "tools/sk_tool_utils_font.cpp",
1271 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001272 "tools/trace/SkChromeTracingTracer.cpp",
1273 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001274 "tools/trace/SkDebugfTracer.cpp",
1275 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001276 "tools/trace/SkEventTracingPriv.cpp",
1277 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001278 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001279 libs = []
1280 if (is_ios) {
1281 sources += [ "tools/ios_utils.m" ]
1282 libs += [ "Foundation.framework" ]
1283 }
mtkleinc095df52016-08-24 12:23:52 -07001284 deps = [
mtklein046cb562016-09-16 10:23:12 -07001285 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001286 ":flags",
1287 "//third_party/libpng",
1288 ]
1289 public_deps = [
1290 "//third_party/jsoncpp",
1291 ]
Hal Canarya4935102017-12-08 13:35:47 -05001292 if (skia_embed_resources) {
1293 defines = [ "SK_EMBED_RESOURCES" ]
1294 sources += [ "$target_gen_dir/binary_resources.cpp" ]
1295 deps += [ ":binary_resources.cpp" ]
1296 }
mtkleinc095df52016-08-24 12:23:52 -07001297 }
mtklein25c81d42016-07-27 13:55:26 -07001298
Mike Klein6e744122016-10-27 12:21:40 -04001299 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001300 test_lib("gm") {
1301 public_include_dirs = [ "gm" ]
1302 sources = gm_sources
1303 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001304 ":experimental_sksg",
scroggo19b91532016-10-24 09:03:26 -07001305 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001306 ":gpu_tool_utils",
1307 ":skia",
1308 ":tool_utils",
1309 ]
1310 }
mtklein25c81d42016-07-27 13:55:26 -07001311
Mike Klein6e744122016-10-27 12:21:40 -04001312 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001313 test_lib("tests") {
1314 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001315 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001316 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001317 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001318 }
mtkleinc095df52016-08-24 12:23:52 -07001319 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001320 ":experimental_sksg",
mtkleinc095df52016-08-24 12:23:52 -07001321 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001322 ":skia",
1323 ":tool_utils",
1324 "//third_party/libpng",
1325 "//third_party/zlib",
1326 ]
Hal Canaryff2742e2018-01-30 11:35:47 -05001327 if (skia_use_expat) {
1328 deps += [ ":experimental_svg_model" ]
1329 }
Mike Kleind63442d2017-03-27 14:16:04 -04001330 public_deps = [
1331 ":gpu_tool_utils", # Test.h #includes headers from this target.
1332 ]
mtkleinc095df52016-08-24 12:23:52 -07001333 }
mtklein2f3416d2016-08-02 16:02:05 -07001334
Mike Klein6e744122016-10-27 12:21:40 -04001335 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001336 test_lib("bench") {
1337 public_include_dirs = [ "bench" ]
1338 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001339 deps = [
1340 ":flags",
1341 ":gm",
1342 ":gpu_tool_utils",
1343 ":skia",
1344 ":tool_utils",
1345 ]
1346 }
mtklein2b6870c2016-07-28 14:17:33 -07001347
Florin Malita54f65c42018-01-16 17:04:30 -05001348 test_lib("experimental_skottie") {
1349 public_include_dirs = [ "experimental/skottie" ]
Florin Malita094ccde2017-12-30 12:27:00 -05001350 include_dirs = [ "tools" ]
1351 sources = [
Florin Malita54f65c42018-01-16 17:04:30 -05001352 "experimental/skottie/Skottie.cpp",
1353 "experimental/skottie/SkottieAnimator.cpp",
Florin Malitacf8ed522018-01-25 15:27:33 -05001354 "experimental/skottie/SkottieParser.cpp",
Florin Malita54f65c42018-01-16 17:04:30 -05001355 "experimental/skottie/SkottieProperties.cpp",
Florin Malita094ccde2017-12-30 12:27:00 -05001356 ]
1357 deps = [
1358 ":experimental_sksg",
1359 ":skia",
1360 "//third_party/jsoncpp",
1361 ]
1362 }
1363
mtkleinc095df52016-08-24 12:23:52 -07001364 test_lib("experimental_svg_model") {
1365 public_include_dirs = [ "experimental/svg/model" ]
1366 sources = [
1367 "experimental/svg/model/SkSVGAttribute.cpp",
1368 "experimental/svg/model/SkSVGAttributeParser.cpp",
1369 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -05001370 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001371 "experimental/svg/model/SkSVGContainer.cpp",
1372 "experimental/svg/model/SkSVGDOM.cpp",
1373 "experimental/svg/model/SkSVGEllipse.cpp",
Florin Malitadf007e12017-10-09 15:14:13 -04001374 "experimental/svg/model/SkSVGGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001375 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001376 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001377 "experimental/svg/model/SkSVGNode.cpp",
1378 "experimental/svg/model/SkSVGPath.cpp",
Florin Malita1aa1bb62017-10-11 14:34:33 -04001379 "experimental/svg/model/SkSVGPattern.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001380 "experimental/svg/model/SkSVGPoly.cpp",
Florin Malitacc6cc292017-10-09 16:05:30 -04001381 "experimental/svg/model/SkSVGRadialGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001382 "experimental/svg/model/SkSVGRect.cpp",
1383 "experimental/svg/model/SkSVGRenderContext.cpp",
1384 "experimental/svg/model/SkSVGSVG.cpp",
1385 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001386 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001387 "experimental/svg/model/SkSVGTransformableNode.cpp",
Florin Malita6a69c052017-10-11 14:02:11 -04001388 "experimental/svg/model/SkSVGUse.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001389 "experimental/svg/model/SkSVGValue.cpp",
1390 ]
1391 deps = [
1392 ":skia",
1393 ]
1394 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001395
Florin Malita4aa44412017-12-19 12:21:02 -05001396 test_lib("experimental_sksg") {
1397 public_include_dirs = [
1398 "experimental/sksg",
1399 "experimental/sksg/effects",
1400 "experimental/sksg/geometry",
1401 "experimental/sksg/paint",
1402 ]
1403 sources = [
1404 "experimental/sksg/SkSGDraw.cpp",
1405 "experimental/sksg/SkSGEffectNode.cpp",
1406 "experimental/sksg/SkSGGeometryNode.cpp",
1407 "experimental/sksg/SkSGGroup.cpp",
Florin Malita49328072018-01-08 12:51:12 -05001408 "experimental/sksg/SkSGImage.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001409 "experimental/sksg/SkSGInvalidationController.cpp",
1410 "experimental/sksg/SkSGNode.cpp",
1411 "experimental/sksg/SkSGPaintNode.cpp",
1412 "experimental/sksg/SkSGRenderNode.cpp",
Florin Malita35efaa82018-01-22 12:57:06 -05001413 "experimental/sksg/SkSGScene.cpp",
Florin Malita38ea40e2018-01-29 16:31:14 -05001414 "experimental/sksg/effects/SkSGClipEffect.cpp",
Florin Malita5f9102f2018-01-10 13:36:22 -05001415 "experimental/sksg/effects/SkSGMaskEffect.cpp",
Florin Malitac0034172018-01-08 16:42:59 -05001416 "experimental/sksg/effects/SkSGOpacityEffect.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001417 "experimental/sksg/effects/SkSGTransform.cpp",
Florin Malita16d0ad02018-01-19 15:07:29 -05001418 "experimental/sksg/geometry/SkSGGeometryTransform.cpp",
Florin Malitae6345d92018-01-03 23:37:54 -05001419 "experimental/sksg/geometry/SkSGMerge.cpp",
Florin Malita047ae272017-12-27 11:13:13 -05001420 "experimental/sksg/geometry/SkSGPath.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001421 "experimental/sksg/geometry/SkSGRect.cpp",
Florin Malita51b8c892018-01-07 08:54:24 -05001422 "experimental/sksg/geometry/SkSGTrimEffect.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001423 "experimental/sksg/paint/SkSGColor.cpp",
Florin Malita6aaee592018-01-12 12:25:09 -05001424 "experimental/sksg/paint/SkSGGradient.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001425 ]
1426 deps = [
1427 ":skia",
1428 ]
1429 }
1430
Kevin Lubickebf648e2017-09-21 13:45:16 -04001431 if (target_cpu != "wasm") {
1432 test_lib("views") {
1433 public_include_dirs = [ "include/views" ]
1434 sources = [
1435 "src/views/SkEvent.cpp",
1436 "src/views/SkEventSink.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001437 "src/views/SkTouchGesture.cpp",
1438 "src/views/SkView.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001439 ]
Brian Osman34755e22016-12-05 09:46:02 -05001440 }
Brian Osman16adfa32016-10-18 14:42:44 -04001441 }
1442
Mike Klein38af9432016-11-11 11:39:44 -05001443 if (skia_use_lua) {
1444 test_lib("lua") {
1445 public_include_dirs = []
1446 sources = [
1447 "src/utils/SkLua.cpp",
1448 "src/utils/SkLuaCanvas.cpp",
1449 ]
1450 deps = [
1451 "//third_party/lua",
1452 ]
1453 }
1454
Mike Kleine6682eb2017-01-05 10:54:57 -05001455 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001456 sources = [
1457 "tools/lua/lua_app.cpp",
1458 ]
1459 deps = [
1460 ":lua",
1461 ":skia",
1462 "//third_party/lua",
1463 ]
Mike Klein38af9432016-11-11 11:39:44 -05001464 }
1465
Mike Kleine6682eb2017-01-05 10:54:57 -05001466 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001467 sources = [
1468 "tools/lua/lua_pictures.cpp",
1469 ]
1470 deps = [
1471 ":flags",
1472 ":lua",
1473 ":skia",
1474 ":tool_utils",
1475 "//third_party/lua",
1476 ]
Mike Klein38af9432016-11-11 11:39:44 -05001477 }
1478 }
1479
Cary Clark8032b982017-07-28 11:04:54 -04001480 test_app("bookmaker") {
1481 sources = [
1482 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001483 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001484 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001485 "tools/bookmaker/fiddleParser.cpp",
1486 "tools/bookmaker/includeParser.cpp",
1487 "tools/bookmaker/includeWriter.cpp",
1488 "tools/bookmaker/mdOut.cpp",
1489 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001490 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001491 "tools/bookmaker/spellCheck.cpp",
1492 ]
1493 deps = [
1494 ":flags",
1495 ":skia",
1496 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001497 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001498 ]
1499 }
1500
Kevin Lubickebf648e2017-09-21 13:45:16 -04001501 if (target_cpu != "wasm") {
1502 import("gn/samples.gni")
1503 test_lib("samples") {
1504 public_include_dirs = [ "samplecode" ]
1505 include_dirs = [ "experimental" ]
1506 sources = samples_sources + [
Kevin Lubickebf648e2017-09-21 13:45:16 -04001507 # Relocating these files here, so that clients don't try to build them while they're
1508 # still in active development. Clang's thread safety analysis gets tripped up by
1509 # conditional locks.
1510 "src/core/SkThreadedBMPDevice.cpp",
1511 "src/core/SkThreadedBMPDevice.h",
1512 ]
1513 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001514 ":experimental_sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001515 ":experimental_svg_model",
1516 ":flags",
1517 ":gm",
1518 ":tool_utils",
1519 ":views",
1520 ":xml",
1521 ]
Mike Klein38af9432016-11-11 11:39:44 -05001522
Kevin Lubickebf648e2017-09-21 13:45:16 -04001523 if (skia_use_lua) {
1524 sources += [ "samplecode/SampleLua.cpp" ]
1525 deps += [
1526 ":lua",
1527 "//third_party/lua",
1528 ]
1529 }
1530 }
1531 test_app("dm") {
1532 sources = [
1533 "dm/DM.cpp",
Mike Klein31868212017-11-06 12:02:47 -05001534 "dm/DMFontMgr.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001535 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001536 "dm/DMJsonWriter.cpp",
1537 "dm/DMSrcSink.cpp",
1538 ]
1539 include_dirs = [ "tests" ]
1540 deps = [
1541 ":common_flags",
Florin Malita54f65c42018-01-16 17:04:30 -05001542 ":experimental_skottie",
Florin Malita4aa44412017-12-19 12:21:02 -05001543 ":experimental_sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001544 ":experimental_svg_model",
1545 ":flags",
1546 ":gm",
1547 ":gpu_tool_utils",
1548 ":skia",
1549 ":tests",
1550 ":tool_utils",
1551 "//third_party/jsoncpp",
1552 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001553 ]
1554 }
Brian Osman16adfa32016-10-18 14:42:44 -04001555 }
1556
Mike Kleina8a51ce2018-01-09 12:34:11 -05001557 if (!is_win) {
1558 test_app("remote_demo") {
1559 sources = [
1560 "tools/remote_demo.cpp",
1561 ]
1562 deps = [
1563 ":skia",
1564 ]
1565 }
1566 }
1567
Mike Klein06432b22017-03-21 13:14:33 -04001568 test_app("ok") {
1569 sources = [
Mike Klein361dde02017-11-07 08:14:52 -05001570 "dm/DMFontMgr.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001571 "tools/ok.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001572 "tools/ok_dsts.cpp",
Mike Klein154e6da2017-07-26 15:13:47 -04001573 "tools/ok_engines.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001574 "tools/ok_srcs.cpp",
Mike Kleind63442d2017-03-27 14:16:04 -04001575 "tools/ok_test.cpp",
Mike Kleinf5d1a552017-03-25 12:32:22 -04001576 "tools/ok_vias.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001577 ]
1578 deps = [
Mike Klein4f6e2712017-08-11 10:37:35 -04001579 ":bench",
Mike Klein06432b22017-03-21 13:14:33 -04001580 ":gm",
1581 ":skia",
Mike Kleind63442d2017-03-27 14:16:04 -04001582 ":tests",
Mike Klein62669ad2017-05-09 16:03:07 -04001583 ":tool_utils",
Mike Klein06432b22017-03-21 13:14:33 -04001584 ]
1585 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001586 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001587 sources = [
1588 "bench/nanobench.cpp",
1589 ]
1590 deps = [
1591 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001592 ":common_flags",
Florin Malita4aa44412017-12-19 12:21:02 -05001593 ":experimental_sksg",
fmalita6519c212016-09-14 08:05:17 -07001594 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001595 ":flags",
1596 ":gm",
1597 ":gpu_tool_utils",
1598 ":skia",
1599 ":tool_utils",
1600 "//third_party/jsoncpp",
1601 ]
mtklein2b6870c2016-07-28 14:17:33 -07001602 }
halcanary19a97202016-08-03 15:08:04 -07001603
Ravi Mistry10d36c52017-01-31 09:49:18 -05001604 test_app("skpinfo") {
1605 sources = [
1606 "tools/skpinfo.cpp",
1607 ]
1608 deps = [
1609 ":flags",
1610 ":skia",
1611 ]
1612 }
1613
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001614 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001615 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001616 sources = [
1617 "tools/skpbench/skpbench.cpp",
1618 ]
1619 deps = [
1620 ":flags",
1621 ":gpu_tool_utils",
1622 ":skia",
1623 ":tool_utils",
1624 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001625 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001626 }
1627
Mike Klein7d302882016-11-03 14:06:31 -04001628 # We can't yet build ICU on iOS or Windows.
Kevin Lubickebf648e2017-09-21 13:45:16 -04001629 if (!is_ios && !is_win && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001630 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001631 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001632 "tools/shape/SkShaper_harfbuzz.cpp",
1633 "tools/shape/using_skia_and_harfbuzz.cpp",
mtklein6f5df6a2016-08-29 16:01:10 -07001634 ]
1635 deps = [
1636 ":skia",
1637 "//third_party/harfbuzz",
Ben Wagnera25fbef2017-08-30 13:56:19 -04001638 "//third_party/icu",
mtklein6f5df6a2016-08-29 16:01:10 -07001639 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001640 }
halcanary19a97202016-08-03 15:08:04 -07001641 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001642 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001643 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001644 "tools/shape/SkShaper_primitive.cpp",
1645 "tools/shape/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001646 ]
1647 deps = [
1648 ":skia",
1649 ]
halcanary3eee9d92016-09-10 07:01:53 -07001650 }
mtklein046cb562016-09-16 10:23:12 -07001651
Matt Sarett9f1c4032017-05-17 10:06:32 -04001652 test_app("create_flutter_test_images") {
1653 sources = [
1654 "tools/create_flutter_test_images.cpp",
1655 ]
1656 deps = [
1657 ":skia",
1658 ":tool_utils",
1659 ]
1660 }
1661
Ben Wagner219f3622017-07-17 15:32:25 -04001662 test_app("create_test_font") {
1663 sources = [
1664 "tools/create_test_font.cpp",
1665 ]
1666 deps = [
1667 ":skia",
1668 ]
1669 assert_no_deps = [
1670 # tool_utils requires the output of this app.
1671 ":tool_utils",
1672 ]
1673 }
1674
Mike Kleine6682eb2017-01-05 10:54:57 -05001675 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001676 sources = [
1677 "tools/get_images_from_skps.cpp",
1678 ]
1679 deps = [
1680 ":flags",
1681 ":skia",
1682 "//third_party/jsoncpp",
1683 ]
mtklein046cb562016-09-16 10:23:12 -07001684 }
mtkleinecbc5262016-09-22 11:51:24 -07001685
Mike Kleine6682eb2017-01-05 10:54:57 -05001686 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001687 sources = [
1688 "tools/colorspaceinfo.cpp",
1689 ]
1690 deps = [
1691 ":flags",
1692 ":skia",
1693 ":tool_utils",
1694 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001695 }
1696
Kevin Lubickebf648e2017-09-21 13:45:16 -04001697 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001698 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001699 sources = [
1700 "tools/skiaserve/Request.cpp",
1701 "tools/skiaserve/Response.cpp",
1702 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001703 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1704 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1705 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1706 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1707 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1708 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1709 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1710 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1711 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001712 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1713 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001714 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1715 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1716 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1717 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1718 ]
1719 deps = [
1720 ":flags",
1721 ":gpu_tool_utils",
1722 ":skia",
1723 ":tool_utils",
1724 "//third_party/jsoncpp",
1725 "//third_party/libmicrohttpd",
1726 "//third_party/libpng",
1727 ]
Mike Klein7d302882016-11-03 14:06:31 -04001728 }
mtkleinecbc5262016-09-22 11:51:24 -07001729 }
kjlubick14f984b2016-10-03 11:49:45 -07001730
Mike Kleine6682eb2017-01-05 10:54:57 -05001731 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001732 include_dirs = [
1733 "tools",
1734 "tools/debugger",
1735 ]
kjlubick14f984b2016-10-03 11:49:45 -07001736 sources = [
Hal Canary24ac42b2017-02-14 13:35:14 -05001737 "fuzz/FuzzCanvas.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001738 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001739 "fuzz/FuzzGradients.cpp",
1740 "fuzz/FuzzParsePath.cpp",
1741 "fuzz/FuzzPathop.cpp",
1742 "fuzz/FuzzScaleToSides.cpp",
1743 "fuzz/fuzz.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001744 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1745 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001746 "tools/UrlDataManager.cpp",
1747 "tools/debugger/SkDebugCanvas.cpp",
1748 "tools/debugger/SkDrawCommand.cpp",
1749 "tools/debugger/SkJsonWriteBuffer.cpp",
1750 "tools/debugger/SkObjectParser.cpp",
1751 "tools/picture_utils.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001752 ]
1753 deps = [
1754 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001755 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001756 ":skia",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001757 "//third_party/jsoncpp",
1758 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001759 ]
kjlubick14f984b2016-10-03 11:49:45 -07001760 }
Mike Klein38312422016-10-05 15:41:01 -04001761
Mike Kleine6682eb2017-01-05 10:54:57 -05001762 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001763 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001764 rebase_path("tests/skia_test.cpp"),
1765 rebase_path("tests/Test.cpp"),
1766 ]
caryclark9feb6322016-10-25 08:58:26 -07001767 deps = [
1768 ":flags",
1769 ":gpu_tool_utils",
1770 ":skia",
1771 ":tool_utils",
1772 ]
caryclark9feb6322016-10-25 08:58:26 -07001773 }
1774
Mike Kleine6682eb2017-01-05 10:54:57 -05001775 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001776 sources = [
1777 "tools/DumpRecord.cpp",
1778 "tools/dump_record.cpp",
1779 ]
1780 deps = [
1781 ":flags",
1782 ":skia",
1783 ]
Mike Klein38312422016-10-05 15:41:01 -04001784 }
bungemanfe917272016-10-13 17:36:40 -04001785
Mike Kleine6682eb2017-01-05 10:54:57 -05001786 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001787 sources = [
1788 "tools/skdiff/skdiff.cpp",
1789 "tools/skdiff/skdiff_html.cpp",
1790 "tools/skdiff/skdiff_main.cpp",
1791 "tools/skdiff/skdiff_utils.cpp",
1792 ]
1793 deps = [
1794 ":skia",
1795 ":tool_utils",
1796 ]
bungemanfe917272016-10-13 17:36:40 -04001797 }
halcanarya73d76a2016-10-17 13:19:02 -07001798
Mike Kleine6682eb2017-01-05 10:54:57 -05001799 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001800 sources = [
1801 "tools/skp_parser.cpp",
1802 ]
1803 deps = [
1804 ":skia",
1805 ":tool_utils",
1806 "//third_party/jsoncpp",
1807 ]
halcanarya73d76a2016-10-17 13:19:02 -07001808 }
Brian Osman16adfa32016-10-18 14:42:44 -04001809
Hal Canaryd7b38452017-12-11 17:46:26 -05001810 if (!is_win && skia_enable_gpu) {
1811 test_lib("skqp_lib") {
1812 public_include_dirs = [ "tools/skqp" ]
Hal Canary75427132017-10-11 16:00:31 -04001813 sources = [
Hal Canaryd7b38452017-12-11 17:46:26 -05001814 "dm/DMFontMgr.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001815 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001816 "tools/skqp/gm_knowledge.cpp",
1817 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001818 ]
1819 deps = [
1820 ":gm",
1821 ":gpu_tool_utils",
1822 ":skia",
1823 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001824 ":tool_utils",
1825 ]
1826 }
1827 test_app("skqp") {
1828 sources = [
1829 "tools/skqp/skqp.cpp",
1830 ]
1831 deps = [
1832 ":skia",
1833 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04001834 "//third_party/googletest",
1835 ]
1836 }
1837 }
Hal Canary28f89382017-12-12 09:42:14 -05001838 if (is_android && skia_enable_gpu) {
1839 test_app("skqp_app") {
1840 is_shared_library = true
1841 sources = [
1842 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
1843 ]
1844 deps = [
1845 ":skia",
1846 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05001847 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05001848 ]
1849 libs = [ "android" ]
1850 }
1851 }
Hal Canary75427132017-10-11 16:00:31 -04001852
Hal Canarya9de7602018-01-19 13:08:23 -05001853 test_app("list_gms") {
1854 sources = [
1855 "tools/list_gms.cpp",
1856 ]
1857 deps = [
1858 ":gm",
1859 ":skia",
1860 ]
1861 }
1862 test_app("list_gpu_unit_tests") {
1863 sources = [
1864 "dm/DMGpuTestProcs.cpp",
1865 "tools/list_gpu_unit_tests.cpp",
1866 ]
1867 deps = [
1868 ":skia",
1869 ":tests",
1870 ]
1871 }
1872
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001873 if (skia_enable_gpu) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001874 test_lib("sk_app") {
1875 public_include_dirs = [ "tools/sk_app" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001876 sources = [
Brian Osmaneff04b52017-11-21 13:18:02 -05001877 "tools/sk_app/CommandSet.cpp",
1878 "tools/sk_app/GLWindowContext.cpp",
1879 "tools/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001880 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001881 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001882
Jim Van Verth4e56a912016-10-21 10:58:52 -04001883 if (is_android) {
1884 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001885 "tools/sk_app/android/GLWindowContext_android.cpp",
1886 "tools/sk_app/android/RasterWindowContext_android.cpp",
1887 "tools/sk_app/android/Window_android.cpp",
1888 "tools/sk_app/android/main_android.cpp",
1889 "tools/sk_app/android/surface_glue_android.cpp",
Jim Van Verth4e56a912016-10-21 10:58:52 -04001890 ]
Brian Osman462334e2017-02-09 11:22:57 -05001891 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001892 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001893 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001894 "tools/sk_app/unix/GLWindowContext_unix.cpp",
1895 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
1896 "tools/sk_app/unix/Window_unix.cpp",
Brian Osmanfa916272017-12-01 09:18:20 -05001897 "tools/sk_app/unix/keysym2ucs.c",
Brian Osmaneff04b52017-11-21 13:18:02 -05001898 "tools/sk_app/unix/main_unix.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001899 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001900 libs += [
1901 "GL",
1902 "X11",
1903 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001904 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001905 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001906 "tools/sk_app/win/GLWindowContext_win.cpp",
1907 "tools/sk_app/win/RasterWindowContext_win.cpp",
1908 "tools/sk_app/win/Window_win.cpp",
1909 "tools/sk_app/win/main_win.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001910 ]
Brian Salomon194db172017-08-17 14:37:06 -04001911 if (skia_use_angle) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001912 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04001913 }
Mike Klein43c25262016-10-20 10:17:47 -04001914 } else if (is_mac) {
1915 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001916 "tools/sk_app/mac/GLWindowContext_mac.cpp",
1917 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
1918 "tools/sk_app/mac/Window_mac.cpp",
1919 "tools/sk_app/mac/main_mac.cpp",
Mike Klein43c25262016-10-20 10:17:47 -04001920 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001921 libs += [
1922 "QuartzCore.framework",
1923 "Cocoa.framework",
1924 "Foundation.framework",
1925 ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001926 } else if (is_ios) {
1927 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001928 "tools/sk_app/ios/GLWindowContext_ios.cpp",
1929 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
1930 "tools/sk_app/ios/Window_ios.cpp",
1931 "tools/sk_app/ios/main_ios.cpp",
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001932 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001933 }
1934
1935 if (skia_use_vulkan) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001936 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001937 if (is_android) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001938 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001939 } else if (is_linux) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001940 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
Brian Osman2dd96932016-10-18 15:33:53 -04001941 libs += [ "X11-xcb" ]
1942 } else if (is_win) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001943 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001944 }
1945 }
1946
Brian Osman16adfa32016-10-18 14:42:44 -04001947 deps = [
Brian Osman16adfa32016-10-18 14:42:44 -04001948 ":gpu_tool_utils",
Brian Osman16adfa32016-10-18 14:42:44 -04001949 ":skia",
1950 ":tool_utils",
1951 ":views",
Brian Osman16adfa32016-10-18 14:42:44 -04001952 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001953 if (is_android) {
1954 deps += [ "//third_party/native_app_glue" ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001955 } else if (is_mac || is_ios) {
Mike Klein43c25262016-10-20 10:17:47 -04001956 deps += [ "//third_party/libsdl" ]
1957 }
Brian Salomon194db172017-08-17 14:37:06 -04001958 if (skia_use_angle) {
1959 deps += [ "//third_party/angle2" ]
1960 }
Mike Kleina92c3832016-12-08 09:49:39 -05001961 }
Brian Osman16adfa32016-10-18 14:42:44 -04001962 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001963
Brian Osmaneff04b52017-11-21 13:18:02 -05001964 if (skia_enable_gpu) {
1965 test_app("viewer") {
1966 is_shared_library = is_android
Jim Van Verth329c5a62017-11-29 11:42:33 -05001967 if (is_ios) {
1968 bundle_ios_data = true
1969 }
Brian Osmaneff04b52017-11-21 13:18:02 -05001970 sources = [
1971 "tools/viewer/GMSlide.cpp",
Brian Osmand67e5182017-12-08 16:46:09 -05001972 "tools/viewer/ImGuiLayer.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05001973 "tools/viewer/ImageSlide.cpp",
1974 "tools/viewer/SKPSlide.cpp",
1975 "tools/viewer/SampleSlide.cpp",
Florin Malita54f65c42018-01-16 17:04:30 -05001976 "tools/viewer/SkottieSlide.cpp",
1977 "tools/viewer/SkottieSlide2.cpp",
Brian Osman56a24812017-12-19 11:15:16 -05001978 "tools/viewer/StatsLayer.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05001979 "tools/viewer/Viewer.cpp",
1980 ]
1981 libs = []
1982
1983 include_dirs = []
1984 deps = [
Florin Malita54f65c42018-01-16 17:04:30 -05001985 ":experimental_skottie",
Brian Osmaneff04b52017-11-21 13:18:02 -05001986 ":flags",
1987 ":gm",
1988 ":gpu_tool_utils",
1989 ":samples",
1990 ":sk_app",
1991 ":skia",
1992 ":tool_utils",
1993 ":views",
1994 "//third_party/imgui",
1995 "//third_party/jsoncpp",
1996 ]
1997 }
1998 }
1999
2000 if (skia_enable_gpu && !skia_use_angle && (is_linux || is_win || is_mac)) {
2001 test_app("HelloWorld") {
2002 sources = [
2003 "example/HelloWorld.cpp",
2004 ]
2005 libs = []
2006
2007 include_dirs = []
2008 deps = [
2009 ":flags",
2010 ":gpu_tool_utils",
2011 ":sk_app",
2012 ":skia",
2013 ":tool_utils",
2014 ":views",
2015 ]
2016 }
2017 }
2018
Jim Van Verthecfed2b2017-08-30 14:02:50 -04002019 if (skia_enable_gpu && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002020 test_app("SkiaSDLExample") {
2021 sources = [
2022 "example/SkiaSDLExample.cpp",
2023 ]
2024 libs = []
2025 include_dirs = []
2026 deps = [
2027 ":gpu_tool_utils",
2028 ":skia",
2029 "//third_party/libsdl",
2030 ]
2031 }
2032 }
2033
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002034 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2035 action_foreach("generate_mocs") {
2036 script = "gn/call.py"
2037 sources = [
2038 "tools/mdbviz/MainWindow.h",
2039 ]
2040 outputs = [
2041 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2042 ]
2043 args = [
2044 "$skia_qt_path" + "/bin/moc",
2045 "{{source}}",
2046 "-o",
2047 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2048 ]
2049 }
2050 action_foreach("generate_resources") {
2051 script = "gn/call.py"
2052 sources = [
2053 "tools/mdbviz/resources.qrc",
2054 ]
2055 outputs = [
2056 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2057 ]
2058 args = [
2059 "$skia_qt_path" + "/bin/rcc",
2060 "{{source}}",
2061 "-o",
2062 "gen/mdbviz/{{source_name_part}}_res.cpp",
2063 ]
2064 }
2065 test_app("mdbviz") {
2066 if (is_win) {
2067 # on Windows we need to disable some exception handling warnings due to the Qt headers
2068 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2069 }
2070 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002071 "tools/UrlDataManager.cpp",
2072 "tools/debugger/SkDebugCanvas.cpp",
2073 "tools/debugger/SkDrawCommand.cpp",
2074 "tools/debugger/SkJsonWriteBuffer.cpp",
2075 "tools/debugger/SkObjectParser.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002076 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002077 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002078 "tools/mdbviz/main.cpp",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002079 "tools/picture_utils.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002080
2081 # generated files
2082 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2083 "$target_gen_dir/mdbviz/resources_res.cpp",
2084 ]
2085 lib_dirs = [ "$skia_qt_path/lib" ]
2086 libs = [
2087 "Qt5Core.lib",
2088 "Qt5Gui.lib",
2089 "Qt5Widgets.lib",
2090 ]
2091 include_dirs = [
2092 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002093 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002094 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002095 "tools",
2096 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002097 ]
2098 deps = [
2099 ":generate_mocs",
2100 ":generate_resources",
2101 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002102 "//third_party/jsoncpp",
2103 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002104 ]
2105 }
2106 }
2107
Mike Kleine459afd2017-03-03 09:21:30 -05002108 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002109 copy("gdbserver") {
2110 sources = [
2111 "$ndk/$ndk_gdbserver",
2112 ]
2113 outputs = [
2114 "$root_out_dir/gdbserver",
2115 ]
2116 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002117 }
mtklein25c81d42016-07-27 13:55:26 -07002118}
Mike Kleinc55a6cb2017-06-28 13:21:47 -04002119
2120if (skia_jumper_clang != "") {
2121 action("regen_jumper") {
2122 script = "src/jumper/build_stages.py"
2123
2124 inputs = [
2125 "src/jumper/SkJumper_stages.cpp",
Mike Klein9b2f69b2017-09-12 16:40:53 -04002126 "src/jumper/SkJumper_stages_lowp.cpp",
Mike Kleinc55a6cb2017-06-28 13:21:47 -04002127 ]
2128
2129 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it.
2130 outputs = [
2131 "$target_out_dir/" +
2132 rebase_path("src/jumper/SkJumper_generated.S", target_out_dir),
2133 "$target_out_dir/" +
2134 rebase_path("src/jumper/SkJumper_generated_win.S", target_out_dir),
2135 ]
2136
2137 args = [
2138 skia_jumper_clang,
2139 skia_jumper_objdump,
2140 skia_jumper_ccache,
2141 ] + rebase_path(inputs) + rebase_path(outputs)
2142 }
2143}