blob: 289728687d1b91675889637b76dfd2c5ae79739e [file] [log] [blame]
mtkleinc04ff472016-06-23 10:29:30 -07001# Copyright 2016 Google Inc.
2#
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
Brian Osmanf2c90142017-07-13 15:50:03 -04006import("gn/flutter_defines.gni")
Mike Reed025f7832018-11-12 09:27:05 -05007import("gn/fuchsia_defines.gni")
mikejurka8c24f4f2016-09-12 16:51:58 -07008import("gn/shared_sources.gni")
Hal Canary32498f02019-02-04 15:36:31 -05009import("gn/skia.gni")
brettwb9447282016-09-01 14:24:39 -070010
Forrest Reiling30229ac2017-04-17 13:36:39 -070011if (is_fuchsia) {
Chinmay Garde89820762019-05-06 16:44:06 -070012 import("//build/fuchsia/sdk.gni")
Forrest Reiling30229ac2017-04-17 13:36:39 -070013 import("//build/vulkan/config.gni")
14}
15
mtkleinc04ff472016-06-23 10:29:30 -070016declare_args() {
Mike Klein26a60492018-10-15 10:38:25 -040017 skia_enable_flutter_defines = false
18}
19
20declare_args() {
Mike Kleinc168a3a2016-11-14 14:53:13 +000021 skia_use_angle = false
Kevin Lubick4a24e102017-03-29 11:19:01 -040022 skia_use_egl = false
mtklein63213812016-08-24 09:55:56 -070023 skia_use_expat = true
Mike Reedd62d4062019-06-12 10:20:44 -040024 skia_use_experimental_xform = false
Mike Reed7bf160e2019-05-17 16:50:51 -040025 skia_use_ffmpeg = false
mtklein3cc22182016-08-29 13:26:14 -070026 skia_use_fontconfig = is_linux
Leon Scroggins III85e22fc2018-11-28 08:58:47 -050027 skia_use_fonthost_mac = is_mac
mtkleincdedd0e2016-09-12 15:15:44 -070028 skia_use_freetype = is_android || is_fuchsia || is_linux
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -050029 skia_use_fixed_gamma_text = is_android
mtklein63213812016-08-24 09:55:56 -070030 skia_use_libjpeg_turbo = true
31 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070032 skia_use_libwebp = !is_fuchsia
Mike Kleinfae86b72018-01-08 15:49:09 -050033 skia_use_lua = is_skia_dev_build && !is_ios
Mike Kleinf9ae6702018-06-20 14:05:05 -040034 skia_use_opencl = false
Mike Klein10d665d2016-11-01 11:46:10 -040035 skia_use_piex = !is_win
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -040036 skia_use_wuffs = false
mtklein63213812016-08-24 09:55:56 -070037 skia_use_zlib = true
Greg Daniele5ddff52017-07-05 16:49:36 -040038 skia_use_metal = false
Mike Klein36f182f2017-10-20 12:33:53 -040039 skia_use_libheif = is_skia_dev_build
Chinmay Garded92d0352018-09-17 10:23:28 -070040 skia_use_x11 = is_linux
Mike Klein17a96552019-06-17 09:58:11 -050041 skia_use_xbyak =
42 is_skia_dev_build && target_cpu == "x64" && is_linux && is_clang
Leon Scroggins IIIee0e5d02019-02-27 10:59:11 -050043 skia_use_xps = true
mtklein1bd72ba2016-09-16 07:45:52 -070044
Mike Klein7d921032017-01-05 12:20:41 -050045 skia_android_serial = ""
Kevin Lubick93faa672018-10-10 15:54:53 -040046 skia_enable_ccpr = true
Kevin Lubickca7c2972018-10-17 13:52:24 +000047 skia_enable_nvpr = !skia_enable_flutter_defines
Brian Osman3f375d02016-12-28 11:19:22 -050048 skia_enable_discrete_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050049 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040050 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Kevin Lubick32dfdbe2018-10-18 09:47:01 -040051 skia_enable_skpicture = true
Mike Klein3669a822017-03-03 10:55:02 -050052 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Robert Phillipsa6d2d702017-09-01 12:17:03 -040053 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040054 skia_compile_processors = false
Adrienne Walker1df7cd82018-04-18 13:46:25 -070055 skia_generate_workarounds = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070056 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040057
Hal Canary2331c822018-02-01 14:06:13 -050058 skia_skqp_global_error_tolerance = 0
Ethan Nicholas26a9aad2018-03-27 14:10:52 -040059
60 skia_llvm_path = ""
61 skia_llvm_lib = "LLVM"
Hal Canaryfd9bcab2018-04-24 11:47:23 -040062
63 skia_tools_require_resources = false
mtkleinc04ff472016-06-23 10:29:30 -070064}
Brian Salomon23d73ea2016-10-27 13:31:37 -040065declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040066 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040067 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050068 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -050069 skia_enable_fontmgr_empty = false
Kevin Lubickddd0a332018-12-12 10:35:13 -050070 skia_enable_fontmgr_custom =
71 is_linux && skia_use_freetype && !skia_use_fontconfig
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -050072 skia_enable_fontmgr_custom_empty = is_fuchsia && skia_use_freetype
73 skia_enable_fontmgr_android = skia_use_expat && skia_use_freetype
Sergey Ulanovf3babcd2018-11-30 17:42:00 -080074 skia_enable_fontmgr_fuchsia = is_fuchsia
Leon Scroggins III631dbc82019-03-04 13:54:02 -050075 skia_enable_fontmgr_win = is_win
76 skia_enable_fontmgr_win_gdi = is_win
Mike Klein10d665d2016-11-01 11:46:10 -040077
Kevin Lubick27ba7032019-03-21 08:13:54 -040078 if (is_mac) {
79 skia_gl_standard = "gl"
80 } else if (is_ios) {
81 skia_gl_standard = "gles"
82 } else {
83 skia_gl_standard = ""
84 }
85
Mike Klein4d598a32016-10-31 13:44:49 -040086 if (is_android) {
87 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070088 } else if (is_fuchsia) {
89 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040090 } else {
Mike Klein98dea7b2019-01-15 11:26:43 -050091 skia_use_vulkan = defined(skia_moltenvk_path) && skia_moltenvk_path != ""
Mike Klein4d598a32016-10-31 13:44:49 -040092 }
Jim Van Verth4e502972017-12-07 15:16:10 -050093
94 if (is_ios) {
95 skia_ios_identity = ".*Google.*"
96 skia_ios_profile = "Google Development"
97 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040098}
Brian Salomon789e25e2016-09-30 13:41:03 -040099
Adam Barth54ef74a2017-10-13 10:59:38 -0700100if (defined(skia_settings)) {
101 import(skia_settings)
102}
103
mtkleinc04ff472016-06-23 10:29:30 -0700104# Skia public API, generally provided by :skia.
105config("skia_public") {
Mike Klein9e25bb92019-04-29 09:46:36 -0500106 include_dirs = [ "." ]
107
Mike Kleinae7e6712016-10-11 17:49:33 -0400108 defines = []
109 if (is_component_build) {
110 defines += [ "SKIA_DLL" ]
111 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400112 if (is_fuchsia || is_linux) {
Mike Kleinf0a53692019-04-24 11:42:40 -0500113 defines += [ "SK_R32_SHIFT=16" ]
jcgregorio5561e3d2016-08-25 09:25:11 -0700114 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400115 if (skia_enable_flutter_defines) {
116 defines += flutter_defines
117 }
mtklein06c35c02016-09-20 12:28:12 -0700118 if (!skia_enable_gpu) {
119 defines += [ "SK_SUPPORT_GPU=0" ]
120 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500121 if (skia_enable_atlas_text) {
122 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
123 }
Mike Reed025f7832018-11-12 09:27:05 -0500124 if (is_fuchsia) {
125 defines += fuchsia_defines
126 }
Kevin Lubick27ba7032019-03-21 08:13:54 -0400127 if (skia_gl_standard == "gles") {
128 defines += [ "SK_ASSUME_GL_ES=1" ]
129 } else if (skia_gl_standard == "gl") {
130 defines += [ "SK_ASSUME_GL=1" ]
Kevin Lubick39026282019-03-28 12:46:40 -0400131 } else if (skia_gl_standard == "webgl") {
132 defines += [ "SK_ASSUME_WEBGL=1" ]
Kevin Lubick27ba7032019-03-21 08:13:54 -0400133 }
mtkleinc04ff472016-06-23 10:29:30 -0700134}
135
136# Skia internal APIs, used by Skia itself and a few test tools.
137config("skia_private") {
138 visibility = [ ":*" ]
139
Mike Reeda9e241d2017-05-03 10:52:00 -0400140 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -0500141 if (skia_use_fixed_gamma_text) {
mtkleinb37c0342016-09-09 11:07:45 -0700142 defines += [
143 "SK_GAMMA_EXPONENT=1.4",
144 "SK_GAMMA_CONTRAST=0.0",
145 ]
146 }
Mike Kleinb45d8622019-04-24 14:04:01 -0500147 if (is_skia_dev_build) {
148 defines += [
149 "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1",
150 "GR_TEST_UTILS=1",
151 ]
mtklein88a7ac02016-09-14 11:16:49 -0700152 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400153 libs = []
154 lib_dirs = []
Brian Osman34755e22016-12-05 09:46:02 -0500155 if (skia_use_angle) {
156 defines += [ "SK_ANGLE" ]
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 = [ ":*" ]
Mike Kleinf5f4e812019-04-29 15:45:14 +0000169 defines = [ "SKIA_IMPLEMENTATION=1" ]
mtkleinc04ff472016-06-23 10:29:30 -0700170}
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 }
Mike Klein1b9b7d52018-02-27 10:37:40 -0500285}
286
mtkleinc095df52016-08-24 12:23:52 -0700287# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700288template("optional") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500289 visibility = [ ":*" ]
mtklein457b42a2016-08-23 13:56:37 -0700290 if (invoker.enabled) {
291 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700292 if (defined(invoker.public_defines)) {
293 defines = invoker.public_defines
294 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600295 if (defined(invoker.public_configs)) {
296 configs = invoker.public_configs
297 }
mtklein457b42a2016-08-23 13:56:37 -0700298 }
299 source_set(target_name) {
Hal Canaryc25f4e92019-02-26 11:54:25 -0500300 check_includes = false
mtkleincd01b032016-08-31 04:58:19 -0700301 forward_variables_from(invoker,
302 "*",
303 [
304 "public_defines",
305 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700306 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700307 ])
mtklein457b42a2016-08-23 13:56:37 -0700308 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700309 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700310 if (defined(invoker.configs_to_remove)) {
311 configs -= invoker.configs_to_remove
312 }
mtklein457b42a2016-08-23 13:56:37 -0700313 }
314 } else {
mtklein457b42a2016-08-23 13:56:37 -0700315 source_set(target_name) {
316 forward_variables_from(invoker,
317 "*",
318 [
319 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400320 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700321 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700322 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700323 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700324 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700325 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700326 ])
mtkleincd01b032016-08-31 04:58:19 -0700327 if (defined(invoker.sources_when_disabled)) {
328 sources = invoker.sources_when_disabled
329 }
330 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700331 }
mtkleineb3c4252016-08-23 07:38:09 -0700332 }
mtklein457b42a2016-08-23 13:56:37 -0700333}
mtklein457b42a2016-08-23 13:56:37 -0700334
mtkleina45be612016-08-29 15:22:10 -0700335optional("fontmgr_android") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500336 enabled = skia_enable_fontmgr_android
mtkleina45be612016-08-29 15:22:10 -0700337
338 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500339 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700340 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700341 ]
342 sources = [
343 "src/ports/SkFontMgr_android.cpp",
344 "src/ports/SkFontMgr_android_factory.cpp",
345 "src/ports/SkFontMgr_android_parser.cpp",
346 ]
347}
348
mtkleind2e39db2016-09-07 07:52:55 -0700349optional("fontmgr_custom") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500350 enabled = skia_enable_fontmgr_custom
mtkleind2e39db2016-09-07 07:52:55 -0700351
352 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500353 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700354 ]
355 sources = [
356 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500357 "src/ports/SkFontMgr_custom.h",
358 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700359 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500360 "src/ports/SkFontMgr_custom_embedded.cpp",
361 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700362 ]
363}
364
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500365optional("fontmgr_custom_empty") {
366 enabled = skia_enable_fontmgr_custom_empty
Kevin Lubickddd0a332018-12-12 10:35:13 -0500367
368 deps = [
369 ":typeface_freetype",
370 ]
371 sources = [
372 "src/ports/SkFontMgr_custom.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500373 "src/ports/SkFontMgr_custom_empty.cpp",
374 "src/ports/SkFontMgr_custom_empty_factory.cpp",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800375 ]
376}
377
Hal Canaryff2742e2018-01-30 11:35:47 -0500378optional("fontmgr_empty") {
379 enabled = skia_enable_fontmgr_empty
380 sources = [
381 "src/ports/SkFontMgr_empty_factory.cpp",
382 ]
383}
384
mtklein3cc22182016-08-29 13:26:14 -0700385optional("fontmgr_fontconfig") {
386 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700387
388 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500389 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700390 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700391 ]
392 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700393 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700394 "src/ports/SkFontConfigInterface_direct.cpp",
395 "src/ports/SkFontConfigInterface_direct_factory.cpp",
396 "src/ports/SkFontMgr_FontConfigInterface.cpp",
397 "src/ports/SkFontMgr_fontconfig.cpp",
398 "src/ports/SkFontMgr_fontconfig_factory.cpp",
399 ]
400}
401
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500402optional("fontmgr_fuchsia") {
403 enabled = skia_enable_fontmgr_fuchsia
404
Chinmay Garde89820762019-05-06 16:44:06 -0700405 deps = []
406
407 if (is_fuchsia && using_fuchsia_sdk) {
408 deps += [ "$fuchsia_sdk_root/fidl:fuchsia.fonts" ]
409 } else {
410 deps += [ "//sdk/fidl/fuchsia.fonts" ]
411 }
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500412 sources = [
413 "src/ports/SkFontMgr_fuchsia.cpp",
414 "src/ports/SkFontMgr_fuchsia.h",
415 ]
416}
417
418optional("fontmgr_wasm") {
Kevin Lubick0e3342c2019-04-16 13:31:25 -0400419 enabled = !skia_enable_fontmgr_empty && target_cpu == "wasm"
mtkleincdedd0e2016-09-12 15:15:44 -0700420
421 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500422 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700423 ]
424 sources = [
425 "src/ports/SkFontMgr_custom.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500426 "src/ports/SkFontMgr_custom.h",
427 "src/ports/SkFontMgr_custom_embedded.cpp",
428 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700429 ]
430}
431
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500432optional("fontmgr_win") {
433 enabled = skia_enable_fontmgr_win
434
435 sources = [
436 "src/fonts/SkFontMgr_indirect.cpp",
437 "src/ports/SkFontMgr_win_dw.cpp",
438 "src/ports/SkFontMgr_win_dw_factory.cpp",
439 "src/ports/SkScalerContext_win_dw.cpp",
440 "src/ports/SkTypeface_win_dw.cpp",
441 ]
442}
443
444optional("fontmgr_win_gdi") {
445 enabled = skia_enable_fontmgr_win_gdi
446
447 sources = [
448 "src/ports/SkFontHost_win.cpp",
449 ]
450 libs = [ "Gdi32.lib" ]
451}
452
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700453if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400454 executable("sksllex") {
455 sources = [
456 "src/sksl/lex/Main.cpp",
457 "src/sksl/lex/NFA.cpp",
458 "src/sksl/lex/RegexNode.cpp",
459 "src/sksl/lex/RegexParser.cpp",
460 ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500461 include_dirs = [ "." ]
Ethan Nicholasca82a922017-09-07 09:39:50 -0400462 }
463
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700464 action("run_sksllex") {
465 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400466 deps = [
467 ":sksllex(//gn/toolchain:$host_toolchain)",
468 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700469 sources = [
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700470 "src/sksl/lex/sksl.lex",
471 ]
472
473 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
474 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
475 outputs = [
476 "$target_out_dir/" +
477 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
478 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
479 # confused due to the same file being named by two different paths
480 ]
481 sksllex_path = "$root_out_dir/"
482 sksllex_path += "sksllex"
483 if (host_os == "win") {
484 sksllex_path += ".exe"
485 }
486 args = [
487 rebase_path(sksllex_path),
488 rebase_path("bin/clang-format"),
489 rebase_path("src"),
490 ]
491 }
492} else {
493 group("run_sksllex") {
494 }
495}
496
497if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400498 executable("skslc") {
499 defines = [ "SKSL_STANDALONE" ]
500 sources = [
501 "src/sksl/SkSLMain.cpp",
502 ]
503 sources += skia_sksl_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400504 sources += skia_sksl_gpu_sources
Mike Kleinc0bd9f92019-04-23 12:05:21 -0500505 include_dirs = [ "." ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400506 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500507 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400508 "//third_party/spirv-tools",
509 ]
510 }
511
512 skia_gpu_processor_outputs = []
513 foreach(src, skia_gpu_processor_sources) {
514 dir = get_path_info(src, "dir")
515 name = get_path_info(src, "name")
516
517 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
518 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
519 skia_gpu_processor_outputs += [
520 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
521 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
522 # confused due to the same file being named by two different paths
523 ]
524 }
525
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500526 action("create_sksl_enums") {
527 script = "gn/create_sksl_enums.py"
528 sources = [
529 "include/private/GrSharedEnums.h",
530 ]
531 outputs = [
532 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500533 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500534 ]
535 args = [
536 rebase_path(sources[0]),
537 rebase_path(outputs[0]),
538 ]
539 }
540
Ethan Nicholas762466e2017-06-29 10:03:38 -0400541 action("compile_processors") {
542 script = "gn/compile_processors.py"
543 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500544 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400545 ":skslc(//gn/toolchain:$host_toolchain)",
546 ]
547 sources = skia_gpu_processor_sources
548 outputs = skia_gpu_processor_outputs
549 skslc_path = "$root_out_dir/"
550 if (host_toolchain != default_toolchain_name) {
551 skslc_path += "$host_toolchain/"
552 }
553 skslc_path += "skslc"
554 if (host_os == "win") {
555 skslc_path += ".exe"
556 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400557 args = [
558 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400559 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400560 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400561 args += rebase_path(skia_gpu_processor_sources)
562 }
563} else {
564 skia_gpu_processor_outputs = []
565 group("compile_processors") {
566 }
567}
568
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500569optional("gpu") {
mtklein06c35c02016-09-20 12:28:12 -0700570 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400571 deps = [
572 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700573 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400574 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700575 if (skia_generate_workarounds) {
576 deps += [ ":workaround_list" ]
577 }
Robert Phillipsefb9f142019-05-17 14:19:44 -0400578 public_defines = [ "SK_GL" ]
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600579 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400580 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700581
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400582 sources =
583 skia_gpu_sources + skia_sksl_gpu_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400584 if (!skia_enable_ccpr) {
585 sources -= skia_ccpr_sources
586 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
587 }
Kevin Lubick4bf2c262018-10-15 09:35:54 -0400588 if (!skia_enable_nvpr) {
589 sources -= skia_nvpr_sources
590 sources += [ "src/gpu/GrPathRendering_none.cpp" ]
591 }
mtklein06c35c02016-09-20 12:28:12 -0700592
593 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500594 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700595 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400596 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700597 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400598 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400599
600 # this lib is required to link against AHardwareBuffer
601 if (defined(ndk_api) && ndk_api >= 26) {
602 libs += [ "android" ]
603 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400604 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500605 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400606 libs += [ "EGL" ]
Chinmay Garded92d0352018-09-17 10:23:28 -0700607 } else if (is_linux && skia_use_x11) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500608 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -0400609 libs += [ "GL" ]
mtklein06c35c02016-09-20 12:28:12 -0700610 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500611 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800612 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500613 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400614 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500615 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -0500616 if (target_cpu != "arm64") {
617 libs += [ "OpenGL32.lib" ]
618 }
mtklein06c35c02016-09-20 12:28:12 -0700619 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500620 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700621 }
mtkleine9fb3d52016-09-20 15:11:46 -0700622
623 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400624 public_defines += [ "SK_VULKAN" ]
Greg Daniel18dbfd02018-05-29 10:46:51 -0400625 deps += [ "third_party/vulkanmemoryallocator" ]
mtkleine9fb3d52016-09-20 15:11:46 -0700626 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700627 if (skia_enable_vulkan_debug_layers) {
628 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
629 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800630 if (is_fuchsia) {
Chinmay Garde89820762019-05-06 16:44:06 -0700631 if (using_fuchsia_sdk) {
632 public_deps += [ "$fuchsia_sdk_root/pkg:vulkan" ]
633 } else {
634 public_deps +=
635 [ "//third_party/vulkan_loader_and_validation_layers:vulkan" ]
636 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800637 }
mtkleine9fb3d52016-09-20 15:11:46 -0700638 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400639
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400640 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400641 if (skia_use_metal) {
642 public_defines += [ "SK_METAL" ]
643 sources += skia_metal_sources
644 libs += [ "Metal.framework" ]
Greg Daniel53956d92018-08-08 14:41:19 -0400645 libs += [ "Foundation.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400646 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400647 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500648
649 if (skia_enable_atlas_text) {
650 sources += skia_atlas_text_sources
651 }
Kevin Lubickf4def342018-10-04 12:52:50 -0400652
653 if (is_debug) {
654 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
655 }
mtklein06c35c02016-09-20 12:28:12 -0700656}
657
Leon Scroggins III41169202019-01-29 09:29:57 -0500658optional("gif") {
659 enabled = !skia_use_wuffs
660 sources = [
661 "src/codec/SkGifCodec.cpp",
662 "third_party/gif/SkGifImageReader.cpp",
663 ]
664}
665
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400666optional("heif") {
667 enabled = skia_use_libheif
668 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
669
670 deps = []
671
672 sources = [
673 "src/codec/SkHeifCodec.cpp",
674 ]
675}
676
mtklein63213812016-08-24 09:55:56 -0700677optional("jpeg") {
678 enabled = skia_use_libjpeg_turbo
679 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
680
mtklein63213812016-08-24 09:55:56 -0700681 deps = [
682 "//third_party/libjpeg-turbo:libjpeg",
683 ]
Mike Kleinf105dc72018-06-05 15:22:54 -0400684 public = [
685 "include/encode/SkJpegEncoder.h",
686 ]
mtklein63213812016-08-24 09:55:56 -0700687 sources = [
688 "src/codec/SkJpegCodec.cpp",
689 "src/codec/SkJpegDecoderMgr.cpp",
690 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700691 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400692 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700693 ]
694}
695
696optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500697 enabled = skia_use_zlib && skia_enable_pdf
698 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700699
mtklein63213812016-08-24 09:55:56 -0700700 deps = [
701 "//third_party/zlib",
702 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400703 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700704 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400705 }
brettwb9447282016-09-01 14:24:39 -0700706 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700707 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
Hal Canary2a3093c2019-02-20 11:25:45 -0500708 if (skia_use_icu && skia_use_harfbuzz && skia_pdf_subset_harfbuzz) {
709 deps += [ "//third_party/harfbuzz" ]
710 defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ]
711 } else if (skia_use_icu && skia_use_sfntly) {
mtklein63213812016-08-24 09:55:56 -0700712 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -0500713 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700714 }
715}
716
717optional("png") {
718 enabled = skia_use_libpng
719 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
720
mtklein63213812016-08-24 09:55:56 -0700721 deps = [
722 "//third_party/libpng",
723 ]
724 sources = [
725 "src/codec/SkIcoCodec.cpp",
726 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400727 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700728 ]
729}
730
scroggof84ad642016-10-31 09:02:57 -0700731optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400732 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700733 public_defines = [ "SK_CODEC_DECODES_RAW" ]
734
735 deps = [
736 "//third_party/dng_sdk",
737 "//third_party/libjpeg-turbo:libjpeg",
738 "//third_party/piex",
739 ]
740
741 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
742 # Skia.
743 configs_to_remove = [ "//gn:no_exceptions" ]
744
745 sources = [
scroggof84ad642016-10-31 09:02:57 -0700746 "src/codec/SkRawCodec.cpp",
747 ]
748}
749
Mike Klein852a8cb2018-05-15 10:46:58 -0400750import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400751source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400752 cflags = []
753 if (!is_win || is_clang) {
754 cflags += [
755 "-w",
756 "-std=c11",
757 ]
758 }
759
760 public = [
Brian Osmanea236bf2019-04-29 10:28:22 -0400761 "include/third_party/skcms/skcms.h",
Mike Klein852a8cb2018-05-15 10:46:58 -0400762 ]
Brian Osmanea236bf2019-04-29 10:28:22 -0400763 include_dirs = [ "include/third_party/skcms" ]
Mike Klein852a8cb2018-05-15 10:46:58 -0400764 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
765}
766
mtklein3cc22182016-08-29 13:26:14 -0700767optional("typeface_freetype") {
768 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700769
770 deps = [
771 "//third_party/freetype2",
772 ]
773 sources = [
774 "src/ports/SkFontHost_FreeType.cpp",
775 "src/ports/SkFontHost_FreeType_common.cpp",
776 ]
777}
778
mtklein457b42a2016-08-23 13:56:37 -0700779optional("webp") {
780 enabled = skia_use_libwebp
781 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
782
mtklein457b42a2016-08-23 13:56:37 -0700783 deps = [
784 "//third_party/libwebp",
785 ]
786 sources = [
mtklein457b42a2016-08-23 13:56:37 -0700787 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400788 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700789 ]
mtkleineb3c4252016-08-23 07:38:09 -0700790}
791
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400792optional("wuffs") {
793 enabled = skia_use_wuffs
794 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
795
796 deps = [
797 "//third_party/wuffs",
798 ]
799 sources = [
800 "src/codec/SkWuffsCodec.cpp",
801 ]
802}
803
mtklein63213812016-08-24 09:55:56 -0700804optional("xml") {
805 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000806 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700807
mtklein63213812016-08-24 09:55:56 -0700808 deps = [
809 "//third_party/expat",
810 ]
811 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500812 "src/svg/SkSVGCanvas.cpp",
813 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700814 "src/xml/SkDOM.cpp",
815 "src/xml/SkXMLParser.cpp",
816 "src/xml/SkXMLWriter.cpp",
817 ]
818}
819
Mike Klein613ad382019-06-06 11:42:02 -0500820optional("skvm_jit") {
821 enabled = skia_use_xbyak
822 public_defines = [ "SKVM_JIT" ]
823
824 public_deps = [
825 "//third_party/xbyak",
826 ]
827}
828
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700829if (skia_enable_gpu && skia_generate_workarounds) {
830 action("workaround_list") {
831 script = "tools/build_workaround_header.py"
832
833 inputs = [
834 "src/gpu/gpu_workaround_list.txt",
835 ]
836
837 # see comments in skia_compile_processors about out dir path shenanigans.
838 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700839 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700840
841 outputs = [
842 "$root_out_dir/$output_file",
843 ]
844 args = [
845 "--output-file",
846 "$output_file",
847 ]
848
849 foreach(file, inputs) {
850 args += [ rebase_path(file, root_build_dir) ]
851 }
852 }
853}
854
mtkleinc04ff472016-06-23 10:29:30 -0700855component("skia") {
856 public_configs = [ ":skia_public" ]
857 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700858
Mike Klein607b0a72018-11-07 16:17:34 -0500859 public_deps = [
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500860 ":gpu",
Mike Klein607b0a72018-11-07 16:17:34 -0500861 ":pdf",
862 ":skcms",
863 ]
864
mtkleinc04ff472016-06-23 10:29:30 -0700865 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700866 ":arm64",
867 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700868 ":avx",
Mike Klein54378232018-11-08 12:08:05 +0000869 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -0700870 ":crc32",
mtkleina45be612016-08-29 15:22:10 -0700871 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700872 ":fontmgr_custom",
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500873 ":fontmgr_custom_empty",
Hal Canaryff2742e2018-01-30 11:35:47 -0500874 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700875 ":fontmgr_fontconfig",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800876 ":fontmgr_fuchsia",
Kevin Lubickddd0a332018-12-12 10:35:13 -0500877 ":fontmgr_wasm",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500878 ":fontmgr_win",
879 ":fontmgr_win_gdi",
Leon Scroggins III41169202019-01-29 09:29:57 -0500880 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400881 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500882 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700883 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700884 ":none",
mtklein63213812016-08-24 09:55:56 -0700885 ":png",
scroggof84ad642016-10-31 09:02:57 -0700886 ":raw",
Mike Klein613ad382019-06-06 11:42:02 -0500887 ":skvm_jit",
mtklein9b8583d2016-08-24 17:32:30 -0700888 ":sse2",
889 ":sse41",
890 ":sse42",
891 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700892 ":webp",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400893 ":wuffs",
mtklein63213812016-08-24 09:55:56 -0700894 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700895 ]
896
Chinmay Garde43f115c2016-11-16 15:04:12 -0800897 # This file (and all GN files in Skia) are designed to work with an
898 # empty sources assignment filter; we handle all that explicitly.
899 # We clear the filter here for clients who may have set up a global filter.
900 set_sources_assignment_filter([])
901
Hal Canaryc25f4e92019-02-26 11:54:25 -0500902 public = skia_core_public
903 public += skia_utils_public
904 public += skia_effects_public
905 public += skia_effects_imagefilter_public
906 public += skia_xps_public
907
mtkleinc04ff472016-06-23 10:29:30 -0700908 sources = []
brettwb9447282016-09-01 14:24:39 -0700909 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700910 sources += skia_utils_sources
Leon Scroggins IIIee0e5d02019-02-27 10:59:11 -0500911 if (skia_use_xps) {
912 sources += skia_xps_sources
913 }
Mike Klein54378232018-11-08 12:08:05 +0000914 sources += skia_effects_sources
915 sources += skia_effects_imagefilter_sources
Brian Osmanfb32ddf2019-06-18 10:14:20 -0400916 sources += skia_sksl_sources
mtkleinc04ff472016-06-23 10:29:30 -0700917 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400918 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500919 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700920 "src/android/SkBitmapRegionCodec.cpp",
921 "src/android/SkBitmapRegionDecoder.cpp",
922 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +1100923 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400924 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700925 "src/codec/SkBmpCodec.cpp",
926 "src/codec/SkBmpMaskCodec.cpp",
927 "src/codec/SkBmpRLECodec.cpp",
928 "src/codec/SkBmpStandardCodec.cpp",
929 "src/codec/SkCodec.cpp",
930 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -0400931 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -0400932 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700933 "src/codec/SkMaskSwizzler.cpp",
934 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700935 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700936 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700937 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700938 "src/codec/SkSwizzler.cpp",
939 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700940 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700941 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +0000942 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700943 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700944 "src/ports/SkMemory_malloc.cpp",
945 "src/ports/SkOSFile_stdio.cpp",
946 "src/sfnt/SkOTTable_name.cpp",
947 "src/sfnt/SkOTUtils.cpp",
948 "src/utils/mac/SkStream_mac.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700949 ]
brettwb9447282016-09-01 14:24:39 -0700950
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400951 defines = []
952 if (!skia_enable_skpicture) {
953 defines = [ "SK_DISABLE_SKPICTURE" ]
Hal Canaryc25f4e92019-02-26 11:54:25 -0500954 public -= skia_skpicture_public
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400955 sources -= skia_skpicture_sources
Mike Klein54378232018-11-08 12:08:05 +0000956 sources -= [ "//src/effects/imagefilters/SkPictureImageFilter.cpp" ]
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400957 sources += [ "src/core/SkPicture_none.cpp" ]
958 }
959
mtklein7d6fb2c2016-08-25 14:50:44 -0700960 libs = []
961
mtkleinc04ff472016-06-23 10:29:30 -0700962 if (is_win) {
963 sources += [
964 "src/ports/SkDebug_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700965 "src/ports/SkImageEncoder_WIC.cpp",
966 "src/ports/SkImageGeneratorWIC.cpp",
967 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700968 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700969 "src/ports/SkTLS_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700970 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400971 libs += [
972 "FontSub.lib",
973 "Ole32.lib",
974 "OleAut32.lib",
975 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500976 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400977 ]
mtkleinc04ff472016-06-23 10:29:30 -0700978 } else {
979 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700980 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700981 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700982 "src/ports/SkTLS_pthread.cpp",
983 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400984 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700985 }
986
mtklein7d6fb2c2016-08-25 14:50:44 -0700987 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500988 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500989 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500990 deps += [ "//third_party/cpu-features" ]
991 }
mtklein06c35c02016-09-20 12:28:12 -0700992 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700993 libs += [
994 "EGL",
995 "GLESv2",
996 "log",
997 ]
998 }
999
Kevin Lubick217056c2018-09-20 17:39:31 -04001000 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -07001001 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -04001002 if (skia_use_egl) {
1003 libs += [ "GLESv2" ]
1004 }
mtkleinc04ff472016-06-23 10:29:30 -07001005 }
1006
Leon Scroggins III85e22fc2018-11-28 08:58:47 -05001007 if (skia_use_fonthost_mac) {
Sergey Ulanovf3babcd2018-11-30 17:42:00 -08001008 sources += [ "src/ports/SkFontHost_mac.cpp" ]
Leon Scroggins III85e22fc2018-11-28 08:58:47 -05001009 }
1010
mtkleinc04ff472016-06-23 10:29:30 -07001011 if (is_mac) {
1012 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001013 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001014 "src/ports/SkImageEncoder_CG.cpp",
1015 "src/ports/SkImageGeneratorCG.cpp",
1016 ]
mtklein09e61f72016-08-23 13:35:28 -07001017 libs += [
bungeman3e306f62017-03-29 11:32:02 -04001018 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
1019 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -07001020 "ApplicationServices.framework",
1021 "OpenGL.framework",
1022 ]
mtkleinc04ff472016-06-23 10:29:30 -07001023 }
abarth6fc8ff02016-07-15 15:15:15 -07001024
Mike Klein7d302882016-11-03 14:06:31 -04001025 if (is_ios) {
1026 sources += [
1027 "src/ports/SkDebug_stdio.cpp",
1028 "src/ports/SkFontHost_mac.cpp",
1029 "src/ports/SkImageEncoder_CG.cpp",
1030 "src/ports/SkImageGeneratorCG.cpp",
1031 ]
1032 libs += [
1033 "CoreFoundation.framework",
1034 "CoreGraphics.framework",
1035 "CoreText.framework",
1036 "ImageIO.framework",
1037 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -04001038
1039 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
1040 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001041 ]
1042 }
1043
abarth6fc8ff02016-07-15 15:15:15 -07001044 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001045 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001046 }
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001047
1048 if (skia_enable_spirv_validation) {
1049 deps += [ "//third_party/spirv-tools" ]
1050 defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
1051 }
mtkleinc04ff472016-06-23 10:29:30 -07001052}
1053
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001054# DebugCanvas used in experimental/wasm-skp-debugger
1055if (target_cpu == "wasm") {
1056 static_library("debugcanvas") {
1057 public_configs = [ ":skia_public" ]
1058
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001059 sources = [
1060 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001061 "tools/debugger/DebugCanvas.cpp",
1062 "tools/debugger/DrawCommand.cpp",
1063 "tools/debugger/JsonWriteBuffer.cpp",
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001064 ]
1065
1066 deps = [
1067 ":fontmgr_wasm",
1068 ]
1069 }
1070}
1071
Kevin Lubickcbcff382018-10-02 09:02:18 -04001072static_library("pathkit") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001073 check_includes = false
Kevin Lubickcbcff382018-10-02 09:02:18 -04001074 public_configs = [ ":skia_public" ]
1075 configs += skia_library_configs
1076
1077 deps = [
1078 ":arm64",
1079 ":armv7",
1080 ":avx",
1081 ":crc32",
1082 ":hsw",
1083 ":none",
1084 ":sse2",
1085 ":sse41",
1086 ":sse42",
1087 ":ssse3",
1088 ]
1089
1090 # This file (and all GN files in Skia) are designed to work with an
1091 # empty sources assignment filter; we handle all that explicitly.
1092 # We clear the filter here for clients who may have set up a global filter.
1093 set_sources_assignment_filter([])
1094
1095 sources = []
1096 sources += skia_pathops_sources
Hal Canaryc25f4e92019-02-26 11:54:25 -05001097 sources += skia_pathops_public
Kevin Lubickcbcff382018-10-02 09:02:18 -04001098 sources += [
1099 "src/core/SkAnalyticEdge.cpp",
1100 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001101 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001102 "src/core/SkCubicMap.cpp",
1103 "src/core/SkEdge.cpp",
1104 "src/core/SkEdgeBuilder.cpp",
1105 "src/core/SkEdgeClipper.cpp",
1106 "src/core/SkGeometry.cpp",
1107 "src/core/SkLineClipper.cpp",
1108 "src/core/SkMallocPixelRef.cpp",
1109 "src/core/SkMath.cpp",
1110 "src/core/SkMatrix.cpp",
1111 "src/core/SkOpts.cpp",
1112 "src/core/SkPaint.cpp",
1113 "src/core/SkPath.cpp",
1114 "src/core/SkPathEffect.cpp",
1115 "src/core/SkPathMeasure.cpp",
1116 "src/core/SkPathRef.cpp",
1117 "src/core/SkPoint.cpp",
1118 "src/core/SkRRect.cpp",
1119 "src/core/SkRect.cpp",
1120 "src/core/SkSemaphore.cpp",
1121 "src/core/SkStream.cpp",
1122 "src/core/SkString.cpp",
1123 "src/core/SkStringUtils.cpp",
1124 "src/core/SkStroke.cpp",
1125 "src/core/SkStrokeRec.cpp",
1126 "src/core/SkStrokerPriv.cpp",
1127 "src/core/SkThreadID.cpp",
1128 "src/core/SkUtils.cpp",
1129 "src/effects/SkDashPathEffect.cpp",
1130 "src/effects/SkTrimPathEffect.cpp",
1131 "src/ports/SkDebug_stdio.cpp",
1132 "src/ports/SkMemory_malloc.cpp",
1133 "src/utils/SkDashPath.cpp",
1134 "src/utils/SkParse.cpp",
1135 "src/utils/SkParsePath.cpp",
1136 "src/utils/SkUTF.cpp",
1137 ]
1138}
1139
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001140group("modules") {
1141 deps = [
Kevin Lubick96634842019-03-05 14:09:24 -05001142 "modules/particles",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001143 "modules/skottie",
1144 "modules/skshaper",
1145 ]
1146}
1147
Brian Osmanfb32ddf2019-06-18 10:14:20 -04001148executable("cpu_modules") {
1149 sources = [
1150 "tools/cpu_modules.cpp",
1151 ]
1152 deps = [
1153 ":skia",
1154 "modules/particles",
1155 ]
1156}
1157
mtkleinc095df52016-08-24 12:23:52 -07001158# Targets guarded by skia_enable_tools may use //third_party freely.
1159if (skia_enable_tools) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001160 skia_public_includes = [
1161 "include/android",
1162 "include/atlastext",
1163 "include/c",
1164 "include/codec",
1165 "include/config",
1166 "include/core",
1167 "include/docs",
1168 "include/effects",
1169 "include/encode",
1170 "include/gpu",
1171 "include/pathops",
1172 "include/ports",
1173 "include/svg",
1174 "include/utils",
1175 "include/utils/mac",
1176 "modules/sksg/include",
1177 "modules/skshaper/include",
1178 "modules/skottie/include",
1179 ]
1180
Mike Klein308b5ac2016-12-06 16:03:52 -05001181 # Used by gn_to_bp.py to list our public include dirs.
1182 source_set("public") {
1183 configs += [ ":skia_public" ]
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001184 include_dirs = skia_public_includes
Mike Klein308b5ac2016-12-06 16:03:52 -05001185 }
1186
Mike Kleinc36dedf2016-11-18 09:35:28 -05001187 config("skia.h_config") {
1188 include_dirs = [ "$target_gen_dir" ]
1189 }
1190 action("skia.h") {
1191 public_configs = [ ":skia.h_config" ]
1192 skia_h = "$target_gen_dir/skia.h"
1193 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001194
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001195 args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1196 [ rebase_path(skia_h, root_build_dir) ] +
1197 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001198 depfile = "$skia_h.deps"
1199 outputs = [
1200 skia_h,
1201 ]
1202 }
1203
Brian Osmanc9a42472018-05-31 13:17:12 -04001204 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001205 executable("fiddle") {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001206 check_includes = false
Mike Kleinc36dedf2016-11-18 09:35:28 -05001207 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001208 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001209 "tools/fiddle/draw.cpp",
1210 "tools/fiddle/fiddle_main.cpp",
1211 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001212
1213 if (skia_use_egl) {
1214 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001215 } else {
1216 sources += [ "tools/fiddle/null_context.cpp" ]
1217 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001218 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001219 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001220 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001221 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001222 ":skia",
1223 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001224 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001225 "modules/skshaper",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001226 ]
1227 }
1228 }
1229
Mike Klein9e25bb92019-04-29 09:46:36 -05001230 config("our_vulkan_headers") {
1231 # We add this directory to simulate the client already have
1232 # vulkan/vulkan_core.h on their path.
1233 include_dirs = [ "include/third_party/vulkan" ]
1234 }
1235
Brian Osmanc9a42472018-05-31 13:17:12 -04001236 source_set("public_headers_warnings_check") {
1237 sources = [
1238 "tools/public_headers_warnings_check.cpp",
1239 ]
1240 configs -= [ "//gn:warnings_except_public_headers" ]
Mike Klein9e25bb92019-04-29 09:46:36 -05001241 configs += [ ":our_vulkan_headers" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001242 deps = [
1243 ":skia",
1244 ":skia.h",
1245 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04001246 "modules/skshaper",
Brian Osmanc9a42472018-05-31 13:17:12 -04001247 ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001248 }
1249
mtkleinc095df52016-08-24 12:23:52 -07001250 template("test_lib") {
1251 config(target_name + "_config") {
mtkleina627b5c2016-09-20 13:36:47 -07001252 if (defined(invoker.public_defines)) {
1253 defines = invoker.public_defines
1254 }
mtklein25c81d42016-07-27 13:55:26 -07001255 }
mtkleinc095df52016-08-24 12:23:52 -07001256 source_set(target_name) {
Mike Kleinc0bd9f92019-04-23 12:05:21 -05001257 forward_variables_from(invoker, "*", [])
Hal Canaryc25f4e92019-02-26 11:54:25 -05001258 check_includes = false
mtkleinc095df52016-08-24 12:23:52 -07001259 public_configs = [
1260 ":" + target_name + "_config",
1261 ":skia_private",
1262 ]
1263
1264 if (!defined(deps)) {
1265 deps = []
1266 }
1267 deps += [ ":skia" ]
1268 testonly = true
1269 }
mtklein25c81d42016-07-27 13:55:26 -07001270 }
mtklein25c81d42016-07-27 13:55:26 -07001271
Mike Kleine6682eb2017-01-05 10:54:57 -05001272 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001273 if (is_ios) {
1274 app_name = target_name
1275 gen_path = target_gen_dir
1276
1277 action("${app_name}_generate_info_plist") {
1278 script = "//gn/gen_plist_ios.py"
1279 outputs = [
1280 "$gen_path/${app_name}_Info.plist",
1281 ]
1282 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1283 }
1284
1285 bundle_data("${app_name}_bundle_info_plist") {
1286 public_deps = [
1287 ":${app_name}_generate_info_plist",
1288 ]
1289 sources = [
1290 "$gen_path/${app_name}_Info.plist",
1291 ]
1292 outputs = [
1293 "{{bundle_root_dir}}/Info.plist",
1294 ]
1295 }
1296
Jim Van Verthffacf652019-04-02 11:59:34 -04001297 has_skps = "True" == exec_script("//gn/checkdir.py",
1298 [ rebase_path("skps", root_build_dir) ],
1299 "trim string")
1300 bundle_data("${app_name}_bundle_resources") {
1301 sources = [
1302 "resources",
1303 ]
1304 outputs = [
1305 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1306 "{{bundle_resources_dir}}/data/resources",
1307 ]
1308 }
1309 if (has_skps) {
1310 bundle_data("${app_name}_bundle_skps") {
Jim Van Verth329c5a62017-11-29 11:42:33 -05001311 sources = [
Jim Van Verthffacf652019-04-02 11:59:34 -04001312 "skps",
Jim Van Verth329c5a62017-11-29 11:42:33 -05001313 ]
1314 outputs = [
Jim Van Verthffacf652019-04-02 11:59:34 -04001315 # Store in same folder as resources
1316 "{{bundle_resources_dir}}/data/skps",
Jim Van Verth329c5a62017-11-29 11:42:33 -05001317 ]
1318 }
Jim Van Verth329c5a62017-11-29 11:42:33 -05001319 }
1320
Jim Van Verth443a9132017-11-28 09:45:26 -05001321 executable("${app_name}_generate_executable") {
1322 forward_variables_from(invoker,
1323 "*",
1324 [
1325 "output_name",
1326 "visibility",
1327 "is_shared_library",
1328 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001329 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001330 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001331 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1332 }
1333
1334 bundle_data("${app_name}_bundle_executable") {
1335 public_deps = [
1336 ":${app_name}_generate_executable",
1337 ]
1338 sources = [
1339 "$gen_path/$app_name",
1340 ]
1341 outputs = [
1342 "{{bundle_executable_dir}}/$app_name",
1343 ]
1344 testonly = true
1345 }
1346
Jim Van Verthffacf652019-04-02 11:59:34 -04001347 bundle_data("${app_name}_bundle_symbols") {
1348 public_deps = [
1349 ":${app_name}_generate_executable",
1350 ]
1351 sources = [
1352 "$gen_path/${app_name}.dSYM",
1353 ]
1354 outputs = [
1355 "{{bundle_executable_dir}}/${app_name}.dSYM",
1356 ]
1357 testonly = true
1358 }
1359
Jim Van Verth443a9132017-11-28 09:45:26 -05001360 create_bundle("$app_name") {
1361 product_type = "com.apple.product-type.application"
1362 testonly = true
1363
1364 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1365 bundle_resources_dir = bundle_root_dir
1366 bundle_executable_dir = bundle_root_dir
Jim Van Verth443a9132017-11-28 09:45:26 -05001367
1368 deps = [
1369 ":${app_name}_bundle_executable",
1370 ":${app_name}_bundle_info_plist",
Jim Van Verthffacf652019-04-02 11:59:34 -04001371 ":${app_name}_bundle_resources",
1372 ":${app_name}_bundle_symbols",
Jim Van Verth443a9132017-11-28 09:45:26 -05001373 ]
Jim Van Verthffacf652019-04-02 11:59:34 -04001374 if (has_skps) {
1375 deps += [ ":${app_name}_bundle_skps" ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001376 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001377
1378 # should only code sign when running on a device, not the simulator
1379 if (target_cpu != "x64") {
1380 code_signing_script = "//gn/codesign_ios.py"
1381 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1382 code_signing_outputs = [
1383 "$bundle_root_dir/_CodeSignature/CodeResources",
1384 "$bundle_root_dir/embedded.mobileprovision",
1385 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001386 code_signing_args = [
1387 rebase_path("$bundle_root_dir", root_build_dir),
1388 skia_ios_identity,
1389 skia_ios_profile,
1390 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001391 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001392 }
1393 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001394 # !is_ios
1395
1396 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1397 shared_library("lib" + target_name) {
1398 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1399 configs += [ ":skia_private" ]
1400 testonly = true
1401 }
1402 } else {
1403 _executable = target_name
1404 executable(_executable) {
Hal Canaryc25f4e92019-02-26 11:54:25 -05001405 check_includes = false
Jim Van Verth443a9132017-11-28 09:45:26 -05001406 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1407 configs += [ ":skia_private" ]
1408 testonly = true
1409 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001410 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001411 if (is_android && skia_android_serial != "" && defined(_executable)) {
1412 action("push_" + target_name) {
1413 script = "gn/push_to_android.py"
1414 deps = [
1415 ":" + _executable,
1416 ]
1417 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1418 outputs = [
1419 _stamp,
1420 ]
1421 args = [
1422 rebase_path("$root_build_dir/$_executable"),
1423 skia_android_serial,
1424 rebase_path(_stamp),
1425 ]
1426 testonly = true
1427 }
Mike Klein7d921032017-01-05 12:20:41 -05001428 }
1429 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001430 }
1431
Greg Danielda16cce2018-08-01 09:23:57 -04001432 config("moltenvk_config") {
1433 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1434 if (is_ios) {
1435 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS"
1436 } else {
1437 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS"
1438 }
1439 cflags = [ "-F$moltenvk_framework_path" ]
1440 ldflags = [ "-F$moltenvk_framework_path" ]
1441 libs = [
1442 "MoltenVK.framework",
1443 "Metal.framework",
1444 "IOSurface.framework",
1445 "QuartzCore.framework",
1446 "Foundation.framework",
1447 ]
1448 if (is_ios) {
1449 libs += [ "UIKit.framework" ]
1450 } else {
1451 libs += [ "IOKit.framework" ]
1452 }
1453 defines = [ "SK_MOLTENVK" ]
1454 }
1455 }
1456
1457 source_set("moltenvk") {
1458 public_configs = [ ":moltenvk_config" ]
1459 }
1460
mtkleinc095df52016-08-24 12:23:52 -07001461 test_lib("gpu_tool_utils") {
Brian Osmanc9a42472018-05-31 13:17:12 -04001462 public_defines = []
mtkleind68f9b02016-09-23 13:18:41 -07001463
Mike Klein9e25bb92019-04-29 09:46:36 -05001464 # Bots and even devs may not have Vulkan headers, so put
1465 # include/third_party/vulkan on our path so they're always available.
1466 all_dependent_configs = [ ":our_vulkan_headers" ]
1467
Mike Klein333fb452019-04-24 08:48:11 -05001468 defines = []
1469 if (skia_enable_discrete_gpu) {
1470 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
1471 }
1472
Brian Osmanc9a42472018-05-31 13:17:12 -04001473 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001474 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001475 sources = [
1476 "tools/gpu/GrContextFactory.cpp",
1477 "tools/gpu/GrTest.cpp",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001478 "tools/gpu/MemoryCache.cpp",
1479 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001480 "tools/gpu/ProxyUtils.cpp",
1481 "tools/gpu/TestContext.cpp",
Michael Ludwigd9958f82019-03-21 13:08:36 -04001482 "tools/gpu/YUVUtils.cpp",
1483 "tools/gpu/YUVUtils.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001484 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1485 "tools/gpu/gl/GLTestContext.cpp",
1486 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04001487 "tools/gpu/mock/MockTestContext.cpp",
1488 ]
1489 libs = []
1490
1491 if (is_android || skia_use_egl) {
1492 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1493 } else if (is_ios) {
1494 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1495 libs += [ "OpenGLES.framework" ]
1496 } else if (is_linux) {
1497 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -04001498 libs += [
1499 "GLU",
1500 "X11",
1501 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001502 } else if (is_mac) {
1503 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1504 } else if (is_win) {
1505 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001506 libs += [ "Gdi32.lib" ]
1507 if (target_cpu != "arm64") {
1508 libs += [ "OpenGL32.lib" ]
1509 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001510 }
mtklein25c81d42016-07-27 13:55:26 -07001511
Brian Osmanc9a42472018-05-31 13:17:12 -04001512 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001513
Brian Osmanc9a42472018-05-31 13:17:12 -04001514 if (skia_use_angle) {
1515 deps += [ "//third_party/angle2" ]
1516 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1517 }
Greg Daniel54200e42018-12-11 17:03:39 -05001518
Brian Osmanc9a42472018-05-31 13:17:12 -04001519 if (skia_use_vulkan) {
1520 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1521 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Greg Danielda16cce2018-08-01 09:23:57 -04001522 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1523 public_deps += [ ":moltenvk" ]
1524 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001525 }
1526 if (skia_use_metal) {
1527 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001528 }
mtklein25c81d42016-07-27 13:55:26 -07001529 }
mtklein25c81d42016-07-27 13:55:26 -07001530
mtkleinc095df52016-08-24 12:23:52 -07001531 test_lib("flags") {
mtkleinc095df52016-08-24 12:23:52 -07001532 sources = [
Mike Klein88544fb2019-03-20 10:50:33 -05001533 "tools/flags/CommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001534 ]
1535 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001536
1537 test_lib("common_flags_config") {
mtklein046cb562016-09-16 10:23:12 -07001538 sources = [
Mike Klein88544fb2019-03-20 10:50:33 -05001539 "tools/flags/CommonFlagsConfig.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001540 ]
1541 deps = [
mtklein046cb562016-09-16 10:23:12 -07001542 ":flags",
Greg Danielda16cce2018-08-01 09:23:57 -04001543 ]
1544 public_deps = [
mtkleinc095df52016-08-24 12:23:52 -07001545 ":gpu_tool_utils",
1546 ]
1547 }
Mike Kleinc6142d82019-03-25 10:54:59 -05001548 test_lib("common_flags_gpu") {
Mike Kleinc6142d82019-03-25 10:54:59 -05001549 sources = [
1550 "tools/flags/CommonFlagsGpu.cpp",
1551 ]
1552 deps = [
1553 ":flags",
1554 ]
1555 public_deps = [
1556 ":gpu_tool_utils",
1557 ]
1558 }
1559 test_lib("common_flags_images") {
Mike Kleinc6142d82019-03-25 10:54:59 -05001560 sources = [
1561 "tools/flags/CommonFlagsImages.cpp",
1562 ]
1563 deps = [
1564 ":flags",
1565 ]
1566 }
1567 test_lib("common_flags_aa") {
Mike Kleinc6142d82019-03-25 10:54:59 -05001568 sources = [
1569 "tools/flags/CommonFlagsAA.cpp",
1570 ]
1571 deps = [
1572 ":flags",
1573 ]
1574 }
mtklein25c81d42016-07-27 13:55:26 -07001575
Mike Klein499f0ac2019-03-25 13:00:12 -05001576 test_lib("trace") {
Mike Klein499f0ac2019-03-25 13:00:12 -05001577 deps = [
1578 ":flags",
1579 ]
1580 sources = [
1581 "tools/trace/ChromeTracingTracer.cpp",
1582 "tools/trace/ChromeTracingTracer.h",
1583 "tools/trace/EventTracingPriv.cpp",
1584 "tools/trace/EventTracingPriv.h",
1585 "tools/trace/SkDebugfTracer.cpp",
1586 "tools/trace/SkDebugfTracer.h",
1587 ]
1588 }
1589
mtkleinc095df52016-08-24 12:23:52 -07001590 test_lib("tool_utils") {
mtkleinc095df52016-08-24 12:23:52 -07001591 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001592 "tools/AndroidSkDebugToStdOut.cpp",
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001593 "tools/AutoreleasePool.h",
mtkleinc095df52016-08-24 12:23:52 -07001594 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001595 "tools/DDLPromiseImageHelper.cpp",
1596 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001597 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001598 "tools/ProcStats.cpp",
1599 "tools/Resources.cpp",
Mike Kleinea3f0142019-03-20 11:12:10 -05001600 "tools/ToolUtils.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001601 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05001602 "tools/debugger/DebugCanvas.cpp",
1603 "tools/debugger/DrawCommand.cpp",
1604 "tools/debugger/JsonWriteBuffer.cpp",
Mike Klein0cffcbf92019-03-20 11:08:46 -05001605 "tools/fonts/RandomScalerContext.cpp",
1606 "tools/fonts/TestEmptyTypeface.h",
1607 "tools/fonts/TestFontMgr.cpp",
1608 "tools/fonts/TestFontMgr.h",
1609 "tools/fonts/TestSVGTypeface.cpp",
1610 "tools/fonts/TestSVGTypeface.h",
1611 "tools/fonts/TestTypeface.cpp",
1612 "tools/fonts/TestTypeface.h",
Mike Kleinea3f0142019-03-20 11:12:10 -05001613 "tools/fonts/ToolUtilsFont.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001614 "tools/random_parse_path.cpp",
Mike Kleincd5104e2019-03-20 11:55:08 -05001615 "tools/timer/AnimTimer.h",
mtkleinc095df52016-08-24 12:23:52 -07001616 "tools/timer/Timer.cpp",
1617 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001618 libs = []
1619 if (is_ios) {
1620 sources += [ "tools/ios_utils.m" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001621 sources += [ "tools/ios_utils.h" ]
1622 if (skia_use_metal) {
1623 sources += [ "tools/AutoreleasePool.mm" ]
1624 }
Mike Kleinadacaef2017-02-06 09:26:14 -05001625 libs += [ "Foundation.framework" ]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001626 } else if (is_mac) {
1627 if (skia_use_metal) {
1628 sources += [ "tools/AutoreleasePool.mm" ]
1629 libs += [ "Foundation.framework" ]
1630 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001631 } else if (is_win) {
1632 libs += [ "DbgHelp.lib" ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001633 }
Mike Kleinbf15b662019-04-15 11:32:16 -05001634
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001635 defines = []
1636 if (skia_tools_require_resources) {
1637 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1638 }
mtkleinc095df52016-08-24 12:23:52 -07001639 deps = [
Ben Wagner97182cc2018-02-15 10:20:04 -05001640 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001641 ":flags",
Mike Kleine4ad58a2019-03-26 09:05:52 -05001642 ]
1643 public_deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05001644 ":gpu_tool_utils",
mtkleinc095df52016-08-24 12:23:52 -07001645 ]
mtkleinc095df52016-08-24 12:23:52 -07001646 }
mtklein25c81d42016-07-27 13:55:26 -07001647
Mike Kleine11e5c12019-04-24 12:46:06 -05001648 test_lib("etc1") {
1649 sources = [
1650 "third_party/etc1/etc1.cpp",
1651 ]
1652 }
1653
Mike Reed7bf160e2019-05-17 16:50:51 -04001654 if (skia_use_ffmpeg) {
1655 test_lib("video_decoder") {
1656 sources = [
1657 "experimental/ffmpeg/SkVideoDecoder.cpp",
1658 "experimental/ffmpeg/SkVideoDecoder.h",
Mike Reedc0ee21f2019-05-28 16:11:03 -04001659 "experimental/ffmpeg/SkVideoEncoder.cpp",
1660 "experimental/ffmpeg/SkVideoEncoder.h",
Mike Reed7bf160e2019-05-17 16:50:51 -04001661 ]
1662 libs = [
Mike Reedf97e8e92019-05-29 13:33:55 -04001663 "swscale",
Mike Reed7bf160e2019-05-17 16:50:51 -04001664 "avcodec",
1665 "avformat",
1666 "avutil",
1667 ]
1668 }
1669 }
1670
Mike Klein6e744122016-10-27 12:21:40 -04001671 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001672 test_lib("gm") {
mtkleinc095df52016-08-24 12:23:52 -07001673 sources = gm_sources
1674 deps = [
Mike Kleine11e5c12019-04-24 12:46:06 -05001675 ":etc1",
scroggo19b91532016-10-24 09:03:26 -07001676 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001677 ":skia",
1678 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001679 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001680 "modules/skottie:gm",
Florin Malita3b526b02018-05-25 12:43:51 -04001681 "modules/sksg",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001682 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001683 ]
Greg Danielda16cce2018-08-01 09:23:57 -04001684 public_deps = [
1685 ":gpu_tool_utils",
1686 ]
Mike Reed7bf160e2019-05-17 16:50:51 -04001687
1688 if (skia_use_ffmpeg) {
1689 deps += [ ":video_decoder" ]
1690 sources += [ "gm/video_decoder.cpp" ]
1691 }
mtkleinc095df52016-08-24 12:23:52 -07001692 }
mtklein25c81d42016-07-27 13:55:26 -07001693
Mike Klein7b7077c2019-06-03 17:10:59 -05001694 test_lib("skvm_builders") {
1695 sources = [
1696 "tools/SkVMBuilders.cpp",
1697 "tools/SkVMBuilders.h",
1698 ]
1699 }
1700
Mike Klein6e744122016-10-27 12:21:40 -04001701 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001702 test_lib("tests") {
Mike Klein6e744122016-10-27 12:21:40 -04001703 sources = tests_sources + pathops_tests_sources
Robert Phillips0c6daf02019-05-16 12:43:11 -04001704 if (skia_use_metal) {
1705 sources += metal_tests_sources
1706 }
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -05001707 if (!skia_enable_fontmgr_android) {
Mike Klein6e744122016-10-27 12:21:40 -04001708 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001709 }
Ben Wagner37a06c02018-06-22 21:11:00 +00001710 if (!(skia_use_freetype && skia_use_fontconfig)) {
1711 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1712 }
mtkleinc095df52016-08-24 12:23:52 -07001713 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001714 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001715 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001716 ":skia",
Mike Klein7b7077c2019-06-03 17:10:59 -05001717 ":skvm_builders",
mtkleinc095df52016-08-24 12:23:52 -07001718 ":tool_utils",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001719 "modules/skottie:tests",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001720 "modules/skparagraph:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001721 "modules/sksg:tests",
Brian Osmanc725e8f2019-04-10 14:08:44 -04001722 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001723 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05001724 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07001725 "//third_party/zlib",
1726 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001727 public_deps = [
1728 ":gpu_tool_utils", # Test.h #includes headers from this target.
1729 ]
mtkleinc095df52016-08-24 12:23:52 -07001730 }
mtklein2f3416d2016-08-02 16:02:05 -07001731
Mike Klein6e744122016-10-27 12:21:40 -04001732 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001733 test_lib("bench") {
mtkleinc095df52016-08-24 12:23:52 -07001734 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001735 deps = [
1736 ":flags",
1737 ":gm",
1738 ":gpu_tool_utils",
1739 ":skia",
Mike Klein7b7077c2019-06-03 17:10:59 -05001740 ":skvm_builders",
mtkleinc095df52016-08-24 12:23:52 -07001741 ":tool_utils",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001742 "modules/skparagraph:bench",
Mike Reedd62d4062019-06-12 10:20:44 -04001743 "modules/skshaper",
mtkleinc095df52016-08-24 12:23:52 -07001744 ]
1745 }
mtklein2b6870c2016-07-28 14:17:33 -07001746
mtkleinc095df52016-08-24 12:23:52 -07001747 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001748 if (skia_use_expat) {
Hal Canary0f666812018-03-22 15:21:12 -04001749 sources = [
1750 "experimental/svg/model/SkSVGAttribute.cpp",
1751 "experimental/svg/model/SkSVGAttributeParser.cpp",
1752 "experimental/svg/model/SkSVGCircle.cpp",
1753 "experimental/svg/model/SkSVGClipPath.cpp",
1754 "experimental/svg/model/SkSVGContainer.cpp",
1755 "experimental/svg/model/SkSVGDOM.cpp",
1756 "experimental/svg/model/SkSVGEllipse.cpp",
1757 "experimental/svg/model/SkSVGGradient.cpp",
1758 "experimental/svg/model/SkSVGLine.cpp",
1759 "experimental/svg/model/SkSVGLinearGradient.cpp",
1760 "experimental/svg/model/SkSVGNode.cpp",
1761 "experimental/svg/model/SkSVGPath.cpp",
1762 "experimental/svg/model/SkSVGPattern.cpp",
1763 "experimental/svg/model/SkSVGPoly.cpp",
1764 "experimental/svg/model/SkSVGRadialGradient.cpp",
1765 "experimental/svg/model/SkSVGRect.cpp",
1766 "experimental/svg/model/SkSVGRenderContext.cpp",
1767 "experimental/svg/model/SkSVGSVG.cpp",
1768 "experimental/svg/model/SkSVGShape.cpp",
1769 "experimental/svg/model/SkSVGStop.cpp",
1770 "experimental/svg/model/SkSVGTransformableNode.cpp",
1771 "experimental/svg/model/SkSVGUse.cpp",
1772 "experimental/svg/model/SkSVGValue.cpp",
1773 ]
1774 deps = [
1775 ":skia",
1776 ":xml",
1777 ]
1778 }
mtkleinc095df52016-08-24 12:23:52 -07001779 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001780
Mike Reedd62d4062019-06-12 10:20:44 -04001781 test_lib("experimental_xform") {
1782 sources = [
1783 "experimental/xform/SkShape.cpp",
1784 "experimental/xform/SkXform.cpp",
1785 "experimental/xform/XContext.cpp",
1786 ]
1787 deps = [
1788 ":skia",
1789 ]
1790 }
1791
Mike Klein38af9432016-11-11 11:39:44 -05001792 if (skia_use_lua) {
1793 test_lib("lua") {
Mike Klein38af9432016-11-11 11:39:44 -05001794 sources = [
1795 "src/utils/SkLua.cpp",
1796 "src/utils/SkLuaCanvas.cpp",
1797 ]
1798 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001799 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001800 "//third_party/lua",
1801 ]
1802 }
1803
Mike Kleine6682eb2017-01-05 10:54:57 -05001804 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001805 sources = [
1806 "tools/lua/lua_app.cpp",
1807 ]
1808 deps = [
1809 ":lua",
1810 ":skia",
1811 "//third_party/lua",
1812 ]
Mike Klein38af9432016-11-11 11:39:44 -05001813 }
1814
Mike Kleine6682eb2017-01-05 10:54:57 -05001815 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001816 sources = [
1817 "tools/lua/lua_pictures.cpp",
1818 ]
1819 deps = [
1820 ":flags",
1821 ":lua",
1822 ":skia",
1823 ":tool_utils",
1824 "//third_party/lua",
1825 ]
Mike Klein38af9432016-11-11 11:39:44 -05001826 }
1827 }
1828
Florin Malitabfe876a2018-09-02 12:33:59 -04001829 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001830 test_app("skottie_tool") {
1831 deps = [
1832 "modules/skottie:tool",
1833 ]
1834 }
1835 }
1836
Hal Canary5b39dc82019-04-17 13:29:46 -04001837 test_app("make_skqp_model") {
1838 sources = [
1839 "tools/skqp/make_skqp_model.cpp",
1840 ]
1841 deps = [
1842 ":skia",
1843 ]
1844 }
1845
Kevin Lubickebf648e2017-09-21 13:45:16 -04001846 if (target_cpu != "wasm") {
1847 import("gn/samples.gni")
1848 test_lib("samples") {
Yuqian Li56a4a092018-02-12 14:47:34 +08001849 sources = samples_sources
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001850 public_deps = [
1851 ":tool_utils",
1852 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001853 deps = [
1854 ":experimental_svg_model",
1855 ":flags",
Mike Kleinc6142d82019-03-25 10:54:59 -05001856 ":gpu_tool_utils",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001857 ":xml",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001858 "modules/skparagraph:samples",
Mike Reedec80d902019-02-12 11:31:27 -05001859 "modules/sksg",
Herb Derby264182c2018-05-29 15:53:40 -04001860 "modules/skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001861 ]
Mike Klein38af9432016-11-11 11:39:44 -05001862
Kevin Lubickebf648e2017-09-21 13:45:16 -04001863 if (skia_use_lua) {
1864 sources += [ "samplecode/SampleLua.cpp" ]
1865 deps += [
1866 ":lua",
1867 "//third_party/lua",
1868 ]
1869 }
1870 }
Mike Klein7af351a2018-07-27 09:54:43 -04001871 test_app("imgcvt") {
1872 sources = [
1873 "tools/imgcvt.cpp",
1874 ]
1875 deps = [
1876 ":skcms",
1877 ":skia",
1878 ]
1879 }
Mike Klein735c7ba2019-03-25 12:57:58 -05001880 test_lib("hash_and_encode") {
Mike Klein735c7ba2019-03-25 12:57:58 -05001881 sources = [
1882 "tools/HashAndEncode.cpp",
1883 "tools/HashAndEncode.h",
1884 ]
1885 deps = [
1886 ":flags",
1887 ":skia",
1888 "//third_party/libpng",
1889 ]
1890 }
1891 test_app("fm") {
1892 sources = [
1893 "tools/fm/fm.cpp",
1894 ]
1895 deps = [
1896 ":common_flags_aa",
1897 ":common_flags_gpu",
Mike Klein6253d902019-03-27 15:09:12 -05001898 ":experimental_svg_model",
Mike Klein735c7ba2019-03-25 12:57:58 -05001899 ":flags",
1900 ":gm",
1901 ":gpu_tool_utils",
1902 ":hash_and_encode",
1903 ":skia",
1904 ":tool_utils",
1905 ":trace",
Mike Klein22924262019-04-02 14:14:56 -04001906 "modules/skottie",
1907 "modules/skottie:utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05001908 ]
1909 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04001910 test_app("dm") {
1911 sources = [
1912 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001913 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001914 "dm/DMJsonWriter.cpp",
1915 "dm/DMSrcSink.cpp",
1916 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001917 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05001918 ":common_flags_aa",
1919 ":common_flags_config",
1920 ":common_flags_gpu",
1921 ":common_flags_images",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001922 ":experimental_svg_model",
1923 ":flags",
1924 ":gm",
1925 ":gpu_tool_utils",
Mike Klein735c7ba2019-03-25 12:57:58 -05001926 ":hash_and_encode",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001927 ":skia",
1928 ":tests",
1929 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05001930 ":trace",
Florin Malita3d856bd2018-05-26 09:49:28 -04001931 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05001932 "modules/skottie:utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001933 "modules/sksg",
Mike Klein38af9432016-11-11 11:39:44 -05001934 ]
1935 }
Brian Osman16adfa32016-10-18 14:42:44 -04001936 }
1937
Mike Kleina8a51ce2018-01-09 12:34:11 -05001938 if (!is_win) {
1939 test_app("remote_demo") {
1940 sources = [
1941 "tools/remote_demo.cpp",
1942 ]
1943 deps = [
1944 ":skia",
1945 ]
1946 }
1947 }
1948
Mike Kleine6682eb2017-01-05 10:54:57 -05001949 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001950 sources = [
1951 "bench/nanobench.cpp",
1952 ]
1953 deps = [
1954 ":bench",
Mike Kleinc6142d82019-03-25 10:54:59 -05001955 ":common_flags_aa",
1956 ":common_flags_config",
1957 ":common_flags_gpu",
1958 ":common_flags_images",
fmalita6519c212016-09-14 08:05:17 -07001959 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001960 ":flags",
1961 ":gm",
1962 ":gpu_tool_utils",
1963 ":skia",
1964 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05001965 ":trace",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001966 "modules/skparagraph:bench",
Mike Reedd62d4062019-06-12 10:20:44 -04001967 "modules/sksg",
Julia Lavrovaa3552c52019-05-30 16:12:56 -04001968 "modules/skshaper",
mtklein2b6870c2016-07-28 14:17:33 -07001969 ]
mtklein2b6870c2016-07-28 14:17:33 -07001970 }
halcanary19a97202016-08-03 15:08:04 -07001971
Ravi Mistry10d36c52017-01-31 09:49:18 -05001972 test_app("skpinfo") {
1973 sources = [
1974 "tools/skpinfo.cpp",
1975 ]
1976 deps = [
1977 ":flags",
1978 ":skia",
1979 ]
1980 }
1981
Mike Reedc0ee21f2019-05-28 16:11:03 -04001982 if (skia_use_ffmpeg) {
1983 test_app("skottie2movie") {
1984 sources = [
1985 "tools/skottie2movie.cpp",
1986 ]
1987 deps = [
1988 ":flags",
1989 ":skia",
1990 ":video_decoder",
1991 "modules/skottie",
Mike Reed5093e232019-05-30 10:10:50 -04001992 "modules/skottie:utils",
Mike Reedc0ee21f2019-05-28 16:11:03 -04001993 ]
1994 }
1995 }
1996
Brian Osmanc9a42472018-05-31 13:17:12 -04001997 test_app("skpbench") {
1998 sources = [
1999 "tools/skpbench/skpbench.cpp",
2000 ]
2001 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002002 ":common_flags_config",
2003 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04002004 ":flags",
2005 ":gpu_tool_utils",
2006 ":skia",
2007 ":tool_utils",
2008 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07002009 }
2010
Mike Kleine6682eb2017-01-05 10:54:57 -05002011 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07002012 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04002013 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07002014 ]
2015 deps = [
2016 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04002017 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07002018 ]
halcanary3eee9d92016-09-10 07:01:53 -07002019 }
mtklein046cb562016-09-16 10:23:12 -07002020
Ben Wagner219f3622017-07-17 15:32:25 -04002021 test_app("create_test_font") {
2022 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05002023 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04002024 ]
2025 deps = [
2026 ":skia",
2027 ]
2028 assert_no_deps = [
2029 # tool_utils requires the output of this app.
2030 ":tool_utils",
2031 ]
2032 }
2033
Florin Malita5d3ff432018-07-31 16:38:43 -04002034 if (skia_use_expat) {
2035 test_app("create_test_font_color") {
2036 sources = [
2037 "tools/fonts/create_test_font_color.cpp",
2038 ]
2039 deps = [
2040 ":flags",
2041 ":skia",
2042 ":tool_utils",
2043 ]
2044 }
Ben Wagner97182cc2018-02-15 10:20:04 -05002045 }
2046
Mike Kleine6682eb2017-01-05 10:54:57 -05002047 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07002048 sources = [
2049 "tools/get_images_from_skps.cpp",
2050 ]
2051 deps = [
2052 ":flags",
2053 ":skia",
mtklein046cb562016-09-16 10:23:12 -07002054 ]
mtklein046cb562016-09-16 10:23:12 -07002055 }
mtkleinecbc5262016-09-22 11:51:24 -07002056
Brian Osman6788a542018-12-10 11:56:01 -05002057 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05002058 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04002059 sources = [
2060 "tools/skiaserve/Request.cpp",
2061 "tools/skiaserve/Response.cpp",
2062 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002063 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
2064 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
2065 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
2066 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
2067 "tools/skiaserve/urlhandlers/DataHandler.cpp",
2068 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
2069 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
2070 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
2071 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05002072 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
2073 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04002074 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
2075 "tools/skiaserve/urlhandlers/PostHandler.cpp",
2076 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
2077 "tools/skiaserve/urlhandlers/RootHandler.cpp",
2078 ]
2079 deps = [
2080 ":flags",
2081 ":gpu_tool_utils",
2082 ":skia",
2083 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04002084 "//third_party/libmicrohttpd",
Mike Klein7d302882016-11-03 14:06:31 -04002085 ]
Mike Klein7d302882016-11-03 14:06:31 -04002086 }
mtkleinecbc5262016-09-22 11:51:24 -07002087 }
kjlubick14f984b2016-10-03 11:49:45 -07002088
Mike Kleine6682eb2017-01-05 10:54:57 -05002089 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07002090 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002091 "fuzz/Fuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05002092 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002093 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05002094 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04002095 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002096 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04002097 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002098 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05002099 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002100 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04002101 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04002102 "fuzz/FuzzRegionOp.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002103 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05002104 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
2105 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002106 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04002107 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04002108 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002109 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05002110 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
2111 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002112 "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp",
2113 "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
Kevin Lubick0f0a7102019-03-18 16:20:55 -04002114 "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp",
Kevin Lubicke9c1ce82019-03-11 11:09:40 -04002115 "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05002116 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002117 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002118 "tools/debugger/DebugCanvas.cpp",
2119 "tools/debugger/DrawCommand.cpp",
2120 "tools/debugger/JsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07002121 ]
2122 deps = [
2123 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04002124 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07002125 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04002126 "modules/skottie:fuzz",
kjlubick14f984b2016-10-03 11:49:45 -07002127 ]
kjlubick14f984b2016-10-03 11:49:45 -07002128 }
Mike Klein38312422016-10-05 15:41:01 -04002129
Mike Kleine6682eb2017-01-05 10:54:57 -05002130 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04002131 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04002132 rebase_path("tests/skia_test.cpp"),
2133 rebase_path("tests/Test.cpp"),
2134 ]
caryclark9feb6322016-10-25 08:58:26 -07002135 deps = [
2136 ":flags",
2137 ":gpu_tool_utils",
2138 ":skia",
2139 ":tool_utils",
2140 ]
caryclark9feb6322016-10-25 08:58:26 -07002141 }
2142
Mike Kleine6682eb2017-01-05 10:54:57 -05002143 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04002144 sources = [
2145 "tools/DumpRecord.cpp",
2146 "tools/dump_record.cpp",
2147 ]
2148 deps = [
2149 ":flags",
2150 ":skia",
2151 ]
Mike Klein38312422016-10-05 15:41:01 -04002152 }
bungemanfe917272016-10-13 17:36:40 -04002153
Mike Kleine6682eb2017-01-05 10:54:57 -05002154 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04002155 sources = [
2156 "tools/skdiff/skdiff.cpp",
2157 "tools/skdiff/skdiff_html.cpp",
2158 "tools/skdiff/skdiff_main.cpp",
2159 "tools/skdiff/skdiff_utils.cpp",
2160 ]
2161 deps = [
2162 ":skia",
2163 ":tool_utils",
2164 ]
bungemanfe917272016-10-13 17:36:40 -04002165 }
halcanarya73d76a2016-10-17 13:19:02 -07002166
Mike Kleine6682eb2017-01-05 10:54:57 -05002167 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07002168 sources = [
2169 "tools/skp_parser.cpp",
2170 ]
2171 deps = [
2172 ":skia",
2173 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002174 ]
halcanarya73d76a2016-10-17 13:19:02 -07002175 }
Brian Osman16adfa32016-10-18 14:42:44 -04002176
Brian Osmanc9a42472018-05-31 13:17:12 -04002177 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05002178 test_lib("skqp_lib") {
Hal Canary0e07ad72018-02-08 13:06:56 -05002179 defines =
2180 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002181 sources = [
2182 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002183 "tools/skqp/src/skqp.cpp",
2184 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002185 ]
2186 deps = [
2187 ":gm",
2188 ":gpu_tool_utils",
2189 ":skia",
2190 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002191 ":tool_utils",
2192 ]
2193 }
2194 test_app("skqp") {
2195 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002196 "tools/skqp/src/skqp_main.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05002197 ]
2198 deps = [
2199 ":skia",
2200 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05002201 ":tool_utils",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002202 ]
2203 }
2204 test_app("jitter_gms") {
2205 sources = [
2206 "tools/skqp/jitter_gms.cpp",
2207 ]
2208 deps = [
2209 ":gm",
2210 ":skia",
2211 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002212 ]
2213 }
2214 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002215 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05002216 test_app("skqp_app") {
2217 is_shared_library = true
2218 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002219 "tools/skqp/src/jni_skqp.cpp",
Hal Canary28f89382017-12-12 09:42:14 -05002220 ]
2221 deps = [
2222 ":skia",
2223 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002224 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002225 ]
2226 libs = [ "android" ]
2227 }
2228 }
Stan Iliev93151722018-08-02 11:10:52 -04002229 if (is_android && skia_enable_gpu) {
2230 test_app("skottie_android") {
2231 is_shared_library = true
2232
2233 sources = [
2234 "platform_tools/android/apps/skottie/src/main/cpp/JavaInputStreamAdaptor.cpp",
2235 "platform_tools/android/apps/skottie/src/main/cpp/native-lib.cpp",
2236 ]
2237 libs = []
2238
Stan Iliev93151722018-08-02 11:10:52 -04002239 deps = [
2240 ":skia",
2241 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002242 "modules/sksg:samples",
Stan Iliev93151722018-08-02 11:10:52 -04002243 ]
2244 }
2245 }
Hal Canary75427132017-10-11 16:00:31 -04002246
Hal Canarya9de7602018-01-19 13:08:23 -05002247 test_app("list_gms") {
2248 sources = [
2249 "tools/list_gms.cpp",
2250 ]
2251 deps = [
2252 ":gm",
2253 ":skia",
2254 ]
2255 }
2256 test_app("list_gpu_unit_tests") {
2257 sources = [
2258 "dm/DMGpuTestProcs.cpp",
2259 "tools/list_gpu_unit_tests.cpp",
2260 ]
2261 deps = [
2262 ":skia",
2263 ":tests",
2264 ]
2265 }
2266
Brian Osmanc9a42472018-05-31 13:17:12 -04002267 test_lib("sk_app") {
Hal Canary378be8d2019-04-26 08:20:14 -04002268 public_deps = [
Hal Canary378be8d2019-04-26 08:20:14 -04002269 ":gpu_tool_utils",
Hal Canary05694472019-05-03 17:14:21 -04002270 ":skia",
Hal Canary378be8d2019-04-26 08:20:14 -04002271 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002272 sources = [
2273 "tools/sk_app/CommandSet.cpp",
2274 "tools/sk_app/GLWindowContext.cpp",
2275 "tools/sk_app/Window.cpp",
2276 ]
2277 libs = []
2278
2279 if (is_android) {
2280 sources += [
2281 "tools/sk_app/android/GLWindowContext_android.cpp",
2282 "tools/sk_app/android/RasterWindowContext_android.cpp",
2283 "tools/sk_app/android/Window_android.cpp",
2284 "tools/sk_app/android/main_android.cpp",
2285 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002286 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002287 libs += [ "android" ]
2288 } else if (is_linux) {
2289 sources += [
2290 "tools/sk_app/unix/GLWindowContext_unix.cpp",
2291 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
2292 "tools/sk_app/unix/Window_unix.cpp",
2293 "tools/sk_app/unix/keysym2ucs.c",
2294 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002295 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002296 libs += [
2297 "GL",
2298 "X11",
2299 ]
2300 } else if (is_win) {
2301 sources += [
2302 "tools/sk_app/win/GLWindowContext_win.cpp",
2303 "tools/sk_app/win/RasterWindowContext_win.cpp",
2304 "tools/sk_app/win/Window_win.cpp",
2305 "tools/sk_app/win/main_win.cpp",
2306 ]
Brian Salomon194db172017-08-17 14:37:06 -04002307 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002308 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04002309 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002310 } else if (is_mac) {
2311 sources += [
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002312 "tools/sk_app/mac/GLWindowContext_mac.mm",
2313 "tools/sk_app/mac/RasterWindowContext_mac.mm",
2314 "tools/sk_app/mac/Window_mac.mm",
2315 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002316 ]
2317 libs += [
2318 "QuartzCore.framework",
2319 "Cocoa.framework",
2320 "Foundation.framework",
2321 ]
2322 } else if (is_ios) {
2323 sources += [
2324 "tools/sk_app/ios/GLWindowContext_ios.cpp",
2325 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
2326 "tools/sk_app/ios/Window_ios.cpp",
2327 "tools/sk_app/ios/main_ios.cpp",
2328 ]
2329 }
2330
2331 if (skia_use_vulkan) {
2332 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
2333 if (is_android) {
2334 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2335 } else if (is_linux) {
2336 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2337 libs += [ "X11-xcb" ]
2338 } else if (is_win) {
2339 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Jim Van Verthce51c142019-02-14 14:07:46 -05002340 } else if (is_mac) {
2341 sources += [ "tools/sk_app/mac/VulkanWindowContext_mac.mm" ]
2342 libs += [ "MetalKit.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002343 }
2344 }
2345
Jim Van Verthbe39f712019-02-08 15:36:14 -05002346 if (skia_use_metal) {
2347 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
2348 if (is_mac) {
2349 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
2350 }
2351 libs += [ "MetalKit.framework" ]
2352 }
2353
Brian Osmanc9a42472018-05-31 13:17:12 -04002354 deps = [
Brian Osmanc9a42472018-05-31 13:17:12 -04002355 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002356 ]
2357 if (is_android) {
2358 deps += [ "//third_party/native_app_glue" ]
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002359 } else if (is_ios) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002360 deps += [ "//third_party/libsdl" ]
2361 }
2362 if (skia_use_angle) {
2363 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002364 }
Brian Osman16adfa32016-10-18 14:42:44 -04002365 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002366
Hal Canary87515122019-03-15 14:22:51 -04002367 if (!skia_use_vulkan && (is_mac || is_linux || is_win)) {
2368 test_app("fiddle_examples") {
2369 sources = [
Brian Osmanc725e8f2019-04-10 14:08:44 -04002370 "tools/fiddle/all_examples.cpp",
Hal Canary87515122019-03-15 14:22:51 -04002371 "tools/fiddle/examples.cpp",
Brian Osman72ef2d52019-03-17 11:09:17 -04002372 "tools/fiddle/examples.h",
Hal Canary87515122019-03-15 14:22:51 -04002373 ]
Brian Osman72ef2d52019-03-17 11:09:17 -04002374 if (is_win) {
2375 cflags = [ "/wd4756" ] # Overflow in constant arithmetic
2376 }
Hal Canary87515122019-03-15 14:22:51 -04002377 deps = [
2378 ":skia",
2379 ":skia.h",
2380 "modules/skottie",
Florin Malitaa1dcaae2019-03-25 17:38:43 -04002381 "modules/skshaper",
Hal Canary87515122019-03-15 14:22:51 -04002382 ]
2383 }
2384 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002385 test_app("viewer") {
2386 is_shared_library = is_android
Brian Osmanc9a42472018-05-31 13:17:12 -04002387 sources = [
2388 "tools/viewer/BisectSlide.cpp",
2389 "tools/viewer/GMSlide.cpp",
2390 "tools/viewer/ImGuiLayer.cpp",
2391 "tools/viewer/ImageSlide.cpp",
Brian Osman7c979f52019-02-12 13:27:51 -05002392 "tools/viewer/ParticlesSlide.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04002393 "tools/viewer/SKPSlide.cpp",
2394 "tools/viewer/SampleSlide.cpp",
2395 "tools/viewer/SkottieSlide.cpp",
2396 "tools/viewer/SlideDir.cpp",
2397 "tools/viewer/StatsLayer.cpp",
2398 "tools/viewer/SvgSlide.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002399 "tools/viewer/TouchGesture.cpp",
Leon Scroggins III81886e82018-08-22 11:18:08 -04002400 "tools/viewer/TouchGesture.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002401 "tools/viewer/Viewer.cpp",
2402 ]
2403 libs = []
2404
Brian Osmanc9a42472018-05-31 13:17:12 -04002405 deps = [
Mike Kleinc6142d82019-03-25 10:54:59 -05002406 ":common_flags_gpu",
Brian Osmanc9a42472018-05-31 13:17:12 -04002407 ":experimental_svg_model",
2408 ":flags",
2409 ":gm",
2410 ":gpu_tool_utils",
2411 ":samples",
2412 ":sk_app",
2413 ":skia",
2414 ":tool_utils",
Mike Klein499f0ac2019-03-25 13:00:12 -05002415 ":trace",
Brian Osman7c979f52019-02-12 13:27:51 -05002416 "modules/particles",
Brian Osmanc9a42472018-05-31 13:17:12 -04002417 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002418 "modules/skottie:utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002419 "modules/sksg",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002420 "modules/sksg:samples",
Brian Osmanc9a42472018-05-31 13:17:12 -04002421 "//third_party/imgui",
Brian Osmanc9a42472018-05-31 13:17:12 -04002422 ]
Mike Reedd62d4062019-06-12 10:20:44 -04002423 if (skia_use_experimental_xform) {
2424 deps += [ ":experimental_xform" ]
2425 sources += [ "gm/xform.cpp" ]
2426 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002427 }
2428
Brian Osmanc9a42472018-05-31 13:17:12 -04002429 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002430 test_app("HelloWorld") {
2431 sources = [
2432 "example/HelloWorld.cpp",
2433 ]
2434 libs = []
2435
Brian Osmaneff04b52017-11-21 13:18:02 -05002436 deps = [
2437 ":flags",
2438 ":gpu_tool_utils",
2439 ":sk_app",
2440 ":skia",
2441 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002442 ]
2443 }
2444 }
2445
Brian Osmanc9a42472018-05-31 13:17:12 -04002446 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002447 test_app("SkiaSDLExample") {
2448 sources = [
2449 "example/SkiaSDLExample.cpp",
2450 ]
2451 libs = []
Jim Van Verth4c70c752017-07-11 12:03:01 -04002452 deps = [
2453 ":gpu_tool_utils",
2454 ":skia",
2455 "//third_party/libsdl",
2456 ]
2457 }
2458 }
2459
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002460 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2461 action_foreach("generate_mocs") {
2462 script = "gn/call.py"
2463 sources = [
2464 "tools/mdbviz/MainWindow.h",
2465 ]
2466 outputs = [
2467 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2468 ]
2469 args = [
2470 "$skia_qt_path" + "/bin/moc",
2471 "{{source}}",
2472 "-o",
2473 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2474 ]
2475 }
2476 action_foreach("generate_resources") {
2477 script = "gn/call.py"
2478 sources = [
2479 "tools/mdbviz/resources.qrc",
2480 ]
2481 outputs = [
2482 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2483 ]
2484 args = [
2485 "$skia_qt_path" + "/bin/rcc",
2486 "{{source}}",
2487 "-o",
2488 "gen/mdbviz/{{source_name_part}}_res.cpp",
2489 ]
2490 }
2491 test_app("mdbviz") {
2492 if (is_win) {
2493 # on Windows we need to disable some exception handling warnings due to the Qt headers
2494 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2495 }
2496 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002497 "tools/UrlDataManager.cpp",
Mike Klein8f4e2242019-03-20 11:59:00 -05002498 "tools/debugger/DebugCanvas.cpp",
2499 "tools/debugger/DrawCommand.cpp",
2500 "tools/debugger/JsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002501 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002502 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002503 "tools/mdbviz/main.cpp",
2504
2505 # generated files
2506 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2507 "$target_gen_dir/mdbviz/resources_res.cpp",
2508 ]
2509 lib_dirs = [ "$skia_qt_path/lib" ]
2510 libs = [
2511 "Qt5Core.lib",
2512 "Qt5Gui.lib",
2513 "Qt5Widgets.lib",
2514 ]
2515 include_dirs = [
2516 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002517 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002518 "$skia_qt_path/include/QtWidgets",
2519 ]
2520 deps = [
2521 ":generate_mocs",
2522 ":generate_resources",
2523 ":skia",
2524 ]
2525 }
2526 }
2527
Mike Kleine459afd2017-03-03 09:21:30 -05002528 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002529 copy("gdbserver") {
2530 sources = [
2531 "$ndk/$ndk_gdbserver",
2532 ]
2533 outputs = [
2534 "$root_out_dir/gdbserver",
2535 ]
2536 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002537 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002538
2539 if (skia_use_opencl) {
2540 test_app("hello-opencl") {
2541 sources = [
Mike Kleinf9ae6702018-06-20 14:05:05 -04002542 "tools/hello-opencl.cpp",
2543 ]
Mike Klein8a1f15d2019-02-11 11:59:41 -05002544 deps = [
2545 "//third_party/opencl",
2546 ]
Mike Kleinf9ae6702018-06-20 14:05:05 -04002547 }
2548 }
Hal Canaryb8f81af2019-04-24 13:56:16 -04002549
2550 test_app("editor") {
2551 is_shared_library = is_android
2552 sources = [
Hal Canary50d650d2019-04-28 14:40:45 -04002553 "experimental/editor/editor.cpp",
2554 "experimental/editor/editor.h",
Hal Canary05694472019-05-03 17:14:21 -04002555 "experimental/editor/editor_application.cpp",
Hal Canary7b300a42019-04-30 12:38:28 -04002556 "experimental/editor/run_handler.cpp",
2557 "experimental/editor/run_handler.h",
Hal Canary05694472019-05-03 17:14:21 -04002558 "experimental/editor/stringslice.cpp",
2559 "experimental/editor/stringslice.h",
Hal Canaryb8f81af2019-04-24 13:56:16 -04002560 ]
2561 deps = [
2562 ":sk_app",
2563 ":skia",
2564 "modules/skshaper",
2565 ]
2566 }
mtklein25c81d42016-07-27 13:55:26 -07002567}