blob: 42388de1cf5d08d0c65600e0cef5c881dd66f2f1 [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) {
Chinmay Garde89820762019-05-06 16:44:06 -070012 import("//build/fuchsia/sdk.gni")
Forrest Reiling30229ac2017-04-17 13:36:39 -070013 import("//build/vulkan/config.gni")
14}
15
mtkleinc04ff472016-06-23 10:29:30 -070016declare_args() {
Mike Klein26a60492018-10-15 10:38:25 -040017 skia_enable_flutter_defines = false
18}
19
20declare_args() {
Mike Kleinc168a3a2016-11-14 14:53:13 +000021 skia_use_angle = false
Kevin Lubick4a24e102017-03-29 11:19:01 -040022 skia_use_egl = false
mtklein63213812016-08-24 09:55:56 -070023 skia_use_expat = true
Mike Reed7bf160e2019-05-17 16:50:51 -040024 skia_use_ffmpeg = false
mtklein3cc22182016-08-29 13:26:14 -070025 skia_use_fontconfig = is_linux
Leon Scroggins III85e22fc2018-11-28 08:58:47 -050026 skia_use_fonthost_mac = is_mac
mtkleincdedd0e2016-09-12 15:15:44 -070027 skia_use_freetype = is_android || is_fuchsia || is_linux
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -050028 skia_use_fixed_gamma_text = is_android
mtklein63213812016-08-24 09:55:56 -070029 skia_use_libjpeg_turbo = true
30 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070031 skia_use_libwebp = !is_fuchsia
Mike Kleinfae86b72018-01-08 15:49:09 -050032 skia_use_lua = is_skia_dev_build && !is_ios
Mike Kleinf9ae6702018-06-20 14:05:05 -040033 skia_use_opencl = false
Mike Klein10d665d2016-11-01 11:46:10 -040034 skia_use_piex = !is_win
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -040035 skia_use_wuffs = false
mtklein63213812016-08-24 09:55:56 -070036 skia_use_zlib = true
Greg Daniele5ddff52017-07-05 16:49:36 -040037 skia_use_metal = false
Mike Klein36f182f2017-10-20 12:33:53 -040038 skia_use_libheif = is_skia_dev_build
Chinmay Garded92d0352018-09-17 10:23:28 -070039 skia_use_x11 = is_linux
Leon Scroggins IIIee0e5d02019-02-27 10:59:11 -050040 skia_use_xps = true
mtklein1bd72ba2016-09-16 07:45:52 -070041
Mike Klein7d921032017-01-05 12:20:41 -050042 skia_android_serial = ""
Kevin Lubick93faa672018-10-10 15:54:53 -040043 skia_enable_ccpr = true
Kevin Lubickca7c2972018-10-17 13:52:24 +000044 skia_enable_nvpr = !skia_enable_flutter_defines
Brian Osman3f375d02016-12-28 11:19:22 -050045 skia_enable_discrete_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050046 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040047 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Kevin Lubick32dfdbe2018-10-18 09:47:01 -040048 skia_enable_skpicture = true
Mike Klein3669a822017-03-03 10:55:02 -050049 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Robert Phillipsa6d2d702017-09-01 12:17:03 -040050 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040051 skia_compile_processors = false
Adrienne Walker1df7cd82018-04-18 13:46:25 -070052 skia_generate_workarounds = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070053 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040054
Hal Canary2331c822018-02-01 14:06:13 -050055 skia_skqp_global_error_tolerance = 0
Ethan Nicholas26a9aad2018-03-27 14:10:52 -040056
57 skia_llvm_path = ""
58 skia_llvm_lib = "LLVM"
Hal Canaryfd9bcab2018-04-24 11:47:23 -040059
60 skia_tools_require_resources = false
mtkleinc04ff472016-06-23 10:29:30 -070061}
Brian Salomon23d73ea2016-10-27 13:31:37 -040062declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040063 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040064 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050065 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -050066 skia_enable_fontmgr_empty = false
Kevin Lubickddd0a332018-12-12 10:35:13 -050067 skia_enable_fontmgr_custom =
68 is_linux && skia_use_freetype && !skia_use_fontconfig
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -050069 skia_enable_fontmgr_custom_empty = is_fuchsia && skia_use_freetype
70 skia_enable_fontmgr_android = skia_use_expat && skia_use_freetype
Sergey Ulanovf3babcd2018-11-30 17:42:00 -080071 skia_enable_fontmgr_fuchsia = is_fuchsia
Leon Scroggins III631dbc82019-03-04 13:54:02 -050072 skia_enable_fontmgr_win = is_win
73 skia_enable_fontmgr_win_gdi = is_win
Mike Klein10d665d2016-11-01 11:46:10 -040074
Kevin Lubick27ba7032019-03-21 08:13:54 -040075 if (is_mac) {
76 skia_gl_standard = "gl"
77 } else if (is_ios) {
78 skia_gl_standard = "gles"
79 } else {
80 skia_gl_standard = ""
81 }
82
Mike Klein4d598a32016-10-31 13:44:49 -040083 if (is_android) {
84 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070085 } else if (is_fuchsia) {
86 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040087 } else {
Mike Klein98dea7b2019-01-15 11:26:43 -050088 skia_use_vulkan = defined(skia_moltenvk_path) && skia_moltenvk_path != ""
Mike Klein4d598a32016-10-31 13:44:49 -040089 }
Jim Van Verth4e502972017-12-07 15:16:10 -050090
91 if (is_ios) {
92 skia_ios_identity = ".*Google.*"
93 skia_ios_profile = "Google Development"
94 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040095}
Brian Salomon789e25e2016-09-30 13:41:03 -040096
Adam Barth54ef74a2017-10-13 10:59:38 -070097if (defined(skia_settings)) {
98 import(skia_settings)
99}
100
mtkleinc04ff472016-06-23 10:29:30 -0700101# Skia public API, generally provided by :skia.
102config("skia_public") {
Mike Klein9e25bb92019-04-29 09:46:36 -0500103 include_dirs = [ "." ]
104
Mike Kleinae7e6712016-10-11 17:49:33 -0400105 defines = []
106 if (is_component_build) {
107 defines += [ "SKIA_DLL" ]
108 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400109 if (is_fuchsia || is_linux) {
Mike Kleinf0a53692019-04-24 11:42:40 -0500110 defines += [ "SK_R32_SHIFT=16" ]
jcgregorio5561e3d2016-08-25 09:25:11 -0700111 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400112 if (skia_enable_flutter_defines) {
113 defines += flutter_defines
114 }
mtklein06c35c02016-09-20 12:28:12 -0700115 if (!skia_enable_gpu) {
116 defines += [ "SK_SUPPORT_GPU=0" ]
117 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500118 if (skia_enable_atlas_text) {
119 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
120 }
Mike Reed025f7832018-11-12 09:27:05 -0500121 if (is_fuchsia) {
122 defines += fuchsia_defines
123 }
Kevin Lubick27ba7032019-03-21 08:13:54 -0400124 if (skia_gl_standard == "gles") {
125 defines += [ "SK_ASSUME_GL_ES=1" ]
126 } else if (skia_gl_standard == "gl") {
127 defines += [ "SK_ASSUME_GL=1" ]
Kevin Lubick39026282019-03-28 12:46:40 -0400128 } else if (skia_gl_standard == "webgl") {
129 defines += [ "SK_ASSUME_WEBGL=1" ]
Kevin Lubick27ba7032019-03-21 08:13:54 -0400130 }
mtkleinc04ff472016-06-23 10:29:30 -0700131}
132
133# Skia internal APIs, used by Skia itself and a few test tools.
134config("skia_private") {
135 visibility = [ ":*" ]
136
Mike Reeda9e241d2017-05-03 10:52:00 -0400137 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -0500138 if (skia_use_fixed_gamma_text) {
mtkleinb37c0342016-09-09 11:07:45 -0700139 defines += [
140 "SK_GAMMA_EXPONENT=1.4",
141 "SK_GAMMA_CONTRAST=0.0",
142 ]
143 }
Mike Kleinb45d8622019-04-24 14:04:01 -0500144 if (is_skia_dev_build) {
145 defines += [
146 "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1",
147 "GR_TEST_UTILS=1",
148 ]
mtklein88a7ac02016-09-14 11:16:49 -0700149 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400150 libs = []
151 lib_dirs = []
Brian Osman34755e22016-12-05 09:46:02 -0500152 if (skia_use_angle) {
153 defines += [ "SK_ANGLE" ]
154 }
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400155 if (skia_llvm_path != "") {
156 defines += [ "SK_LLVM_AVAILABLE" ]
157 include_dirs += [ "$skia_llvm_path/include" ]
158 libs += [ skia_llvm_lib ]
159 lib_dirs += [ "$skia_llvm_path/lib/" ]
160 }
mtkleinc04ff472016-06-23 10:29:30 -0700161}
162
163# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
164config("skia_library") {
165 visibility = [ ":*" ]
Mike Kleinf5f4e812019-04-29 15:45:14 +0000166 defines = [ "SKIA_IMPLEMENTATION=1" ]
mtkleinc04ff472016-06-23 10:29:30 -0700167}
168
169skia_library_configs = [
170 ":skia_public",
171 ":skia_private",
172 ":skia_library",
173]
174
mtklein9b8583d2016-08-24 17:32:30 -0700175# Use for CPU-specific Skia code that needs particular compiler flags.
176template("opts") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500177 visibility = [ ":*" ]
mtklein9b8583d2016-08-24 17:32:30 -0700178 if (invoker.enabled) {
179 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500180 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700181 forward_variables_from(invoker, "*")
182 configs += skia_library_configs
183 }
184 } else {
185 # If not enabled, a phony empty target that swallows all otherwise unused variables.
186 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500187 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700188 forward_variables_from(invoker,
189 "*",
190 [
191 "sources",
192 "cflags",
193 ])
194 }
195 }
anmittala7eaf2e2016-08-17 13:57:26 -0700196}
197
mtklein422310d2016-08-16 18:28:43 -0700198is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700199
mtklein7d6fb2c2016-08-25 14:50:44 -0700200opts("none") {
201 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700202 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700203 cflags = []
204}
205
mtklein7d6fb2c2016-08-25 14:50:44 -0700206opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700207 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700208 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700209 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700210}
211
212opts("arm64") {
213 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700214 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700215 cflags = []
216}
217
218opts("crc32") {
219 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700220 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700221 cflags = [ "-march=armv8-a+crc" ]
222}
223
mtklein9b8583d2016-08-24 17:32:30 -0700224opts("sse2") {
225 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700226 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400227 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400228 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
229 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400230 cflags = [ "-msse2" ]
231 }
mtklein9b8583d2016-08-24 17:32:30 -0700232}
mtkleinc04ff472016-06-23 10:29:30 -0700233
mtklein9b8583d2016-08-24 17:32:30 -0700234opts("ssse3") {
235 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700236 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400237 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400238 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
239 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400240 cflags = [ "-mssse3" ]
241 }
mtklein9b8583d2016-08-24 17:32:30 -0700242}
mtkleinc04ff472016-06-23 10:29:30 -0700243
mtklein9b8583d2016-08-24 17:32:30 -0700244opts("sse41") {
245 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700246 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400247 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400248 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
249 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400250 cflags = [ "-msse4.1" ]
251 }
mtklein9b8583d2016-08-24 17:32:30 -0700252}
mtklein4e976072016-08-08 09:06:27 -0700253
mtklein9b8583d2016-08-24 17:32:30 -0700254opts("sse42") {
255 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700256 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400257 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400258 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
259 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400260 cflags = [ "-msse4.2" ]
261 }
mtklein9b8583d2016-08-24 17:32:30 -0700262}
263
264opts("avx") {
265 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700266 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400267 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000268 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400269 } else {
270 cflags = [ "-mavx" ]
271 }
mtkleinc04ff472016-06-23 10:29:30 -0700272}
273
Mike Klein1b9b7d52018-02-27 10:37:40 -0500274opts("hsw") {
275 enabled = is_x86
276 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400277 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500278 cflags = [ "/arch:AVX2" ]
279 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000280 cflags = [ "-march=haswell" ]
Mike Klein1b9b7d52018-02-27 10:37:40 -0500281 }
282
283 # Oddly, clang-cl doesn't recognize this as a valid flag.
284 # If it ever does, it'd nice to move this up with -mavx2 and co.
285 if (is_clang && !is_win) {
286 # This flag lets Clang generate FMAs when it sees a mul-then-add. It's optional,
287 # but nice to have, generating slightly better code for paths without explicit FMAs.
288 cflags += [ "-ffp-contract=fast" ]
289 }
290}
291
mtkleinc095df52016-08-24 12:23:52 -0700292# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700293template("optional") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500294 visibility = [ ":*" ]
mtklein457b42a2016-08-23 13:56:37 -0700295 if (invoker.enabled) {
296 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700297 if (defined(invoker.public_defines)) {
298 defines = invoker.public_defines
299 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600300 if (defined(invoker.public_configs)) {
301 configs = invoker.public_configs
302 }
mtklein457b42a2016-08-23 13:56:37 -0700303 }
304 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500305 check_includes = false
mtkleincd01b032016-08-31 04:58:19 -0700306 forward_variables_from(invoker,
307 "*",
308 [
309 "public_defines",
310 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700311 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700312 ])
mtklein457b42a2016-08-23 13:56:37 -0700313 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700314 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700315 if (defined(invoker.configs_to_remove)) {
316 configs -= invoker.configs_to_remove
317 }
mtklein457b42a2016-08-23 13:56:37 -0700318 }
319 } else {
mtklein457b42a2016-08-23 13:56:37 -0700320 source_set(target_name) {
321 forward_variables_from(invoker,
322 "*",
323 [
324 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400325 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700326 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700327 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700328 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700329 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700330 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700331 ])
mtkleincd01b032016-08-31 04:58:19 -0700332 if (defined(invoker.sources_when_disabled)) {
333 sources = invoker.sources_when_disabled
334 }
335 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700336 }
mtkleineb3c4252016-08-23 07:38:09 -0700337 }
mtklein457b42a2016-08-23 13:56:37 -0700338}
mtklein457b42a2016-08-23 13:56:37 -0700339
mtkleina45be612016-08-29 15:22:10 -0700340optional("fontmgr_android") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500341 enabled = skia_enable_fontmgr_android
mtkleina45be612016-08-29 15:22:10 -0700342
343 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500344 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700345 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700346 ]
347 sources = [
348 "src/ports/SkFontMgr_android.cpp",
349 "src/ports/SkFontMgr_android_factory.cpp",
350 "src/ports/SkFontMgr_android_parser.cpp",
351 ]
352}
353
mtkleind2e39db2016-09-07 07:52:55 -0700354optional("fontmgr_custom") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500355 enabled = skia_enable_fontmgr_custom
mtkleind2e39db2016-09-07 07:52:55 -0700356
357 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500358 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700359 ]
360 sources = [
361 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500362 "src/ports/SkFontMgr_custom.h",
363 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700364 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500365 "src/ports/SkFontMgr_custom_embedded.cpp",
366 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700367 ]
368}
369
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500370optional("fontmgr_custom_empty") {
371 enabled = skia_enable_fontmgr_custom_empty
Kevin Lubickddd0a332018-12-12 10:35:13 -0500372
373 deps = [
374 ":typeface_freetype",
375 ]
376 sources = [
377 "src/ports/SkFontMgr_custom.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500378 "src/ports/SkFontMgr_custom_empty.cpp",
379 "src/ports/SkFontMgr_custom_empty_factory.cpp",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800380 ]
381}
382
Hal Canaryff2742e2018-01-30 11:35:47 -0500383optional("fontmgr_empty") {
384 enabled = skia_enable_fontmgr_empty
385 sources = [
386 "src/ports/SkFontMgr_empty_factory.cpp",
387 ]
388}
389
mtklein3cc22182016-08-29 13:26:14 -0700390optional("fontmgr_fontconfig") {
391 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700392
393 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500394 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700395 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700396 ]
397 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700398 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700399 "src/ports/SkFontConfigInterface_direct.cpp",
400 "src/ports/SkFontConfigInterface_direct_factory.cpp",
401 "src/ports/SkFontMgr_FontConfigInterface.cpp",
402 "src/ports/SkFontMgr_fontconfig.cpp",
403 "src/ports/SkFontMgr_fontconfig_factory.cpp",
404 ]
405}
406
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500407optional("fontmgr_fuchsia") {
408 enabled = skia_enable_fontmgr_fuchsia
409
Chinmay Garde89820762019-05-06 16:44:06 -0700410 deps = []
411
412 if (is_fuchsia && using_fuchsia_sdk) {
413 deps += [ "$fuchsia_sdk_root/fidl:fuchsia.fonts" ]
414 } else {
415 deps += [ "//sdk/fidl/fuchsia.fonts" ]
416 }
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500417 sources = [
418 "src/ports/SkFontMgr_fuchsia.cpp",
419 "src/ports/SkFontMgr_fuchsia.h",
420 ]
421}
422
423optional("fontmgr_wasm") {
Kevin Lubick0e3342c2019-04-16 13:31:25 -0400424 enabled = !skia_enable_fontmgr_empty && target_cpu == "wasm"
mtkleincdedd0e2016-09-12 15:15:44 -0700425
426 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500427 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700428 ]
429 sources = [
430 "src/ports/SkFontMgr_custom.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500431 "src/ports/SkFontMgr_custom.h",
432 "src/ports/SkFontMgr_custom_embedded.cpp",
433 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700434 ]
435}
436
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500437optional("fontmgr_win") {
438 enabled = skia_enable_fontmgr_win
439
440 sources = [
441 "src/fonts/SkFontMgr_indirect.cpp",
442 "src/ports/SkFontMgr_win_dw.cpp",
443 "src/ports/SkFontMgr_win_dw_factory.cpp",
444 "src/ports/SkScalerContext_win_dw.cpp",
445 "src/ports/SkTypeface_win_dw.cpp",
446 ]
447}
448
449optional("fontmgr_win_gdi") {
450 enabled = skia_enable_fontmgr_win_gdi
451
452 sources = [
453 "src/ports/SkFontHost_win.cpp",
454 ]
455 libs = [ "Gdi32.lib" ]
456}
457
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700458if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400459 executable("sksllex") {
460 sources = [
461 "src/sksl/lex/Main.cpp",
462 "src/sksl/lex/NFA.cpp",
463 "src/sksl/lex/RegexNode.cpp",
464 "src/sksl/lex/RegexParser.cpp",
465 ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500466 include_dirs = [ "." ]
Ethan Nicholasca82a922017-09-07 09:39:50 -0400467 }
468
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700469 action("run_sksllex") {
470 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400471 deps = [
472 ":sksllex(//gn/toolchain:$host_toolchain)",
473 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700474 sources = [
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700475 "src/sksl/lex/sksl.lex",
476 ]
477
478 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
479 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
480 outputs = [
481 "$target_out_dir/" +
482 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
483 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
484 # confused due to the same file being named by two different paths
485 ]
486 sksllex_path = "$root_out_dir/"
487 sksllex_path += "sksllex"
488 if (host_os == "win") {
489 sksllex_path += ".exe"
490 }
491 args = [
492 rebase_path(sksllex_path),
493 rebase_path("bin/clang-format"),
494 rebase_path("src"),
495 ]
496 }
497} else {
498 group("run_sksllex") {
499 }
500}
501
502if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400503 executable("skslc") {
504 defines = [ "SKSL_STANDALONE" ]
505 sources = [
506 "src/sksl/SkSLMain.cpp",
507 ]
508 sources += skia_sksl_sources
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500509 include_dirs = [ "." ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400510 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500511 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400512 "//third_party/spirv-tools",
513 ]
514 }
515
516 skia_gpu_processor_outputs = []
517 foreach(src, skia_gpu_processor_sources) {
518 dir = get_path_info(src, "dir")
519 name = get_path_info(src, "name")
520
521 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
522 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
523 skia_gpu_processor_outputs += [
524 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
525 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
526 # confused due to the same file being named by two different paths
527 ]
528 }
529
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500530 action("create_sksl_enums") {
531 script = "gn/create_sksl_enums.py"
532 sources = [
533 "include/private/GrSharedEnums.h",
534 ]
535 outputs = [
536 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500537 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500538 ]
539 args = [
540 rebase_path(sources[0]),
541 rebase_path(outputs[0]),
542 ]
543 }
544
Ethan Nicholas762466e2017-06-29 10:03:38 -0400545 action("compile_processors") {
546 script = "gn/compile_processors.py"
547 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500548 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400549 ":skslc(//gn/toolchain:$host_toolchain)",
550 ]
551 sources = skia_gpu_processor_sources
552 outputs = skia_gpu_processor_outputs
553 skslc_path = "$root_out_dir/"
554 if (host_toolchain != default_toolchain_name) {
555 skslc_path += "$host_toolchain/"
556 }
557 skslc_path += "skslc"
558 if (host_os == "win") {
559 skslc_path += ".exe"
560 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400561 args = [
562 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400563 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400564 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400565 args += rebase_path(skia_gpu_processor_sources)
566 }
567} else {
568 skia_gpu_processor_outputs = []
569 group("compile_processors") {
570 }
571}
572
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500573optional("gpu") {
mtklein06c35c02016-09-20 12:28:12 -0700574 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400575 deps = [
576 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700577 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400578 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700579 if (skia_generate_workarounds) {
580 deps += [ ":workaround_list" ]
581 }
Robert Phillipsefb9f142019-05-17 14:19:44 -0400582 public_defines = [ "SK_GL" ]
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600583 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400584 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700585
Brian Salomon3d6801e2017-12-11 10:06:31 -0500586 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400587 if (!skia_enable_ccpr) {
588 sources -= skia_ccpr_sources
589 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
590 }
Kevin Lubick4bf2c262018-10-15 09:35:54 -0400591 if (!skia_enable_nvpr) {
592 sources -= skia_nvpr_sources
593 sources += [ "src/gpu/GrPathRendering_none.cpp" ]
594 }
mtklein06c35c02016-09-20 12:28:12 -0700595
596 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500597 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700598 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400599 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700600 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400601 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400602
603 # this lib is required to link against AHardwareBuffer
604 if (defined(ndk_api) && ndk_api >= 26) {
605 libs += [ "android" ]
606 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400607 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500608 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400609 libs += [ "EGL" ]
Chinmay Garded92d0352018-09-17 10:23:28 -0700610 } else if (is_linux && skia_use_x11) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500611 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -0400612 libs += [ "GL" ]
mtklein06c35c02016-09-20 12:28:12 -0700613 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500614 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800615 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500616 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400617 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500618 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -0500619 if (target_cpu != "arm64") {
620 libs += [ "OpenGL32.lib" ]
621 }
mtklein06c35c02016-09-20 12:28:12 -0700622 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500623 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700624 }
mtkleine9fb3d52016-09-20 15:11:46 -0700625
626 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400627 public_defines += [ "SK_VULKAN" ]
Greg Daniel18dbfd02018-05-29 10:46:51 -0400628 deps += [ "third_party/vulkanmemoryallocator" ]
mtkleine9fb3d52016-09-20 15:11:46 -0700629 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700630 if (skia_enable_vulkan_debug_layers) {
631 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
632 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800633 if (is_fuchsia) {
Chinmay Garde89820762019-05-06 16:44:06 -0700634 if (using_fuchsia_sdk) {
635 public_deps += [ "$fuchsia_sdk_root/pkg:vulkan" ]
636 } else {
637 public_deps +=
638 [ "//third_party/vulkan_loader_and_validation_layers:vulkan" ]
639 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800640 }
mtkleine9fb3d52016-09-20 15:11:46 -0700641 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400642
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400643 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400644 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400645 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
646 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400647
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400648 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400649 if (skia_use_metal) {
650 public_defines += [ "SK_METAL" ]
651 sources += skia_metal_sources
652 libs += [ "Metal.framework" ]
Greg Daniel53956d92018-08-08 14:41:19 -0400653 libs += [ "Foundation.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400654 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400655 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500656
657 if (skia_enable_atlas_text) {
658 sources += skia_atlas_text_sources
659 }
Kevin Lubickf4def342018-10-04 12:52:50 -0400660
661 if (is_debug) {
662 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
663 }
mtklein06c35c02016-09-20 12:28:12 -0700664}
665
Leon Scroggins III41169202019-01-29 09:29:57 -0500666optional("gif") {
667 enabled = !skia_use_wuffs
668 sources = [
669 "src/codec/SkGifCodec.cpp",
670 "third_party/gif/SkGifImageReader.cpp",
671 ]
672}
673
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400674optional("heif") {
675 enabled = skia_use_libheif
676 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
677
678 deps = []
679
680 sources = [
681 "src/codec/SkHeifCodec.cpp",
682 ]
683}
684
mtklein63213812016-08-24 09:55:56 -0700685optional("jpeg") {
686 enabled = skia_use_libjpeg_turbo
687 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
688
mtklein63213812016-08-24 09:55:56 -0700689 deps = [
690 "//third_party/libjpeg-turbo:libjpeg",
691 ]
Mike Kleinf105dc72018-06-05 15:22:54 -0400692 public = [
693 "include/encode/SkJpegEncoder.h",
694 ]
mtklein63213812016-08-24 09:55:56 -0700695 sources = [
696 "src/codec/SkJpegCodec.cpp",
697 "src/codec/SkJpegDecoderMgr.cpp",
698 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700699 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400700 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700701 ]
702}
703
704optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500705 enabled = skia_use_zlib && skia_enable_pdf
706 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700707
mtklein63213812016-08-24 09:55:56 -0700708 deps = [
709 "//third_party/zlib",
710 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400711 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700712 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400713 }
brettwb9447282016-09-01 14:24:39 -0700714 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700715 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
Hal Canary2a3093c2019-02-20 11:25:45 -0500716 if (skia_use_icu && skia_use_harfbuzz && skia_pdf_subset_harfbuzz) {
717 deps += [ "//third_party/harfbuzz" ]
718 defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ]
719 } else if (skia_use_icu && skia_use_sfntly) {
mtklein63213812016-08-24 09:55:56 -0700720 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -0500721 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700722 }
723}
724
725optional("png") {
726 enabled = skia_use_libpng
727 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
728
mtklein63213812016-08-24 09:55:56 -0700729 deps = [
730 "//third_party/libpng",
731 ]
732 sources = [
733 "src/codec/SkIcoCodec.cpp",
734 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400735 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700736 ]
737}
738
scroggof84ad642016-10-31 09:02:57 -0700739optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400740 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700741 public_defines = [ "SK_CODEC_DECODES_RAW" ]
742
743 deps = [
744 "//third_party/dng_sdk",
745 "//third_party/libjpeg-turbo:libjpeg",
746 "//third_party/piex",
747 ]
748
749 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
750 # Skia.
751 configs_to_remove = [ "//gn:no_exceptions" ]
752
753 sources = [
scroggof84ad642016-10-31 09:02:57 -0700754 "src/codec/SkRawCodec.cpp",
755 ]
756}
757
Mike Klein852a8cb2018-05-15 10:46:58 -0400758import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400759source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400760 cflags = []
761 if (!is_win || is_clang) {
762 cflags += [
763 "-w",
764 "-std=c11",
765 ]
766 }
767
768 public = [
Brian Osmanea236bf2019-04-29 10:28:22 -0400769 "include/third_party/skcms/skcms.h",
Mike Klein852a8cb2018-05-15 10:46:58 -0400770 ]
Brian Osmanea236bf2019-04-29 10:28:22 -0400771 include_dirs = [ "include/third_party/skcms" ]
Mike Klein852a8cb2018-05-15 10:46:58 -0400772 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
773}
774
mtklein3cc22182016-08-29 13:26:14 -0700775optional("typeface_freetype") {
776 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700777
778 deps = [
779 "//third_party/freetype2",
780 ]
781 sources = [
782 "src/ports/SkFontHost_FreeType.cpp",
783 "src/ports/SkFontHost_FreeType_common.cpp",
784 ]
785}
786
mtklein457b42a2016-08-23 13:56:37 -0700787optional("webp") {
788 enabled = skia_use_libwebp
789 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
790
mtklein457b42a2016-08-23 13:56:37 -0700791 deps = [
792 "//third_party/libwebp",
793 ]
794 sources = [
mtklein457b42a2016-08-23 13:56:37 -0700795 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400796 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700797 ]
mtkleineb3c4252016-08-23 07:38:09 -0700798}
799
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400800optional("wuffs") {
801 enabled = skia_use_wuffs
802 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
803
804 deps = [
805 "//third_party/wuffs",
806 ]
807 sources = [
808 "src/codec/SkWuffsCodec.cpp",
809 ]
810}
811
mtklein63213812016-08-24 09:55:56 -0700812optional("xml") {
813 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000814 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700815
mtklein63213812016-08-24 09:55:56 -0700816 deps = [
817 "//third_party/expat",
818 ]
819 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500820 "src/svg/SkSVGCanvas.cpp",
821 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700822 "src/xml/SkDOM.cpp",
823 "src/xml/SkXMLParser.cpp",
824 "src/xml/SkXMLWriter.cpp",
825 ]
826}
827
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700828if (skia_enable_gpu && skia_generate_workarounds) {
829 action("workaround_list") {
830 script = "tools/build_workaround_header.py"
831
832 inputs = [
833 "src/gpu/gpu_workaround_list.txt",
834 ]
835
836 # see comments in skia_compile_processors about out dir path shenanigans.
837 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700838 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700839
840 outputs = [
841 "$root_out_dir/$output_file",
842 ]
843 args = [
844 "--output-file",
845 "$output_file",
846 ]
847
848 foreach(file, inputs) {
849 args += [ rebase_path(file, root_build_dir) ]
850 }
851 }
852}
853
mtkleinc04ff472016-06-23 10:29:30 -0700854component("skia") {
855 public_configs = [ ":skia_public" ]
856 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700857
Mike Klein607b0a72018-11-07 16:17:34 -0500858 public_deps = [
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500859 ":gpu",
Mike Klein607b0a72018-11-07 16:17:34 -0500860 ":pdf",
861 ":skcms",
862 ]
863
mtkleinc04ff472016-06-23 10:29:30 -0700864 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700865 ":arm64",
866 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700867 ":avx",
Mike Klein54378232018-11-08 12:08:05 +0000868 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -0700869 ":crc32",
mtkleina45be612016-08-29 15:22:10 -0700870 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700871 ":fontmgr_custom",
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500872 ":fontmgr_custom_empty",
Hal Canaryff2742e2018-01-30 11:35:47 -0500873 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700874 ":fontmgr_fontconfig",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800875 ":fontmgr_fuchsia",
Kevin Lubickddd0a332018-12-12 10:35:13 -0500876 ":fontmgr_wasm",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500877 ":fontmgr_win",
878 ":fontmgr_win_gdi",
Leon Scroggins III41169202019-01-29 09:29:57 -0500879 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400880 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500881 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700882 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700883 ":none",
mtklein63213812016-08-24 09:55:56 -0700884 ":png",
scroggof84ad642016-10-31 09:02:57 -0700885 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700886 ":sse2",
887 ":sse41",
888 ":sse42",
889 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700890 ":webp",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400891 ":wuffs",
mtklein63213812016-08-24 09:55:56 -0700892 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700893 ]
894
Chinmay Garde43f115c2016-11-16 15:04:12 -0800895 # This file (and all GN files in Skia) are designed to work with an
896 # empty sources assignment filter; we handle all that explicitly.
897 # We clear the filter here for clients who may have set up a global filter.
898 set_sources_assignment_filter([])
899
Hal Canaryc25f4e92019-02-26 11:54:25 -0500900 public = skia_core_public
901 public += skia_utils_public
902 public += skia_effects_public
903 public += skia_effects_imagefilter_public
904 public += skia_xps_public
905
mtkleinc04ff472016-06-23 10:29:30 -0700906 sources = []
brettwb9447282016-09-01 14:24:39 -0700907 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700908 sources += skia_utils_sources
Leon Scroggins IIIee0e5d02019-02-27 10:59:11 -0500909 if (skia_use_xps) {
910 sources += skia_xps_sources
911 }
Mike Klein54378232018-11-08 12:08:05 +0000912 sources += skia_effects_sources
913 sources += skia_effects_imagefilter_sources
mtkleinc04ff472016-06-23 10:29:30 -0700914 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400915 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500916 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700917 "src/android/SkBitmapRegionCodec.cpp",
918 "src/android/SkBitmapRegionDecoder.cpp",
919 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +1100920 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400921 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700922 "src/codec/SkBmpCodec.cpp",
923 "src/codec/SkBmpMaskCodec.cpp",
924 "src/codec/SkBmpRLECodec.cpp",
925 "src/codec/SkBmpStandardCodec.cpp",
926 "src/codec/SkCodec.cpp",
927 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -0400928 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -0400929 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700930 "src/codec/SkMaskSwizzler.cpp",
931 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700932 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700933 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700934 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700935 "src/codec/SkSwizzler.cpp",
936 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700937 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700938 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +0000939 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700940 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700941 "src/ports/SkMemory_malloc.cpp",
942 "src/ports/SkOSFile_stdio.cpp",
943 "src/sfnt/SkOTTable_name.cpp",
944 "src/sfnt/SkOTUtils.cpp",
945 "src/utils/mac/SkStream_mac.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700946 ]
brettwb9447282016-09-01 14:24:39 -0700947
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400948 defines = []
949 if (!skia_enable_skpicture) {
950 defines = [ "SK_DISABLE_SKPICTURE" ]
Hal Canaryc25f4e92019-02-26 11:54:25 -0500951 public -= skia_skpicture_public
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400952 sources -= skia_skpicture_sources
Mike Klein54378232018-11-08 12:08:05 +0000953 sources -= [ "//src/effects/imagefilters/SkPictureImageFilter.cpp" ]
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400954 sources += [ "src/core/SkPicture_none.cpp" ]
955 }
956
mtklein7d6fb2c2016-08-25 14:50:44 -0700957 libs = []
958
mtkleinc04ff472016-06-23 10:29:30 -0700959 if (is_win) {
960 sources += [
961 "src/ports/SkDebug_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700962 "src/ports/SkImageEncoder_WIC.cpp",
963 "src/ports/SkImageGeneratorWIC.cpp",
964 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700965 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700966 "src/ports/SkTLS_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700967 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400968 libs += [
969 "FontSub.lib",
970 "Ole32.lib",
971 "OleAut32.lib",
972 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500973 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400974 ]
mtkleinc04ff472016-06-23 10:29:30 -0700975 } else {
976 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700977 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700978 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700979 "src/ports/SkTLS_pthread.cpp",
980 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400981 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700982 }
983
mtklein7d6fb2c2016-08-25 14:50:44 -0700984 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500985 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500986 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500987 deps += [ "//third_party/cpu-features" ]
988 }
mtklein06c35c02016-09-20 12:28:12 -0700989 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700990 libs += [
991 "EGL",
992 "GLESv2",
993 "log",
994 ]
995 }
996
Kevin Lubick217056c2018-09-20 17:39:31 -0400997 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -0700998 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -0400999 if (skia_use_egl) {
1000 libs += [ "GLESv2" ]
1001 }
mtkleinc04ff472016-06-23 10:29:30 -07001002 }
1003
Leon Scroggins III85e22fc2018-11-28 08:58:47 -05001004 if (skia_use_fonthost_mac) {
Sergey Ulanovf3babcd2018-11-30 17:42:00 -08001005 sources += [ "src/ports/SkFontHost_mac.cpp" ]
Leon Scroggins III85e22fc2018-11-28 08:58:47 -05001006 }
1007
mtkleinc04ff472016-06-23 10:29:30 -07001008 if (is_mac) {
1009 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001010 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001011 "src/ports/SkImageEncoder_CG.cpp",
1012 "src/ports/SkImageGeneratorCG.cpp",
1013 ]
mtklein09e61f72016-08-23 13:35:28 -07001014 libs += [
bungeman3e306f62017-03-29 11:32:02 -04001015 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
1016 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -07001017 "ApplicationServices.framework",
1018 "OpenGL.framework",
1019 ]
mtkleinc04ff472016-06-23 10:29:30 -07001020 }
abarth6fc8ff02016-07-15 15:15:15 -07001021
Mike Klein7d302882016-11-03 14:06:31 -04001022 if (is_ios) {
1023 sources += [
1024 "src/ports/SkDebug_stdio.cpp",
1025 "src/ports/SkFontHost_mac.cpp",
1026 "src/ports/SkImageEncoder_CG.cpp",
1027 "src/ports/SkImageGeneratorCG.cpp",
1028 ]
1029 libs += [
1030 "CoreFoundation.framework",
1031 "CoreGraphics.framework",
1032 "CoreText.framework",
1033 "ImageIO.framework",
1034 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -04001035
1036 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
1037 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001038 ]
1039 }
1040
abarth6fc8ff02016-07-15 15:15:15 -07001041 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001042 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001043 }
mtkleinc04ff472016-06-23 10:29:30 -07001044}
1045
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001046# DebugCanvas used in experimental/wasm-skp-debugger
1047if (target_cpu == "wasm") {
1048 static_library("debugcanvas") {
1049 public_configs = [ ":skia_public" ]
1050
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001051 sources = [
1052 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001053 "tools/debugger/DebugCanvas.cpp",
1054 "tools/debugger/DrawCommand.cpp",
1055 "tools/debugger/JsonWriteBuffer.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001056 ]
1057
1058 deps = [
1059 ":fontmgr_wasm",
1060 ]
1061 }
1062}
1063
Kevin Lubickcbcff382018-10-02 09:02:18 -04001064static_library("pathkit") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001065 check_includes = false
Kevin Lubickcbcff382018-10-02 09:02:18 -04001066 public_configs = [ ":skia_public" ]
1067 configs += skia_library_configs
1068
1069 deps = [
1070 ":arm64",
1071 ":armv7",
1072 ":avx",
1073 ":crc32",
1074 ":hsw",
1075 ":none",
1076 ":sse2",
1077 ":sse41",
1078 ":sse42",
1079 ":ssse3",
1080 ]
1081
1082 # This file (and all GN files in Skia) are designed to work with an
1083 # empty sources assignment filter; we handle all that explicitly.
1084 # We clear the filter here for clients who may have set up a global filter.
1085 set_sources_assignment_filter([])
1086
1087 sources = []
1088 sources += skia_pathops_sources
Hal Canaryc25f4e92019-02-26 11:54:25 -05001089 sources += skia_pathops_public
Kevin Lubickcbcff382018-10-02 09:02:18 -04001090 sources += [
1091 "src/core/SkAnalyticEdge.cpp",
1092 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001093 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001094 "src/core/SkCubicMap.cpp",
1095 "src/core/SkEdge.cpp",
1096 "src/core/SkEdgeBuilder.cpp",
1097 "src/core/SkEdgeClipper.cpp",
1098 "src/core/SkGeometry.cpp",
1099 "src/core/SkLineClipper.cpp",
1100 "src/core/SkMallocPixelRef.cpp",
1101 "src/core/SkMath.cpp",
1102 "src/core/SkMatrix.cpp",
1103 "src/core/SkOpts.cpp",
1104 "src/core/SkPaint.cpp",
1105 "src/core/SkPath.cpp",
1106 "src/core/SkPathEffect.cpp",
1107 "src/core/SkPathMeasure.cpp",
1108 "src/core/SkPathRef.cpp",
1109 "src/core/SkPoint.cpp",
1110 "src/core/SkRRect.cpp",
1111 "src/core/SkRect.cpp",
1112 "src/core/SkSemaphore.cpp",
1113 "src/core/SkStream.cpp",
1114 "src/core/SkString.cpp",
1115 "src/core/SkStringUtils.cpp",
1116 "src/core/SkStroke.cpp",
1117 "src/core/SkStrokeRec.cpp",
1118 "src/core/SkStrokerPriv.cpp",
1119 "src/core/SkThreadID.cpp",
1120 "src/core/SkUtils.cpp",
1121 "src/effects/SkDashPathEffect.cpp",
1122 "src/effects/SkTrimPathEffect.cpp",
1123 "src/ports/SkDebug_stdio.cpp",
1124 "src/ports/SkMemory_malloc.cpp",
1125 "src/utils/SkDashPath.cpp",
1126 "src/utils/SkParse.cpp",
1127 "src/utils/SkParsePath.cpp",
1128 "src/utils/SkUTF.cpp",
1129 ]
1130}
1131
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001132group("modules") {
1133 deps = [
Kevin Lubick96634842019-03-05 14:09:24 -05001134 "modules/particles",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001135 "modules/skottie",
1136 "modules/skshaper",
1137 ]
1138}
1139
mtkleinc095df52016-08-24 12:23:52 -07001140# Targets guarded by skia_enable_tools may use //third_party freely.
1141if (skia_enable_tools) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001142 skia_public_includes = [
1143 "include/android",
1144 "include/atlastext",
1145 "include/c",
1146 "include/codec",
1147 "include/config",
1148 "include/core",
1149 "include/docs",
1150 "include/effects",
1151 "include/encode",
1152 "include/gpu",
1153 "include/pathops",
1154 "include/ports",
1155 "include/svg",
1156 "include/utils",
1157 "include/utils/mac",
1158 "modules/sksg/include",
1159 "modules/skshaper/include",
1160 "modules/skottie/include",
1161 ]
1162
Mike Klein308b5ac2016-12-06 16:03:52 -05001163 # Used by gn_to_bp.py to list our public include dirs.
1164 source_set("public") {
1165 configs += [ ":skia_public" ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001166 include_dirs = skia_public_includes
Mike Klein308b5ac2016-12-06 16:03:52 -05001167 }
1168
Mike Kleinc36dedf2016-11-18 09:35:28 -05001169 config("skia.h_config") {
1170 include_dirs = [ "$target_gen_dir" ]
1171 }
1172 action("skia.h") {
1173 public_configs = [ ":skia.h_config" ]
1174 skia_h = "$target_gen_dir/skia.h"
1175 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001176
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001177 args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1178 [ rebase_path(skia_h, root_build_dir) ] +
1179 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001180 depfile = "$skia_h.deps"
1181 outputs = [
1182 skia_h,
1183 ]
1184 }
1185
Brian Osmanc9a42472018-05-31 13:17:12 -04001186 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001187 executable("fiddle") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001188 check_includes = false
Mike Kleinc36dedf2016-11-18 09:35:28 -05001189 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001190 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001191 "tools/fiddle/draw.cpp",
1192 "tools/fiddle/fiddle_main.cpp",
1193 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001194
1195 if (skia_use_egl) {
1196 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001197 } else {
1198 sources += [ "tools/fiddle/null_context.cpp" ]
1199 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001200 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001201 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001202 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001203 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001204 ":skia",
1205 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001206 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001207 "modules/skshaper",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001208 ]
1209 }
1210 }
1211
Mike Klein9e25bb92019-04-29 09:46:36 -05001212 config("our_vulkan_headers") {
1213 # We add this directory to simulate the client already have
1214 # vulkan/vulkan_core.h on their path.
1215 include_dirs = [ "include/third_party/vulkan" ]
1216 }
1217
Brian Osmanc9a42472018-05-31 13:17:12 -04001218 source_set("public_headers_warnings_check") {
1219 sources = [
1220 "tools/public_headers_warnings_check.cpp",
1221 ]
1222 configs -= [ "//gn:warnings_except_public_headers" ]
Mike Klein9e25bb92019-04-29 09:46:36 -05001223 configs += [ ":our_vulkan_headers" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001224 deps = [
1225 ":skia",
1226 ":skia.h",
1227 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001228 "modules/skshaper",
Brian Osmanc9a42472018-05-31 13:17:12 -04001229 ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001230 }
1231
mtkleinc095df52016-08-24 12:23:52 -07001232 template("test_lib") {
1233 config(target_name + "_config") {
mtkleina627b5c2016-09-20 13:36:47 -07001234 if (defined(invoker.public_defines)) {
1235 defines = invoker.public_defines
1236 }
mtklein25c81d42016-07-27 13:55:26 -07001237 }
mtkleinc095df52016-08-24 12:23:52 -07001238 source_set(target_name) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001239 forward_variables_from(invoker, "*", [])
Hal Canaryc25f4e92019-02-26 11:54:25 -05001240 check_includes = false
mtkleinc095df52016-08-24 12:23:52 -07001241 public_configs = [
1242 ":" + target_name + "_config",
1243 ":skia_private",
1244 ]
1245
1246 if (!defined(deps)) {
1247 deps = []
1248 }
1249 deps += [ ":skia" ]
1250 testonly = true
1251 }
mtklein25c81d42016-07-27 13:55:26 -07001252 }
mtklein25c81d42016-07-27 13:55:26 -07001253
Mike Kleine6682eb2017-01-05 10:54:57 -05001254 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001255 if (is_ios) {
1256 app_name = target_name
1257 gen_path = target_gen_dir
1258
1259 action("${app_name}_generate_info_plist") {
1260 script = "//gn/gen_plist_ios.py"
1261 outputs = [
1262 "$gen_path/${app_name}_Info.plist",
1263 ]
1264 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1265 }
1266
1267 bundle_data("${app_name}_bundle_info_plist") {
1268 public_deps = [
1269 ":${app_name}_generate_info_plist",
1270 ]
1271 sources = [
1272 "$gen_path/${app_name}_Info.plist",
1273 ]
1274 outputs = [
1275 "{{bundle_root_dir}}/Info.plist",
1276 ]
1277 }
1278
Jim Van Verthffacf652019-04-02 11:59:34 -04001279 has_skps = "True" == exec_script("//gn/checkdir.py",
1280 [ rebase_path("skps", root_build_dir) ],
1281 "trim string")
1282 bundle_data("${app_name}_bundle_resources") {
1283 sources = [
1284 "resources",
1285 ]
1286 outputs = [
1287 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1288 "{{bundle_resources_dir}}/data/resources",
1289 ]
1290 }
1291 if (has_skps) {
1292 bundle_data("${app_name}_bundle_skps") {
Jim Van Verth329c5a62017-11-29 11:42:33 -05001293 sources = [
Jim Van Verthffacf652019-04-02 11:59:34 -04001294 "skps",
Jim Van Verth329c5a62017-11-29 11:42:33 -05001295 ]
1296 outputs = [
Jim Van Verthffacf652019-04-02 11:59:34 -04001297 # Store in same folder as resources
1298 "{{bundle_resources_dir}}/data/skps",
Jim Van Verth329c5a62017-11-29 11:42:33 -05001299 ]
1300 }
Jim Van Verth329c5a62017-11-29 11:42:33 -05001301 }
1302
Jim Van Verth443a9132017-11-28 09:45:26 -05001303 executable("${app_name}_generate_executable") {
1304 forward_variables_from(invoker,
1305 "*",
1306 [
1307 "output_name",
1308 "visibility",
1309 "is_shared_library",
1310 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001311 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001312 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001313 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1314 }
1315
1316 bundle_data("${app_name}_bundle_executable") {
1317 public_deps = [
1318 ":${app_name}_generate_executable",
1319 ]
1320 sources = [
1321 "$gen_path/$app_name",
1322 ]
1323 outputs = [
1324 "{{bundle_executable_dir}}/$app_name",
1325 ]
1326 testonly = true
1327 }
1328
Jim Van Verthffacf652019-04-02 11:59:34 -04001329 bundle_data("${app_name}_bundle_symbols") {
1330 public_deps = [
1331 ":${app_name}_generate_executable",
1332 ]
1333 sources = [
1334 "$gen_path/${app_name}.dSYM",
1335 ]
1336 outputs = [
1337 "{{bundle_executable_dir}}/${app_name}.dSYM",
1338 ]
1339 testonly = true
1340 }
1341
Jim Van Verth443a9132017-11-28 09:45:26 -05001342 create_bundle("$app_name") {
1343 product_type = "com.apple.product-type.application"
1344 testonly = true
1345
1346 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1347 bundle_resources_dir = bundle_root_dir
1348 bundle_executable_dir = bundle_root_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001349
1350 deps = [
1351 ":${app_name}_bundle_executable",
1352 ":${app_name}_bundle_info_plist",
Jim Van Verthffacf652019-04-02 11:59:34 -04001353 ":${app_name}_bundle_resources",
1354 ":${app_name}_bundle_symbols",
Jim Van Verth443a9132017-11-28 09:45:26 -05001355 ]
Jim Van Verthffacf652019-04-02 11:59:34 -04001356 if (has_skps) {
1357 deps += [ ":${app_name}_bundle_skps" ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001358 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001359
1360 # should only code sign when running on a device, not the simulator
1361 if (target_cpu != "x64") {
1362 code_signing_script = "//gn/codesign_ios.py"
1363 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1364 code_signing_outputs = [
1365 "$bundle_root_dir/_CodeSignature/CodeResources",
1366 "$bundle_root_dir/embedded.mobileprovision",
1367 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001368 code_signing_args = [
1369 rebase_path("$bundle_root_dir", root_build_dir),
1370 skia_ios_identity,
1371 skia_ios_profile,
1372 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001373 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001374 }
1375 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001376 # !is_ios
1377
1378 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1379 shared_library("lib" + target_name) {
1380 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1381 configs += [ ":skia_private" ]
1382 testonly = true
1383 }
1384 } else {
1385 _executable = target_name
1386 executable(_executable) {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001387 check_includes = false
Jim Van Verth443a9132017-11-28 09:45:26 -05001388 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1389 configs += [ ":skia_private" ]
1390 testonly = true
1391 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001392 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001393 if (is_android && skia_android_serial != "" && defined(_executable)) {
1394 action("push_" + target_name) {
1395 script = "gn/push_to_android.py"
1396 deps = [
1397 ":" + _executable,
1398 ]
1399 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1400 outputs = [
1401 _stamp,
1402 ]
1403 args = [
1404 rebase_path("$root_build_dir/$_executable"),
1405 skia_android_serial,
1406 rebase_path(_stamp),
1407 ]
1408 testonly = true
1409 }
Mike Klein7d921032017-01-05 12:20:41 -05001410 }
1411 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001412 }
1413
Greg Danielda16cce2018-08-01 09:23:57 -04001414 config("moltenvk_config") {
1415 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1416 if (is_ios) {
1417 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS"
1418 } else {
1419 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS"
1420 }
1421 cflags = [ "-F$moltenvk_framework_path" ]
1422 ldflags = [ "-F$moltenvk_framework_path" ]
1423 libs = [
1424 "MoltenVK.framework",
1425 "Metal.framework",
1426 "IOSurface.framework",
1427 "QuartzCore.framework",
1428 "Foundation.framework",
1429 ]
1430 if (is_ios) {
1431 libs += [ "UIKit.framework" ]
1432 } else {
1433 libs += [ "IOKit.framework" ]
1434 }
1435 defines = [ "SK_MOLTENVK" ]
1436 }
1437 }
1438
1439 source_set("moltenvk") {
1440 public_configs = [ ":moltenvk_config" ]
1441 }
1442
mtkleinc095df52016-08-24 12:23:52 -07001443 test_lib("gpu_tool_utils") {
Brian Osmanc9a42472018-05-31 13:17:12 -04001444 public_defines = []
mtkleind68f9b02016-09-23 13:18:41 -07001445
Mike Klein9e25bb92019-04-29 09:46:36 -05001446 # Bots and even devs may not have Vulkan headers, so put
1447 # include/third_party/vulkan on our path so they're always available.
1448 all_dependent_configs = [ ":our_vulkan_headers" ]
1449
Mike Klein333fb452019-04-24 08:48:11 -05001450 defines = []
1451 if (skia_enable_discrete_gpu) {
1452 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
1453 }
1454
Brian Osmanc9a42472018-05-31 13:17:12 -04001455 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001456 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001457 sources = [
1458 "tools/gpu/GrContextFactory.cpp",
1459 "tools/gpu/GrTest.cpp",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001460 "tools/gpu/MemoryCache.cpp",
1461 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001462 "tools/gpu/ProxyUtils.cpp",
1463 "tools/gpu/TestContext.cpp",
Michael Ludwigd9958f82019-03-21 13:08:36 -04001464 "tools/gpu/YUVUtils.cpp",
1465 "tools/gpu/YUVUtils.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001466 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1467 "tools/gpu/gl/GLTestContext.cpp",
1468 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04001469 "tools/gpu/mock/MockTestContext.cpp",
1470 ]
1471 libs = []
1472
1473 if (is_android || skia_use_egl) {
1474 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1475 } else if (is_ios) {
1476 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1477 libs += [ "OpenGLES.framework" ]
1478 } else if (is_linux) {
1479 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -04001480 libs += [
1481 "GLU",
1482 "X11",
1483 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001484 } else if (is_mac) {
1485 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1486 } else if (is_win) {
1487 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001488 libs += [ "Gdi32.lib" ]
1489 if (target_cpu != "arm64") {
1490 libs += [ "OpenGL32.lib" ]
1491 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001492 }
mtklein25c81d42016-07-27 13:55:26 -07001493
Brian Osmanc9a42472018-05-31 13:17:12 -04001494 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001495
Brian Osmanc9a42472018-05-31 13:17:12 -04001496 if (skia_use_angle) {
1497 deps += [ "//third_party/angle2" ]
1498 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1499 }
Greg Daniel54200e42018-12-11 17:03:39 -05001500
Brian Osmanc9a42472018-05-31 13:17:12 -04001501 if (skia_use_vulkan) {
1502 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1503 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Greg Danielda16cce2018-08-01 09:23:57 -04001504 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1505 public_deps += [ ":moltenvk" ]
1506 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001507 }
1508 if (skia_use_metal) {
1509 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001510 }
mtklein25c81d42016-07-27 13:55:26 -07001511 }
mtklein25c81d42016-07-27 13:55:26 -07001512
mtkleinc095df52016-08-24 12:23:52 -07001513 test_lib("flags") {
mtkleinc095df52016-08-24 12:23:52 -07001514 sources = [
Mike Klein88544fb2019-03-20 10:50:33 -05001515 "tools/flags/CommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001516 ]
1517 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001518
1519 test_lib("common_flags_config") {
mtklein046cb562016-09-16 10:23:12 -07001520 sources = [
Mike Klein88544fb2019-03-20 10:50:33 -05001521 "tools/flags/CommonFlagsConfig.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001522 ]
1523 deps = [
mtklein046cb562016-09-16 10:23:12 -07001524 ":flags",
Greg Danielda16cce2018-08-01 09:23:57 -04001525 ]
1526 public_deps = [
mtkleinc095df52016-08-24 12:23:52 -07001527 ":gpu_tool_utils",
1528 ]
1529 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001530 test_lib("common_flags_gpu") {
Mike Kleinc6142d82019-03-25 10:54:59 -05001531 sources = [
1532 "tools/flags/CommonFlagsGpu.cpp",
1533 ]
1534 deps = [
1535 ":flags",
1536 ]
1537 public_deps = [
1538 ":gpu_tool_utils",
1539 ]
1540 }
1541 test_lib("common_flags_images") {
Mike Kleinc6142d82019-03-25 10:54:59 -05001542 sources = [
1543 "tools/flags/CommonFlagsImages.cpp",
1544 ]
1545 deps = [
1546 ":flags",
1547 ]
1548 }
1549 test_lib("common_flags_aa") {
Mike Kleinc6142d82019-03-25 10:54:59 -05001550 sources = [
1551 "tools/flags/CommonFlagsAA.cpp",
1552 ]
1553 deps = [
1554 ":flags",
1555 ]
1556 }
mtklein25c81d42016-07-27 13:55:26 -07001557
Mike Klein499f0ac2019-03-25 13:00:12 -05001558 test_lib("trace") {
Mike Klein499f0ac2019-03-25 13:00:12 -05001559 deps = [
1560 ":flags",
1561 ]
1562 sources = [
1563 "tools/trace/ChromeTracingTracer.cpp",
1564 "tools/trace/ChromeTracingTracer.h",
1565 "tools/trace/EventTracingPriv.cpp",
1566 "tools/trace/EventTracingPriv.h",
1567 "tools/trace/SkDebugfTracer.cpp",
1568 "tools/trace/SkDebugfTracer.h",
1569 ]
1570 }
1571
mtkleinc095df52016-08-24 12:23:52 -07001572 test_lib("tool_utils") {
mtkleinc095df52016-08-24 12:23:52 -07001573 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001574 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001575 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001576 "tools/DDLPromiseImageHelper.cpp",
1577 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001578 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001579 "tools/ProcStats.cpp",
1580 "tools/Resources.cpp",
Mike Kleinea3f0142019-03-20 11:12:10 -05001581 "tools/ToolUtils.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001582 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001583 "tools/debugger/DebugCanvas.cpp",
1584 "tools/debugger/DrawCommand.cpp",
1585 "tools/debugger/JsonWriteBuffer.cpp",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001586 "tools/fonts/RandomScalerContext.cpp",
1587 "tools/fonts/TestEmptyTypeface.h",
1588 "tools/fonts/TestFontMgr.cpp",
1589 "tools/fonts/TestFontMgr.h",
1590 "tools/fonts/TestSVGTypeface.cpp",
1591 "tools/fonts/TestSVGTypeface.h",
1592 "tools/fonts/TestTypeface.cpp",
1593 "tools/fonts/TestTypeface.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001594 "tools/fonts/ToolUtilsFont.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001595 "tools/random_parse_path.cpp",
Mike Kleincd5104e2019-03-20 11:55:08 -05001596 "tools/timer/AnimTimer.h",
mtkleinc095df52016-08-24 12:23:52 -07001597 "tools/timer/Timer.cpp",
1598 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001599 libs = []
1600 if (is_ios) {
1601 sources += [ "tools/ios_utils.m" ]
1602 libs += [ "Foundation.framework" ]
Mike Kleinbf15b662019-04-15 11:32:16 -05001603 } else if (is_win) {
1604 libs += [ "DbgHelp.lib" ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001605 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001606
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001607 defines = []
1608 if (skia_tools_require_resources) {
1609 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1610 }
mtkleinc095df52016-08-24 12:23:52 -07001611 deps = [
Ben Wagner97182cc2018-02-15 10:20:04 -05001612 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001613 ":flags",
Mike Kleine4ad58a2019-03-26 09:05:52 -05001614 ]
1615 public_deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05001616 ":gpu_tool_utils",
mtkleinc095df52016-08-24 12:23:52 -07001617 ]
mtkleinc095df52016-08-24 12:23:52 -07001618 }
mtklein25c81d42016-07-27 13:55:26 -07001619
Mike Kleine11e5c12019-04-24 12:46:06 -05001620 test_lib("etc1") {
1621 sources = [
1622 "third_party/etc1/etc1.cpp",
1623 ]
1624 }
1625
Mike Reed7bf160e2019-05-17 16:50:51 -04001626 if (skia_use_ffmpeg) {
1627 test_lib("video_decoder") {
1628 sources = [
1629 "experimental/ffmpeg/SkVideoDecoder.cpp",
1630 "experimental/ffmpeg/SkVideoDecoder.h",
1631 ]
1632 libs = [
1633 "avcodec",
1634 "avformat",
1635 "avutil",
1636 ]
1637 }
1638 }
1639
Mike Klein6e744122016-10-27 12:21:40 -04001640 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001641 test_lib("gm") {
mtkleinc095df52016-08-24 12:23:52 -07001642 sources = gm_sources
1643 deps = [
Mike Kleine11e5c12019-04-24 12:46:06 -05001644 ":etc1",
scroggo19b91532016-10-24 09:03:26 -07001645 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001646 ":skia",
1647 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001648 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001649 "modules/skottie:gm",
Florin Malita3b526b02018-05-25 12:43:51 -04001650 "modules/sksg",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001651 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001652 ]
Greg Danielda16cce2018-08-01 09:23:57 -04001653 public_deps = [
1654 ":gpu_tool_utils",
1655 ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001656
1657 if (skia_use_ffmpeg) {
1658 deps += [ ":video_decoder" ]
1659 sources += [ "gm/video_decoder.cpp" ]
1660 }
mtkleinc095df52016-08-24 12:23:52 -07001661 }
mtklein25c81d42016-07-27 13:55:26 -07001662
Mike Klein6e744122016-10-27 12:21:40 -04001663 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001664 test_lib("tests") {
Mike Klein6e744122016-10-27 12:21:40 -04001665 sources = tests_sources + pathops_tests_sources
Robert Phillips0c6daf02019-05-16 12:43:11 -04001666 if (skia_use_metal) {
1667 sources += metal_tests_sources
1668 }
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -05001669 if (!skia_enable_fontmgr_android) {
Mike Klein6e744122016-10-27 12:21:40 -04001670 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001671 }
Ben Wagner37a06c02018-06-22 21:11:00 +00001672 if (!(skia_use_freetype && skia_use_fontconfig)) {
1673 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1674 }
mtkleinc095df52016-08-24 12:23:52 -07001675 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001676 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001677 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001678 ":skia",
1679 ":tool_utils",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001680 "modules/skottie:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001681 "modules/sksg:tests",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001682 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001683 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05001684 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07001685 "//third_party/zlib",
1686 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001687 public_deps = [
1688 ":gpu_tool_utils", # Test.h #includes headers from this target.
1689 ]
mtkleinc095df52016-08-24 12:23:52 -07001690 }
mtklein2f3416d2016-08-02 16:02:05 -07001691
Mike Klein6e744122016-10-27 12:21:40 -04001692 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001693 test_lib("bench") {
mtkleinc095df52016-08-24 12:23:52 -07001694 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001695 deps = [
1696 ":flags",
1697 ":gm",
1698 ":gpu_tool_utils",
1699 ":skia",
1700 ":tool_utils",
1701 ]
1702 }
mtklein2b6870c2016-07-28 14:17:33 -07001703
mtkleinc095df52016-08-24 12:23:52 -07001704 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001705 if (skia_use_expat) {
Hal Canary0f666812018-03-22 15:21:12 -04001706 sources = [
1707 "experimental/svg/model/SkSVGAttribute.cpp",
1708 "experimental/svg/model/SkSVGAttributeParser.cpp",
1709 "experimental/svg/model/SkSVGCircle.cpp",
1710 "experimental/svg/model/SkSVGClipPath.cpp",
1711 "experimental/svg/model/SkSVGContainer.cpp",
1712 "experimental/svg/model/SkSVGDOM.cpp",
1713 "experimental/svg/model/SkSVGEllipse.cpp",
1714 "experimental/svg/model/SkSVGGradient.cpp",
1715 "experimental/svg/model/SkSVGLine.cpp",
1716 "experimental/svg/model/SkSVGLinearGradient.cpp",
1717 "experimental/svg/model/SkSVGNode.cpp",
1718 "experimental/svg/model/SkSVGPath.cpp",
1719 "experimental/svg/model/SkSVGPattern.cpp",
1720 "experimental/svg/model/SkSVGPoly.cpp",
1721 "experimental/svg/model/SkSVGRadialGradient.cpp",
1722 "experimental/svg/model/SkSVGRect.cpp",
1723 "experimental/svg/model/SkSVGRenderContext.cpp",
1724 "experimental/svg/model/SkSVGSVG.cpp",
1725 "experimental/svg/model/SkSVGShape.cpp",
1726 "experimental/svg/model/SkSVGStop.cpp",
1727 "experimental/svg/model/SkSVGTransformableNode.cpp",
1728 "experimental/svg/model/SkSVGUse.cpp",
1729 "experimental/svg/model/SkSVGValue.cpp",
1730 ]
1731 deps = [
1732 ":skia",
1733 ":xml",
1734 ]
1735 }
mtkleinc095df52016-08-24 12:23:52 -07001736 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001737
Mike Klein38af9432016-11-11 11:39:44 -05001738 if (skia_use_lua) {
1739 test_lib("lua") {
Mike Klein38af9432016-11-11 11:39:44 -05001740 sources = [
1741 "src/utils/SkLua.cpp",
1742 "src/utils/SkLuaCanvas.cpp",
1743 ]
1744 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001745 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001746 "//third_party/lua",
1747 ]
1748 }
1749
Mike Kleine6682eb2017-01-05 10:54:57 -05001750 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001751 sources = [
1752 "tools/lua/lua_app.cpp",
1753 ]
1754 deps = [
1755 ":lua",
1756 ":skia",
1757 "//third_party/lua",
1758 ]
Mike Klein38af9432016-11-11 11:39:44 -05001759 }
1760
Mike Kleine6682eb2017-01-05 10:54:57 -05001761 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001762 sources = [
1763 "tools/lua/lua_pictures.cpp",
1764 ]
1765 deps = [
1766 ":flags",
1767 ":lua",
1768 ":skia",
1769 ":tool_utils",
1770 "//third_party/lua",
1771 ]
Mike Klein38af9432016-11-11 11:39:44 -05001772 }
1773 }
1774
Florin Malitabfe876a2018-09-02 12:33:59 -04001775 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001776 test_app("skottie_tool") {
1777 deps = [
1778 "modules/skottie:tool",
1779 ]
1780 }
1781 }
1782
Hal Canary5b39dc82019-04-17 13:29:46 -04001783 test_app("make_skqp_model") {
1784 sources = [
1785 "tools/skqp/make_skqp_model.cpp",
1786 ]
1787 deps = [
1788 ":skia",
1789 ]
1790 }
1791
Kevin Lubickebf648e2017-09-21 13:45:16 -04001792 if (target_cpu != "wasm") {
1793 import("gn/samples.gni")
1794 test_lib("samples") {
Yuqian Li56a4a092018-02-12 14:47:34 +08001795 sources = samples_sources
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001796 public_deps = [
1797 ":tool_utils",
1798 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001799 deps = [
1800 ":experimental_svg_model",
1801 ":flags",
Mike Kleinc6142d82019-03-25 10:54:59 -05001802 ":gpu_tool_utils",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001803 ":xml",
Mike Reedec80d902019-02-12 11:31:27 -05001804 "modules/sksg",
Herb Derby264182c2018-05-29 15:53:40 -04001805 "modules/skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001806 ]
Mike Klein38af9432016-11-11 11:39:44 -05001807
Kevin Lubickebf648e2017-09-21 13:45:16 -04001808 if (skia_use_lua) {
1809 sources += [ "samplecode/SampleLua.cpp" ]
1810 deps += [
1811 ":lua",
1812 "//third_party/lua",
1813 ]
1814 }
1815 }
Mike Klein7af351a2018-07-27 09:54:43 -04001816 test_app("imgcvt") {
1817 sources = [
1818 "tools/imgcvt.cpp",
1819 ]
1820 deps = [
1821 ":skcms",
1822 ":skia",
1823 ]
1824 }
Mike Klein735c7ba2019-03-25 12:57:58 -05001825 test_lib("hash_and_encode") {
Mike Klein735c7ba2019-03-25 12:57:58 -05001826 sources = [
1827 "tools/HashAndEncode.cpp",
1828 "tools/HashAndEncode.h",
1829 ]
1830 deps = [
1831 ":flags",
1832 ":skia",
1833 "//third_party/libpng",
1834 ]
1835 }
1836 test_app("fm") {
1837 sources = [
1838 "tools/fm/fm.cpp",
1839 ]
1840 deps = [
1841 ":common_flags_aa",
1842 ":common_flags_gpu",
Mike Klein6253d902019-03-27 15:09:12 -05001843 ":experimental_svg_model",
Mike Klein735c7ba2019-03-25 12:57:58 -05001844 ":flags",
1845 ":gm",
1846 ":gpu_tool_utils",
1847 ":hash_and_encode",
1848 ":skia",
1849 ":tool_utils",
1850 ":trace",
Mike Klein22924262019-04-02 14:14:56 -04001851 "modules/skottie",
1852 "modules/skottie:utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05001853 ]
1854 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04001855 test_app("dm") {
1856 sources = [
1857 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001858 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001859 "dm/DMJsonWriter.cpp",
1860 "dm/DMSrcSink.cpp",
1861 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001862 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05001863 ":common_flags_aa",
1864 ":common_flags_config",
1865 ":common_flags_gpu",
1866 ":common_flags_images",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001867 ":experimental_svg_model",
1868 ":flags",
1869 ":gm",
1870 ":gpu_tool_utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05001871 ":hash_and_encode",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001872 ":skia",
1873 ":tests",
1874 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05001875 ":trace",
Florin Malita3d856bd2018-05-26 09:49:28 -04001876 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05001877 "modules/skottie:utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001878 "modules/sksg",
Mike Klein38af9432016-11-11 11:39:44 -05001879 ]
1880 }
Brian Osman16adfa32016-10-18 14:42:44 -04001881 }
1882
Mike Kleina8a51ce2018-01-09 12:34:11 -05001883 if (!is_win) {
1884 test_app("remote_demo") {
1885 sources = [
1886 "tools/remote_demo.cpp",
1887 ]
1888 deps = [
1889 ":skia",
1890 ]
1891 }
1892 }
1893
Mike Kleine6682eb2017-01-05 10:54:57 -05001894 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001895 sources = [
1896 "bench/nanobench.cpp",
1897 ]
1898 deps = [
1899 ":bench",
Mike Kleinc6142d82019-03-25 10:54:59 -05001900 ":common_flags_aa",
1901 ":common_flags_config",
1902 ":common_flags_gpu",
1903 ":common_flags_images",
fmalita6519c212016-09-14 08:05:17 -07001904 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001905 ":flags",
1906 ":gm",
1907 ":gpu_tool_utils",
1908 ":skia",
1909 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05001910 ":trace",
Florin Malita3b526b02018-05-25 12:43:51 -04001911 "modules/sksg",
mtklein2b6870c2016-07-28 14:17:33 -07001912 ]
mtklein2b6870c2016-07-28 14:17:33 -07001913 }
halcanary19a97202016-08-03 15:08:04 -07001914
Ravi Mistry10d36c52017-01-31 09:49:18 -05001915 test_app("skpinfo") {
1916 sources = [
1917 "tools/skpinfo.cpp",
1918 ]
1919 deps = [
1920 ":flags",
1921 ":skia",
1922 ]
1923 }
1924
Brian Osmanc9a42472018-05-31 13:17:12 -04001925 test_app("skpbench") {
1926 sources = [
1927 "tools/skpbench/skpbench.cpp",
1928 ]
1929 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05001930 ":common_flags_config",
1931 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04001932 ":flags",
1933 ":gpu_tool_utils",
1934 ":skia",
1935 ":tool_utils",
1936 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07001937 }
1938
Mike Kleine6682eb2017-01-05 10:54:57 -05001939 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001940 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04001941 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001942 ]
1943 deps = [
1944 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04001945 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001946 ]
halcanary3eee9d92016-09-10 07:01:53 -07001947 }
mtklein046cb562016-09-16 10:23:12 -07001948
Ben Wagner219f3622017-07-17 15:32:25 -04001949 test_app("create_test_font") {
1950 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001951 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001952 ]
1953 deps = [
1954 ":skia",
1955 ]
1956 assert_no_deps = [
1957 # tool_utils requires the output of this app.
1958 ":tool_utils",
1959 ]
1960 }
1961
Florin Malita5d3ff432018-07-31 16:38:43 -04001962 if (skia_use_expat) {
1963 test_app("create_test_font_color") {
1964 sources = [
1965 "tools/fonts/create_test_font_color.cpp",
1966 ]
1967 deps = [
1968 ":flags",
1969 ":skia",
1970 ":tool_utils",
1971 ]
1972 }
Ben Wagner97182cc2018-02-15 10:20:04 -05001973 }
1974
Mike Kleine6682eb2017-01-05 10:54:57 -05001975 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001976 sources = [
1977 "tools/get_images_from_skps.cpp",
1978 ]
1979 deps = [
1980 ":flags",
1981 ":skia",
mtklein046cb562016-09-16 10:23:12 -07001982 ]
mtklein046cb562016-09-16 10:23:12 -07001983 }
mtkleinecbc5262016-09-22 11:51:24 -07001984
Brian Osman6788a542018-12-10 11:56:01 -05001985 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001986 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001987 sources = [
1988 "tools/skiaserve/Request.cpp",
1989 "tools/skiaserve/Response.cpp",
1990 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001991 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1992 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1993 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1994 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1995 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1996 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1997 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1998 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1999 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05002000 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
2001 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002002 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
2003 "tools/skiaserve/urlhandlers/PostHandler.cpp",
2004 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
2005 "tools/skiaserve/urlhandlers/RootHandler.cpp",
2006 ]
2007 deps = [
2008 ":flags",
2009 ":gpu_tool_utils",
2010 ":skia",
2011 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04002012 "//third_party/libmicrohttpd",
Mike Klein7d302882016-11-03 14:06:31 -04002013 ]
Mike Klein7d302882016-11-03 14:06:31 -04002014 }
mtkleinecbc5262016-09-22 11:51:24 -07002015 }
kjlubick14f984b2016-10-03 11:49:45 -07002016
Mike Kleine6682eb2017-01-05 10:54:57 -05002017 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07002018 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002019 "fuzz/Fuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05002020 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002021 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05002022 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04002023 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002024 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002025 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002026 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002027 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002028 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04002029 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04002030 "fuzz/FuzzRegionOp.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002031 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05002032 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
2033 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002034 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002035 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04002036 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002037 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05002038 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
2039 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002040 "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp",
2041 "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
Kevin Lubick0f0a7102019-03-18 16:20:55 -04002042 "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002043 "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002044 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002045 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002046 "tools/debugger/DebugCanvas.cpp",
2047 "tools/debugger/DrawCommand.cpp",
2048 "tools/debugger/JsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002049 ]
2050 deps = [
2051 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04002052 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07002053 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04002054 "modules/skottie:fuzz",
kjlubick14f984b2016-10-03 11:49:45 -07002055 ]
kjlubick14f984b2016-10-03 11:49:45 -07002056 }
Mike Klein38312422016-10-05 15:41:01 -04002057
Mike Kleine6682eb2017-01-05 10:54:57 -05002058 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04002059 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04002060 rebase_path("tests/skia_test.cpp"),
2061 rebase_path("tests/Test.cpp"),
2062 ]
caryclark9feb6322016-10-25 08:58:26 -07002063 deps = [
2064 ":flags",
2065 ":gpu_tool_utils",
2066 ":skia",
2067 ":tool_utils",
2068 ]
caryclark9feb6322016-10-25 08:58:26 -07002069 }
2070
Mike Kleine6682eb2017-01-05 10:54:57 -05002071 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04002072 sources = [
2073 "tools/DumpRecord.cpp",
2074 "tools/dump_record.cpp",
2075 ]
2076 deps = [
2077 ":flags",
2078 ":skia",
2079 ]
Mike Klein38312422016-10-05 15:41:01 -04002080 }
bungemanfe917272016-10-13 17:36:40 -04002081
Mike Kleine6682eb2017-01-05 10:54:57 -05002082 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04002083 sources = [
2084 "tools/skdiff/skdiff.cpp",
2085 "tools/skdiff/skdiff_html.cpp",
2086 "tools/skdiff/skdiff_main.cpp",
2087 "tools/skdiff/skdiff_utils.cpp",
2088 ]
2089 deps = [
2090 ":skia",
2091 ":tool_utils",
2092 ]
bungemanfe917272016-10-13 17:36:40 -04002093 }
halcanarya73d76a2016-10-17 13:19:02 -07002094
Mike Kleine6682eb2017-01-05 10:54:57 -05002095 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07002096 sources = [
2097 "tools/skp_parser.cpp",
2098 ]
2099 deps = [
2100 ":skia",
2101 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002102 ]
halcanarya73d76a2016-10-17 13:19:02 -07002103 }
Brian Osman16adfa32016-10-18 14:42:44 -04002104
Brian Osmanc9a42472018-05-31 13:17:12 -04002105 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05002106 test_lib("skqp_lib") {
Hal Canary0e07ad72018-02-08 13:06:56 -05002107 defines =
2108 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002109 sources = [
2110 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002111 "tools/skqp/src/skqp.cpp",
2112 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002113 ]
2114 deps = [
2115 ":gm",
2116 ":gpu_tool_utils",
2117 ":skia",
2118 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002119 ":tool_utils",
2120 ]
2121 }
2122 test_app("skqp") {
2123 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002124 "tools/skqp/src/skqp_main.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05002125 ]
2126 deps = [
2127 ":skia",
2128 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05002129 ":tool_utils",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002130 ]
2131 }
2132 test_app("jitter_gms") {
2133 sources = [
2134 "tools/skqp/jitter_gms.cpp",
2135 ]
2136 deps = [
2137 ":gm",
2138 ":skia",
2139 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002140 ]
2141 }
2142 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002143 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05002144 test_app("skqp_app") {
2145 is_shared_library = true
2146 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002147 "tools/skqp/src/jni_skqp.cpp",
Hal Canary28f89382017-12-12 09:42:14 -05002148 ]
2149 deps = [
2150 ":skia",
2151 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002152 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002153 ]
2154 libs = [ "android" ]
2155 }
2156 }
Stan Iliev93151722018-08-02 11:10:52 -04002157 if (is_android && skia_enable_gpu) {
2158 test_app("skottie_android") {
2159 is_shared_library = true
2160
2161 sources = [
2162 "platform_tools/android/apps/skottie/src/main/cpp/JavaInputStreamAdaptor.cpp",
2163 "platform_tools/android/apps/skottie/src/main/cpp/native-lib.cpp",
2164 ]
2165 libs = []
2166
Stan Iliev93151722018-08-02 11:10:52 -04002167 deps = [
2168 ":skia",
2169 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002170 "modules/sksg:samples",
Stan Iliev93151722018-08-02 11:10:52 -04002171 ]
2172 }
2173 }
Hal Canary75427132017-10-11 16:00:31 -04002174
Hal Canarya9de7602018-01-19 13:08:23 -05002175 test_app("list_gms") {
2176 sources = [
2177 "tools/list_gms.cpp",
2178 ]
2179 deps = [
2180 ":gm",
2181 ":skia",
2182 ]
2183 }
2184 test_app("list_gpu_unit_tests") {
2185 sources = [
2186 "dm/DMGpuTestProcs.cpp",
2187 "tools/list_gpu_unit_tests.cpp",
2188 ]
2189 deps = [
2190 ":skia",
2191 ":tests",
2192 ]
2193 }
2194
Brian Osmanc9a42472018-05-31 13:17:12 -04002195 test_lib("sk_app") {
Hal Canary378be8d2019-04-26 08:20:14 -04002196 public_deps = [
Hal Canary378be8d2019-04-26 08:20:14 -04002197 ":gpu_tool_utils",
Hal Canary05694472019-05-03 17:14:21 -04002198 ":skia",
Hal Canary378be8d2019-04-26 08:20:14 -04002199 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002200 sources = [
2201 "tools/sk_app/CommandSet.cpp",
2202 "tools/sk_app/GLWindowContext.cpp",
2203 "tools/sk_app/Window.cpp",
2204 ]
2205 libs = []
2206
2207 if (is_android) {
2208 sources += [
2209 "tools/sk_app/android/GLWindowContext_android.cpp",
2210 "tools/sk_app/android/RasterWindowContext_android.cpp",
2211 "tools/sk_app/android/Window_android.cpp",
2212 "tools/sk_app/android/main_android.cpp",
2213 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002214 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002215 libs += [ "android" ]
2216 } else if (is_linux) {
2217 sources += [
2218 "tools/sk_app/unix/GLWindowContext_unix.cpp",
2219 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
2220 "tools/sk_app/unix/Window_unix.cpp",
2221 "tools/sk_app/unix/keysym2ucs.c",
2222 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002223 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002224 libs += [
2225 "GL",
2226 "X11",
2227 ]
2228 } else if (is_win) {
2229 sources += [
2230 "tools/sk_app/win/GLWindowContext_win.cpp",
2231 "tools/sk_app/win/RasterWindowContext_win.cpp",
2232 "tools/sk_app/win/Window_win.cpp",
2233 "tools/sk_app/win/main_win.cpp",
2234 ]
Brian Salomon194db172017-08-17 14:37:06 -04002235 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002236 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04002237 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002238 } else if (is_mac) {
2239 sources += [
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002240 "tools/sk_app/mac/GLWindowContext_mac.mm",
2241 "tools/sk_app/mac/RasterWindowContext_mac.mm",
2242 "tools/sk_app/mac/Window_mac.mm",
2243 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002244 ]
2245 libs += [
2246 "QuartzCore.framework",
2247 "Cocoa.framework",
2248 "Foundation.framework",
2249 ]
2250 } else if (is_ios) {
2251 sources += [
2252 "tools/sk_app/ios/GLWindowContext_ios.cpp",
2253 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
2254 "tools/sk_app/ios/Window_ios.cpp",
2255 "tools/sk_app/ios/main_ios.cpp",
2256 ]
2257 }
2258
2259 if (skia_use_vulkan) {
2260 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
2261 if (is_android) {
2262 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2263 } else if (is_linux) {
2264 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2265 libs += [ "X11-xcb" ]
2266 } else if (is_win) {
2267 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Jim Van Verthce51c142019-02-14 14:07:46 -05002268 } else if (is_mac) {
2269 sources += [ "tools/sk_app/mac/VulkanWindowContext_mac.mm" ]
2270 libs += [ "MetalKit.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002271 }
2272 }
2273
Jim Van Verthbe39f712019-02-08 15:36:14 -05002274 if (skia_use_metal) {
2275 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
2276 if (is_mac) {
2277 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
2278 }
2279 libs += [ "MetalKit.framework" ]
2280 }
2281
Brian Osmanc9a42472018-05-31 13:17:12 -04002282 deps = [
Brian Osmanc9a42472018-05-31 13:17:12 -04002283 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002284 ]
2285 if (is_android) {
2286 deps += [ "//third_party/native_app_glue" ]
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002287 } else if (is_ios) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002288 deps += [ "//third_party/libsdl" ]
2289 }
2290 if (skia_use_angle) {
2291 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002292 }
Brian Osman16adfa32016-10-18 14:42:44 -04002293 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002294
Hal Canary87515122019-03-15 14:22:51 -04002295 if (!skia_use_vulkan && (is_mac || is_linux || is_win)) {
2296 test_app("fiddle_examples") {
2297 sources = [
Brian Osmanc725e8f2019-04-10 14:08:44 -04002298 "tools/fiddle/all_examples.cpp",
Hal Canary87515122019-03-15 14:22:51 -04002299 "tools/fiddle/examples.cpp",
Brian Osman72ef2d52019-03-17 11:09:17 -04002300 "tools/fiddle/examples.h",
Hal Canary87515122019-03-15 14:22:51 -04002301 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002302 if (is_win) {
2303 cflags = [ "/wd4756" ] # Overflow in constant arithmetic
2304 }
Hal Canary87515122019-03-15 14:22:51 -04002305 deps = [
2306 ":skia",
2307 ":skia.h",
2308 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04002309 "modules/skshaper",
Hal Canary87515122019-03-15 14:22:51 -04002310 ]
2311 }
2312 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002313 test_app("viewer") {
2314 is_shared_library = is_android
Brian Osmanc9a42472018-05-31 13:17:12 -04002315 sources = [
2316 "tools/viewer/BisectSlide.cpp",
2317 "tools/viewer/GMSlide.cpp",
2318 "tools/viewer/ImGuiLayer.cpp",
2319 "tools/viewer/ImageSlide.cpp",
Brian Osman7c979f52019-02-12 13:27:51 -05002320 "tools/viewer/ParticlesSlide.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04002321 "tools/viewer/SKPSlide.cpp",
2322 "tools/viewer/SampleSlide.cpp",
2323 "tools/viewer/SkottieSlide.cpp",
2324 "tools/viewer/SlideDir.cpp",
2325 "tools/viewer/StatsLayer.cpp",
2326 "tools/viewer/SvgSlide.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002327 "tools/viewer/TouchGesture.cpp",
Leon Scroggins III81886e82018-08-22 11:18:08 -04002328 "tools/viewer/TouchGesture.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002329 "tools/viewer/Viewer.cpp",
2330 ]
2331 libs = []
2332
Brian Osmanc9a42472018-05-31 13:17:12 -04002333 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002334 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04002335 ":experimental_svg_model",
2336 ":flags",
2337 ":gm",
2338 ":gpu_tool_utils",
2339 ":samples",
2340 ":sk_app",
2341 ":skia",
2342 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002343 ":trace",
Brian Osman7c979f52019-02-12 13:27:51 -05002344 "modules/particles",
Brian Osmanc9a42472018-05-31 13:17:12 -04002345 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002346 "modules/skottie:utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002347 "modules/sksg",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002348 "modules/sksg:samples",
Brian Osmanc9a42472018-05-31 13:17:12 -04002349 "//third_party/imgui",
Brian Osmanc9a42472018-05-31 13:17:12 -04002350 ]
Brian Osmaneff04b52017-11-21 13:18:02 -05002351 }
2352
Brian Osmanc9a42472018-05-31 13:17:12 -04002353 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002354 test_app("HelloWorld") {
2355 sources = [
2356 "example/HelloWorld.cpp",
2357 ]
2358 libs = []
2359
Brian Osmaneff04b52017-11-21 13:18:02 -05002360 deps = [
2361 ":flags",
2362 ":gpu_tool_utils",
2363 ":sk_app",
2364 ":skia",
2365 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002366 ]
2367 }
2368 }
2369
Brian Osmanc9a42472018-05-31 13:17:12 -04002370 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002371 test_app("SkiaSDLExample") {
2372 sources = [
2373 "example/SkiaSDLExample.cpp",
2374 ]
2375 libs = []
Jim Van Verth4c70c752017-07-11 12:03:01 -04002376 deps = [
2377 ":gpu_tool_utils",
2378 ":skia",
2379 "//third_party/libsdl",
2380 ]
2381 }
2382 }
2383
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002384 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2385 action_foreach("generate_mocs") {
2386 script = "gn/call.py"
2387 sources = [
2388 "tools/mdbviz/MainWindow.h",
2389 ]
2390 outputs = [
2391 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2392 ]
2393 args = [
2394 "$skia_qt_path" + "/bin/moc",
2395 "{{source}}",
2396 "-o",
2397 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2398 ]
2399 }
2400 action_foreach("generate_resources") {
2401 script = "gn/call.py"
2402 sources = [
2403 "tools/mdbviz/resources.qrc",
2404 ]
2405 outputs = [
2406 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2407 ]
2408 args = [
2409 "$skia_qt_path" + "/bin/rcc",
2410 "{{source}}",
2411 "-o",
2412 "gen/mdbviz/{{source_name_part}}_res.cpp",
2413 ]
2414 }
2415 test_app("mdbviz") {
2416 if (is_win) {
2417 # on Windows we need to disable some exception handling warnings due to the Qt headers
2418 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2419 }
2420 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002421 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002422 "tools/debugger/DebugCanvas.cpp",
2423 "tools/debugger/DrawCommand.cpp",
2424 "tools/debugger/JsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002425 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002426 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002427 "tools/mdbviz/main.cpp",
2428
2429 # generated files
2430 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2431 "$target_gen_dir/mdbviz/resources_res.cpp",
2432 ]
2433 lib_dirs = [ "$skia_qt_path/lib" ]
2434 libs = [
2435 "Qt5Core.lib",
2436 "Qt5Gui.lib",
2437 "Qt5Widgets.lib",
2438 ]
2439 include_dirs = [
2440 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002441 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002442 "$skia_qt_path/include/QtWidgets",
2443 ]
2444 deps = [
2445 ":generate_mocs",
2446 ":generate_resources",
2447 ":skia",
2448 ]
2449 }
2450 }
2451
Mike Kleine459afd2017-03-03 09:21:30 -05002452 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002453 copy("gdbserver") {
2454 sources = [
2455 "$ndk/$ndk_gdbserver",
2456 ]
2457 outputs = [
2458 "$root_out_dir/gdbserver",
2459 ]
2460 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002461 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002462
2463 if (skia_use_opencl) {
2464 test_app("hello-opencl") {
2465 sources = [
Mike Kleinf9ae6702018-06-20 14:05:05 -04002466 "tools/hello-opencl.cpp",
2467 ]
Mike Klein8a1f15d2019-02-11 11:59:41 -05002468 deps = [
2469 "//third_party/opencl",
2470 ]
Mike Kleinf9ae6702018-06-20 14:05:05 -04002471 }
2472 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002473
2474 test_app("editor") {
2475 is_shared_library = is_android
2476 sources = [
Hal Canary50d650d2019-04-28 14:40:45 -04002477 "experimental/editor/editor.cpp",
2478 "experimental/editor/editor.h",
Hal Canary05694472019-05-03 17:14:21 -04002479 "experimental/editor/editor_application.cpp",
Hal Canary7b300a42019-04-30 12:38:28 -04002480 "experimental/editor/run_handler.cpp",
2481 "experimental/editor/run_handler.h",
Hal Canary05694472019-05-03 17:14:21 -04002482 "experimental/editor/stringslice.cpp",
2483 "experimental/editor/stringslice.h",
Hal Canaryb8f81af2019-04-24 13:56:16 -04002484 ]
2485 deps = [
2486 ":sk_app",
2487 ":skia",
2488 "modules/skshaper",
2489 ]
2490 }
mtklein25c81d42016-07-27 13:55:26 -07002491}