blob: 320c0c57a79377f0d426cf099fd4b30b63ed2a21 [file] [log] [blame]
mtkleinc04ff472016-06-23 10:29:30 -07001# Copyright 2016 Google Inc.
2#
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
Brian Osmanf2c90142017-07-13 15:50:03 -04006import("gn/flutter_defines.gni")
Mike Reed025f7832018-11-12 09:27:05 -05007import("gn/fuchsia_defines.gni")
mikejurka8c24f4f2016-09-12 16:51:58 -07008import("gn/shared_sources.gni")
Hal Canary32498f02019-02-04 15:36:31 -05009import("gn/skia.gni")
brettwb9447282016-09-01 14:24:39 -070010
Forrest Reiling30229ac2017-04-17 13:36:39 -070011if (is_fuchsia) {
12 import("//build/vulkan/config.gni")
13}
14
mtkleinc04ff472016-06-23 10:29:30 -070015declare_args() {
Mike Klein26a60492018-10-15 10:38:25 -040016 skia_enable_flutter_defines = false
17}
18
19declare_args() {
Mike Kleinc168a3a2016-11-14 14:53:13 +000020 skia_use_angle = false
Kevin Lubick4a24e102017-03-29 11:19:01 -040021 skia_use_egl = false
mtklein63213812016-08-24 09:55:56 -070022 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070023 skia_use_fontconfig = is_linux
Leon Scroggins III85e22fc2018-11-28 08:58:47 -050024 skia_use_fonthost_mac = is_mac
mtkleincdedd0e2016-09-12 15:15:44 -070025 skia_use_freetype = is_android || is_fuchsia || is_linux
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -050026 skia_use_fixed_gamma_text = is_android
mtklein63213812016-08-24 09:55:56 -070027 skia_use_libjpeg_turbo = true
28 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070029 skia_use_libwebp = !is_fuchsia
Mike Kleinfae86b72018-01-08 15:49:09 -050030 skia_use_lua = is_skia_dev_build && !is_ios
Mike Kleinf9ae6702018-06-20 14:05:05 -040031 skia_use_opencl = false
Mike Klein10d665d2016-11-01 11:46:10 -040032 skia_use_piex = !is_win
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -040033 skia_use_wuffs = false
mtklein63213812016-08-24 09:55:56 -070034 skia_use_zlib = true
Greg Daniele5ddff52017-07-05 16:49:36 -040035 skia_use_metal = false
Mike Klein36f182f2017-10-20 12:33:53 -040036 skia_use_libheif = is_skia_dev_build
Chinmay Garded92d0352018-09-17 10:23:28 -070037 skia_use_x11 = is_linux
Leon Scroggins IIIee0e5d02019-02-27 10:59:11 -050038 skia_use_xps = true
mtklein1bd72ba2016-09-16 07:45:52 -070039
Mike Klein7d921032017-01-05 12:20:41 -050040 skia_android_serial = ""
Kevin Lubick93faa672018-10-10 15:54:53 -040041 skia_enable_ccpr = true
Kevin Lubickca7c2972018-10-17 13:52:24 +000042 skia_enable_nvpr = !skia_enable_flutter_defines
Brian Osman3f375d02016-12-28 11:19:22 -050043 skia_enable_discrete_gpu = true
Kevin Lubick134be1d2018-10-30 15:05:04 -040044 skia_enable_nima = false
Hal Canary43fb7a02016-12-30 13:09:03 -050045 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040046 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Kevin Lubick32dfdbe2018-10-18 09:47:01 -040047 skia_enable_skpicture = true
Mike Klein3669a822017-03-03 10:55:02 -050048 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Robert Phillipsa6d2d702017-09-01 12:17:03 -040049 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040050 skia_compile_processors = false
Adrienne Walker1df7cd82018-04-18 13:46:25 -070051 skia_generate_workarounds = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070052 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040053
Hal Canary2331c822018-02-01 14:06:13 -050054 skia_skqp_global_error_tolerance = 0
Ethan Nicholas26a9aad2018-03-27 14:10:52 -040055
56 skia_llvm_path = ""
57 skia_llvm_lib = "LLVM"
Hal Canaryfd9bcab2018-04-24 11:47:23 -040058
59 skia_tools_require_resources = false
mtkleinc04ff472016-06-23 10:29:30 -070060}
Brian Salomon23d73ea2016-10-27 13:31:37 -040061declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040062 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040063 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050064 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -050065 skia_enable_fontmgr_empty = false
Kevin Lubickddd0a332018-12-12 10:35:13 -050066 skia_enable_fontmgr_custom =
67 is_linux && skia_use_freetype && !skia_use_fontconfig
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -050068 skia_enable_fontmgr_custom_empty = is_fuchsia && skia_use_freetype
69 skia_enable_fontmgr_android = skia_use_expat && skia_use_freetype
Sergey Ulanovf3babcd2018-11-30 17:42:00 -080070 skia_enable_fontmgr_fuchsia = is_fuchsia
Leon Scroggins III631dbc82019-03-04 13:54:02 -050071 skia_enable_fontmgr_win = is_win
72 skia_enable_fontmgr_win_gdi = is_win
Mike Klein10d665d2016-11-01 11:46:10 -040073
Kevin Lubick27ba7032019-03-21 08:13:54 -040074 if (is_mac) {
75 skia_gl_standard = "gl"
76 } else if (is_ios) {
77 skia_gl_standard = "gles"
78 } else {
79 skia_gl_standard = ""
80 }
81
Mike Klein4d598a32016-10-31 13:44:49 -040082 if (is_android) {
83 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070084 } else if (is_fuchsia) {
85 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040086 } else {
Mike Klein98dea7b2019-01-15 11:26:43 -050087 skia_use_vulkan = defined(skia_moltenvk_path) && skia_moltenvk_path != ""
Mike Klein4d598a32016-10-31 13:44:49 -040088 }
Jim Van Verth4e502972017-12-07 15:16:10 -050089
90 if (is_ios) {
91 skia_ios_identity = ".*Google.*"
92 skia_ios_profile = "Google Development"
93 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040094}
Brian Salomon789e25e2016-09-30 13:41:03 -040095
Adam Barth54ef74a2017-10-13 10:59:38 -070096if (defined(skia_settings)) {
97 import(skia_settings)
98}
99
mtkleinc04ff472016-06-23 10:29:30 -0700100# Skia public API, generally provided by :skia.
101config("skia_public") {
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500102 include_dirs = [
103 ".",
104 "third_party/skcms",
105 "include/third_party/vulkan",
106 ]
Mike Kleinae7e6712016-10-11 17:49:33 -0400107 defines = []
108 if (is_component_build) {
109 defines += [ "SKIA_DLL" ]
110 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400111 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700112 defines += [ "SK_SAMPLES_FOR_X" ]
113 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400114 if (skia_enable_flutter_defines) {
115 defines += flutter_defines
116 }
mtklein06c35c02016-09-20 12:28:12 -0700117 if (!skia_enable_gpu) {
118 defines += [ "SK_SUPPORT_GPU=0" ]
119 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500120 if (skia_enable_atlas_text) {
121 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
122 }
Mike Reed025f7832018-11-12 09:27:05 -0500123 if (is_fuchsia) {
124 defines += fuchsia_defines
125 }
Kevin Lubick27ba7032019-03-21 08:13:54 -0400126 if (skia_gl_standard == "gles") {
127 defines += [ "SK_ASSUME_GL_ES=1" ]
128 } else if (skia_gl_standard == "gl") {
129 defines += [ "SK_ASSUME_GL=1" ]
Kevin Lubick39026282019-03-28 12:46:40 -0400130 } else if (skia_gl_standard == "webgl") {
131 defines += [ "SK_ASSUME_WEBGL=1" ]
Kevin Lubick27ba7032019-03-21 08:13:54 -0400132 }
mtkleinc04ff472016-06-23 10:29:30 -0700133}
134
135# Skia internal APIs, used by Skia itself and a few test tools.
136config("skia_private") {
137 visibility = [ ":*" ]
138
Mike Reeda9e241d2017-05-03 10:52:00 -0400139 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -0500140 if (skia_use_fixed_gamma_text) {
mtkleinb37c0342016-09-09 11:07:45 -0700141 defines += [
142 "SK_GAMMA_EXPONENT=1.4",
143 "SK_GAMMA_CONTRAST=0.0",
144 ]
145 }
mtklein88a7ac02016-09-14 11:16:49 -0700146 if (is_official_build || is_android) {
147 # TODO(bsalomon): it'd be nice to make Android normal.
148 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
149 }
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 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400155 if (!is_official_build) {
156 defines += [ "GR_TEST_UTILS=1" ]
157 }
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400158 if (skia_llvm_path != "") {
159 defines += [ "SK_LLVM_AVAILABLE" ]
160 include_dirs += [ "$skia_llvm_path/include" ]
161 libs += [ skia_llvm_lib ]
162 lib_dirs += [ "$skia_llvm_path/lib/" ]
163 }
mtkleinc04ff472016-06-23 10:29:30 -0700164}
165
166# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
167config("skia_library") {
168 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700169 defines = [ "SKIA_IMPLEMENTATION=1" ]
170}
171
172skia_library_configs = [
173 ":skia_public",
174 ":skia_private",
175 ":skia_library",
176]
177
mtklein9b8583d2016-08-24 17:32:30 -0700178# Use for CPU-specific Skia code that needs particular compiler flags.
179template("opts") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500180 visibility = [ ":*" ]
mtklein9b8583d2016-08-24 17:32:30 -0700181 if (invoker.enabled) {
182 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500183 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700184 forward_variables_from(invoker, "*")
185 configs += skia_library_configs
186 }
187 } else {
188 # If not enabled, a phony empty target that swallows all otherwise unused variables.
189 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500190 check_includes = false
mtklein9b8583d2016-08-24 17:32:30 -0700191 forward_variables_from(invoker,
192 "*",
193 [
194 "sources",
195 "cflags",
196 ])
197 }
198 }
anmittala7eaf2e2016-08-17 13:57:26 -0700199}
200
mtklein422310d2016-08-16 18:28:43 -0700201is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700202
mtklein7d6fb2c2016-08-25 14:50:44 -0700203opts("none") {
204 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700205 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700206 cflags = []
207}
208
mtklein7d6fb2c2016-08-25 14:50:44 -0700209opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700210 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700211 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700212 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700213}
214
215opts("arm64") {
216 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700217 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700218 cflags = []
219}
220
221opts("crc32") {
222 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700223 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700224 cflags = [ "-march=armv8-a+crc" ]
225}
226
mtklein9b8583d2016-08-24 17:32:30 -0700227opts("sse2") {
228 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700229 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400230 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400231 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
232 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400233 cflags = [ "-msse2" ]
234 }
mtklein9b8583d2016-08-24 17:32:30 -0700235}
mtkleinc04ff472016-06-23 10:29:30 -0700236
mtklein9b8583d2016-08-24 17:32:30 -0700237opts("ssse3") {
238 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700239 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400240 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400241 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
242 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400243 cflags = [ "-mssse3" ]
244 }
mtklein9b8583d2016-08-24 17:32:30 -0700245}
mtkleinc04ff472016-06-23 10:29:30 -0700246
mtklein9b8583d2016-08-24 17:32:30 -0700247opts("sse41") {
248 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700249 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400250 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400251 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
252 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400253 cflags = [ "-msse4.1" ]
254 }
mtklein9b8583d2016-08-24 17:32:30 -0700255}
mtklein4e976072016-08-08 09:06:27 -0700256
mtklein9b8583d2016-08-24 17:32:30 -0700257opts("sse42") {
258 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700259 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400260 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400261 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
262 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400263 cflags = [ "-msse4.2" ]
264 }
mtklein9b8583d2016-08-24 17:32:30 -0700265}
266
267opts("avx") {
268 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700269 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400270 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000271 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400272 } else {
273 cflags = [ "-mavx" ]
274 }
mtkleinc04ff472016-06-23 10:29:30 -0700275}
276
Mike Klein1b9b7d52018-02-27 10:37:40 -0500277opts("hsw") {
278 enabled = is_x86
279 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400280 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500281 cflags = [ "/arch:AVX2" ]
282 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000283 cflags = [ "-march=haswell" ]
Mike Klein1b9b7d52018-02-27 10:37:40 -0500284 }
285
286 # Oddly, clang-cl doesn't recognize this as a valid flag.
287 # If it ever does, it'd nice to move this up with -mavx2 and co.
288 if (is_clang && !is_win) {
289 # This flag lets Clang generate FMAs when it sees a mul-then-add. It's optional,
290 # but nice to have, generating slightly better code for paths without explicit FMAs.
291 cflags += [ "-ffp-contract=fast" ]
292 }
293}
294
mtkleinc095df52016-08-24 12:23:52 -0700295# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700296template("optional") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500297 visibility = [ ":*" ]
mtklein457b42a2016-08-23 13:56:37 -0700298 if (invoker.enabled) {
299 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700300 if (defined(invoker.public_defines)) {
301 defines = invoker.public_defines
302 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600303 if (defined(invoker.public_configs)) {
304 configs = invoker.public_configs
305 }
mtklein457b42a2016-08-23 13:56:37 -0700306 }
307 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500308 check_includes = false
mtkleincd01b032016-08-31 04:58:19 -0700309 forward_variables_from(invoker,
310 "*",
311 [
312 "public_defines",
313 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700314 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700315 ])
mtklein457b42a2016-08-23 13:56:37 -0700316 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700317 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700318 if (defined(invoker.configs_to_remove)) {
319 configs -= invoker.configs_to_remove
320 }
mtklein457b42a2016-08-23 13:56:37 -0700321 }
322 } else {
mtklein457b42a2016-08-23 13:56:37 -0700323 source_set(target_name) {
324 forward_variables_from(invoker,
325 "*",
326 [
327 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400328 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700329 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700330 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700331 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700332 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700333 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700334 ])
mtkleincd01b032016-08-31 04:58:19 -0700335 if (defined(invoker.sources_when_disabled)) {
336 sources = invoker.sources_when_disabled
337 }
338 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700339 }
mtkleineb3c4252016-08-23 07:38:09 -0700340 }
mtklein457b42a2016-08-23 13:56:37 -0700341}
mtklein457b42a2016-08-23 13:56:37 -0700342
mtkleina45be612016-08-29 15:22:10 -0700343optional("fontmgr_android") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500344 enabled = skia_enable_fontmgr_android
mtkleina45be612016-08-29 15:22:10 -0700345
346 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500347 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700348 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700349 ]
350 sources = [
351 "src/ports/SkFontMgr_android.cpp",
352 "src/ports/SkFontMgr_android_factory.cpp",
353 "src/ports/SkFontMgr_android_parser.cpp",
354 ]
355}
356
mtkleind2e39db2016-09-07 07:52:55 -0700357optional("fontmgr_custom") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500358 enabled = skia_enable_fontmgr_custom
mtkleind2e39db2016-09-07 07:52:55 -0700359
360 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500361 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700362 ]
363 sources = [
364 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500365 "src/ports/SkFontMgr_custom.h",
366 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700367 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500368 "src/ports/SkFontMgr_custom_embedded.cpp",
369 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700370 ]
371}
372
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500373optional("fontmgr_custom_empty") {
374 enabled = skia_enable_fontmgr_custom_empty
Kevin Lubickddd0a332018-12-12 10:35:13 -0500375
376 deps = [
377 ":typeface_freetype",
378 ]
379 sources = [
380 "src/ports/SkFontMgr_custom.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500381 "src/ports/SkFontMgr_custom_empty.cpp",
382 "src/ports/SkFontMgr_custom_empty_factory.cpp",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800383 ]
384}
385
Hal Canaryff2742e2018-01-30 11:35:47 -0500386optional("fontmgr_empty") {
387 enabled = skia_enable_fontmgr_empty
388 sources = [
389 "src/ports/SkFontMgr_empty_factory.cpp",
390 ]
391}
392
mtklein3cc22182016-08-29 13:26:14 -0700393optional("fontmgr_fontconfig") {
394 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700395
396 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500397 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700398 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700399 ]
400 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700401 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700402 "src/ports/SkFontConfigInterface_direct.cpp",
403 "src/ports/SkFontConfigInterface_direct_factory.cpp",
404 "src/ports/SkFontMgr_FontConfigInterface.cpp",
405 "src/ports/SkFontMgr_fontconfig.cpp",
406 "src/ports/SkFontMgr_fontconfig_factory.cpp",
407 ]
408}
409
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500410optional("fontmgr_fuchsia") {
411 enabled = skia_enable_fontmgr_fuchsia
412
413 deps = [
414 "//sdk/fidl/fuchsia.fonts",
415 ]
416 sources = [
417 "src/ports/SkFontMgr_fuchsia.cpp",
418 "src/ports/SkFontMgr_fuchsia.h",
419 ]
420}
421
422optional("fontmgr_wasm") {
Kevin Lubick0e3342c2019-04-16 13:31:25 -0400423 enabled = !skia_enable_fontmgr_empty && target_cpu == "wasm"
mtkleincdedd0e2016-09-12 15:15:44 -0700424
425 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500426 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700427 ]
428 sources = [
429 "src/ports/SkFontMgr_custom.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500430 "src/ports/SkFontMgr_custom.h",
431 "src/ports/SkFontMgr_custom_embedded.cpp",
432 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700433 ]
434}
435
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500436optional("fontmgr_win") {
437 enabled = skia_enable_fontmgr_win
438
439 sources = [
440 "src/fonts/SkFontMgr_indirect.cpp",
441 "src/ports/SkFontMgr_win_dw.cpp",
442 "src/ports/SkFontMgr_win_dw_factory.cpp",
443 "src/ports/SkScalerContext_win_dw.cpp",
444 "src/ports/SkTypeface_win_dw.cpp",
445 ]
446}
447
448optional("fontmgr_win_gdi") {
449 enabled = skia_enable_fontmgr_win_gdi
450
451 sources = [
452 "src/ports/SkFontHost_win.cpp",
453 ]
454 libs = [ "Gdi32.lib" ]
455}
456
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700457if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400458 executable("sksllex") {
459 sources = [
460 "src/sksl/lex/Main.cpp",
461 "src/sksl/lex/NFA.cpp",
462 "src/sksl/lex/RegexNode.cpp",
463 "src/sksl/lex/RegexParser.cpp",
464 ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500465 include_dirs = [ "." ]
Ethan Nicholasca82a922017-09-07 09:39:50 -0400466 }
467
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700468 action("run_sksllex") {
469 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400470 deps = [
471 ":sksllex(//gn/toolchain:$host_toolchain)",
472 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700473 sources = [
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700474 "src/sksl/lex/sksl.lex",
475 ]
476
477 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
478 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
479 outputs = [
480 "$target_out_dir/" +
481 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
482 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
483 # confused due to the same file being named by two different paths
484 ]
485 sksllex_path = "$root_out_dir/"
486 sksllex_path += "sksllex"
487 if (host_os == "win") {
488 sksllex_path += ".exe"
489 }
490 args = [
491 rebase_path(sksllex_path),
492 rebase_path("bin/clang-format"),
493 rebase_path("src"),
494 ]
495 }
496} else {
497 group("run_sksllex") {
498 }
499}
500
501if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400502 executable("skslc") {
503 defines = [ "SKSL_STANDALONE" ]
504 sources = [
505 "src/sksl/SkSLMain.cpp",
506 ]
507 sources += skia_sksl_sources
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500508 include_dirs = [ "." ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400509 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500510 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400511 "//third_party/spirv-tools",
512 ]
513 }
514
515 skia_gpu_processor_outputs = []
516 foreach(src, skia_gpu_processor_sources) {
517 dir = get_path_info(src, "dir")
518 name = get_path_info(src, "name")
519
520 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
521 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
522 skia_gpu_processor_outputs += [
523 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
524 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
525 # confused due to the same file being named by two different paths
526 ]
527 }
528
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500529 action("create_sksl_enums") {
530 script = "gn/create_sksl_enums.py"
531 sources = [
532 "include/private/GrSharedEnums.h",
533 ]
534 outputs = [
535 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500536 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500537 ]
538 args = [
539 rebase_path(sources[0]),
540 rebase_path(outputs[0]),
541 ]
542 }
543
Ethan Nicholas762466e2017-06-29 10:03:38 -0400544 action("compile_processors") {
545 script = "gn/compile_processors.py"
546 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500547 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400548 ":skslc(//gn/toolchain:$host_toolchain)",
549 ]
550 sources = skia_gpu_processor_sources
551 outputs = skia_gpu_processor_outputs
552 skslc_path = "$root_out_dir/"
553 if (host_toolchain != default_toolchain_name) {
554 skslc_path += "$host_toolchain/"
555 }
556 skslc_path += "skslc"
557 if (host_os == "win") {
558 skslc_path += ".exe"
559 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400560 args = [
561 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400562 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400563 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400564 args += rebase_path(skia_gpu_processor_sources)
565 }
566} else {
567 skia_gpu_processor_outputs = []
568 group("compile_processors") {
569 }
570}
571
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500572optional("gpu") {
mtklein06c35c02016-09-20 12:28:12 -0700573 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400574 deps = [
575 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700576 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400577 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700578 if (skia_generate_workarounds) {
579 deps += [ ":workaround_list" ]
580 }
mtkleine9fb3d52016-09-20 15:11:46 -0700581 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600582 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400583 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700584
Brian Salomon3d6801e2017-12-11 10:06:31 -0500585 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400586 if (!skia_enable_ccpr) {
587 sources -= skia_ccpr_sources
588 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
589 }
Kevin Lubick4bf2c262018-10-15 09:35:54 -0400590 if (!skia_enable_nvpr) {
591 sources -= skia_nvpr_sources
592 sources += [ "src/gpu/GrPathRendering_none.cpp" ]
593 }
mtklein06c35c02016-09-20 12:28:12 -0700594
595 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500596 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700597 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400598 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700599 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400600 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400601
602 # this lib is required to link against AHardwareBuffer
603 if (defined(ndk_api) && ndk_api >= 26) {
604 libs += [ "android" ]
605 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400606 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500607 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400608 libs += [ "EGL" ]
Chinmay Garded92d0352018-09-17 10:23:28 -0700609 } else if (is_linux && skia_use_x11) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500610 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -0400611 libs += [ "GL" ]
mtklein06c35c02016-09-20 12:28:12 -0700612 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500613 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800614 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500615 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400616 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500617 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -0500618 if (target_cpu != "arm64") {
619 libs += [ "OpenGL32.lib" ]
620 }
mtklein06c35c02016-09-20 12:28:12 -0700621 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500622 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700623 }
mtkleine9fb3d52016-09-20 15:11:46 -0700624
625 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400626 public_defines += [ "SK_VULKAN" ]
Greg Daniel18dbfd02018-05-29 10:46:51 -0400627 deps += [ "third_party/vulkanmemoryallocator" ]
mtkleine9fb3d52016-09-20 15:11:46 -0700628 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700629 if (skia_enable_vulkan_debug_layers) {
630 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
631 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800632 if (is_fuchsia) {
Kevin Lubickec1c6202018-12-14 11:42:53 -0500633 public_deps +=
634 [ "//third_party/vulkan_loader_and_validation_layers:vulkan" ]
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800635 }
mtkleine9fb3d52016-09-20 15:11:46 -0700636 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400637
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400638 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400639 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400640 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
641 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400642
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400643 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400644 if (skia_use_metal) {
645 public_defines += [ "SK_METAL" ]
646 sources += skia_metal_sources
647 libs += [ "Metal.framework" ]
Greg Daniel53956d92018-08-08 14:41:19 -0400648 libs += [ "Foundation.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400649 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400650 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500651
652 if (skia_enable_atlas_text) {
653 sources += skia_atlas_text_sources
654 }
Kevin Lubickf4def342018-10-04 12:52:50 -0400655
656 if (is_debug) {
657 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
658 }
mtklein06c35c02016-09-20 12:28:12 -0700659}
660
Leon Scroggins III41169202019-01-29 09:29:57 -0500661optional("gif") {
662 enabled = !skia_use_wuffs
663 sources = [
664 "src/codec/SkGifCodec.cpp",
665 "third_party/gif/SkGifImageReader.cpp",
666 ]
667}
668
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400669optional("heif") {
670 enabled = skia_use_libheif
671 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
672
673 deps = []
674
675 sources = [
676 "src/codec/SkHeifCodec.cpp",
677 ]
678}
679
mtklein63213812016-08-24 09:55:56 -0700680optional("jpeg") {
681 enabled = skia_use_libjpeg_turbo
682 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
683
mtklein63213812016-08-24 09:55:56 -0700684 deps = [
685 "//third_party/libjpeg-turbo:libjpeg",
686 ]
Mike Kleinf105dc72018-06-05 15:22:54 -0400687 public = [
688 "include/encode/SkJpegEncoder.h",
689 ]
mtklein63213812016-08-24 09:55:56 -0700690 sources = [
691 "src/codec/SkJpegCodec.cpp",
692 "src/codec/SkJpegDecoderMgr.cpp",
693 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700694 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400695 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700696 ]
697}
698
699optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500700 enabled = skia_use_zlib && skia_enable_pdf
701 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700702
mtklein63213812016-08-24 09:55:56 -0700703 deps = [
704 "//third_party/zlib",
705 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400706 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700707 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400708 }
brettwb9447282016-09-01 14:24:39 -0700709 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700710 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
Hal Canary2a3093c2019-02-20 11:25:45 -0500711 if (skia_use_icu && skia_use_harfbuzz && skia_pdf_subset_harfbuzz) {
712 deps += [ "//third_party/harfbuzz" ]
713 defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ]
714 } else if (skia_use_icu && skia_use_sfntly) {
mtklein63213812016-08-24 09:55:56 -0700715 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -0500716 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700717 }
718}
719
720optional("png") {
721 enabled = skia_use_libpng
722 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
723
mtklein63213812016-08-24 09:55:56 -0700724 deps = [
725 "//third_party/libpng",
726 ]
727 sources = [
728 "src/codec/SkIcoCodec.cpp",
729 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400730 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700731 ]
732}
733
scroggof84ad642016-10-31 09:02:57 -0700734optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400735 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700736 public_defines = [ "SK_CODEC_DECODES_RAW" ]
737
738 deps = [
739 "//third_party/dng_sdk",
740 "//third_party/libjpeg-turbo:libjpeg",
741 "//third_party/piex",
742 ]
743
744 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
745 # Skia.
746 configs_to_remove = [ "//gn:no_exceptions" ]
747
748 sources = [
scroggof84ad642016-10-31 09:02:57 -0700749 "src/codec/SkRawCodec.cpp",
750 ]
751}
752
Mike Klein852a8cb2018-05-15 10:46:58 -0400753import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400754source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400755 cflags = []
756 if (!is_win || is_clang) {
757 cflags += [
758 "-w",
759 "-std=c11",
760 ]
761 }
762
763 public = [
764 "third_party/skcms/skcms.h",
765 ]
766 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
767}
768
mtklein3cc22182016-08-29 13:26:14 -0700769optional("typeface_freetype") {
770 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700771
772 deps = [
773 "//third_party/freetype2",
774 ]
775 sources = [
776 "src/ports/SkFontHost_FreeType.cpp",
777 "src/ports/SkFontHost_FreeType_common.cpp",
778 ]
779}
780
mtklein457b42a2016-08-23 13:56:37 -0700781optional("webp") {
782 enabled = skia_use_libwebp
783 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
784
mtklein457b42a2016-08-23 13:56:37 -0700785 deps = [
786 "//third_party/libwebp",
787 ]
788 sources = [
mtklein457b42a2016-08-23 13:56:37 -0700789 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400790 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700791 ]
mtkleineb3c4252016-08-23 07:38:09 -0700792}
793
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400794optional("wuffs") {
795 enabled = skia_use_wuffs
796 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
797
798 deps = [
799 "//third_party/wuffs",
800 ]
801 sources = [
802 "src/codec/SkWuffsCodec.cpp",
803 ]
804}
805
mtklein63213812016-08-24 09:55:56 -0700806optional("xml") {
807 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000808 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700809
mtklein63213812016-08-24 09:55:56 -0700810 deps = [
811 "//third_party/expat",
812 ]
813 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500814 "src/svg/SkSVGCanvas.cpp",
815 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700816 "src/xml/SkDOM.cpp",
817 "src/xml/SkXMLParser.cpp",
818 "src/xml/SkXMLWriter.cpp",
819 ]
820}
821
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700822if (skia_enable_gpu && skia_generate_workarounds) {
823 action("workaround_list") {
824 script = "tools/build_workaround_header.py"
825
826 inputs = [
827 "src/gpu/gpu_workaround_list.txt",
828 ]
829
830 # see comments in skia_compile_processors about out dir path shenanigans.
831 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700832 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700833
834 outputs = [
835 "$root_out_dir/$output_file",
836 ]
837 args = [
838 "--output-file",
839 "$output_file",
840 ]
841
842 foreach(file, inputs) {
843 args += [ rebase_path(file, root_build_dir) ]
844 }
845 }
846}
847
mtkleinc04ff472016-06-23 10:29:30 -0700848component("skia") {
849 public_configs = [ ":skia_public" ]
850 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700851
Mike Klein607b0a72018-11-07 16:17:34 -0500852 public_deps = [
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500853 ":gpu",
Mike Klein607b0a72018-11-07 16:17:34 -0500854 ":pdf",
855 ":skcms",
856 ]
857
mtkleinc04ff472016-06-23 10:29:30 -0700858 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700859 ":arm64",
860 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700861 ":avx",
Mike Klein54378232018-11-08 12:08:05 +0000862 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -0700863 ":crc32",
mtkleina45be612016-08-29 15:22:10 -0700864 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700865 ":fontmgr_custom",
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500866 ":fontmgr_custom_empty",
Hal Canaryff2742e2018-01-30 11:35:47 -0500867 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700868 ":fontmgr_fontconfig",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800869 ":fontmgr_fuchsia",
Kevin Lubickddd0a332018-12-12 10:35:13 -0500870 ":fontmgr_wasm",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500871 ":fontmgr_win",
872 ":fontmgr_win_gdi",
Leon Scroggins III41169202019-01-29 09:29:57 -0500873 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400874 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500875 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700876 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700877 ":none",
mtklein63213812016-08-24 09:55:56 -0700878 ":png",
scroggof84ad642016-10-31 09:02:57 -0700879 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700880 ":sse2",
881 ":sse41",
882 ":sse42",
883 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700884 ":webp",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400885 ":wuffs",
mtklein63213812016-08-24 09:55:56 -0700886 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700887 ]
888
Kevin Lubick134be1d2018-10-30 15:05:04 -0400889 if (skia_enable_nima) {
890 deps += [ "//third_party/Nima-Cpp" ]
891 }
892
Chinmay Garde43f115c2016-11-16 15:04:12 -0800893 # This file (and all GN files in Skia) are designed to work with an
894 # empty sources assignment filter; we handle all that explicitly.
895 # We clear the filter here for clients who may have set up a global filter.
896 set_sources_assignment_filter([])
897
Hal Canaryc25f4e92019-02-26 11:54:25 -0500898 public = skia_core_public
899 public += skia_utils_public
900 public += skia_effects_public
901 public += skia_effects_imagefilter_public
902 public += skia_xps_public
903
mtkleinc04ff472016-06-23 10:29:30 -0700904 sources = []
brettwb9447282016-09-01 14:24:39 -0700905 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700906 sources += skia_utils_sources
Leon Scroggins IIIee0e5d02019-02-27 10:59:11 -0500907 if (skia_use_xps) {
908 sources += skia_xps_sources
909 }
Mike Klein54378232018-11-08 12:08:05 +0000910 sources += skia_effects_sources
911 sources += skia_effects_imagefilter_sources
mtkleinc04ff472016-06-23 10:29:30 -0700912 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400913 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500914 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700915 "src/android/SkBitmapRegionCodec.cpp",
916 "src/android/SkBitmapRegionDecoder.cpp",
917 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +1100918 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400919 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700920 "src/codec/SkBmpCodec.cpp",
921 "src/codec/SkBmpMaskCodec.cpp",
922 "src/codec/SkBmpRLECodec.cpp",
923 "src/codec/SkBmpStandardCodec.cpp",
924 "src/codec/SkCodec.cpp",
925 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -0400926 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -0400927 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700928 "src/codec/SkMaskSwizzler.cpp",
929 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700930 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700931 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700932 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700933 "src/codec/SkSwizzler.cpp",
934 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700935 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700936 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +0000937 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700938 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700939 "src/ports/SkMemory_malloc.cpp",
940 "src/ports/SkOSFile_stdio.cpp",
941 "src/sfnt/SkOTTable_name.cpp",
942 "src/sfnt/SkOTUtils.cpp",
943 "src/utils/mac/SkStream_mac.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700944 ]
brettwb9447282016-09-01 14:24:39 -0700945
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400946 defines = []
947 if (!skia_enable_skpicture) {
948 defines = [ "SK_DISABLE_SKPICTURE" ]
Hal Canaryc25f4e92019-02-26 11:54:25 -0500949 public -= skia_skpicture_public
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400950 sources -= skia_skpicture_sources
Mike Klein54378232018-11-08 12:08:05 +0000951 sources -= [ "//src/effects/imagefilters/SkPictureImageFilter.cpp" ]
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400952 sources += [ "src/core/SkPicture_none.cpp" ]
953 }
954
mtklein7d6fb2c2016-08-25 14:50:44 -0700955 libs = []
956
mtkleinc04ff472016-06-23 10:29:30 -0700957 if (is_win) {
958 sources += [
959 "src/ports/SkDebug_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700960 "src/ports/SkImageEncoder_WIC.cpp",
961 "src/ports/SkImageGeneratorWIC.cpp",
962 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700963 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700964 "src/ports/SkTLS_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700965 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400966 libs += [
967 "FontSub.lib",
968 "Ole32.lib",
969 "OleAut32.lib",
970 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500971 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400972 ]
mtkleinc04ff472016-06-23 10:29:30 -0700973 } else {
974 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700975 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700976 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700977 "src/ports/SkTLS_pthread.cpp",
978 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400979 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700980 }
981
mtklein7d6fb2c2016-08-25 14:50:44 -0700982 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500983 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500984 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500985 deps += [ "//third_party/cpu-features" ]
986 }
mtklein06c35c02016-09-20 12:28:12 -0700987 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700988 libs += [
989 "EGL",
990 "GLESv2",
991 "log",
992 ]
993 }
994
Kevin Lubick217056c2018-09-20 17:39:31 -0400995 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -0700996 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -0400997 if (skia_use_egl) {
998 libs += [ "GLESv2" ]
999 }
mtkleinc04ff472016-06-23 10:29:30 -07001000 }
1001
Leon Scroggins III85e22fc2018-11-28 08:58:47 -05001002 if (skia_use_fonthost_mac) {
Sergey Ulanovf3babcd2018-11-30 17:42:00 -08001003 sources += [ "src/ports/SkFontHost_mac.cpp" ]
Leon Scroggins III85e22fc2018-11-28 08:58:47 -05001004 }
1005
mtkleinc04ff472016-06-23 10:29:30 -07001006 if (is_mac) {
1007 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001008 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001009 "src/ports/SkImageEncoder_CG.cpp",
1010 "src/ports/SkImageGeneratorCG.cpp",
1011 ]
mtklein09e61f72016-08-23 13:35:28 -07001012 libs += [
bungeman3e306f62017-03-29 11:32:02 -04001013 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
1014 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -07001015 "ApplicationServices.framework",
1016 "OpenGL.framework",
1017 ]
mtkleinc04ff472016-06-23 10:29:30 -07001018 }
abarth6fc8ff02016-07-15 15:15:15 -07001019
Mike Klein7d302882016-11-03 14:06:31 -04001020 if (is_ios) {
1021 sources += [
1022 "src/ports/SkDebug_stdio.cpp",
1023 "src/ports/SkFontHost_mac.cpp",
1024 "src/ports/SkImageEncoder_CG.cpp",
1025 "src/ports/SkImageGeneratorCG.cpp",
1026 ]
1027 libs += [
1028 "CoreFoundation.framework",
1029 "CoreGraphics.framework",
1030 "CoreText.framework",
1031 "ImageIO.framework",
1032 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -04001033
1034 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
1035 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001036 ]
1037 }
1038
abarth6fc8ff02016-07-15 15:15:15 -07001039 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001040 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001041 }
mtkleinc04ff472016-06-23 10:29:30 -07001042}
1043
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001044# DebugCanvas used in experimental/wasm-skp-debugger
1045if (target_cpu == "wasm") {
1046 static_library("debugcanvas") {
1047 public_configs = [ ":skia_public" ]
1048
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001049 sources = [
1050 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001051 "tools/debugger/DebugCanvas.cpp",
1052 "tools/debugger/DrawCommand.cpp",
1053 "tools/debugger/JsonWriteBuffer.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001054 ]
1055
1056 deps = [
1057 ":fontmgr_wasm",
1058 ]
1059 }
1060}
1061
Kevin Lubickcbcff382018-10-02 09:02:18 -04001062static_library("pathkit") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001063 check_includes = false
Kevin Lubickcbcff382018-10-02 09:02:18 -04001064 public_configs = [ ":skia_public" ]
1065 configs += skia_library_configs
1066
1067 deps = [
1068 ":arm64",
1069 ":armv7",
1070 ":avx",
1071 ":crc32",
1072 ":hsw",
1073 ":none",
1074 ":sse2",
1075 ":sse41",
1076 ":sse42",
1077 ":ssse3",
1078 ]
1079
1080 # This file (and all GN files in Skia) are designed to work with an
1081 # empty sources assignment filter; we handle all that explicitly.
1082 # We clear the filter here for clients who may have set up a global filter.
1083 set_sources_assignment_filter([])
1084
1085 sources = []
1086 sources += skia_pathops_sources
Hal Canaryc25f4e92019-02-26 11:54:25 -05001087 sources += skia_pathops_public
Kevin Lubickcbcff382018-10-02 09:02:18 -04001088 sources += [
1089 "src/core/SkAnalyticEdge.cpp",
1090 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001091 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001092 "src/core/SkCubicMap.cpp",
1093 "src/core/SkEdge.cpp",
1094 "src/core/SkEdgeBuilder.cpp",
1095 "src/core/SkEdgeClipper.cpp",
1096 "src/core/SkGeometry.cpp",
1097 "src/core/SkLineClipper.cpp",
1098 "src/core/SkMallocPixelRef.cpp",
1099 "src/core/SkMath.cpp",
1100 "src/core/SkMatrix.cpp",
1101 "src/core/SkOpts.cpp",
1102 "src/core/SkPaint.cpp",
1103 "src/core/SkPath.cpp",
1104 "src/core/SkPathEffect.cpp",
1105 "src/core/SkPathMeasure.cpp",
1106 "src/core/SkPathRef.cpp",
1107 "src/core/SkPoint.cpp",
1108 "src/core/SkRRect.cpp",
1109 "src/core/SkRect.cpp",
1110 "src/core/SkSemaphore.cpp",
1111 "src/core/SkStream.cpp",
1112 "src/core/SkString.cpp",
1113 "src/core/SkStringUtils.cpp",
1114 "src/core/SkStroke.cpp",
1115 "src/core/SkStrokeRec.cpp",
1116 "src/core/SkStrokerPriv.cpp",
1117 "src/core/SkThreadID.cpp",
1118 "src/core/SkUtils.cpp",
1119 "src/effects/SkDashPathEffect.cpp",
1120 "src/effects/SkTrimPathEffect.cpp",
1121 "src/ports/SkDebug_stdio.cpp",
1122 "src/ports/SkMemory_malloc.cpp",
1123 "src/utils/SkDashPath.cpp",
1124 "src/utils/SkParse.cpp",
1125 "src/utils/SkParsePath.cpp",
1126 "src/utils/SkUTF.cpp",
1127 ]
1128}
1129
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001130group("modules") {
1131 deps = [
Kevin Lubick96634842019-03-05 14:09:24 -05001132 "modules/particles",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001133 "modules/skottie",
1134 "modules/skshaper",
1135 ]
1136}
1137
mtkleinc095df52016-08-24 12:23:52 -07001138# Targets guarded by skia_enable_tools may use //third_party freely.
1139if (skia_enable_tools) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001140 skia_public_includes = [
1141 "include/android",
1142 "include/atlastext",
1143 "include/c",
1144 "include/codec",
1145 "include/config",
1146 "include/core",
1147 "include/docs",
1148 "include/effects",
1149 "include/encode",
1150 "include/gpu",
1151 "include/pathops",
1152 "include/ports",
1153 "include/svg",
1154 "include/utils",
1155 "include/utils/mac",
1156 "modules/sksg/include",
1157 "modules/skshaper/include",
1158 "modules/skottie/include",
1159 ]
1160
Mike Klein308b5ac2016-12-06 16:03:52 -05001161 # Used by gn_to_bp.py to list our public include dirs.
1162 source_set("public") {
1163 configs += [ ":skia_public" ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001164 include_dirs = skia_public_includes
Mike Klein308b5ac2016-12-06 16:03:52 -05001165 }
1166
Mike Kleinc36dedf2016-11-18 09:35:28 -05001167 config("skia.h_config") {
1168 include_dirs = [ "$target_gen_dir" ]
1169 }
1170 action("skia.h") {
1171 public_configs = [ ":skia.h_config" ]
1172 skia_h = "$target_gen_dir/skia.h"
1173 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001174
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001175 args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1176 [ rebase_path(skia_h, root_build_dir) ] +
1177 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001178 depfile = "$skia_h.deps"
1179 outputs = [
1180 skia_h,
1181 ]
1182 }
1183
Brian Osmanc9a42472018-05-31 13:17:12 -04001184 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001185 executable("fiddle") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001186 check_includes = false
Mike Kleinc36dedf2016-11-18 09:35:28 -05001187 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001188 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001189 "tools/fiddle/draw.cpp",
1190 "tools/fiddle/fiddle_main.cpp",
1191 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001192
1193 if (skia_use_egl) {
1194 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001195 } else {
1196 sources += [ "tools/fiddle/null_context.cpp" ]
1197 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001198 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001199 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001200 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001201 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001202 ":skia",
1203 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001204 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001205 "modules/skshaper",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001206 ]
1207 }
1208 }
1209
Brian Osmanc9a42472018-05-31 13:17:12 -04001210 source_set("public_headers_warnings_check") {
1211 sources = [
1212 "tools/public_headers_warnings_check.cpp",
1213 ]
1214 configs -= [ "//gn:warnings_except_public_headers" ]
1215 deps = [
1216 ":skia",
1217 ":skia.h",
1218 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001219 "modules/skshaper",
Brian Osmanc9a42472018-05-31 13:17:12 -04001220 ]
Greg Daniel54bfb182018-11-20 17:12:36 -05001221
1222 # We add this directory to simulate the client already have
1223 # vulkan/vulkan_core.h on their path.
Greg Daniel54200e42018-12-11 17:03:39 -05001224 include_dirs = [ "include/third_party/vulkan" ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001225 }
1226
mtkleinc095df52016-08-24 12:23:52 -07001227 template("test_lib") {
1228 config(target_name + "_config") {
mtkleina627b5c2016-09-20 13:36:47 -07001229 if (defined(invoker.public_defines)) {
1230 defines = invoker.public_defines
1231 }
mtklein25c81d42016-07-27 13:55:26 -07001232 }
mtkleinc095df52016-08-24 12:23:52 -07001233 source_set(target_name) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001234 forward_variables_from(invoker, "*", [])
Hal Canaryc25f4e92019-02-26 11:54:25 -05001235 check_includes = false
mtkleinc095df52016-08-24 12:23:52 -07001236 public_configs = [
1237 ":" + target_name + "_config",
1238 ":skia_private",
1239 ]
1240
1241 if (!defined(deps)) {
1242 deps = []
1243 }
1244 deps += [ ":skia" ]
1245 testonly = true
1246 }
mtklein25c81d42016-07-27 13:55:26 -07001247 }
mtklein25c81d42016-07-27 13:55:26 -07001248
Mike Kleine6682eb2017-01-05 10:54:57 -05001249 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001250 if (is_ios) {
1251 app_name = target_name
1252 gen_path = target_gen_dir
1253
1254 action("${app_name}_generate_info_plist") {
1255 script = "//gn/gen_plist_ios.py"
1256 outputs = [
1257 "$gen_path/${app_name}_Info.plist",
1258 ]
1259 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1260 }
1261
1262 bundle_data("${app_name}_bundle_info_plist") {
1263 public_deps = [
1264 ":${app_name}_generate_info_plist",
1265 ]
1266 sources = [
1267 "$gen_path/${app_name}_Info.plist",
1268 ]
1269 outputs = [
1270 "{{bundle_root_dir}}/Info.plist",
1271 ]
1272 }
1273
Jim Van Verthffacf652019-04-02 11:59:34 -04001274 has_skps = "True" == exec_script("//gn/checkdir.py",
1275 [ rebase_path("skps", root_build_dir) ],
1276 "trim string")
1277 bundle_data("${app_name}_bundle_resources") {
1278 sources = [
1279 "resources",
1280 ]
1281 outputs = [
1282 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1283 "{{bundle_resources_dir}}/data/resources",
1284 ]
1285 }
1286 if (has_skps) {
1287 bundle_data("${app_name}_bundle_skps") {
Jim Van Verth329c5a62017-11-29 11:42:33 -05001288 sources = [
Jim Van Verthffacf652019-04-02 11:59:34 -04001289 "skps",
Jim Van Verth329c5a62017-11-29 11:42:33 -05001290 ]
1291 outputs = [
Jim Van Verthffacf652019-04-02 11:59:34 -04001292 # Store in same folder as resources
1293 "{{bundle_resources_dir}}/data/skps",
Jim Van Verth329c5a62017-11-29 11:42:33 -05001294 ]
1295 }
Jim Van Verth329c5a62017-11-29 11:42:33 -05001296 }
1297
Jim Van Verth443a9132017-11-28 09:45:26 -05001298 executable("${app_name}_generate_executable") {
1299 forward_variables_from(invoker,
1300 "*",
1301 [
1302 "output_name",
1303 "visibility",
1304 "is_shared_library",
1305 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001306 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001307 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001308 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1309 }
1310
1311 bundle_data("${app_name}_bundle_executable") {
1312 public_deps = [
1313 ":${app_name}_generate_executable",
1314 ]
1315 sources = [
1316 "$gen_path/$app_name",
1317 ]
1318 outputs = [
1319 "{{bundle_executable_dir}}/$app_name",
1320 ]
1321 testonly = true
1322 }
1323
Jim Van Verthffacf652019-04-02 11:59:34 -04001324 bundle_data("${app_name}_bundle_symbols") {
1325 public_deps = [
1326 ":${app_name}_generate_executable",
1327 ]
1328 sources = [
1329 "$gen_path/${app_name}.dSYM",
1330 ]
1331 outputs = [
1332 "{{bundle_executable_dir}}/${app_name}.dSYM",
1333 ]
1334 testonly = true
1335 }
1336
Jim Van Verth443a9132017-11-28 09:45:26 -05001337 create_bundle("$app_name") {
1338 product_type = "com.apple.product-type.application"
1339 testonly = true
1340
1341 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1342 bundle_resources_dir = bundle_root_dir
1343 bundle_executable_dir = bundle_root_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001344
1345 deps = [
1346 ":${app_name}_bundle_executable",
1347 ":${app_name}_bundle_info_plist",
Jim Van Verthffacf652019-04-02 11:59:34 -04001348 ":${app_name}_bundle_resources",
1349 ":${app_name}_bundle_symbols",
Jim Van Verth443a9132017-11-28 09:45:26 -05001350 ]
Jim Van Verthffacf652019-04-02 11:59:34 -04001351 if (has_skps) {
1352 deps += [ ":${app_name}_bundle_skps" ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001353 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001354
1355 # should only code sign when running on a device, not the simulator
1356 if (target_cpu != "x64") {
1357 code_signing_script = "//gn/codesign_ios.py"
1358 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1359 code_signing_outputs = [
1360 "$bundle_root_dir/_CodeSignature/CodeResources",
1361 "$bundle_root_dir/embedded.mobileprovision",
1362 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001363 code_signing_args = [
1364 rebase_path("$bundle_root_dir", root_build_dir),
1365 skia_ios_identity,
1366 skia_ios_profile,
1367 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001368 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001369 }
1370 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001371 # !is_ios
1372
1373 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1374 shared_library("lib" + target_name) {
1375 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1376 configs += [ ":skia_private" ]
1377 testonly = true
1378 }
1379 } else {
1380 _executable = target_name
1381 executable(_executable) {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001382 check_includes = false
Jim Van Verth443a9132017-11-28 09:45:26 -05001383 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1384 configs += [ ":skia_private" ]
1385 testonly = true
1386 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001387 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001388 if (is_android && skia_android_serial != "" && defined(_executable)) {
1389 action("push_" + target_name) {
1390 script = "gn/push_to_android.py"
1391 deps = [
1392 ":" + _executable,
1393 ]
1394 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1395 outputs = [
1396 _stamp,
1397 ]
1398 args = [
1399 rebase_path("$root_build_dir/$_executable"),
1400 skia_android_serial,
1401 rebase_path(_stamp),
1402 ]
1403 testonly = true
1404 }
Mike Klein7d921032017-01-05 12:20:41 -05001405 }
1406 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001407 }
1408
Greg Danielda16cce2018-08-01 09:23:57 -04001409 config("moltenvk_config") {
1410 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1411 if (is_ios) {
1412 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS"
1413 } else {
1414 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS"
1415 }
1416 cflags = [ "-F$moltenvk_framework_path" ]
1417 ldflags = [ "-F$moltenvk_framework_path" ]
1418 libs = [
1419 "MoltenVK.framework",
1420 "Metal.framework",
1421 "IOSurface.framework",
1422 "QuartzCore.framework",
1423 "Foundation.framework",
1424 ]
1425 if (is_ios) {
1426 libs += [ "UIKit.framework" ]
1427 } else {
1428 libs += [ "IOKit.framework" ]
1429 }
1430 defines = [ "SK_MOLTENVK" ]
1431 }
1432 }
1433
1434 source_set("moltenvk") {
1435 public_configs = [ ":moltenvk_config" ]
1436 }
1437
mtkleinc095df52016-08-24 12:23:52 -07001438 test_lib("gpu_tool_utils") {
Brian Osmanc9a42472018-05-31 13:17:12 -04001439 public_defines = []
mtkleind68f9b02016-09-23 13:18:41 -07001440
Mike Klein333fb452019-04-24 08:48:11 -05001441 defines = []
1442 if (skia_enable_discrete_gpu) {
1443 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
1444 }
1445
Brian Osmanc9a42472018-05-31 13:17:12 -04001446 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001447 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001448 sources = [
1449 "tools/gpu/GrContextFactory.cpp",
1450 "tools/gpu/GrTest.cpp",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001451 "tools/gpu/MemoryCache.cpp",
1452 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001453 "tools/gpu/ProxyUtils.cpp",
1454 "tools/gpu/TestContext.cpp",
Michael Ludwigd9958f82019-03-21 13:08:36 -04001455 "tools/gpu/YUVUtils.cpp",
1456 "tools/gpu/YUVUtils.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001457 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1458 "tools/gpu/gl/GLTestContext.cpp",
1459 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04001460 "tools/gpu/mock/MockTestContext.cpp",
1461 ]
1462 libs = []
1463
1464 if (is_android || skia_use_egl) {
1465 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1466 } else if (is_ios) {
1467 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1468 libs += [ "OpenGLES.framework" ]
1469 } else if (is_linux) {
1470 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -04001471 libs += [
1472 "GLU",
1473 "X11",
1474 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001475 } else if (is_mac) {
1476 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1477 } else if (is_win) {
1478 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001479 libs += [ "Gdi32.lib" ]
1480 if (target_cpu != "arm64") {
1481 libs += [ "OpenGL32.lib" ]
1482 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001483 }
mtklein25c81d42016-07-27 13:55:26 -07001484
Brian Osmanc9a42472018-05-31 13:17:12 -04001485 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001486
Brian Osmanc9a42472018-05-31 13:17:12 -04001487 if (skia_use_angle) {
1488 deps += [ "//third_party/angle2" ]
1489 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1490 }
Greg Daniel54200e42018-12-11 17:03:39 -05001491
Brian Osmanc9a42472018-05-31 13:17:12 -04001492 if (skia_use_vulkan) {
1493 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1494 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Greg Danielda16cce2018-08-01 09:23:57 -04001495 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1496 public_deps += [ ":moltenvk" ]
1497 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001498 }
1499 if (skia_use_metal) {
1500 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001501 }
mtklein25c81d42016-07-27 13:55:26 -07001502 }
mtklein25c81d42016-07-27 13:55:26 -07001503
mtkleinc095df52016-08-24 12:23:52 -07001504 test_lib("flags") {
mtkleinc095df52016-08-24 12:23:52 -07001505 sources = [
Mike Klein88544fb2019-03-20 10:50:33 -05001506 "tools/flags/CommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001507 ]
1508 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001509
1510 test_lib("common_flags_config") {
mtklein046cb562016-09-16 10:23:12 -07001511 sources = [
Mike Klein88544fb2019-03-20 10:50:33 -05001512 "tools/flags/CommonFlagsConfig.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001513 ]
1514 deps = [
mtklein046cb562016-09-16 10:23:12 -07001515 ":flags",
Greg Danielda16cce2018-08-01 09:23:57 -04001516 ]
1517 public_deps = [
mtkleinc095df52016-08-24 12:23:52 -07001518 ":gpu_tool_utils",
1519 ]
1520 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001521 test_lib("common_flags_gpu") {
Mike Kleinc6142d82019-03-25 10:54:59 -05001522 sources = [
1523 "tools/flags/CommonFlagsGpu.cpp",
1524 ]
1525 deps = [
1526 ":flags",
1527 ]
1528 public_deps = [
1529 ":gpu_tool_utils",
1530 ]
1531 }
1532 test_lib("common_flags_images") {
Mike Kleinc6142d82019-03-25 10:54:59 -05001533 sources = [
1534 "tools/flags/CommonFlagsImages.cpp",
1535 ]
1536 deps = [
1537 ":flags",
1538 ]
1539 }
1540 test_lib("common_flags_aa") {
Mike Kleinc6142d82019-03-25 10:54:59 -05001541 sources = [
1542 "tools/flags/CommonFlagsAA.cpp",
1543 ]
1544 deps = [
1545 ":flags",
1546 ]
1547 }
mtklein25c81d42016-07-27 13:55:26 -07001548
Mike Klein499f0ac2019-03-25 13:00:12 -05001549 test_lib("trace") {
Mike Klein499f0ac2019-03-25 13:00:12 -05001550 deps = [
1551 ":flags",
1552 ]
1553 sources = [
1554 "tools/trace/ChromeTracingTracer.cpp",
1555 "tools/trace/ChromeTracingTracer.h",
1556 "tools/trace/EventTracingPriv.cpp",
1557 "tools/trace/EventTracingPriv.h",
1558 "tools/trace/SkDebugfTracer.cpp",
1559 "tools/trace/SkDebugfTracer.h",
1560 ]
1561 }
1562
mtkleinc095df52016-08-24 12:23:52 -07001563 test_lib("tool_utils") {
mtkleinc095df52016-08-24 12:23:52 -07001564 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001565 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001566 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001567 "tools/DDLPromiseImageHelper.cpp",
1568 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001569 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001570 "tools/ProcStats.cpp",
1571 "tools/Resources.cpp",
Mike Kleinea3f0142019-03-20 11:12:10 -05001572 "tools/ToolUtils.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001573 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001574 "tools/debugger/DebugCanvas.cpp",
1575 "tools/debugger/DrawCommand.cpp",
1576 "tools/debugger/JsonWriteBuffer.cpp",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001577 "tools/fonts/RandomScalerContext.cpp",
1578 "tools/fonts/TestEmptyTypeface.h",
1579 "tools/fonts/TestFontMgr.cpp",
1580 "tools/fonts/TestFontMgr.h",
1581 "tools/fonts/TestSVGTypeface.cpp",
1582 "tools/fonts/TestSVGTypeface.h",
1583 "tools/fonts/TestTypeface.cpp",
1584 "tools/fonts/TestTypeface.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001585 "tools/fonts/ToolUtilsFont.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001586 "tools/random_parse_path.cpp",
Mike Kleincd5104e2019-03-20 11:55:08 -05001587 "tools/timer/AnimTimer.h",
mtkleinc095df52016-08-24 12:23:52 -07001588 "tools/timer/Timer.cpp",
1589 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001590 libs = []
1591 if (is_ios) {
1592 sources += [ "tools/ios_utils.m" ]
1593 libs += [ "Foundation.framework" ]
Mike Kleinbf15b662019-04-15 11:32:16 -05001594 } else if (is_win) {
1595 libs += [ "DbgHelp.lib" ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001596 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001597
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001598 defines = []
1599 if (skia_tools_require_resources) {
1600 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1601 }
mtkleinc095df52016-08-24 12:23:52 -07001602 deps = [
Ben Wagner97182cc2018-02-15 10:20:04 -05001603 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001604 ":flags",
Mike Kleine4ad58a2019-03-26 09:05:52 -05001605 ]
1606 public_deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05001607 ":gpu_tool_utils",
mtkleinc095df52016-08-24 12:23:52 -07001608 ]
mtkleinc095df52016-08-24 12:23:52 -07001609 }
mtklein25c81d42016-07-27 13:55:26 -07001610
Mike Kleine11e5c12019-04-24 12:46:06 -05001611 test_lib("etc1") {
1612 sources = [
1613 "third_party/etc1/etc1.cpp",
1614 ]
1615 }
1616
Mike Klein6e744122016-10-27 12:21:40 -04001617 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001618 test_lib("gm") {
mtkleinc095df52016-08-24 12:23:52 -07001619 sources = gm_sources
1620 deps = [
Mike Kleine11e5c12019-04-24 12:46:06 -05001621 ":etc1",
scroggo19b91532016-10-24 09:03:26 -07001622 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001623 ":skia",
1624 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001625 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001626 "modules/skottie:gm",
Florin Malita3b526b02018-05-25 12:43:51 -04001627 "modules/sksg",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001628 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001629 ]
Greg Danielda16cce2018-08-01 09:23:57 -04001630 public_deps = [
1631 ":gpu_tool_utils",
1632 ]
mtkleinc095df52016-08-24 12:23:52 -07001633 }
mtklein25c81d42016-07-27 13:55:26 -07001634
Mike Klein6e744122016-10-27 12:21:40 -04001635 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001636 test_lib("tests") {
Mike Klein6e744122016-10-27 12:21:40 -04001637 sources = tests_sources + pathops_tests_sources
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -05001638 if (!skia_enable_fontmgr_android) {
Mike Klein6e744122016-10-27 12:21:40 -04001639 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001640 }
Ben Wagner37a06c02018-06-22 21:11:00 +00001641 if (!(skia_use_freetype && skia_use_fontconfig)) {
1642 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1643 }
mtkleinc095df52016-08-24 12:23:52 -07001644 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001645 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001646 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001647 ":skia",
1648 ":tool_utils",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001649 "modules/skottie:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001650 "modules/sksg:tests",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001651 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001652 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05001653 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07001654 "//third_party/zlib",
1655 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001656 public_deps = [
1657 ":gpu_tool_utils", # Test.h #includes headers from this target.
1658 ]
mtkleinc095df52016-08-24 12:23:52 -07001659 }
mtklein2f3416d2016-08-02 16:02:05 -07001660
Mike Klein6e744122016-10-27 12:21:40 -04001661 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001662 test_lib("bench") {
mtkleinc095df52016-08-24 12:23:52 -07001663 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001664 deps = [
1665 ":flags",
1666 ":gm",
1667 ":gpu_tool_utils",
1668 ":skia",
1669 ":tool_utils",
1670 ]
1671 }
mtklein2b6870c2016-07-28 14:17:33 -07001672
mtkleinc095df52016-08-24 12:23:52 -07001673 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001674 if (skia_use_expat) {
Hal Canary0f666812018-03-22 15:21:12 -04001675 sources = [
1676 "experimental/svg/model/SkSVGAttribute.cpp",
1677 "experimental/svg/model/SkSVGAttributeParser.cpp",
1678 "experimental/svg/model/SkSVGCircle.cpp",
1679 "experimental/svg/model/SkSVGClipPath.cpp",
1680 "experimental/svg/model/SkSVGContainer.cpp",
1681 "experimental/svg/model/SkSVGDOM.cpp",
1682 "experimental/svg/model/SkSVGEllipse.cpp",
1683 "experimental/svg/model/SkSVGGradient.cpp",
1684 "experimental/svg/model/SkSVGLine.cpp",
1685 "experimental/svg/model/SkSVGLinearGradient.cpp",
1686 "experimental/svg/model/SkSVGNode.cpp",
1687 "experimental/svg/model/SkSVGPath.cpp",
1688 "experimental/svg/model/SkSVGPattern.cpp",
1689 "experimental/svg/model/SkSVGPoly.cpp",
1690 "experimental/svg/model/SkSVGRadialGradient.cpp",
1691 "experimental/svg/model/SkSVGRect.cpp",
1692 "experimental/svg/model/SkSVGRenderContext.cpp",
1693 "experimental/svg/model/SkSVGSVG.cpp",
1694 "experimental/svg/model/SkSVGShape.cpp",
1695 "experimental/svg/model/SkSVGStop.cpp",
1696 "experimental/svg/model/SkSVGTransformableNode.cpp",
1697 "experimental/svg/model/SkSVGUse.cpp",
1698 "experimental/svg/model/SkSVGValue.cpp",
1699 ]
1700 deps = [
1701 ":skia",
1702 ":xml",
1703 ]
1704 }
mtkleinc095df52016-08-24 12:23:52 -07001705 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001706
Mike Klein38af9432016-11-11 11:39:44 -05001707 if (skia_use_lua) {
1708 test_lib("lua") {
Mike Klein38af9432016-11-11 11:39:44 -05001709 sources = [
1710 "src/utils/SkLua.cpp",
1711 "src/utils/SkLuaCanvas.cpp",
1712 ]
1713 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001714 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001715 "//third_party/lua",
1716 ]
1717 }
1718
Mike Kleine6682eb2017-01-05 10:54:57 -05001719 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001720 sources = [
1721 "tools/lua/lua_app.cpp",
1722 ]
1723 deps = [
1724 ":lua",
1725 ":skia",
1726 "//third_party/lua",
1727 ]
Mike Klein38af9432016-11-11 11:39:44 -05001728 }
1729
Mike Kleine6682eb2017-01-05 10:54:57 -05001730 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001731 sources = [
1732 "tools/lua/lua_pictures.cpp",
1733 ]
1734 deps = [
1735 ":flags",
1736 ":lua",
1737 ":skia",
1738 ":tool_utils",
1739 "//third_party/lua",
1740 ]
Mike Klein38af9432016-11-11 11:39:44 -05001741 }
1742 }
1743
Florin Malitabfe876a2018-09-02 12:33:59 -04001744 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001745 test_app("skottie_tool") {
1746 deps = [
1747 "modules/skottie:tool",
1748 ]
1749 }
1750 }
1751
Hal Canary5b39dc82019-04-17 13:29:46 -04001752 test_app("make_skqp_model") {
1753 sources = [
1754 "tools/skqp/make_skqp_model.cpp",
1755 ]
1756 deps = [
1757 ":skia",
1758 ]
1759 }
1760
Kevin Lubickebf648e2017-09-21 13:45:16 -04001761 if (target_cpu != "wasm") {
1762 import("gn/samples.gni")
1763 test_lib("samples") {
Yuqian Li56a4a092018-02-12 14:47:34 +08001764 sources = samples_sources
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001765 public_deps = [
1766 ":tool_utils",
1767 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001768 deps = [
1769 ":experimental_svg_model",
1770 ":flags",
Mike Kleinc6142d82019-03-25 10:54:59 -05001771 ":gpu_tool_utils",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001772 ":xml",
Mike Reedec80d902019-02-12 11:31:27 -05001773 "modules/sksg",
Herb Derby264182c2018-05-29 15:53:40 -04001774 "modules/skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001775 ]
Mike Klein38af9432016-11-11 11:39:44 -05001776
Ruiqi Maof5101492018-06-29 14:32:21 -04001777 # NIMA does not build on Windows clang
1778 if (!is_win || !is_clang) {
Kevin Lubickd9699322018-10-30 15:08:53 -04001779 sources += [ "experimental/nima/NimaActor.cpp" ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001780 deps += [ "//third_party/Nima-Cpp" ]
1781 }
1782
Kevin Lubickebf648e2017-09-21 13:45:16 -04001783 if (skia_use_lua) {
1784 sources += [ "samplecode/SampleLua.cpp" ]
1785 deps += [
1786 ":lua",
1787 "//third_party/lua",
1788 ]
1789 }
1790 }
Mike Klein7af351a2018-07-27 09:54:43 -04001791 test_app("imgcvt") {
1792 sources = [
1793 "tools/imgcvt.cpp",
1794 ]
1795 deps = [
1796 ":skcms",
1797 ":skia",
1798 ]
1799 }
Mike Klein735c7ba2019-03-25 12:57:58 -05001800 test_lib("hash_and_encode") {
Mike Klein735c7ba2019-03-25 12:57:58 -05001801 sources = [
1802 "tools/HashAndEncode.cpp",
1803 "tools/HashAndEncode.h",
1804 ]
1805 deps = [
1806 ":flags",
1807 ":skia",
1808 "//third_party/libpng",
1809 ]
1810 }
1811 test_app("fm") {
1812 sources = [
1813 "tools/fm/fm.cpp",
1814 ]
1815 deps = [
1816 ":common_flags_aa",
1817 ":common_flags_gpu",
Mike Klein6253d902019-03-27 15:09:12 -05001818 ":experimental_svg_model",
Mike Klein735c7ba2019-03-25 12:57:58 -05001819 ":flags",
1820 ":gm",
1821 ":gpu_tool_utils",
1822 ":hash_and_encode",
1823 ":skia",
1824 ":tool_utils",
1825 ":trace",
Mike Klein22924262019-04-02 14:14:56 -04001826 "modules/skottie",
1827 "modules/skottie:utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05001828 ]
1829 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04001830 test_app("dm") {
1831 sources = [
1832 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001833 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001834 "dm/DMJsonWriter.cpp",
1835 "dm/DMSrcSink.cpp",
1836 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001837 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05001838 ":common_flags_aa",
1839 ":common_flags_config",
1840 ":common_flags_gpu",
1841 ":common_flags_images",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001842 ":experimental_svg_model",
1843 ":flags",
1844 ":gm",
1845 ":gpu_tool_utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05001846 ":hash_and_encode",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001847 ":skia",
1848 ":tests",
1849 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05001850 ":trace",
Florin Malita3d856bd2018-05-26 09:49:28 -04001851 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05001852 "modules/skottie:utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001853 "modules/sksg",
Mike Klein38af9432016-11-11 11:39:44 -05001854 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001855
1856 # NIMA does not build on Windows clang
1857 if (!is_win || !is_clang) {
1858 deps += [ "//third_party/Nima-Cpp" ]
1859 }
Mike Klein38af9432016-11-11 11:39:44 -05001860 }
Brian Osman16adfa32016-10-18 14:42:44 -04001861 }
1862
Mike Kleina8a51ce2018-01-09 12:34:11 -05001863 if (!is_win) {
1864 test_app("remote_demo") {
1865 sources = [
1866 "tools/remote_demo.cpp",
1867 ]
1868 deps = [
1869 ":skia",
1870 ]
1871 }
1872 }
1873
Mike Kleine6682eb2017-01-05 10:54:57 -05001874 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001875 sources = [
1876 "bench/nanobench.cpp",
1877 ]
1878 deps = [
1879 ":bench",
Mike Kleinc6142d82019-03-25 10:54:59 -05001880 ":common_flags_aa",
1881 ":common_flags_config",
1882 ":common_flags_gpu",
1883 ":common_flags_images",
fmalita6519c212016-09-14 08:05:17 -07001884 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001885 ":flags",
1886 ":gm",
1887 ":gpu_tool_utils",
1888 ":skia",
1889 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05001890 ":trace",
Florin Malita3b526b02018-05-25 12:43:51 -04001891 "modules/sksg",
mtklein2b6870c2016-07-28 14:17:33 -07001892 ]
mtklein2b6870c2016-07-28 14:17:33 -07001893 }
halcanary19a97202016-08-03 15:08:04 -07001894
Ravi Mistry10d36c52017-01-31 09:49:18 -05001895 test_app("skpinfo") {
1896 sources = [
1897 "tools/skpinfo.cpp",
1898 ]
1899 deps = [
1900 ":flags",
1901 ":skia",
1902 ]
1903 }
1904
Brian Osmanc9a42472018-05-31 13:17:12 -04001905 test_app("skpbench") {
1906 sources = [
1907 "tools/skpbench/skpbench.cpp",
1908 ]
1909 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05001910 ":common_flags_config",
1911 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04001912 ":flags",
1913 ":gpu_tool_utils",
1914 ":skia",
1915 ":tool_utils",
1916 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07001917 }
1918
Mike Kleine6682eb2017-01-05 10:54:57 -05001919 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001920 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04001921 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001922 ]
1923 deps = [
1924 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04001925 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001926 ]
halcanary3eee9d92016-09-10 07:01:53 -07001927 }
mtklein046cb562016-09-16 10:23:12 -07001928
Ben Wagner219f3622017-07-17 15:32:25 -04001929 test_app("create_test_font") {
1930 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001931 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001932 ]
1933 deps = [
1934 ":skia",
1935 ]
1936 assert_no_deps = [
1937 # tool_utils requires the output of this app.
1938 ":tool_utils",
1939 ]
1940 }
1941
Florin Malita5d3ff432018-07-31 16:38:43 -04001942 if (skia_use_expat) {
1943 test_app("create_test_font_color") {
1944 sources = [
1945 "tools/fonts/create_test_font_color.cpp",
1946 ]
1947 deps = [
1948 ":flags",
1949 ":skia",
1950 ":tool_utils",
1951 ]
1952 }
Ben Wagner97182cc2018-02-15 10:20:04 -05001953 }
1954
Mike Kleine6682eb2017-01-05 10:54:57 -05001955 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001956 sources = [
1957 "tools/get_images_from_skps.cpp",
1958 ]
1959 deps = [
1960 ":flags",
1961 ":skia",
mtklein046cb562016-09-16 10:23:12 -07001962 ]
mtklein046cb562016-09-16 10:23:12 -07001963 }
mtkleinecbc5262016-09-22 11:51:24 -07001964
Brian Osman6788a542018-12-10 11:56:01 -05001965 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001966 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001967 sources = [
1968 "tools/skiaserve/Request.cpp",
1969 "tools/skiaserve/Response.cpp",
1970 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001971 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1972 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1973 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1974 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1975 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1976 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1977 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1978 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1979 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001980 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1981 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001982 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1983 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1984 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1985 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1986 ]
1987 deps = [
1988 ":flags",
1989 ":gpu_tool_utils",
1990 ":skia",
1991 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04001992 "//third_party/libmicrohttpd",
Mike Klein7d302882016-11-03 14:06:31 -04001993 ]
Mike Klein7d302882016-11-03 14:06:31 -04001994 }
mtkleinecbc5262016-09-22 11:51:24 -07001995 }
kjlubick14f984b2016-10-03 11:49:45 -07001996
Mike Kleine6682eb2017-01-05 10:54:57 -05001997 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07001998 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001999 "fuzz/Fuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05002000 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002001 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05002002 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04002003 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002004 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002005 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002006 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002007 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002008 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04002009 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04002010 "fuzz/FuzzRegionOp.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002011 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05002012 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
2013 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002014 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002015 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04002016 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002017 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05002018 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
2019 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002020 "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp",
2021 "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
Kevin Lubick0f0a7102019-03-18 16:20:55 -04002022 "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002023 "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002024 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002025 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002026 "tools/debugger/DebugCanvas.cpp",
2027 "tools/debugger/DrawCommand.cpp",
2028 "tools/debugger/JsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002029 ]
2030 deps = [
2031 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04002032 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07002033 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04002034 "modules/skottie:fuzz",
kjlubick14f984b2016-10-03 11:49:45 -07002035 ]
kjlubick14f984b2016-10-03 11:49:45 -07002036 }
Mike Klein38312422016-10-05 15:41:01 -04002037
Mike Kleine6682eb2017-01-05 10:54:57 -05002038 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04002039 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04002040 rebase_path("tests/skia_test.cpp"),
2041 rebase_path("tests/Test.cpp"),
2042 ]
caryclark9feb6322016-10-25 08:58:26 -07002043 deps = [
2044 ":flags",
2045 ":gpu_tool_utils",
2046 ":skia",
2047 ":tool_utils",
2048 ]
caryclark9feb6322016-10-25 08:58:26 -07002049 }
2050
Mike Kleine6682eb2017-01-05 10:54:57 -05002051 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04002052 sources = [
2053 "tools/DumpRecord.cpp",
2054 "tools/dump_record.cpp",
2055 ]
2056 deps = [
2057 ":flags",
2058 ":skia",
2059 ]
Mike Klein38312422016-10-05 15:41:01 -04002060 }
bungemanfe917272016-10-13 17:36:40 -04002061
Mike Kleine6682eb2017-01-05 10:54:57 -05002062 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04002063 sources = [
2064 "tools/skdiff/skdiff.cpp",
2065 "tools/skdiff/skdiff_html.cpp",
2066 "tools/skdiff/skdiff_main.cpp",
2067 "tools/skdiff/skdiff_utils.cpp",
2068 ]
2069 deps = [
2070 ":skia",
2071 ":tool_utils",
2072 ]
bungemanfe917272016-10-13 17:36:40 -04002073 }
halcanarya73d76a2016-10-17 13:19:02 -07002074
Mike Kleine6682eb2017-01-05 10:54:57 -05002075 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07002076 sources = [
2077 "tools/skp_parser.cpp",
2078 ]
2079 deps = [
2080 ":skia",
2081 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002082 ]
halcanarya73d76a2016-10-17 13:19:02 -07002083 }
Brian Osman16adfa32016-10-18 14:42:44 -04002084
Brian Osmanc9a42472018-05-31 13:17:12 -04002085 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05002086 test_lib("skqp_lib") {
Hal Canary0e07ad72018-02-08 13:06:56 -05002087 defines =
2088 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002089 sources = [
2090 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002091 "tools/skqp/src/skqp.cpp",
2092 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002093 ]
2094 deps = [
2095 ":gm",
2096 ":gpu_tool_utils",
2097 ":skia",
2098 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002099 ":tool_utils",
2100 ]
2101 }
2102 test_app("skqp") {
2103 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002104 "tools/skqp/src/skqp_main.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05002105 ]
2106 deps = [
2107 ":skia",
2108 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05002109 ":tool_utils",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002110 ]
2111 }
2112 test_app("jitter_gms") {
2113 sources = [
2114 "tools/skqp/jitter_gms.cpp",
2115 ]
2116 deps = [
2117 ":gm",
2118 ":skia",
2119 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002120 ]
2121 }
2122 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002123 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05002124 test_app("skqp_app") {
2125 is_shared_library = true
2126 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002127 "tools/skqp/src/jni_skqp.cpp",
Hal Canary28f89382017-12-12 09:42:14 -05002128 ]
2129 deps = [
2130 ":skia",
2131 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002132 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002133 ]
2134 libs = [ "android" ]
2135 }
2136 }
Stan Iliev93151722018-08-02 11:10:52 -04002137 if (is_android && skia_enable_gpu) {
2138 test_app("skottie_android") {
2139 is_shared_library = true
2140
2141 sources = [
2142 "platform_tools/android/apps/skottie/src/main/cpp/JavaInputStreamAdaptor.cpp",
2143 "platform_tools/android/apps/skottie/src/main/cpp/native-lib.cpp",
2144 ]
2145 libs = []
2146
Stan Iliev93151722018-08-02 11:10:52 -04002147 deps = [
2148 ":skia",
2149 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002150 "modules/sksg:samples",
Stan Iliev93151722018-08-02 11:10:52 -04002151 ]
2152 }
2153 }
Hal Canary75427132017-10-11 16:00:31 -04002154
Hal Canarya9de7602018-01-19 13:08:23 -05002155 test_app("list_gms") {
2156 sources = [
2157 "tools/list_gms.cpp",
2158 ]
2159 deps = [
2160 ":gm",
2161 ":skia",
2162 ]
2163 }
2164 test_app("list_gpu_unit_tests") {
2165 sources = [
2166 "dm/DMGpuTestProcs.cpp",
2167 "tools/list_gpu_unit_tests.cpp",
2168 ]
2169 deps = [
2170 ":skia",
2171 ":tests",
2172 ]
2173 }
2174
Brian Osmanc9a42472018-05-31 13:17:12 -04002175 test_lib("sk_app") {
Brian Osmanc9a42472018-05-31 13:17:12 -04002176 sources = [
2177 "tools/sk_app/CommandSet.cpp",
2178 "tools/sk_app/GLWindowContext.cpp",
2179 "tools/sk_app/Window.cpp",
2180 ]
2181 libs = []
2182
2183 if (is_android) {
2184 sources += [
2185 "tools/sk_app/android/GLWindowContext_android.cpp",
2186 "tools/sk_app/android/RasterWindowContext_android.cpp",
2187 "tools/sk_app/android/Window_android.cpp",
2188 "tools/sk_app/android/main_android.cpp",
2189 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002190 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002191 libs += [ "android" ]
2192 } else if (is_linux) {
2193 sources += [
2194 "tools/sk_app/unix/GLWindowContext_unix.cpp",
2195 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
2196 "tools/sk_app/unix/Window_unix.cpp",
2197 "tools/sk_app/unix/keysym2ucs.c",
2198 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002199 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002200 libs += [
2201 "GL",
2202 "X11",
2203 ]
2204 } else if (is_win) {
2205 sources += [
2206 "tools/sk_app/win/GLWindowContext_win.cpp",
2207 "tools/sk_app/win/RasterWindowContext_win.cpp",
2208 "tools/sk_app/win/Window_win.cpp",
2209 "tools/sk_app/win/main_win.cpp",
2210 ]
Brian Salomon194db172017-08-17 14:37:06 -04002211 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002212 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04002213 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002214 } else if (is_mac) {
2215 sources += [
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002216 "tools/sk_app/mac/GLWindowContext_mac.mm",
2217 "tools/sk_app/mac/RasterWindowContext_mac.mm",
2218 "tools/sk_app/mac/Window_mac.mm",
2219 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002220 ]
2221 libs += [
2222 "QuartzCore.framework",
2223 "Cocoa.framework",
2224 "Foundation.framework",
2225 ]
2226 } else if (is_ios) {
2227 sources += [
2228 "tools/sk_app/ios/GLWindowContext_ios.cpp",
2229 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
2230 "tools/sk_app/ios/Window_ios.cpp",
2231 "tools/sk_app/ios/main_ios.cpp",
2232 ]
2233 }
2234
2235 if (skia_use_vulkan) {
2236 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
2237 if (is_android) {
2238 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2239 } else if (is_linux) {
2240 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2241 libs += [ "X11-xcb" ]
2242 } else if (is_win) {
2243 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Jim Van Verthce51c142019-02-14 14:07:46 -05002244 } else if (is_mac) {
2245 sources += [ "tools/sk_app/mac/VulkanWindowContext_mac.mm" ]
2246 libs += [ "MetalKit.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002247 }
2248 }
2249
Jim Van Verthbe39f712019-02-08 15:36:14 -05002250 if (skia_use_metal) {
2251 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
2252 if (is_mac) {
2253 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
2254 }
2255 libs += [ "MetalKit.framework" ]
2256 }
2257
Brian Osmanc9a42472018-05-31 13:17:12 -04002258 deps = [
2259 ":gpu_tool_utils",
2260 ":skia",
2261 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002262 ]
2263 if (is_android) {
2264 deps += [ "//third_party/native_app_glue" ]
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002265 } else if (is_ios) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002266 deps += [ "//third_party/libsdl" ]
2267 }
2268 if (skia_use_angle) {
2269 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002270 }
Brian Osman16adfa32016-10-18 14:42:44 -04002271 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002272
Hal Canary87515122019-03-15 14:22:51 -04002273 if (!skia_use_vulkan && (is_mac || is_linux || is_win)) {
2274 test_app("fiddle_examples") {
2275 sources = [
Brian Osmanc725e8f2019-04-10 14:08:44 -04002276 "tools/fiddle/all_examples.cpp",
Hal Canary87515122019-03-15 14:22:51 -04002277 "tools/fiddle/examples.cpp",
Brian Osman72ef2d52019-03-17 11:09:17 -04002278 "tools/fiddle/examples.h",
Hal Canary87515122019-03-15 14:22:51 -04002279 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002280 if (is_win) {
2281 cflags = [ "/wd4756" ] # Overflow in constant arithmetic
2282 }
Hal Canary87515122019-03-15 14:22:51 -04002283 deps = [
2284 ":skia",
2285 ":skia.h",
2286 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04002287 "modules/skshaper",
Hal Canary87515122019-03-15 14:22:51 -04002288 ]
2289 }
2290 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002291 test_app("viewer") {
2292 is_shared_library = is_android
Brian Osmanc9a42472018-05-31 13:17:12 -04002293 sources = [
2294 "tools/viewer/BisectSlide.cpp",
2295 "tools/viewer/GMSlide.cpp",
2296 "tools/viewer/ImGuiLayer.cpp",
2297 "tools/viewer/ImageSlide.cpp",
Brian Osman7c979f52019-02-12 13:27:51 -05002298 "tools/viewer/ParticlesSlide.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04002299 "tools/viewer/SKPSlide.cpp",
2300 "tools/viewer/SampleSlide.cpp",
2301 "tools/viewer/SkottieSlide.cpp",
2302 "tools/viewer/SlideDir.cpp",
2303 "tools/viewer/StatsLayer.cpp",
2304 "tools/viewer/SvgSlide.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002305 "tools/viewer/TouchGesture.cpp",
Leon Scroggins III81886e82018-08-22 11:18:08 -04002306 "tools/viewer/TouchGesture.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002307 "tools/viewer/Viewer.cpp",
2308 ]
2309 libs = []
2310
Brian Osmanc9a42472018-05-31 13:17:12 -04002311 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002312 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04002313 ":experimental_svg_model",
2314 ":flags",
2315 ":gm",
2316 ":gpu_tool_utils",
2317 ":samples",
2318 ":sk_app",
2319 ":skia",
2320 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002321 ":trace",
Brian Osman7c979f52019-02-12 13:27:51 -05002322 "modules/particles",
Brian Osmanc9a42472018-05-31 13:17:12 -04002323 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002324 "modules/skottie:utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002325 "modules/sksg",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002326 "modules/sksg:samples",
Brian Osmanc9a42472018-05-31 13:17:12 -04002327 "//third_party/imgui",
Brian Osmanc9a42472018-05-31 13:17:12 -04002328 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04002329
2330 # NIMA does not build on Windows clang
2331 if (!is_win || !is_clang) {
2332 sources += [ "tools/viewer/NIMASlide.cpp" ]
2333 deps += [ "//third_party/Nima-Cpp" ]
2334 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002335 }
2336
Brian Osmanc9a42472018-05-31 13:17:12 -04002337 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002338 test_app("HelloWorld") {
2339 sources = [
2340 "example/HelloWorld.cpp",
2341 ]
2342 libs = []
2343
Brian Osmaneff04b52017-11-21 13:18:02 -05002344 deps = [
2345 ":flags",
2346 ":gpu_tool_utils",
2347 ":sk_app",
2348 ":skia",
2349 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002350 ]
2351 }
2352 }
2353
Brian Osmanc9a42472018-05-31 13:17:12 -04002354 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002355 test_app("SkiaSDLExample") {
2356 sources = [
2357 "example/SkiaSDLExample.cpp",
2358 ]
2359 libs = []
Jim Van Verth4c70c752017-07-11 12:03:01 -04002360 deps = [
2361 ":gpu_tool_utils",
2362 ":skia",
2363 "//third_party/libsdl",
2364 ]
2365 }
2366 }
2367
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002368 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2369 action_foreach("generate_mocs") {
2370 script = "gn/call.py"
2371 sources = [
2372 "tools/mdbviz/MainWindow.h",
2373 ]
2374 outputs = [
2375 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2376 ]
2377 args = [
2378 "$skia_qt_path" + "/bin/moc",
2379 "{{source}}",
2380 "-o",
2381 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2382 ]
2383 }
2384 action_foreach("generate_resources") {
2385 script = "gn/call.py"
2386 sources = [
2387 "tools/mdbviz/resources.qrc",
2388 ]
2389 outputs = [
2390 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2391 ]
2392 args = [
2393 "$skia_qt_path" + "/bin/rcc",
2394 "{{source}}",
2395 "-o",
2396 "gen/mdbviz/{{source_name_part}}_res.cpp",
2397 ]
2398 }
2399 test_app("mdbviz") {
2400 if (is_win) {
2401 # on Windows we need to disable some exception handling warnings due to the Qt headers
2402 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2403 }
2404 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002405 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002406 "tools/debugger/DebugCanvas.cpp",
2407 "tools/debugger/DrawCommand.cpp",
2408 "tools/debugger/JsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002409 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002410 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002411 "tools/mdbviz/main.cpp",
2412
2413 # generated files
2414 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2415 "$target_gen_dir/mdbviz/resources_res.cpp",
2416 ]
2417 lib_dirs = [ "$skia_qt_path/lib" ]
2418 libs = [
2419 "Qt5Core.lib",
2420 "Qt5Gui.lib",
2421 "Qt5Widgets.lib",
2422 ]
2423 include_dirs = [
2424 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002425 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002426 "$skia_qt_path/include/QtWidgets",
2427 ]
2428 deps = [
2429 ":generate_mocs",
2430 ":generate_resources",
2431 ":skia",
2432 ]
2433 }
2434 }
2435
Mike Kleine459afd2017-03-03 09:21:30 -05002436 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002437 copy("gdbserver") {
2438 sources = [
2439 "$ndk/$ndk_gdbserver",
2440 ]
2441 outputs = [
2442 "$root_out_dir/gdbserver",
2443 ]
2444 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002445 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002446
2447 if (skia_use_opencl) {
2448 test_app("hello-opencl") {
2449 sources = [
Mike Kleinf9ae6702018-06-20 14:05:05 -04002450 "tools/hello-opencl.cpp",
2451 ]
Mike Klein8a1f15d2019-02-11 11:59:41 -05002452 deps = [
2453 "//third_party/opencl",
2454 ]
Mike Kleinf9ae6702018-06-20 14:05:05 -04002455 }
2456 }
mtklein25c81d42016-07-27 13:55:26 -07002457}