blob: 20293b7feb29d589c2510f078382a46b61536576 [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")
Mike Reed025f7832018-11-12 09:27:05 -05007import("gn/fuchsia_defines.gni")
mikejurka8c24f4f2016-09-12 16:51:58 -07008import("gn/shared_sources.gni")
Hal Canary32498f02019-02-04 15:36:31 -05009import("gn/skia.gni")
brettwb9447282016-09-01 14:24:39 -070010
Forrest Reiling30229ac2017-04-17 13:36:39 -070011if (is_fuchsia) {
12 import("//build/vulkan/config.gni")
13}
14
mtkleinc04ff472016-06-23 10:29:30 -070015declare_args() {
Mike Klein26a60492018-10-15 10:38:25 -040016 skia_enable_flutter_defines = false
17}
18
19declare_args() {
Mike Kleinc168a3a2016-11-14 14:53:13 +000020 skia_use_angle = false
Kevin Lubick4a24e102017-03-29 11:19:01 -040021 skia_use_egl = false
mtklein63213812016-08-24 09:55:56 -070022 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070023 skia_use_fontconfig = is_linux
Leon Scroggins III85e22fc2018-11-28 08:58:47 -050024 skia_use_fonthost_mac = is_mac
mtkleincdedd0e2016-09-12 15:15:44 -070025 skia_use_freetype = is_android || is_fuchsia || is_linux
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -050026 skia_use_fixed_gamma_text = is_android
mtklein63213812016-08-24 09:55:56 -070027 skia_use_libjpeg_turbo = true
28 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070029 skia_use_libwebp = !is_fuchsia
Mike Kleinfae86b72018-01-08 15:49:09 -050030 skia_use_lua = is_skia_dev_build && !is_ios
Mike Kleinf9ae6702018-06-20 14:05:05 -040031 skia_use_opencl = false
Mike Klein10d665d2016-11-01 11:46:10 -040032 skia_use_piex = !is_win
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -040033 skia_use_wuffs = false
mtklein63213812016-08-24 09:55:56 -070034 skia_use_zlib = true
Greg Daniele5ddff52017-07-05 16:49:36 -040035 skia_use_metal = false
Mike Klein36f182f2017-10-20 12:33:53 -040036 skia_use_libheif = is_skia_dev_build
Chinmay Garded92d0352018-09-17 10:23:28 -070037 skia_use_x11 = is_linux
Leon Scroggins IIIee0e5d02019-02-27 10:59:11 -050038 skia_use_xps = true
mtklein1bd72ba2016-09-16 07:45:52 -070039
Mike Klein7d921032017-01-05 12:20:41 -050040 skia_android_serial = ""
Kevin Lubick93faa672018-10-10 15:54:53 -040041 skia_enable_ccpr = true
Kevin Lubickca7c2972018-10-17 13:52:24 +000042 skia_enable_nvpr = !skia_enable_flutter_defines
Brian Osman3f375d02016-12-28 11:19:22 -050043 skia_enable_discrete_gpu = true
Kevin Lubick134be1d2018-10-30 15:05:04 -040044 skia_enable_nima = false
Hal Canary43fb7a02016-12-30 13:09:03 -050045 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040046 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Kevin Lubick32dfdbe2018-10-18 09:47:01 -040047 skia_enable_skpicture = true
Mike Klein3669a822017-03-03 10:55:02 -050048 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Robert Phillipsa6d2d702017-09-01 12:17:03 -040049 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040050 skia_compile_processors = false
Adrienne Walker1df7cd82018-04-18 13:46:25 -070051 skia_generate_workarounds = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070052 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040053
Hal Canary2331c822018-02-01 14:06:13 -050054 skia_skqp_global_error_tolerance = 0
Ethan Nicholas26a9aad2018-03-27 14:10:52 -040055
56 skia_llvm_path = ""
57 skia_llvm_lib = "LLVM"
Hal Canaryfd9bcab2018-04-24 11:47:23 -040058
59 skia_tools_require_resources = false
mtkleinc04ff472016-06-23 10:29:30 -070060}
Brian Salomon23d73ea2016-10-27 13:31:37 -040061declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040062 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040063 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050064 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -050065 skia_enable_fontmgr_empty = false
Kevin Lubickddd0a332018-12-12 10:35:13 -050066 skia_enable_fontmgr_custom =
67 is_linux && skia_use_freetype && !skia_use_fontconfig
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -050068 skia_enable_fontmgr_custom_empty = is_fuchsia && skia_use_freetype
69 skia_enable_fontmgr_android = skia_use_expat && skia_use_freetype
Sergey Ulanovf3babcd2018-11-30 17:42:00 -080070 skia_enable_fontmgr_fuchsia = is_fuchsia
Leon Scroggins III631dbc82019-03-04 13:54:02 -050071 skia_enable_fontmgr_win = is_win
72 skia_enable_fontmgr_win_gdi = is_win
Mike Klein10d665d2016-11-01 11:46:10 -040073
Kevin Lubick27ba7032019-03-21 08:13:54 -040074 if (is_mac) {
75 skia_gl_standard = "gl"
76 } else if (is_ios) {
77 skia_gl_standard = "gles"
78 } else {
79 skia_gl_standard = ""
80 }
81
Mike Klein4d598a32016-10-31 13:44:49 -040082 if (is_android) {
83 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070084 } else if (is_fuchsia) {
85 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040086 } else {
Mike Klein98dea7b2019-01-15 11:26:43 -050087 skia_use_vulkan = defined(skia_moltenvk_path) && skia_moltenvk_path != ""
Mike Klein4d598a32016-10-31 13:44:49 -040088 }
Jim Van Verth4e502972017-12-07 15:16:10 -050089
90 if (is_ios) {
91 skia_ios_identity = ".*Google.*"
92 skia_ios_profile = "Google Development"
93 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040094}
Brian Salomon789e25e2016-09-30 13:41:03 -040095
Adam Barth54ef74a2017-10-13 10:59:38 -070096if (defined(skia_settings)) {
97 import(skia_settings)
98}
99
mtkleinc04ff472016-06-23 10:29:30 -0700100# Skia public API, generally provided by :skia.
101config("skia_public") {
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500102 include_dirs = [
103 ".",
104 "third_party/skcms",
105 "include/third_party/vulkan",
106 ]
Mike Kleinae7e6712016-10-11 17:49:33 -0400107 defines = []
108 if (is_component_build) {
109 defines += [ "SKIA_DLL" ]
110 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400111 if (is_fuchsia || is_linux) {
Mike Kleinf0a53692019-04-24 11:42:40 -0500112 defines += [ "SK_R32_SHIFT=16" ]
jcgregorio5561e3d2016-08-25 09:25:11 -0700113 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400114 if (skia_enable_flutter_defines) {
115 defines += flutter_defines
116 }
mtklein06c35c02016-09-20 12:28:12 -0700117 if (!skia_enable_gpu) {
118 defines += [ "SK_SUPPORT_GPU=0" ]
119 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500120 if (skia_enable_atlas_text) {
121 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
122 }
Mike Reed025f7832018-11-12 09:27:05 -0500123 if (is_fuchsia) {
124 defines += fuchsia_defines
125 }
Kevin Lubick27ba7032019-03-21 08:13:54 -0400126 if (skia_gl_standard == "gles") {
127 defines += [ "SK_ASSUME_GL_ES=1" ]
128 } else if (skia_gl_standard == "gl") {
129 defines += [ "SK_ASSUME_GL=1" ]
Kevin Lubick39026282019-03-28 12:46:40 -0400130 } else if (skia_gl_standard == "webgl") {
131 defines += [ "SK_ASSUME_WEBGL=1" ]
Kevin Lubick27ba7032019-03-21 08:13:54 -0400132 }
mtkleinc04ff472016-06-23 10:29:30 -0700133}
134
135# Skia internal APIs, used by Skia itself and a few test tools.
136config("skia_private") {
137 visibility = [ ":*" ]
138
Mike Reeda9e241d2017-05-03 10:52:00 -0400139 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -0500140 if (skia_use_fixed_gamma_text) {
mtkleinb37c0342016-09-09 11:07:45 -0700141 defines += [
142 "SK_GAMMA_EXPONENT=1.4",
143 "SK_GAMMA_CONTRAST=0.0",
144 ]
145 }
Mike Kleinb45d8622019-04-24 14:04:01 -0500146 if (is_skia_dev_build) {
147 defines += [
148 "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1",
149 "GR_TEST_UTILS=1",
150 ]
mtklein88a7ac02016-09-14 11:16:49 -0700151 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400152 libs = []
153 lib_dirs = []
Brian Osman34755e22016-12-05 09:46:02 -0500154 if (skia_use_angle) {
155 defines += [ "SK_ANGLE" ]
156 }
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400157 if (skia_llvm_path != "") {
158 defines += [ "SK_LLVM_AVAILABLE" ]
159 include_dirs += [ "$skia_llvm_path/include" ]
160 libs += [ skia_llvm_lib ]
161 lib_dirs += [ "$skia_llvm_path/lib/" ]
162 }
mtkleinc04ff472016-06-23 10:29:30 -0700163}
164
165# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
166config("skia_library") {
167 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700168 defines = [ "SKIA_IMPLEMENTATION=1" ]
169}
170
171skia_library_configs = [
172 ":skia_public",
173 ":skia_private",
174 ":skia_library",
175]
176
mtklein9b8583d2016-08-24 17:32:30 -0700177# Use for CPU-specific Skia code that needs particular compiler flags.
178template("opts") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500179 visibility = [ ":*" ]
mtklein9b8583d2016-08-24 17:32:30 -0700180 if (invoker.enabled) {
181 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500182 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700183 forward_variables_from(invoker, "*")
184 configs += skia_library_configs
185 }
186 } else {
187 # If not enabled, a phony empty target that swallows all otherwise unused variables.
188 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500189 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700190 forward_variables_from(invoker,
191 "*",
192 [
193 "sources",
194 "cflags",
195 ])
196 }
197 }
anmittala7eaf2e2016-08-17 13:57:26 -0700198}
199
mtklein422310d2016-08-16 18:28:43 -0700200is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700201
mtklein7d6fb2c2016-08-25 14:50:44 -0700202opts("none") {
203 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700204 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700205 cflags = []
206}
207
mtklein7d6fb2c2016-08-25 14:50:44 -0700208opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700209 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700210 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700211 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700212}
213
214opts("arm64") {
215 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700216 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700217 cflags = []
218}
219
220opts("crc32") {
221 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700222 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700223 cflags = [ "-march=armv8-a+crc" ]
224}
225
mtklein9b8583d2016-08-24 17:32:30 -0700226opts("sse2") {
227 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700228 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400229 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400230 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
231 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400232 cflags = [ "-msse2" ]
233 }
mtklein9b8583d2016-08-24 17:32:30 -0700234}
mtkleinc04ff472016-06-23 10:29:30 -0700235
mtklein9b8583d2016-08-24 17:32:30 -0700236opts("ssse3") {
237 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700238 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400239 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400240 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
241 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400242 cflags = [ "-mssse3" ]
243 }
mtklein9b8583d2016-08-24 17:32:30 -0700244}
mtkleinc04ff472016-06-23 10:29:30 -0700245
mtklein9b8583d2016-08-24 17:32:30 -0700246opts("sse41") {
247 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700248 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400249 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400250 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
251 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400252 cflags = [ "-msse4.1" ]
253 }
mtklein9b8583d2016-08-24 17:32:30 -0700254}
mtklein4e976072016-08-08 09:06:27 -0700255
mtklein9b8583d2016-08-24 17:32:30 -0700256opts("sse42") {
257 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700258 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400259 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400260 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
261 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400262 cflags = [ "-msse4.2" ]
263 }
mtklein9b8583d2016-08-24 17:32:30 -0700264}
265
266opts("avx") {
267 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700268 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400269 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000270 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400271 } else {
272 cflags = [ "-mavx" ]
273 }
mtkleinc04ff472016-06-23 10:29:30 -0700274}
275
Mike Klein1b9b7d52018-02-27 10:37:40 -0500276opts("hsw") {
277 enabled = is_x86
278 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400279 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500280 cflags = [ "/arch:AVX2" ]
281 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000282 cflags = [ "-march=haswell" ]
Mike Klein1b9b7d52018-02-27 10:37:40 -0500283 }
284
285 # Oddly, clang-cl doesn't recognize this as a valid flag.
286 # If it ever does, it'd nice to move this up with -mavx2 and co.
287 if (is_clang && !is_win) {
288 # This flag lets Clang generate FMAs when it sees a mul-then-add. It's optional,
289 # but nice to have, generating slightly better code for paths without explicit FMAs.
290 cflags += [ "-ffp-contract=fast" ]
291 }
292}
293
mtkleinc095df52016-08-24 12:23:52 -0700294# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700295template("optional") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500296 visibility = [ ":*" ]
mtklein457b42a2016-08-23 13:56:37 -0700297 if (invoker.enabled) {
298 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700299 if (defined(invoker.public_defines)) {
300 defines = invoker.public_defines
301 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600302 if (defined(invoker.public_configs)) {
303 configs = invoker.public_configs
304 }
mtklein457b42a2016-08-23 13:56:37 -0700305 }
306 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500307 check_includes = false
mtkleincd01b032016-08-31 04:58:19 -0700308 forward_variables_from(invoker,
309 "*",
310 [
311 "public_defines",
312 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700313 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700314 ])
mtklein457b42a2016-08-23 13:56:37 -0700315 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700316 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700317 if (defined(invoker.configs_to_remove)) {
318 configs -= invoker.configs_to_remove
319 }
mtklein457b42a2016-08-23 13:56:37 -0700320 }
321 } else {
mtklein457b42a2016-08-23 13:56:37 -0700322 source_set(target_name) {
323 forward_variables_from(invoker,
324 "*",
325 [
326 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400327 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700328 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700329 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700330 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700331 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700332 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700333 ])
mtkleincd01b032016-08-31 04:58:19 -0700334 if (defined(invoker.sources_when_disabled)) {
335 sources = invoker.sources_when_disabled
336 }
337 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700338 }
mtkleineb3c4252016-08-23 07:38:09 -0700339 }
mtklein457b42a2016-08-23 13:56:37 -0700340}
mtklein457b42a2016-08-23 13:56:37 -0700341
mtkleina45be612016-08-29 15:22:10 -0700342optional("fontmgr_android") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500343 enabled = skia_enable_fontmgr_android
mtkleina45be612016-08-29 15:22:10 -0700344
345 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500346 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700347 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700348 ]
349 sources = [
350 "src/ports/SkFontMgr_android.cpp",
351 "src/ports/SkFontMgr_android_factory.cpp",
352 "src/ports/SkFontMgr_android_parser.cpp",
353 ]
354}
355
mtkleind2e39db2016-09-07 07:52:55 -0700356optional("fontmgr_custom") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500357 enabled = skia_enable_fontmgr_custom
mtkleind2e39db2016-09-07 07:52:55 -0700358
359 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500360 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700361 ]
362 sources = [
363 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500364 "src/ports/SkFontMgr_custom.h",
365 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700366 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500367 "src/ports/SkFontMgr_custom_embedded.cpp",
368 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700369 ]
370}
371
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500372optional("fontmgr_custom_empty") {
373 enabled = skia_enable_fontmgr_custom_empty
Kevin Lubickddd0a332018-12-12 10:35:13 -0500374
375 deps = [
376 ":typeface_freetype",
377 ]
378 sources = [
379 "src/ports/SkFontMgr_custom.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500380 "src/ports/SkFontMgr_custom_empty.cpp",
381 "src/ports/SkFontMgr_custom_empty_factory.cpp",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800382 ]
383}
384
Hal Canaryff2742e2018-01-30 11:35:47 -0500385optional("fontmgr_empty") {
386 enabled = skia_enable_fontmgr_empty
387 sources = [
388 "src/ports/SkFontMgr_empty_factory.cpp",
389 ]
390}
391
mtklein3cc22182016-08-29 13:26:14 -0700392optional("fontmgr_fontconfig") {
393 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700394
395 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500396 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700397 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700398 ]
399 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700400 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700401 "src/ports/SkFontConfigInterface_direct.cpp",
402 "src/ports/SkFontConfigInterface_direct_factory.cpp",
403 "src/ports/SkFontMgr_FontConfigInterface.cpp",
404 "src/ports/SkFontMgr_fontconfig.cpp",
405 "src/ports/SkFontMgr_fontconfig_factory.cpp",
406 ]
407}
408
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500409optional("fontmgr_fuchsia") {
410 enabled = skia_enable_fontmgr_fuchsia
411
412 deps = [
413 "//sdk/fidl/fuchsia.fonts",
414 ]
415 sources = [
416 "src/ports/SkFontMgr_fuchsia.cpp",
417 "src/ports/SkFontMgr_fuchsia.h",
418 ]
419}
420
421optional("fontmgr_wasm") {
Kevin Lubick0e3342c2019-04-16 13:31:25 -0400422 enabled = !skia_enable_fontmgr_empty && target_cpu == "wasm"
mtkleincdedd0e2016-09-12 15:15:44 -0700423
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",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500429 "src/ports/SkFontMgr_custom.h",
430 "src/ports/SkFontMgr_custom_embedded.cpp",
431 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700432 ]
433}
434
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500435optional("fontmgr_win") {
436 enabled = skia_enable_fontmgr_win
437
438 sources = [
439 "src/fonts/SkFontMgr_indirect.cpp",
440 "src/ports/SkFontMgr_win_dw.cpp",
441 "src/ports/SkFontMgr_win_dw_factory.cpp",
442 "src/ports/SkScalerContext_win_dw.cpp",
443 "src/ports/SkTypeface_win_dw.cpp",
444 ]
445}
446
447optional("fontmgr_win_gdi") {
448 enabled = skia_enable_fontmgr_win_gdi
449
450 sources = [
451 "src/ports/SkFontHost_win.cpp",
452 ]
453 libs = [ "Gdi32.lib" ]
454}
455
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700456if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400457 executable("sksllex") {
458 sources = [
459 "src/sksl/lex/Main.cpp",
460 "src/sksl/lex/NFA.cpp",
461 "src/sksl/lex/RegexNode.cpp",
462 "src/sksl/lex/RegexParser.cpp",
463 ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500464 include_dirs = [ "." ]
Ethan Nicholasca82a922017-09-07 09:39:50 -0400465 }
466
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700467 action("run_sksllex") {
468 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400469 deps = [
470 ":sksllex(//gn/toolchain:$host_toolchain)",
471 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700472 sources = [
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700473 "src/sksl/lex/sksl.lex",
474 ]
475
476 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
477 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
478 outputs = [
479 "$target_out_dir/" +
480 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
481 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
482 # confused due to the same file being named by two different paths
483 ]
484 sksllex_path = "$root_out_dir/"
485 sksllex_path += "sksllex"
486 if (host_os == "win") {
487 sksllex_path += ".exe"
488 }
489 args = [
490 rebase_path(sksllex_path),
491 rebase_path("bin/clang-format"),
492 rebase_path("src"),
493 ]
494 }
495} else {
496 group("run_sksllex") {
497 }
498}
499
500if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400501 executable("skslc") {
502 defines = [ "SKSL_STANDALONE" ]
503 sources = [
504 "src/sksl/SkSLMain.cpp",
505 ]
506 sources += skia_sksl_sources
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500507 include_dirs = [ "." ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400508 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500509 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400510 "//third_party/spirv-tools",
511 ]
512 }
513
514 skia_gpu_processor_outputs = []
515 foreach(src, skia_gpu_processor_sources) {
516 dir = get_path_info(src, "dir")
517 name = get_path_info(src, "name")
518
519 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
520 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
521 skia_gpu_processor_outputs += [
522 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
523 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
524 # confused due to the same file being named by two different paths
525 ]
526 }
527
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500528 action("create_sksl_enums") {
529 script = "gn/create_sksl_enums.py"
530 sources = [
531 "include/private/GrSharedEnums.h",
532 ]
533 outputs = [
534 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500535 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500536 ]
537 args = [
538 rebase_path(sources[0]),
539 rebase_path(outputs[0]),
540 ]
541 }
542
Ethan Nicholas762466e2017-06-29 10:03:38 -0400543 action("compile_processors") {
544 script = "gn/compile_processors.py"
545 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500546 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400547 ":skslc(//gn/toolchain:$host_toolchain)",
548 ]
549 sources = skia_gpu_processor_sources
550 outputs = skia_gpu_processor_outputs
551 skslc_path = "$root_out_dir/"
552 if (host_toolchain != default_toolchain_name) {
553 skslc_path += "$host_toolchain/"
554 }
555 skslc_path += "skslc"
556 if (host_os == "win") {
557 skslc_path += ".exe"
558 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400559 args = [
560 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400561 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400562 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400563 args += rebase_path(skia_gpu_processor_sources)
564 }
565} else {
566 skia_gpu_processor_outputs = []
567 group("compile_processors") {
568 }
569}
570
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500571optional("gpu") {
mtklein06c35c02016-09-20 12:28:12 -0700572 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400573 deps = [
574 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700575 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400576 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700577 if (skia_generate_workarounds) {
578 deps += [ ":workaround_list" ]
579 }
mtkleine9fb3d52016-09-20 15:11:46 -0700580 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600581 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400582 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700583
Brian Salomon3d6801e2017-12-11 10:06:31 -0500584 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400585 if (!skia_enable_ccpr) {
586 sources -= skia_ccpr_sources
587 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
588 }
Kevin Lubick4bf2c262018-10-15 09:35:54 -0400589 if (!skia_enable_nvpr) {
590 sources -= skia_nvpr_sources
591 sources += [ "src/gpu/GrPathRendering_none.cpp" ]
592 }
mtklein06c35c02016-09-20 12:28:12 -0700593
594 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500595 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700596 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400597 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700598 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400599 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400600
601 # this lib is required to link against AHardwareBuffer
602 if (defined(ndk_api) && ndk_api >= 26) {
603 libs += [ "android" ]
604 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400605 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500606 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400607 libs += [ "EGL" ]
Chinmay Garded92d0352018-09-17 10:23:28 -0700608 } else if (is_linux && skia_use_x11) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500609 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -0400610 libs += [ "GL" ]
mtklein06c35c02016-09-20 12:28:12 -0700611 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500612 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800613 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500614 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400615 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500616 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -0500617 if (target_cpu != "arm64") {
618 libs += [ "OpenGL32.lib" ]
619 }
mtklein06c35c02016-09-20 12:28:12 -0700620 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500621 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700622 }
mtkleine9fb3d52016-09-20 15:11:46 -0700623
624 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400625 public_defines += [ "SK_VULKAN" ]
Greg Daniel18dbfd02018-05-29 10:46:51 -0400626 deps += [ "third_party/vulkanmemoryallocator" ]
mtkleine9fb3d52016-09-20 15:11:46 -0700627 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700628 if (skia_enable_vulkan_debug_layers) {
629 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
630 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800631 if (is_fuchsia) {
Kevin Lubickec1c6202018-12-14 11:42:53 -0500632 public_deps +=
633 [ "//third_party/vulkan_loader_and_validation_layers:vulkan" ]
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800634 }
mtkleine9fb3d52016-09-20 15:11:46 -0700635 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400636
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400637 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400638 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400639 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
640 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400641
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400642 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400643 if (skia_use_metal) {
644 public_defines += [ "SK_METAL" ]
645 sources += skia_metal_sources
646 libs += [ "Metal.framework" ]
Greg Daniel53956d92018-08-08 14:41:19 -0400647 libs += [ "Foundation.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400648 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400649 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500650
651 if (skia_enable_atlas_text) {
652 sources += skia_atlas_text_sources
653 }
Kevin Lubickf4def342018-10-04 12:52:50 -0400654
655 if (is_debug) {
656 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
657 }
mtklein06c35c02016-09-20 12:28:12 -0700658}
659
Leon Scroggins III41169202019-01-29 09:29:57 -0500660optional("gif") {
661 enabled = !skia_use_wuffs
662 sources = [
663 "src/codec/SkGifCodec.cpp",
664 "third_party/gif/SkGifImageReader.cpp",
665 ]
666}
667
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400668optional("heif") {
669 enabled = skia_use_libheif
670 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
671
672 deps = []
673
674 sources = [
675 "src/codec/SkHeifCodec.cpp",
676 ]
677}
678
mtklein63213812016-08-24 09:55:56 -0700679optional("jpeg") {
680 enabled = skia_use_libjpeg_turbo
681 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
682
mtklein63213812016-08-24 09:55:56 -0700683 deps = [
684 "//third_party/libjpeg-turbo:libjpeg",
685 ]
Mike Kleinf105dc72018-06-05 15:22:54 -0400686 public = [
687 "include/encode/SkJpegEncoder.h",
688 ]
mtklein63213812016-08-24 09:55:56 -0700689 sources = [
690 "src/codec/SkJpegCodec.cpp",
691 "src/codec/SkJpegDecoderMgr.cpp",
692 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700693 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400694 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700695 ]
696}
697
698optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500699 enabled = skia_use_zlib && skia_enable_pdf
700 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700701
mtklein63213812016-08-24 09:55:56 -0700702 deps = [
703 "//third_party/zlib",
704 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400705 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700706 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400707 }
brettwb9447282016-09-01 14:24:39 -0700708 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700709 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
Hal Canary2a3093c2019-02-20 11:25:45 -0500710 if (skia_use_icu && skia_use_harfbuzz && skia_pdf_subset_harfbuzz) {
711 deps += [ "//third_party/harfbuzz" ]
712 defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ]
713 } else if (skia_use_icu && skia_use_sfntly) {
mtklein63213812016-08-24 09:55:56 -0700714 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -0500715 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700716 }
717}
718
719optional("png") {
720 enabled = skia_use_libpng
721 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
722
mtklein63213812016-08-24 09:55:56 -0700723 deps = [
724 "//third_party/libpng",
725 ]
726 sources = [
727 "src/codec/SkIcoCodec.cpp",
728 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400729 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700730 ]
731}
732
scroggof84ad642016-10-31 09:02:57 -0700733optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400734 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700735 public_defines = [ "SK_CODEC_DECODES_RAW" ]
736
737 deps = [
738 "//third_party/dng_sdk",
739 "//third_party/libjpeg-turbo:libjpeg",
740 "//third_party/piex",
741 ]
742
743 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
744 # Skia.
745 configs_to_remove = [ "//gn:no_exceptions" ]
746
747 sources = [
scroggof84ad642016-10-31 09:02:57 -0700748 "src/codec/SkRawCodec.cpp",
749 ]
750}
751
Mike Klein852a8cb2018-05-15 10:46:58 -0400752import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400753source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400754 cflags = []
755 if (!is_win || is_clang) {
756 cflags += [
757 "-w",
758 "-std=c11",
759 ]
760 }
761
762 public = [
763 "third_party/skcms/skcms.h",
764 ]
765 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
766}
767
mtklein3cc22182016-08-29 13:26:14 -0700768optional("typeface_freetype") {
769 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700770
771 deps = [
772 "//third_party/freetype2",
773 ]
774 sources = [
775 "src/ports/SkFontHost_FreeType.cpp",
776 "src/ports/SkFontHost_FreeType_common.cpp",
777 ]
778}
779
mtklein457b42a2016-08-23 13:56:37 -0700780optional("webp") {
781 enabled = skia_use_libwebp
782 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
783
mtklein457b42a2016-08-23 13:56:37 -0700784 deps = [
785 "//third_party/libwebp",
786 ]
787 sources = [
mtklein457b42a2016-08-23 13:56:37 -0700788 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400789 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700790 ]
mtkleineb3c4252016-08-23 07:38:09 -0700791}
792
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400793optional("wuffs") {
794 enabled = skia_use_wuffs
795 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
796
797 deps = [
798 "//third_party/wuffs",
799 ]
800 sources = [
801 "src/codec/SkWuffsCodec.cpp",
802 ]
803}
804
mtklein63213812016-08-24 09:55:56 -0700805optional("xml") {
806 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000807 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700808
mtklein63213812016-08-24 09:55:56 -0700809 deps = [
810 "//third_party/expat",
811 ]
812 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500813 "src/svg/SkSVGCanvas.cpp",
814 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700815 "src/xml/SkDOM.cpp",
816 "src/xml/SkXMLParser.cpp",
817 "src/xml/SkXMLWriter.cpp",
818 ]
819}
820
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700821if (skia_enable_gpu && skia_generate_workarounds) {
822 action("workaround_list") {
823 script = "tools/build_workaround_header.py"
824
825 inputs = [
826 "src/gpu/gpu_workaround_list.txt",
827 ]
828
829 # see comments in skia_compile_processors about out dir path shenanigans.
830 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700831 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700832
833 outputs = [
834 "$root_out_dir/$output_file",
835 ]
836 args = [
837 "--output-file",
838 "$output_file",
839 ]
840
841 foreach(file, inputs) {
842 args += [ rebase_path(file, root_build_dir) ]
843 }
844 }
845}
846
mtkleinc04ff472016-06-23 10:29:30 -0700847component("skia") {
848 public_configs = [ ":skia_public" ]
849 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700850
Mike Klein607b0a72018-11-07 16:17:34 -0500851 public_deps = [
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500852 ":gpu",
Mike Klein607b0a72018-11-07 16:17:34 -0500853 ":pdf",
854 ":skcms",
855 ]
856
mtkleinc04ff472016-06-23 10:29:30 -0700857 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700858 ":arm64",
859 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700860 ":avx",
Mike Klein54378232018-11-08 12:08:05 +0000861 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -0700862 ":crc32",
mtkleina45be612016-08-29 15:22:10 -0700863 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700864 ":fontmgr_custom",
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500865 ":fontmgr_custom_empty",
Hal Canaryff2742e2018-01-30 11:35:47 -0500866 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700867 ":fontmgr_fontconfig",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800868 ":fontmgr_fuchsia",
Kevin Lubickddd0a332018-12-12 10:35:13 -0500869 ":fontmgr_wasm",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500870 ":fontmgr_win",
871 ":fontmgr_win_gdi",
Leon Scroggins III41169202019-01-29 09:29:57 -0500872 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400873 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500874 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700875 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700876 ":none",
mtklein63213812016-08-24 09:55:56 -0700877 ":png",
scroggof84ad642016-10-31 09:02:57 -0700878 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700879 ":sse2",
880 ":sse41",
881 ":sse42",
882 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700883 ":webp",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400884 ":wuffs",
mtklein63213812016-08-24 09:55:56 -0700885 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700886 ]
887
Kevin Lubick134be1d2018-10-30 15:05:04 -0400888 if (skia_enable_nima) {
889 deps += [ "//third_party/Nima-Cpp" ]
890 }
891
Chinmay Garde43f115c2016-11-16 15:04:12 -0800892 # This file (and all GN files in Skia) are designed to work with an
893 # empty sources assignment filter; we handle all that explicitly.
894 # We clear the filter here for clients who may have set up a global filter.
895 set_sources_assignment_filter([])
896
Hal Canaryc25f4e92019-02-26 11:54:25 -0500897 public = skia_core_public
898 public += skia_utils_public
899 public += skia_effects_public
900 public += skia_effects_imagefilter_public
901 public += skia_xps_public
902
mtkleinc04ff472016-06-23 10:29:30 -0700903 sources = []
brettwb9447282016-09-01 14:24:39 -0700904 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700905 sources += skia_utils_sources
Leon Scroggins IIIee0e5d02019-02-27 10:59:11 -0500906 if (skia_use_xps) {
907 sources += skia_xps_sources
908 }
Mike Klein54378232018-11-08 12:08:05 +0000909 sources += skia_effects_sources
910 sources += skia_effects_imagefilter_sources
mtkleinc04ff472016-06-23 10:29:30 -0700911 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400912 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500913 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700914 "src/android/SkBitmapRegionCodec.cpp",
915 "src/android/SkBitmapRegionDecoder.cpp",
916 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +1100917 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400918 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700919 "src/codec/SkBmpCodec.cpp",
920 "src/codec/SkBmpMaskCodec.cpp",
921 "src/codec/SkBmpRLECodec.cpp",
922 "src/codec/SkBmpStandardCodec.cpp",
923 "src/codec/SkCodec.cpp",
924 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -0400925 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -0400926 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700927 "src/codec/SkMaskSwizzler.cpp",
928 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700929 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700930 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700931 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700932 "src/codec/SkSwizzler.cpp",
933 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700934 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700935 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +0000936 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700937 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700938 "src/ports/SkMemory_malloc.cpp",
939 "src/ports/SkOSFile_stdio.cpp",
940 "src/sfnt/SkOTTable_name.cpp",
941 "src/sfnt/SkOTUtils.cpp",
942 "src/utils/mac/SkStream_mac.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700943 ]
brettwb9447282016-09-01 14:24:39 -0700944
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400945 defines = []
946 if (!skia_enable_skpicture) {
947 defines = [ "SK_DISABLE_SKPICTURE" ]
Hal Canaryc25f4e92019-02-26 11:54:25 -0500948 public -= skia_skpicture_public
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400949 sources -= skia_skpicture_sources
Mike Klein54378232018-11-08 12:08:05 +0000950 sources -= [ "//src/effects/imagefilters/SkPictureImageFilter.cpp" ]
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400951 sources += [ "src/core/SkPicture_none.cpp" ]
952 }
953
mtklein7d6fb2c2016-08-25 14:50:44 -0700954 libs = []
955
mtkleinc04ff472016-06-23 10:29:30 -0700956 if (is_win) {
957 sources += [
958 "src/ports/SkDebug_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700959 "src/ports/SkImageEncoder_WIC.cpp",
960 "src/ports/SkImageGeneratorWIC.cpp",
961 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700962 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700963 "src/ports/SkTLS_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700964 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400965 libs += [
966 "FontSub.lib",
967 "Ole32.lib",
968 "OleAut32.lib",
969 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500970 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400971 ]
mtkleinc04ff472016-06-23 10:29:30 -0700972 } else {
973 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700974 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700975 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700976 "src/ports/SkTLS_pthread.cpp",
977 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400978 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700979 }
980
mtklein7d6fb2c2016-08-25 14:50:44 -0700981 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500982 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500983 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500984 deps += [ "//third_party/cpu-features" ]
985 }
mtklein06c35c02016-09-20 12:28:12 -0700986 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700987 libs += [
988 "EGL",
989 "GLESv2",
990 "log",
991 ]
992 }
993
Kevin Lubick217056c2018-09-20 17:39:31 -0400994 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -0700995 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -0400996 if (skia_use_egl) {
997 libs += [ "GLESv2" ]
998 }
mtkleinc04ff472016-06-23 10:29:30 -0700999 }
1000
Leon Scroggins III85e22fc2018-11-28 08:58:47 -05001001 if (skia_use_fonthost_mac) {
Sergey Ulanovf3babcd2018-11-30 17:42:00 -08001002 sources += [ "src/ports/SkFontHost_mac.cpp" ]
Leon Scroggins III85e22fc2018-11-28 08:58:47 -05001003 }
1004
mtkleinc04ff472016-06-23 10:29:30 -07001005 if (is_mac) {
1006 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001007 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001008 "src/ports/SkImageEncoder_CG.cpp",
1009 "src/ports/SkImageGeneratorCG.cpp",
1010 ]
mtklein09e61f72016-08-23 13:35:28 -07001011 libs += [
bungeman3e306f62017-03-29 11:32:02 -04001012 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
1013 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -07001014 "ApplicationServices.framework",
1015 "OpenGL.framework",
1016 ]
mtkleinc04ff472016-06-23 10:29:30 -07001017 }
abarth6fc8ff02016-07-15 15:15:15 -07001018
Mike Klein7d302882016-11-03 14:06:31 -04001019 if (is_ios) {
1020 sources += [
1021 "src/ports/SkDebug_stdio.cpp",
1022 "src/ports/SkFontHost_mac.cpp",
1023 "src/ports/SkImageEncoder_CG.cpp",
1024 "src/ports/SkImageGeneratorCG.cpp",
1025 ]
1026 libs += [
1027 "CoreFoundation.framework",
1028 "CoreGraphics.framework",
1029 "CoreText.framework",
1030 "ImageIO.framework",
1031 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -04001032
1033 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
1034 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001035 ]
1036 }
1037
abarth6fc8ff02016-07-15 15:15:15 -07001038 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001039 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001040 }
mtkleinc04ff472016-06-23 10:29:30 -07001041}
1042
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001043# DebugCanvas used in experimental/wasm-skp-debugger
1044if (target_cpu == "wasm") {
1045 static_library("debugcanvas") {
1046 public_configs = [ ":skia_public" ]
1047
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001048 sources = [
1049 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001050 "tools/debugger/DebugCanvas.cpp",
1051 "tools/debugger/DrawCommand.cpp",
1052 "tools/debugger/JsonWriteBuffer.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001053 ]
1054
1055 deps = [
1056 ":fontmgr_wasm",
1057 ]
1058 }
1059}
1060
Kevin Lubickcbcff382018-10-02 09:02:18 -04001061static_library("pathkit") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001062 check_includes = false
Kevin Lubickcbcff382018-10-02 09:02:18 -04001063 public_configs = [ ":skia_public" ]
1064 configs += skia_library_configs
1065
1066 deps = [
1067 ":arm64",
1068 ":armv7",
1069 ":avx",
1070 ":crc32",
1071 ":hsw",
1072 ":none",
1073 ":sse2",
1074 ":sse41",
1075 ":sse42",
1076 ":ssse3",
1077 ]
1078
1079 # This file (and all GN files in Skia) are designed to work with an
1080 # empty sources assignment filter; we handle all that explicitly.
1081 # We clear the filter here for clients who may have set up a global filter.
1082 set_sources_assignment_filter([])
1083
1084 sources = []
1085 sources += skia_pathops_sources
Hal Canaryc25f4e92019-02-26 11:54:25 -05001086 sources += skia_pathops_public
Kevin Lubickcbcff382018-10-02 09:02:18 -04001087 sources += [
1088 "src/core/SkAnalyticEdge.cpp",
1089 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001090 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001091 "src/core/SkCubicMap.cpp",
1092 "src/core/SkEdge.cpp",
1093 "src/core/SkEdgeBuilder.cpp",
1094 "src/core/SkEdgeClipper.cpp",
1095 "src/core/SkGeometry.cpp",
1096 "src/core/SkLineClipper.cpp",
1097 "src/core/SkMallocPixelRef.cpp",
1098 "src/core/SkMath.cpp",
1099 "src/core/SkMatrix.cpp",
1100 "src/core/SkOpts.cpp",
1101 "src/core/SkPaint.cpp",
1102 "src/core/SkPath.cpp",
1103 "src/core/SkPathEffect.cpp",
1104 "src/core/SkPathMeasure.cpp",
1105 "src/core/SkPathRef.cpp",
1106 "src/core/SkPoint.cpp",
1107 "src/core/SkRRect.cpp",
1108 "src/core/SkRect.cpp",
1109 "src/core/SkSemaphore.cpp",
1110 "src/core/SkStream.cpp",
1111 "src/core/SkString.cpp",
1112 "src/core/SkStringUtils.cpp",
1113 "src/core/SkStroke.cpp",
1114 "src/core/SkStrokeRec.cpp",
1115 "src/core/SkStrokerPriv.cpp",
1116 "src/core/SkThreadID.cpp",
1117 "src/core/SkUtils.cpp",
1118 "src/effects/SkDashPathEffect.cpp",
1119 "src/effects/SkTrimPathEffect.cpp",
1120 "src/ports/SkDebug_stdio.cpp",
1121 "src/ports/SkMemory_malloc.cpp",
1122 "src/utils/SkDashPath.cpp",
1123 "src/utils/SkParse.cpp",
1124 "src/utils/SkParsePath.cpp",
1125 "src/utils/SkUTF.cpp",
1126 ]
1127}
1128
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001129group("modules") {
1130 deps = [
Kevin Lubick96634842019-03-05 14:09:24 -05001131 "modules/particles",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001132 "modules/skottie",
1133 "modules/skshaper",
1134 ]
1135}
1136
mtkleinc095df52016-08-24 12:23:52 -07001137# Targets guarded by skia_enable_tools may use //third_party freely.
1138if (skia_enable_tools) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001139 skia_public_includes = [
1140 "include/android",
1141 "include/atlastext",
1142 "include/c",
1143 "include/codec",
1144 "include/config",
1145 "include/core",
1146 "include/docs",
1147 "include/effects",
1148 "include/encode",
1149 "include/gpu",
1150 "include/pathops",
1151 "include/ports",
1152 "include/svg",
1153 "include/utils",
1154 "include/utils/mac",
1155 "modules/sksg/include",
1156 "modules/skshaper/include",
1157 "modules/skottie/include",
1158 ]
1159
Mike Klein308b5ac2016-12-06 16:03:52 -05001160 # Used by gn_to_bp.py to list our public include dirs.
1161 source_set("public") {
1162 configs += [ ":skia_public" ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001163 include_dirs = skia_public_includes
Mike Klein308b5ac2016-12-06 16:03:52 -05001164 }
1165
Mike Kleinc36dedf2016-11-18 09:35:28 -05001166 config("skia.h_config") {
1167 include_dirs = [ "$target_gen_dir" ]
1168 }
1169 action("skia.h") {
1170 public_configs = [ ":skia.h_config" ]
1171 skia_h = "$target_gen_dir/skia.h"
1172 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001173
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001174 args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1175 [ rebase_path(skia_h, root_build_dir) ] +
1176 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001177 depfile = "$skia_h.deps"
1178 outputs = [
1179 skia_h,
1180 ]
1181 }
1182
Brian Osmanc9a42472018-05-31 13:17:12 -04001183 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001184 executable("fiddle") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001185 check_includes = false
Mike Kleinc36dedf2016-11-18 09:35:28 -05001186 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001187 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001188 "tools/fiddle/draw.cpp",
1189 "tools/fiddle/fiddle_main.cpp",
1190 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001191
1192 if (skia_use_egl) {
1193 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001194 } else {
1195 sources += [ "tools/fiddle/null_context.cpp" ]
1196 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001197 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001198 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001199 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001200 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001201 ":skia",
1202 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001203 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001204 "modules/skshaper",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001205 ]
1206 }
1207 }
1208
Brian Osmanc9a42472018-05-31 13:17:12 -04001209 source_set("public_headers_warnings_check") {
1210 sources = [
1211 "tools/public_headers_warnings_check.cpp",
1212 ]
1213 configs -= [ "//gn:warnings_except_public_headers" ]
1214 deps = [
1215 ":skia",
1216 ":skia.h",
1217 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001218 "modules/skshaper",
Brian Osmanc9a42472018-05-31 13:17:12 -04001219 ]
Greg Daniel54bfb182018-11-20 17:12:36 -05001220
1221 # We add this directory to simulate the client already have
1222 # vulkan/vulkan_core.h on their path.
Greg Daniel54200e42018-12-11 17:03:39 -05001223 include_dirs = [ "include/third_party/vulkan" ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001224 }
1225
mtkleinc095df52016-08-24 12:23:52 -07001226 template("test_lib") {
1227 config(target_name + "_config") {
mtkleina627b5c2016-09-20 13:36:47 -07001228 if (defined(invoker.public_defines)) {
1229 defines = invoker.public_defines
1230 }
mtklein25c81d42016-07-27 13:55:26 -07001231 }
mtkleinc095df52016-08-24 12:23:52 -07001232 source_set(target_name) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001233 forward_variables_from(invoker, "*", [])
Hal Canaryc25f4e92019-02-26 11:54:25 -05001234 check_includes = false
mtkleinc095df52016-08-24 12:23:52 -07001235 public_configs = [
1236 ":" + target_name + "_config",
1237 ":skia_private",
1238 ]
1239
1240 if (!defined(deps)) {
1241 deps = []
1242 }
1243 deps += [ ":skia" ]
1244 testonly = true
1245 }
mtklein25c81d42016-07-27 13:55:26 -07001246 }
mtklein25c81d42016-07-27 13:55:26 -07001247
Mike Kleine6682eb2017-01-05 10:54:57 -05001248 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001249 if (is_ios) {
1250 app_name = target_name
1251 gen_path = target_gen_dir
1252
1253 action("${app_name}_generate_info_plist") {
1254 script = "//gn/gen_plist_ios.py"
1255 outputs = [
1256 "$gen_path/${app_name}_Info.plist",
1257 ]
1258 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1259 }
1260
1261 bundle_data("${app_name}_bundle_info_plist") {
1262 public_deps = [
1263 ":${app_name}_generate_info_plist",
1264 ]
1265 sources = [
1266 "$gen_path/${app_name}_Info.plist",
1267 ]
1268 outputs = [
1269 "{{bundle_root_dir}}/Info.plist",
1270 ]
1271 }
1272
Jim Van Verthffacf652019-04-02 11:59:34 -04001273 has_skps = "True" == exec_script("//gn/checkdir.py",
1274 [ rebase_path("skps", root_build_dir) ],
1275 "trim string")
1276 bundle_data("${app_name}_bundle_resources") {
1277 sources = [
1278 "resources",
1279 ]
1280 outputs = [
1281 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1282 "{{bundle_resources_dir}}/data/resources",
1283 ]
1284 }
1285 if (has_skps) {
1286 bundle_data("${app_name}_bundle_skps") {
Jim Van Verth329c5a62017-11-29 11:42:33 -05001287 sources = [
Jim Van Verthffacf652019-04-02 11:59:34 -04001288 "skps",
Jim Van Verth329c5a62017-11-29 11:42:33 -05001289 ]
1290 outputs = [
Jim Van Verthffacf652019-04-02 11:59:34 -04001291 # Store in same folder as resources
1292 "{{bundle_resources_dir}}/data/skps",
Jim Van Verth329c5a62017-11-29 11:42:33 -05001293 ]
1294 }
Jim Van Verth329c5a62017-11-29 11:42:33 -05001295 }
1296
Jim Van Verth443a9132017-11-28 09:45:26 -05001297 executable("${app_name}_generate_executable") {
1298 forward_variables_from(invoker,
1299 "*",
1300 [
1301 "output_name",
1302 "visibility",
1303 "is_shared_library",
1304 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001305 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001306 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001307 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1308 }
1309
1310 bundle_data("${app_name}_bundle_executable") {
1311 public_deps = [
1312 ":${app_name}_generate_executable",
1313 ]
1314 sources = [
1315 "$gen_path/$app_name",
1316 ]
1317 outputs = [
1318 "{{bundle_executable_dir}}/$app_name",
1319 ]
1320 testonly = true
1321 }
1322
Jim Van Verthffacf652019-04-02 11:59:34 -04001323 bundle_data("${app_name}_bundle_symbols") {
1324 public_deps = [
1325 ":${app_name}_generate_executable",
1326 ]
1327 sources = [
1328 "$gen_path/${app_name}.dSYM",
1329 ]
1330 outputs = [
1331 "{{bundle_executable_dir}}/${app_name}.dSYM",
1332 ]
1333 testonly = true
1334 }
1335
Jim Van Verth443a9132017-11-28 09:45:26 -05001336 create_bundle("$app_name") {
1337 product_type = "com.apple.product-type.application"
1338 testonly = true
1339
1340 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1341 bundle_resources_dir = bundle_root_dir
1342 bundle_executable_dir = bundle_root_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001343
1344 deps = [
1345 ":${app_name}_bundle_executable",
1346 ":${app_name}_bundle_info_plist",
Jim Van Verthffacf652019-04-02 11:59:34 -04001347 ":${app_name}_bundle_resources",
1348 ":${app_name}_bundle_symbols",
Jim Van Verth443a9132017-11-28 09:45:26 -05001349 ]
Jim Van Verthffacf652019-04-02 11:59:34 -04001350 if (has_skps) {
1351 deps += [ ":${app_name}_bundle_skps" ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001352 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001353
1354 # should only code sign when running on a device, not the simulator
1355 if (target_cpu != "x64") {
1356 code_signing_script = "//gn/codesign_ios.py"
1357 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1358 code_signing_outputs = [
1359 "$bundle_root_dir/_CodeSignature/CodeResources",
1360 "$bundle_root_dir/embedded.mobileprovision",
1361 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001362 code_signing_args = [
1363 rebase_path("$bundle_root_dir", root_build_dir),
1364 skia_ios_identity,
1365 skia_ios_profile,
1366 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001367 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001368 }
1369 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001370 # !is_ios
1371
1372 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1373 shared_library("lib" + target_name) {
1374 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1375 configs += [ ":skia_private" ]
1376 testonly = true
1377 }
1378 } else {
1379 _executable = target_name
1380 executable(_executable) {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001381 check_includes = false
Jim Van Verth443a9132017-11-28 09:45:26 -05001382 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1383 configs += [ ":skia_private" ]
1384 testonly = true
1385 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001386 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001387 if (is_android && skia_android_serial != "" && defined(_executable)) {
1388 action("push_" + target_name) {
1389 script = "gn/push_to_android.py"
1390 deps = [
1391 ":" + _executable,
1392 ]
1393 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1394 outputs = [
1395 _stamp,
1396 ]
1397 args = [
1398 rebase_path("$root_build_dir/$_executable"),
1399 skia_android_serial,
1400 rebase_path(_stamp),
1401 ]
1402 testonly = true
1403 }
Mike Klein7d921032017-01-05 12:20:41 -05001404 }
1405 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001406 }
1407
Greg Danielda16cce2018-08-01 09:23:57 -04001408 config("moltenvk_config") {
1409 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1410 if (is_ios) {
1411 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS"
1412 } else {
1413 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS"
1414 }
1415 cflags = [ "-F$moltenvk_framework_path" ]
1416 ldflags = [ "-F$moltenvk_framework_path" ]
1417 libs = [
1418 "MoltenVK.framework",
1419 "Metal.framework",
1420 "IOSurface.framework",
1421 "QuartzCore.framework",
1422 "Foundation.framework",
1423 ]
1424 if (is_ios) {
1425 libs += [ "UIKit.framework" ]
1426 } else {
1427 libs += [ "IOKit.framework" ]
1428 }
1429 defines = [ "SK_MOLTENVK" ]
1430 }
1431 }
1432
1433 source_set("moltenvk") {
1434 public_configs = [ ":moltenvk_config" ]
1435 }
1436
mtkleinc095df52016-08-24 12:23:52 -07001437 test_lib("gpu_tool_utils") {
Brian Osmanc9a42472018-05-31 13:17:12 -04001438 public_defines = []
mtkleind68f9b02016-09-23 13:18:41 -07001439
Mike Klein333fb452019-04-24 08:48:11 -05001440 defines = []
1441 if (skia_enable_discrete_gpu) {
1442 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
1443 }
1444
Brian Osmanc9a42472018-05-31 13:17:12 -04001445 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001446 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001447 sources = [
1448 "tools/gpu/GrContextFactory.cpp",
1449 "tools/gpu/GrTest.cpp",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001450 "tools/gpu/MemoryCache.cpp",
1451 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001452 "tools/gpu/ProxyUtils.cpp",
1453 "tools/gpu/TestContext.cpp",
Michael Ludwigd9958f82019-03-21 13:08:36 -04001454 "tools/gpu/YUVUtils.cpp",
1455 "tools/gpu/YUVUtils.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001456 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1457 "tools/gpu/gl/GLTestContext.cpp",
1458 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04001459 "tools/gpu/mock/MockTestContext.cpp",
1460 ]
1461 libs = []
1462
1463 if (is_android || skia_use_egl) {
1464 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1465 } else if (is_ios) {
1466 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1467 libs += [ "OpenGLES.framework" ]
1468 } else if (is_linux) {
1469 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -04001470 libs += [
1471 "GLU",
1472 "X11",
1473 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001474 } else if (is_mac) {
1475 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1476 } else if (is_win) {
1477 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001478 libs += [ "Gdi32.lib" ]
1479 if (target_cpu != "arm64") {
1480 libs += [ "OpenGL32.lib" ]
1481 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001482 }
mtklein25c81d42016-07-27 13:55:26 -07001483
Brian Osmanc9a42472018-05-31 13:17:12 -04001484 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001485
Brian Osmanc9a42472018-05-31 13:17:12 -04001486 if (skia_use_angle) {
1487 deps += [ "//third_party/angle2" ]
1488 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1489 }
Greg Daniel54200e42018-12-11 17:03:39 -05001490
Brian Osmanc9a42472018-05-31 13:17:12 -04001491 if (skia_use_vulkan) {
1492 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1493 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Greg Danielda16cce2018-08-01 09:23:57 -04001494 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1495 public_deps += [ ":moltenvk" ]
1496 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001497 }
1498 if (skia_use_metal) {
1499 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001500 }
mtklein25c81d42016-07-27 13:55:26 -07001501 }
mtklein25c81d42016-07-27 13:55:26 -07001502
mtkleinc095df52016-08-24 12:23:52 -07001503 test_lib("flags") {
mtkleinc095df52016-08-24 12:23:52 -07001504 sources = [
Mike Klein88544fb2019-03-20 10:50:33 -05001505 "tools/flags/CommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001506 ]
1507 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001508
1509 test_lib("common_flags_config") {
mtklein046cb562016-09-16 10:23:12 -07001510 sources = [
Mike Klein88544fb2019-03-20 10:50:33 -05001511 "tools/flags/CommonFlagsConfig.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001512 ]
1513 deps = [
mtklein046cb562016-09-16 10:23:12 -07001514 ":flags",
Greg Danielda16cce2018-08-01 09:23:57 -04001515 ]
1516 public_deps = [
mtkleinc095df52016-08-24 12:23:52 -07001517 ":gpu_tool_utils",
1518 ]
1519 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001520 test_lib("common_flags_gpu") {
Mike Kleinc6142d82019-03-25 10:54:59 -05001521 sources = [
1522 "tools/flags/CommonFlagsGpu.cpp",
1523 ]
1524 deps = [
1525 ":flags",
1526 ]
1527 public_deps = [
1528 ":gpu_tool_utils",
1529 ]
1530 }
1531 test_lib("common_flags_images") {
Mike Kleinc6142d82019-03-25 10:54:59 -05001532 sources = [
1533 "tools/flags/CommonFlagsImages.cpp",
1534 ]
1535 deps = [
1536 ":flags",
1537 ]
1538 }
1539 test_lib("common_flags_aa") {
Mike Kleinc6142d82019-03-25 10:54:59 -05001540 sources = [
1541 "tools/flags/CommonFlagsAA.cpp",
1542 ]
1543 deps = [
1544 ":flags",
1545 ]
1546 }
mtklein25c81d42016-07-27 13:55:26 -07001547
Mike Klein499f0ac2019-03-25 13:00:12 -05001548 test_lib("trace") {
Mike Klein499f0ac2019-03-25 13:00:12 -05001549 deps = [
1550 ":flags",
1551 ]
1552 sources = [
1553 "tools/trace/ChromeTracingTracer.cpp",
1554 "tools/trace/ChromeTracingTracer.h",
1555 "tools/trace/EventTracingPriv.cpp",
1556 "tools/trace/EventTracingPriv.h",
1557 "tools/trace/SkDebugfTracer.cpp",
1558 "tools/trace/SkDebugfTracer.h",
1559 ]
1560 }
1561
mtkleinc095df52016-08-24 12:23:52 -07001562 test_lib("tool_utils") {
mtkleinc095df52016-08-24 12:23:52 -07001563 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001564 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001565 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001566 "tools/DDLPromiseImageHelper.cpp",
1567 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001568 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001569 "tools/ProcStats.cpp",
1570 "tools/Resources.cpp",
Mike Kleinea3f0142019-03-20 11:12:10 -05001571 "tools/ToolUtils.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001572 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001573 "tools/debugger/DebugCanvas.cpp",
1574 "tools/debugger/DrawCommand.cpp",
1575 "tools/debugger/JsonWriteBuffer.cpp",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001576 "tools/fonts/RandomScalerContext.cpp",
1577 "tools/fonts/TestEmptyTypeface.h",
1578 "tools/fonts/TestFontMgr.cpp",
1579 "tools/fonts/TestFontMgr.h",
1580 "tools/fonts/TestSVGTypeface.cpp",
1581 "tools/fonts/TestSVGTypeface.h",
1582 "tools/fonts/TestTypeface.cpp",
1583 "tools/fonts/TestTypeface.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001584 "tools/fonts/ToolUtilsFont.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001585 "tools/random_parse_path.cpp",
Mike Kleincd5104e2019-03-20 11:55:08 -05001586 "tools/timer/AnimTimer.h",
mtkleinc095df52016-08-24 12:23:52 -07001587 "tools/timer/Timer.cpp",
1588 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001589 libs = []
1590 if (is_ios) {
1591 sources += [ "tools/ios_utils.m" ]
1592 libs += [ "Foundation.framework" ]
Mike Kleinbf15b662019-04-15 11:32:16 -05001593 } else if (is_win) {
1594 libs += [ "DbgHelp.lib" ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001595 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001596
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001597 defines = []
1598 if (skia_tools_require_resources) {
1599 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1600 }
mtkleinc095df52016-08-24 12:23:52 -07001601 deps = [
Ben Wagner97182cc2018-02-15 10:20:04 -05001602 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001603 ":flags",
Mike Kleine4ad58a2019-03-26 09:05:52 -05001604 ]
1605 public_deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05001606 ":gpu_tool_utils",
mtkleinc095df52016-08-24 12:23:52 -07001607 ]
mtkleinc095df52016-08-24 12:23:52 -07001608 }
mtklein25c81d42016-07-27 13:55:26 -07001609
Mike Kleine11e5c12019-04-24 12:46:06 -05001610 test_lib("etc1") {
1611 sources = [
1612 "third_party/etc1/etc1.cpp",
1613 ]
1614 }
1615
Mike Klein6e744122016-10-27 12:21:40 -04001616 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001617 test_lib("gm") {
mtkleinc095df52016-08-24 12:23:52 -07001618 sources = gm_sources
1619 deps = [
Mike Kleine11e5c12019-04-24 12:46:06 -05001620 ":etc1",
scroggo19b91532016-10-24 09:03:26 -07001621 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001622 ":skia",
1623 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001624 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001625 "modules/skottie:gm",
Florin Malita3b526b02018-05-25 12:43:51 -04001626 "modules/sksg",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001627 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001628 ]
Greg Danielda16cce2018-08-01 09:23:57 -04001629 public_deps = [
1630 ":gpu_tool_utils",
1631 ]
mtkleinc095df52016-08-24 12:23:52 -07001632 }
mtklein25c81d42016-07-27 13:55:26 -07001633
Mike Klein6e744122016-10-27 12:21:40 -04001634 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001635 test_lib("tests") {
Mike Klein6e744122016-10-27 12:21:40 -04001636 sources = tests_sources + pathops_tests_sources
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -05001637 if (!skia_enable_fontmgr_android) {
Mike Klein6e744122016-10-27 12:21:40 -04001638 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001639 }
Ben Wagner37a06c02018-06-22 21:11:00 +00001640 if (!(skia_use_freetype && skia_use_fontconfig)) {
1641 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1642 }
mtkleinc095df52016-08-24 12:23:52 -07001643 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001644 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001645 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001646 ":skia",
1647 ":tool_utils",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001648 "modules/skottie:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001649 "modules/sksg:tests",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001650 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001651 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05001652 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07001653 "//third_party/zlib",
1654 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001655 public_deps = [
1656 ":gpu_tool_utils", # Test.h #includes headers from this target.
1657 ]
mtkleinc095df52016-08-24 12:23:52 -07001658 }
mtklein2f3416d2016-08-02 16:02:05 -07001659
Mike Klein6e744122016-10-27 12:21:40 -04001660 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001661 test_lib("bench") {
mtkleinc095df52016-08-24 12:23:52 -07001662 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001663 deps = [
1664 ":flags",
1665 ":gm",
1666 ":gpu_tool_utils",
1667 ":skia",
1668 ":tool_utils",
1669 ]
1670 }
mtklein2b6870c2016-07-28 14:17:33 -07001671
mtkleinc095df52016-08-24 12:23:52 -07001672 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001673 if (skia_use_expat) {
Hal Canary0f666812018-03-22 15:21:12 -04001674 sources = [
1675 "experimental/svg/model/SkSVGAttribute.cpp",
1676 "experimental/svg/model/SkSVGAttributeParser.cpp",
1677 "experimental/svg/model/SkSVGCircle.cpp",
1678 "experimental/svg/model/SkSVGClipPath.cpp",
1679 "experimental/svg/model/SkSVGContainer.cpp",
1680 "experimental/svg/model/SkSVGDOM.cpp",
1681 "experimental/svg/model/SkSVGEllipse.cpp",
1682 "experimental/svg/model/SkSVGGradient.cpp",
1683 "experimental/svg/model/SkSVGLine.cpp",
1684 "experimental/svg/model/SkSVGLinearGradient.cpp",
1685 "experimental/svg/model/SkSVGNode.cpp",
1686 "experimental/svg/model/SkSVGPath.cpp",
1687 "experimental/svg/model/SkSVGPattern.cpp",
1688 "experimental/svg/model/SkSVGPoly.cpp",
1689 "experimental/svg/model/SkSVGRadialGradient.cpp",
1690 "experimental/svg/model/SkSVGRect.cpp",
1691 "experimental/svg/model/SkSVGRenderContext.cpp",
1692 "experimental/svg/model/SkSVGSVG.cpp",
1693 "experimental/svg/model/SkSVGShape.cpp",
1694 "experimental/svg/model/SkSVGStop.cpp",
1695 "experimental/svg/model/SkSVGTransformableNode.cpp",
1696 "experimental/svg/model/SkSVGUse.cpp",
1697 "experimental/svg/model/SkSVGValue.cpp",
1698 ]
1699 deps = [
1700 ":skia",
1701 ":xml",
1702 ]
1703 }
mtkleinc095df52016-08-24 12:23:52 -07001704 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001705
Mike Klein38af9432016-11-11 11:39:44 -05001706 if (skia_use_lua) {
1707 test_lib("lua") {
Mike Klein38af9432016-11-11 11:39:44 -05001708 sources = [
1709 "src/utils/SkLua.cpp",
1710 "src/utils/SkLuaCanvas.cpp",
1711 ]
1712 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001713 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001714 "//third_party/lua",
1715 ]
1716 }
1717
Mike Kleine6682eb2017-01-05 10:54:57 -05001718 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001719 sources = [
1720 "tools/lua/lua_app.cpp",
1721 ]
1722 deps = [
1723 ":lua",
1724 ":skia",
1725 "//third_party/lua",
1726 ]
Mike Klein38af9432016-11-11 11:39:44 -05001727 }
1728
Mike Kleine6682eb2017-01-05 10:54:57 -05001729 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001730 sources = [
1731 "tools/lua/lua_pictures.cpp",
1732 ]
1733 deps = [
1734 ":flags",
1735 ":lua",
1736 ":skia",
1737 ":tool_utils",
1738 "//third_party/lua",
1739 ]
Mike Klein38af9432016-11-11 11:39:44 -05001740 }
1741 }
1742
Florin Malitabfe876a2018-09-02 12:33:59 -04001743 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001744 test_app("skottie_tool") {
1745 deps = [
1746 "modules/skottie:tool",
1747 ]
1748 }
1749 }
1750
Hal Canary5b39dc82019-04-17 13:29:46 -04001751 test_app("make_skqp_model") {
1752 sources = [
1753 "tools/skqp/make_skqp_model.cpp",
1754 ]
1755 deps = [
1756 ":skia",
1757 ]
1758 }
1759
Kevin Lubickebf648e2017-09-21 13:45:16 -04001760 if (target_cpu != "wasm") {
1761 import("gn/samples.gni")
1762 test_lib("samples") {
Yuqian Li56a4a092018-02-12 14:47:34 +08001763 sources = samples_sources
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001764 public_deps = [
1765 ":tool_utils",
1766 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001767 deps = [
1768 ":experimental_svg_model",
1769 ":flags",
Mike Kleinc6142d82019-03-25 10:54:59 -05001770 ":gpu_tool_utils",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001771 ":xml",
Mike Reedec80d902019-02-12 11:31:27 -05001772 "modules/sksg",
Herb Derby264182c2018-05-29 15:53:40 -04001773 "modules/skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001774 ]
Mike Klein38af9432016-11-11 11:39:44 -05001775
Ruiqi Maof5101492018-06-29 14:32:21 -04001776 # NIMA does not build on Windows clang
1777 if (!is_win || !is_clang) {
Kevin Lubickd9699322018-10-30 15:08:53 -04001778 sources += [ "experimental/nima/NimaActor.cpp" ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001779 deps += [ "//third_party/Nima-Cpp" ]
1780 }
1781
Kevin Lubickebf648e2017-09-21 13:45:16 -04001782 if (skia_use_lua) {
1783 sources += [ "samplecode/SampleLua.cpp" ]
1784 deps += [
1785 ":lua",
1786 "//third_party/lua",
1787 ]
1788 }
1789 }
Mike Klein7af351a2018-07-27 09:54:43 -04001790 test_app("imgcvt") {
1791 sources = [
1792 "tools/imgcvt.cpp",
1793 ]
1794 deps = [
1795 ":skcms",
1796 ":skia",
1797 ]
1798 }
Mike Klein735c7ba2019-03-25 12:57:58 -05001799 test_lib("hash_and_encode") {
Mike Klein735c7ba2019-03-25 12:57:58 -05001800 sources = [
1801 "tools/HashAndEncode.cpp",
1802 "tools/HashAndEncode.h",
1803 ]
1804 deps = [
1805 ":flags",
1806 ":skia",
1807 "//third_party/libpng",
1808 ]
1809 }
1810 test_app("fm") {
1811 sources = [
1812 "tools/fm/fm.cpp",
1813 ]
1814 deps = [
1815 ":common_flags_aa",
1816 ":common_flags_gpu",
Mike Klein6253d902019-03-27 15:09:12 -05001817 ":experimental_svg_model",
Mike Klein735c7ba2019-03-25 12:57:58 -05001818 ":flags",
1819 ":gm",
1820 ":gpu_tool_utils",
1821 ":hash_and_encode",
1822 ":skia",
1823 ":tool_utils",
1824 ":trace",
Mike Klein22924262019-04-02 14:14:56 -04001825 "modules/skottie",
1826 "modules/skottie:utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05001827 ]
1828 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04001829 test_app("dm") {
1830 sources = [
1831 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001832 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001833 "dm/DMJsonWriter.cpp",
1834 "dm/DMSrcSink.cpp",
1835 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001836 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05001837 ":common_flags_aa",
1838 ":common_flags_config",
1839 ":common_flags_gpu",
1840 ":common_flags_images",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001841 ":experimental_svg_model",
1842 ":flags",
1843 ":gm",
1844 ":gpu_tool_utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05001845 ":hash_and_encode",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001846 ":skia",
1847 ":tests",
1848 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05001849 ":trace",
Florin Malita3d856bd2018-05-26 09:49:28 -04001850 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05001851 "modules/skottie:utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001852 "modules/sksg",
Mike Klein38af9432016-11-11 11:39:44 -05001853 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001854
1855 # NIMA does not build on Windows clang
1856 if (!is_win || !is_clang) {
1857 deps += [ "//third_party/Nima-Cpp" ]
1858 }
Mike Klein38af9432016-11-11 11:39:44 -05001859 }
Brian Osman16adfa32016-10-18 14:42:44 -04001860 }
1861
Mike Kleina8a51ce2018-01-09 12:34:11 -05001862 if (!is_win) {
1863 test_app("remote_demo") {
1864 sources = [
1865 "tools/remote_demo.cpp",
1866 ]
1867 deps = [
1868 ":skia",
1869 ]
1870 }
1871 }
1872
Mike Kleine6682eb2017-01-05 10:54:57 -05001873 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001874 sources = [
1875 "bench/nanobench.cpp",
1876 ]
1877 deps = [
1878 ":bench",
Mike Kleinc6142d82019-03-25 10:54:59 -05001879 ":common_flags_aa",
1880 ":common_flags_config",
1881 ":common_flags_gpu",
1882 ":common_flags_images",
fmalita6519c212016-09-14 08:05:17 -07001883 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001884 ":flags",
1885 ":gm",
1886 ":gpu_tool_utils",
1887 ":skia",
1888 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05001889 ":trace",
Florin Malita3b526b02018-05-25 12:43:51 -04001890 "modules/sksg",
mtklein2b6870c2016-07-28 14:17:33 -07001891 ]
mtklein2b6870c2016-07-28 14:17:33 -07001892 }
halcanary19a97202016-08-03 15:08:04 -07001893
Ravi Mistry10d36c52017-01-31 09:49:18 -05001894 test_app("skpinfo") {
1895 sources = [
1896 "tools/skpinfo.cpp",
1897 ]
1898 deps = [
1899 ":flags",
1900 ":skia",
1901 ]
1902 }
1903
Brian Osmanc9a42472018-05-31 13:17:12 -04001904 test_app("skpbench") {
1905 sources = [
1906 "tools/skpbench/skpbench.cpp",
1907 ]
1908 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05001909 ":common_flags_config",
1910 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04001911 ":flags",
1912 ":gpu_tool_utils",
1913 ":skia",
1914 ":tool_utils",
1915 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07001916 }
1917
Mike Kleine6682eb2017-01-05 10:54:57 -05001918 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001919 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04001920 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001921 ]
1922 deps = [
1923 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04001924 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001925 ]
halcanary3eee9d92016-09-10 07:01:53 -07001926 }
mtklein046cb562016-09-16 10:23:12 -07001927
Ben Wagner219f3622017-07-17 15:32:25 -04001928 test_app("create_test_font") {
1929 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001930 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001931 ]
1932 deps = [
1933 ":skia",
1934 ]
1935 assert_no_deps = [
1936 # tool_utils requires the output of this app.
1937 ":tool_utils",
1938 ]
1939 }
1940
Florin Malita5d3ff432018-07-31 16:38:43 -04001941 if (skia_use_expat) {
1942 test_app("create_test_font_color") {
1943 sources = [
1944 "tools/fonts/create_test_font_color.cpp",
1945 ]
1946 deps = [
1947 ":flags",
1948 ":skia",
1949 ":tool_utils",
1950 ]
1951 }
Ben Wagner97182cc2018-02-15 10:20:04 -05001952 }
1953
Mike Kleine6682eb2017-01-05 10:54:57 -05001954 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001955 sources = [
1956 "tools/get_images_from_skps.cpp",
1957 ]
1958 deps = [
1959 ":flags",
1960 ":skia",
mtklein046cb562016-09-16 10:23:12 -07001961 ]
mtklein046cb562016-09-16 10:23:12 -07001962 }
mtkleinecbc5262016-09-22 11:51:24 -07001963
Brian Osman6788a542018-12-10 11:56:01 -05001964 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001965 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001966 sources = [
1967 "tools/skiaserve/Request.cpp",
1968 "tools/skiaserve/Response.cpp",
1969 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001970 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1971 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1972 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1973 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1974 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1975 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1976 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1977 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1978 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001979 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1980 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001981 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1982 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1983 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1984 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1985 ]
1986 deps = [
1987 ":flags",
1988 ":gpu_tool_utils",
1989 ":skia",
1990 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04001991 "//third_party/libmicrohttpd",
Mike Klein7d302882016-11-03 14:06:31 -04001992 ]
Mike Klein7d302882016-11-03 14:06:31 -04001993 }
mtkleinecbc5262016-09-22 11:51:24 -07001994 }
kjlubick14f984b2016-10-03 11:49:45 -07001995
Mike Kleine6682eb2017-01-05 10:54:57 -05001996 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07001997 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001998 "fuzz/Fuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001999 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002000 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05002001 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04002002 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002003 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002004 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002005 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002006 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002007 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04002008 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04002009 "fuzz/FuzzRegionOp.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002010 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05002011 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
2012 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002013 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002014 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04002015 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002016 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05002017 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
2018 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002019 "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp",
2020 "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
Kevin Lubick0f0a7102019-03-18 16:20:55 -04002021 "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002022 "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002023 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002024 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002025 "tools/debugger/DebugCanvas.cpp",
2026 "tools/debugger/DrawCommand.cpp",
2027 "tools/debugger/JsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002028 ]
2029 deps = [
2030 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04002031 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07002032 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04002033 "modules/skottie:fuzz",
kjlubick14f984b2016-10-03 11:49:45 -07002034 ]
kjlubick14f984b2016-10-03 11:49:45 -07002035 }
Mike Klein38312422016-10-05 15:41:01 -04002036
Mike Kleine6682eb2017-01-05 10:54:57 -05002037 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04002038 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04002039 rebase_path("tests/skia_test.cpp"),
2040 rebase_path("tests/Test.cpp"),
2041 ]
caryclark9feb6322016-10-25 08:58:26 -07002042 deps = [
2043 ":flags",
2044 ":gpu_tool_utils",
2045 ":skia",
2046 ":tool_utils",
2047 ]
caryclark9feb6322016-10-25 08:58:26 -07002048 }
2049
Mike Kleine6682eb2017-01-05 10:54:57 -05002050 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04002051 sources = [
2052 "tools/DumpRecord.cpp",
2053 "tools/dump_record.cpp",
2054 ]
2055 deps = [
2056 ":flags",
2057 ":skia",
2058 ]
Mike Klein38312422016-10-05 15:41:01 -04002059 }
bungemanfe917272016-10-13 17:36:40 -04002060
Mike Kleine6682eb2017-01-05 10:54:57 -05002061 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04002062 sources = [
2063 "tools/skdiff/skdiff.cpp",
2064 "tools/skdiff/skdiff_html.cpp",
2065 "tools/skdiff/skdiff_main.cpp",
2066 "tools/skdiff/skdiff_utils.cpp",
2067 ]
2068 deps = [
2069 ":skia",
2070 ":tool_utils",
2071 ]
bungemanfe917272016-10-13 17:36:40 -04002072 }
halcanarya73d76a2016-10-17 13:19:02 -07002073
Mike Kleine6682eb2017-01-05 10:54:57 -05002074 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07002075 sources = [
2076 "tools/skp_parser.cpp",
2077 ]
2078 deps = [
2079 ":skia",
2080 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002081 ]
halcanarya73d76a2016-10-17 13:19:02 -07002082 }
Brian Osman16adfa32016-10-18 14:42:44 -04002083
Brian Osmanc9a42472018-05-31 13:17:12 -04002084 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05002085 test_lib("skqp_lib") {
Hal Canary0e07ad72018-02-08 13:06:56 -05002086 defines =
2087 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002088 sources = [
2089 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002090 "tools/skqp/src/skqp.cpp",
2091 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002092 ]
2093 deps = [
2094 ":gm",
2095 ":gpu_tool_utils",
2096 ":skia",
2097 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002098 ":tool_utils",
2099 ]
2100 }
2101 test_app("skqp") {
2102 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002103 "tools/skqp/src/skqp_main.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05002104 ]
2105 deps = [
2106 ":skia",
2107 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05002108 ":tool_utils",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002109 ]
2110 }
2111 test_app("jitter_gms") {
2112 sources = [
2113 "tools/skqp/jitter_gms.cpp",
2114 ]
2115 deps = [
2116 ":gm",
2117 ":skia",
2118 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002119 ]
2120 }
2121 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002122 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05002123 test_app("skqp_app") {
2124 is_shared_library = true
2125 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002126 "tools/skqp/src/jni_skqp.cpp",
Hal Canary28f89382017-12-12 09:42:14 -05002127 ]
2128 deps = [
2129 ":skia",
2130 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002131 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002132 ]
2133 libs = [ "android" ]
2134 }
2135 }
Stan Iliev93151722018-08-02 11:10:52 -04002136 if (is_android && skia_enable_gpu) {
2137 test_app("skottie_android") {
2138 is_shared_library = true
2139
2140 sources = [
2141 "platform_tools/android/apps/skottie/src/main/cpp/JavaInputStreamAdaptor.cpp",
2142 "platform_tools/android/apps/skottie/src/main/cpp/native-lib.cpp",
2143 ]
2144 libs = []
2145
Stan Iliev93151722018-08-02 11:10:52 -04002146 deps = [
2147 ":skia",
2148 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002149 "modules/sksg:samples",
Stan Iliev93151722018-08-02 11:10:52 -04002150 ]
2151 }
2152 }
Hal Canary75427132017-10-11 16:00:31 -04002153
Hal Canarya9de7602018-01-19 13:08:23 -05002154 test_app("list_gms") {
2155 sources = [
2156 "tools/list_gms.cpp",
2157 ]
2158 deps = [
2159 ":gm",
2160 ":skia",
2161 ]
2162 }
2163 test_app("list_gpu_unit_tests") {
2164 sources = [
2165 "dm/DMGpuTestProcs.cpp",
2166 "tools/list_gpu_unit_tests.cpp",
2167 ]
2168 deps = [
2169 ":skia",
2170 ":tests",
2171 ]
2172 }
2173
Brian Osmanc9a42472018-05-31 13:17:12 -04002174 test_lib("sk_app") {
Brian Osmanc9a42472018-05-31 13:17:12 -04002175 sources = [
2176 "tools/sk_app/CommandSet.cpp",
2177 "tools/sk_app/GLWindowContext.cpp",
2178 "tools/sk_app/Window.cpp",
2179 ]
2180 libs = []
2181
2182 if (is_android) {
2183 sources += [
2184 "tools/sk_app/android/GLWindowContext_android.cpp",
2185 "tools/sk_app/android/RasterWindowContext_android.cpp",
2186 "tools/sk_app/android/Window_android.cpp",
2187 "tools/sk_app/android/main_android.cpp",
2188 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002189 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002190 libs += [ "android" ]
2191 } else if (is_linux) {
2192 sources += [
2193 "tools/sk_app/unix/GLWindowContext_unix.cpp",
2194 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
2195 "tools/sk_app/unix/Window_unix.cpp",
2196 "tools/sk_app/unix/keysym2ucs.c",
2197 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002198 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002199 libs += [
2200 "GL",
2201 "X11",
2202 ]
2203 } else if (is_win) {
2204 sources += [
2205 "tools/sk_app/win/GLWindowContext_win.cpp",
2206 "tools/sk_app/win/RasterWindowContext_win.cpp",
2207 "tools/sk_app/win/Window_win.cpp",
2208 "tools/sk_app/win/main_win.cpp",
2209 ]
Brian Salomon194db172017-08-17 14:37:06 -04002210 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002211 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04002212 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002213 } else if (is_mac) {
2214 sources += [
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002215 "tools/sk_app/mac/GLWindowContext_mac.mm",
2216 "tools/sk_app/mac/RasterWindowContext_mac.mm",
2217 "tools/sk_app/mac/Window_mac.mm",
2218 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002219 ]
2220 libs += [
2221 "QuartzCore.framework",
2222 "Cocoa.framework",
2223 "Foundation.framework",
2224 ]
2225 } else if (is_ios) {
2226 sources += [
2227 "tools/sk_app/ios/GLWindowContext_ios.cpp",
2228 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
2229 "tools/sk_app/ios/Window_ios.cpp",
2230 "tools/sk_app/ios/main_ios.cpp",
2231 ]
2232 }
2233
2234 if (skia_use_vulkan) {
2235 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
2236 if (is_android) {
2237 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2238 } else if (is_linux) {
2239 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2240 libs += [ "X11-xcb" ]
2241 } else if (is_win) {
2242 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Jim Van Verthce51c142019-02-14 14:07:46 -05002243 } else if (is_mac) {
2244 sources += [ "tools/sk_app/mac/VulkanWindowContext_mac.mm" ]
2245 libs += [ "MetalKit.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002246 }
2247 }
2248
Jim Van Verthbe39f712019-02-08 15:36:14 -05002249 if (skia_use_metal) {
2250 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
2251 if (is_mac) {
2252 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
2253 }
2254 libs += [ "MetalKit.framework" ]
2255 }
2256
Brian Osmanc9a42472018-05-31 13:17:12 -04002257 deps = [
2258 ":gpu_tool_utils",
2259 ":skia",
2260 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002261 ]
2262 if (is_android) {
2263 deps += [ "//third_party/native_app_glue" ]
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002264 } else if (is_ios) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002265 deps += [ "//third_party/libsdl" ]
2266 }
2267 if (skia_use_angle) {
2268 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002269 }
Brian Osman16adfa32016-10-18 14:42:44 -04002270 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002271
Hal Canary87515122019-03-15 14:22:51 -04002272 if (!skia_use_vulkan && (is_mac || is_linux || is_win)) {
2273 test_app("fiddle_examples") {
2274 sources = [
Brian Osmanc725e8f2019-04-10 14:08:44 -04002275 "tools/fiddle/all_examples.cpp",
Hal Canary87515122019-03-15 14:22:51 -04002276 "tools/fiddle/examples.cpp",
Brian Osman72ef2d52019-03-17 11:09:17 -04002277 "tools/fiddle/examples.h",
Hal Canary87515122019-03-15 14:22:51 -04002278 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002279 if (is_win) {
2280 cflags = [ "/wd4756" ] # Overflow in constant arithmetic
2281 }
Hal Canary87515122019-03-15 14:22:51 -04002282 deps = [
2283 ":skia",
2284 ":skia.h",
2285 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04002286 "modules/skshaper",
Hal Canary87515122019-03-15 14:22:51 -04002287 ]
2288 }
2289 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002290 test_app("viewer") {
2291 is_shared_library = is_android
Brian Osmanc9a42472018-05-31 13:17:12 -04002292 sources = [
2293 "tools/viewer/BisectSlide.cpp",
2294 "tools/viewer/GMSlide.cpp",
2295 "tools/viewer/ImGuiLayer.cpp",
2296 "tools/viewer/ImageSlide.cpp",
Brian Osman7c979f52019-02-12 13:27:51 -05002297 "tools/viewer/ParticlesSlide.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04002298 "tools/viewer/SKPSlide.cpp",
2299 "tools/viewer/SampleSlide.cpp",
2300 "tools/viewer/SkottieSlide.cpp",
2301 "tools/viewer/SlideDir.cpp",
2302 "tools/viewer/StatsLayer.cpp",
2303 "tools/viewer/SvgSlide.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002304 "tools/viewer/TouchGesture.cpp",
Leon Scroggins III81886e82018-08-22 11:18:08 -04002305 "tools/viewer/TouchGesture.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002306 "tools/viewer/Viewer.cpp",
2307 ]
2308 libs = []
2309
Brian Osmanc9a42472018-05-31 13:17:12 -04002310 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002311 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04002312 ":experimental_svg_model",
2313 ":flags",
2314 ":gm",
2315 ":gpu_tool_utils",
2316 ":samples",
2317 ":sk_app",
2318 ":skia",
2319 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002320 ":trace",
Brian Osman7c979f52019-02-12 13:27:51 -05002321 "modules/particles",
Brian Osmanc9a42472018-05-31 13:17:12 -04002322 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002323 "modules/skottie:utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002324 "modules/sksg",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002325 "modules/sksg:samples",
Brian Osmanc9a42472018-05-31 13:17:12 -04002326 "//third_party/imgui",
Brian Osmanc9a42472018-05-31 13:17:12 -04002327 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04002328
2329 # NIMA does not build on Windows clang
2330 if (!is_win || !is_clang) {
2331 sources += [ "tools/viewer/NIMASlide.cpp" ]
2332 deps += [ "//third_party/Nima-Cpp" ]
2333 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002334 }
2335
Brian Osmanc9a42472018-05-31 13:17:12 -04002336 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002337 test_app("HelloWorld") {
2338 sources = [
2339 "example/HelloWorld.cpp",
2340 ]
2341 libs = []
2342
Brian Osmaneff04b52017-11-21 13:18:02 -05002343 deps = [
2344 ":flags",
2345 ":gpu_tool_utils",
2346 ":sk_app",
2347 ":skia",
2348 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002349 ]
2350 }
2351 }
2352
Brian Osmanc9a42472018-05-31 13:17:12 -04002353 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002354 test_app("SkiaSDLExample") {
2355 sources = [
2356 "example/SkiaSDLExample.cpp",
2357 ]
2358 libs = []
Jim Van Verth4c70c752017-07-11 12:03:01 -04002359 deps = [
2360 ":gpu_tool_utils",
2361 ":skia",
2362 "//third_party/libsdl",
2363 ]
2364 }
2365 }
2366
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002367 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2368 action_foreach("generate_mocs") {
2369 script = "gn/call.py"
2370 sources = [
2371 "tools/mdbviz/MainWindow.h",
2372 ]
2373 outputs = [
2374 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2375 ]
2376 args = [
2377 "$skia_qt_path" + "/bin/moc",
2378 "{{source}}",
2379 "-o",
2380 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2381 ]
2382 }
2383 action_foreach("generate_resources") {
2384 script = "gn/call.py"
2385 sources = [
2386 "tools/mdbviz/resources.qrc",
2387 ]
2388 outputs = [
2389 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2390 ]
2391 args = [
2392 "$skia_qt_path" + "/bin/rcc",
2393 "{{source}}",
2394 "-o",
2395 "gen/mdbviz/{{source_name_part}}_res.cpp",
2396 ]
2397 }
2398 test_app("mdbviz") {
2399 if (is_win) {
2400 # on Windows we need to disable some exception handling warnings due to the Qt headers
2401 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2402 }
2403 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002404 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002405 "tools/debugger/DebugCanvas.cpp",
2406 "tools/debugger/DrawCommand.cpp",
2407 "tools/debugger/JsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002408 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002409 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002410 "tools/mdbviz/main.cpp",
2411
2412 # generated files
2413 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2414 "$target_gen_dir/mdbviz/resources_res.cpp",
2415 ]
2416 lib_dirs = [ "$skia_qt_path/lib" ]
2417 libs = [
2418 "Qt5Core.lib",
2419 "Qt5Gui.lib",
2420 "Qt5Widgets.lib",
2421 ]
2422 include_dirs = [
2423 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002424 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002425 "$skia_qt_path/include/QtWidgets",
2426 ]
2427 deps = [
2428 ":generate_mocs",
2429 ":generate_resources",
2430 ":skia",
2431 ]
2432 }
2433 }
2434
Mike Kleine459afd2017-03-03 09:21:30 -05002435 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002436 copy("gdbserver") {
2437 sources = [
2438 "$ndk/$ndk_gdbserver",
2439 ]
2440 outputs = [
2441 "$root_out_dir/gdbserver",
2442 ]
2443 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002444 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002445
2446 if (skia_use_opencl) {
2447 test_app("hello-opencl") {
2448 sources = [
Mike Kleinf9ae6702018-06-20 14:05:05 -04002449 "tools/hello-opencl.cpp",
2450 ]
Mike Klein8a1f15d2019-02-11 11:59:41 -05002451 deps = [
2452 "//third_party/opencl",
2453 ]
Mike Kleinf9ae6702018-06-20 14:05:05 -04002454 }
2455 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002456
2457 test_app("editor") {
2458 is_shared_library = is_android
2459 sources = [
2460 "experimental/editor/editor_application.cpp",
2461 ]
2462 deps = [
2463 ":sk_app",
2464 ":skia",
2465 "modules/skshaper",
2466 ]
2467 }
mtklein25c81d42016-07-27 13:55:26 -07002468}