blob: 349231195ff77b9705846db4a8b479c9aa7ceffb [file] [log] [blame]
mtkleinc04ff472016-06-23 10:29:30 -07001# Copyright 2016 Google Inc.
2#
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
Brian Osmanf2c90142017-07-13 15:50:03 -04006import("gn/flutter_defines.gni")
Mike Reed025f7832018-11-12 09:27:05 -05007import("gn/fuchsia_defines.gni")
mikejurka8c24f4f2016-09-12 16:51:58 -07008import("gn/shared_sources.gni")
Hal Canary32498f02019-02-04 15:36:31 -05009import("gn/skia.gni")
brettwb9447282016-09-01 14:24:39 -070010
Forrest Reiling30229ac2017-04-17 13:36:39 -070011if (is_fuchsia) {
12 import("//build/vulkan/config.gni")
13}
14
mtkleinc04ff472016-06-23 10:29:30 -070015declare_args() {
Mike Klein26a60492018-10-15 10:38:25 -040016 skia_enable_flutter_defines = false
17}
18
19declare_args() {
Mike Kleinc168a3a2016-11-14 14:53:13 +000020 skia_use_angle = false
Kevin Lubick4a24e102017-03-29 11:19:01 -040021 skia_use_egl = false
mtklein63213812016-08-24 09:55:56 -070022 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070023 skia_use_fontconfig = is_linux
Leon Scroggins III85e22fc2018-11-28 08:58:47 -050024 skia_use_fonthost_mac = is_mac
mtkleincdedd0e2016-09-12 15:15:44 -070025 skia_use_freetype = is_android || is_fuchsia || is_linux
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -050026 skia_use_fixed_gamma_text = is_android
mtklein63213812016-08-24 09:55:56 -070027 skia_use_libjpeg_turbo = true
28 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070029 skia_use_libwebp = !is_fuchsia
Mike Kleinfae86b72018-01-08 15:49:09 -050030 skia_use_lua = is_skia_dev_build && !is_ios
Mike Kleinf9ae6702018-06-20 14:05:05 -040031 skia_use_opencl = false
Mike Klein10d665d2016-11-01 11:46:10 -040032 skia_use_piex = !is_win
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -040033 skia_use_wuffs = false
mtklein63213812016-08-24 09:55:56 -070034 skia_use_zlib = true
Greg Daniele5ddff52017-07-05 16:49:36 -040035 skia_use_metal = false
Mike Klein36f182f2017-10-20 12:33:53 -040036 skia_use_libheif = is_skia_dev_build
Chinmay Garded92d0352018-09-17 10:23:28 -070037 skia_use_x11 = is_linux
Leon Scroggins IIIee0e5d02019-02-27 10:59:11 -050038 skia_use_xps = true
mtklein1bd72ba2016-09-16 07:45:52 -070039
Mike Klein7d921032017-01-05 12:20:41 -050040 skia_android_serial = ""
Kevin Lubick93faa672018-10-10 15:54:53 -040041 skia_enable_ccpr = true
Kevin Lubickca7c2972018-10-17 13:52:24 +000042 skia_enable_nvpr = !skia_enable_flutter_defines
Brian Osman3f375d02016-12-28 11:19:22 -050043 skia_enable_discrete_gpu = true
Kevin Lubick134be1d2018-10-30 15:05:04 -040044 skia_enable_nima = false
Hal Canary43fb7a02016-12-30 13:09:03 -050045 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040046 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Kevin Lubick32dfdbe2018-10-18 09:47:01 -040047 skia_enable_skpicture = true
Mike Klein3669a822017-03-03 10:55:02 -050048 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Robert Phillipsa6d2d702017-09-01 12:17:03 -040049 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040050 skia_compile_processors = false
Adrienne Walker1df7cd82018-04-18 13:46:25 -070051 skia_generate_workarounds = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070052 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040053
Hal Canary2331c822018-02-01 14:06:13 -050054 skia_skqp_global_error_tolerance = 0
Ethan Nicholas26a9aad2018-03-27 14:10:52 -040055
56 skia_llvm_path = ""
57 skia_llvm_lib = "LLVM"
Hal Canaryfd9bcab2018-04-24 11:47:23 -040058
59 skia_tools_require_resources = false
mtkleinc04ff472016-06-23 10:29:30 -070060}
Brian Salomon23d73ea2016-10-27 13:31:37 -040061declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040062 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040063 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050064 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -050065 skia_enable_fontmgr_empty = false
Kevin Lubickddd0a332018-12-12 10:35:13 -050066 skia_enable_fontmgr_custom =
67 is_linux && skia_use_freetype && !skia_use_fontconfig
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -050068 skia_enable_fontmgr_custom_empty = is_fuchsia && skia_use_freetype
69 skia_enable_fontmgr_android = skia_use_expat && skia_use_freetype
Sergey Ulanovf3babcd2018-11-30 17:42:00 -080070 skia_enable_fontmgr_fuchsia = is_fuchsia
Leon Scroggins III631dbc82019-03-04 13:54:02 -050071 skia_enable_fontmgr_win = is_win
72 skia_enable_fontmgr_win_gdi = is_win
Mike Klein10d665d2016-11-01 11:46:10 -040073
Mike Klein4d598a32016-10-31 13:44:49 -040074 if (is_android) {
75 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070076 } else if (is_fuchsia) {
77 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040078 } else {
Mike Klein98dea7b2019-01-15 11:26:43 -050079 skia_use_vulkan = defined(skia_moltenvk_path) && skia_moltenvk_path != ""
Mike Klein4d598a32016-10-31 13:44:49 -040080 }
Jim Van Verth4e502972017-12-07 15:16:10 -050081
82 if (is_ios) {
83 skia_ios_identity = ".*Google.*"
84 skia_ios_profile = "Google Development"
85 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040086}
Brian Salomon789e25e2016-09-30 13:41:03 -040087
Adam Barth54ef74a2017-10-13 10:59:38 -070088if (defined(skia_settings)) {
89 import(skia_settings)
90}
91
mtklein1211e0c2016-07-26 13:55:45 -070092skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070093 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070094 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070095 "include/codec",
96 "include/config",
97 "include/core",
Hal Canary23564b92018-09-07 14:33:14 -040098 "include/docs",
mtklein1211e0c2016-07-26 13:55:45 -070099 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -0400100 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -0700101 "include/gpu",
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500102 "include/atlastext",
mtklein1211e0c2016-07-26 13:55:45 -0700103 "include/pathops",
104 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -0700105 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -0700106 "include/utils",
107 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -0700108]
109
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500110if (skia_enable_atlas_text) {
111 skia_public_includes += [ "include/atlastext" ]
112}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000113
mtkleinc04ff472016-06-23 10:29:30 -0700114# Skia public API, generally provided by :skia.
115config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700116 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -0400117 defines = []
118 if (is_component_build) {
119 defines += [ "SKIA_DLL" ]
120 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400121 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700122 defines += [ "SK_SAMPLES_FOR_X" ]
123 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400124 if (skia_enable_flutter_defines) {
125 defines += flutter_defines
126 }
mtklein06c35c02016-09-20 12:28:12 -0700127 if (!skia_enable_gpu) {
128 defines += [ "SK_SUPPORT_GPU=0" ]
129 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500130 if (skia_enable_atlas_text) {
131 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
132 }
Mike Reed025f7832018-11-12 09:27:05 -0500133 if (is_fuchsia) {
134 defines += fuchsia_defines
135 }
mtkleinc04ff472016-06-23 10:29:30 -0700136}
137
138# Skia internal APIs, used by Skia itself and a few test tools.
139config("skia_private") {
140 visibility = [ ":*" ]
141
142 include_dirs = [
143 "include/private",
144 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700145 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700146 "src/core",
147 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700148 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700149 "src/image",
150 "src/images",
151 "src/lazy",
152 "src/opts",
153 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700154 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700155 "src/ports",
156 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400157 "src/shaders",
158 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700159 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700160 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700161 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500162 "src/xml",
Jim Van Verth1676cb92019-01-15 13:24:45 -0500163 "third_party/etc1",
scroggo19b91532016-10-24 09:03:26 -0700164 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700165 ]
mtklein150d1132016-08-01 06:56:40 -0700166
Mike Reeda9e241d2017-05-03 10:52:00 -0400167 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
Leon Scroggins IIIc41a5f52018-11-15 15:54:59 -0500168 if (skia_use_fixed_gamma_text) {
mtkleinb37c0342016-09-09 11:07:45 -0700169 defines += [
170 "SK_GAMMA_EXPONENT=1.4",
171 "SK_GAMMA_CONTRAST=0.0",
172 ]
173 }
mtklein88a7ac02016-09-14 11:16:49 -0700174 if (is_official_build || is_android) {
175 # TODO(bsalomon): it'd be nice to make Android normal.
176 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
177 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400178 libs = []
179 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500180 if (skia_enable_gpu) {
181 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500182 if (is_skia_dev_build && skia_use_vulkan) {
183 include_dirs += [ "tools/gpu/vk" ]
184 }
Brian Salomon03e05842017-02-23 12:23:47 -0500185 }
Brian Osman34755e22016-12-05 09:46:02 -0500186 if (skia_use_angle) {
187 defines += [ "SK_ANGLE" ]
188 }
Brian Osman3f375d02016-12-28 11:19:22 -0500189 if (skia_enable_discrete_gpu) {
190 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
191 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400192 if (!is_official_build) {
193 defines += [ "GR_TEST_UTILS=1" ]
194 }
Ethan Nicholas26a9aad2018-03-27 14:10:52 -0400195 if (skia_llvm_path != "") {
196 defines += [ "SK_LLVM_AVAILABLE" ]
197 include_dirs += [ "$skia_llvm_path/include" ]
198 libs += [ skia_llvm_lib ]
199 lib_dirs += [ "$skia_llvm_path/lib/" ]
200 }
mtkleinc04ff472016-06-23 10:29:30 -0700201}
202
203# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
204config("skia_library") {
205 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700206 defines = [ "SKIA_IMPLEMENTATION=1" ]
207}
208
209skia_library_configs = [
210 ":skia_public",
211 ":skia_private",
212 ":skia_library",
213]
214
mtklein9b8583d2016-08-24 17:32:30 -0700215# Use for CPU-specific Skia code that needs particular compiler flags.
216template("opts") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500217 visibility = [ ":*" ]
mtklein9b8583d2016-08-24 17:32:30 -0700218 if (invoker.enabled) {
219 source_set(target_name) {
220 forward_variables_from(invoker, "*")
221 configs += skia_library_configs
222 }
223 } else {
224 # If not enabled, a phony empty target that swallows all otherwise unused variables.
225 source_set(target_name) {
226 forward_variables_from(invoker,
227 "*",
228 [
229 "sources",
230 "cflags",
231 ])
232 }
233 }
anmittala7eaf2e2016-08-17 13:57:26 -0700234}
235
mtklein422310d2016-08-16 18:28:43 -0700236is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700237
mtklein7d6fb2c2016-08-25 14:50:44 -0700238opts("none") {
239 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700240 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700241 cflags = []
242}
243
mtklein7d6fb2c2016-08-25 14:50:44 -0700244opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700245 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700246 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700247 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700248}
249
250opts("arm64") {
251 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700252 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700253 cflags = []
254}
255
256opts("crc32") {
257 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700258 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700259 cflags = [ "-march=armv8-a+crc" ]
260}
261
mtklein9b8583d2016-08-24 17:32:30 -0700262opts("sse2") {
263 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700264 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400265 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400266 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
267 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400268 cflags = [ "-msse2" ]
269 }
mtklein9b8583d2016-08-24 17:32:30 -0700270}
mtkleinc04ff472016-06-23 10:29:30 -0700271
mtklein9b8583d2016-08-24 17:32:30 -0700272opts("ssse3") {
273 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700274 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400275 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400276 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
277 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400278 cflags = [ "-mssse3" ]
279 }
mtklein9b8583d2016-08-24 17:32:30 -0700280}
mtkleinc04ff472016-06-23 10:29:30 -0700281
mtklein9b8583d2016-08-24 17:32:30 -0700282opts("sse41") {
283 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700284 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400285 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400286 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
287 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400288 cflags = [ "-msse4.1" ]
289 }
mtklein9b8583d2016-08-24 17:32:30 -0700290}
mtklein4e976072016-08-08 09:06:27 -0700291
mtklein9b8583d2016-08-24 17:32:30 -0700292opts("sse42") {
293 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700294 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400295 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400296 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
297 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400298 cflags = [ "-msse4.2" ]
299 }
mtklein9b8583d2016-08-24 17:32:30 -0700300}
301
302opts("avx") {
303 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700304 sources = skia_opts.avx_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400305 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000306 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400307 } else {
308 cflags = [ "-mavx" ]
309 }
mtkleinc04ff472016-06-23 10:29:30 -0700310}
311
Mike Klein1b9b7d52018-02-27 10:37:40 -0500312opts("hsw") {
313 enabled = is_x86
314 sources = skia_opts.hsw_sources
Mike Klein4d4b3aa2018-03-21 13:07:35 -0400315 if (is_win) {
Mike Klein1b9b7d52018-02-27 10:37:40 -0500316 cflags = [ "/arch:AVX2" ]
317 } else {
Mike Kleine87c4862018-03-23 00:13:58 +0000318 cflags = [ "-march=haswell" ]
Mike Klein1b9b7d52018-02-27 10:37:40 -0500319 }
320
321 # Oddly, clang-cl doesn't recognize this as a valid flag.
322 # If it ever does, it'd nice to move this up with -mavx2 and co.
323 if (is_clang && !is_win) {
324 # This flag lets Clang generate FMAs when it sees a mul-then-add. It's optional,
325 # but nice to have, generating slightly better code for paths without explicit FMAs.
326 cflags += [ "-ffp-contract=fast" ]
327 }
328}
329
mtkleinc095df52016-08-24 12:23:52 -0700330# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700331template("optional") {
Mike Klein6d1df6d2018-11-07 15:03:58 -0500332 visibility = [ ":*" ]
mtklein457b42a2016-08-23 13:56:37 -0700333 if (invoker.enabled) {
334 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700335 if (defined(invoker.public_defines)) {
336 defines = invoker.public_defines
337 }
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600338 if (defined(invoker.public_configs)) {
339 configs = invoker.public_configs
340 }
mtklein457b42a2016-08-23 13:56:37 -0700341 }
342 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700343 forward_variables_from(invoker,
344 "*",
345 [
346 "public_defines",
347 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700348 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700349 ])
mtklein457b42a2016-08-23 13:56:37 -0700350 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700351 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700352 if (defined(invoker.configs_to_remove)) {
353 configs -= invoker.configs_to_remove
354 }
mtklein457b42a2016-08-23 13:56:37 -0700355 }
356 } else {
mtklein457b42a2016-08-23 13:56:37 -0700357 source_set(target_name) {
358 forward_variables_from(invoker,
359 "*",
360 [
361 "public_defines",
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400362 "public_deps",
mtklein457b42a2016-08-23 13:56:37 -0700363 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700364 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700365 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700366 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700367 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700368 ])
mtkleincd01b032016-08-31 04:58:19 -0700369 if (defined(invoker.sources_when_disabled)) {
370 sources = invoker.sources_when_disabled
371 }
372 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700373 }
mtkleineb3c4252016-08-23 07:38:09 -0700374 }
mtklein457b42a2016-08-23 13:56:37 -0700375}
mtklein457b42a2016-08-23 13:56:37 -0700376
mtkleina45be612016-08-29 15:22:10 -0700377optional("fontmgr_android") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500378 enabled = skia_enable_fontmgr_android
mtkleina45be612016-08-29 15:22:10 -0700379
380 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500381 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700382 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700383 ]
384 sources = [
385 "src/ports/SkFontMgr_android.cpp",
386 "src/ports/SkFontMgr_android_factory.cpp",
387 "src/ports/SkFontMgr_android_parser.cpp",
388 ]
389}
390
mtkleind2e39db2016-09-07 07:52:55 -0700391optional("fontmgr_custom") {
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500392 enabled = skia_enable_fontmgr_custom
mtkleind2e39db2016-09-07 07:52:55 -0700393
394 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500395 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700396 ]
397 sources = [
398 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500399 "src/ports/SkFontMgr_custom.h",
400 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700401 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500402 "src/ports/SkFontMgr_custom_embedded.cpp",
403 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700404 ]
405}
406
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500407optional("fontmgr_custom_empty") {
408 enabled = skia_enable_fontmgr_custom_empty
Kevin Lubickddd0a332018-12-12 10:35:13 -0500409
410 deps = [
411 ":typeface_freetype",
412 ]
413 sources = [
414 "src/ports/SkFontMgr_custom.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500415 "src/ports/SkFontMgr_custom_empty.cpp",
416 "src/ports/SkFontMgr_custom_empty_factory.cpp",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800417 ]
418}
419
Hal Canaryff2742e2018-01-30 11:35:47 -0500420optional("fontmgr_empty") {
421 enabled = skia_enable_fontmgr_empty
422 sources = [
423 "src/ports/SkFontMgr_empty_factory.cpp",
424 ]
425}
426
mtklein3cc22182016-08-29 13:26:14 -0700427optional("fontmgr_fontconfig") {
428 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700429
430 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500431 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700432 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700433 ]
434 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700435 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700436 "src/ports/SkFontConfigInterface_direct.cpp",
437 "src/ports/SkFontConfigInterface_direct_factory.cpp",
438 "src/ports/SkFontMgr_FontConfigInterface.cpp",
439 "src/ports/SkFontMgr_fontconfig.cpp",
440 "src/ports/SkFontMgr_fontconfig_factory.cpp",
441 ]
442}
443
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500444optional("fontmgr_fuchsia") {
445 enabled = skia_enable_fontmgr_fuchsia
446
447 deps = [
448 "//sdk/fidl/fuchsia.fonts",
449 ]
450 sources = [
451 "src/ports/SkFontMgr_fuchsia.cpp",
452 "src/ports/SkFontMgr_fuchsia.h",
453 ]
454}
455
456optional("fontmgr_wasm") {
457 enabled = target_cpu == "wasm"
mtkleincdedd0e2016-09-12 15:15:44 -0700458
459 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500460 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700461 ]
462 sources = [
463 "src/ports/SkFontMgr_custom.cpp",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500464 "src/ports/SkFontMgr_custom.h",
465 "src/ports/SkFontMgr_custom_embedded.cpp",
466 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700467 ]
468}
469
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500470optional("fontmgr_win") {
471 enabled = skia_enable_fontmgr_win
472
473 sources = [
474 "src/fonts/SkFontMgr_indirect.cpp",
475 "src/ports/SkFontMgr_win_dw.cpp",
476 "src/ports/SkFontMgr_win_dw_factory.cpp",
477 "src/ports/SkScalerContext_win_dw.cpp",
478 "src/ports/SkTypeface_win_dw.cpp",
479 ]
480}
481
482optional("fontmgr_win_gdi") {
483 enabled = skia_enable_fontmgr_win_gdi
484
485 sources = [
486 "src/ports/SkFontHost_win.cpp",
487 ]
488 libs = [ "Gdi32.lib" ]
489}
490
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700491if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400492 executable("sksllex") {
493 sources = [
494 "src/sksl/lex/Main.cpp",
495 "src/sksl/lex/NFA.cpp",
496 "src/sksl/lex/RegexNode.cpp",
497 "src/sksl/lex/RegexParser.cpp",
498 ]
499 include_dirs = [ "src/sksl/lex" ]
500 }
501
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700502 action("run_sksllex") {
503 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400504 deps = [
505 ":sksllex(//gn/toolchain:$host_toolchain)",
506 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700507 sources = [
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700508 "src/sksl/lex/sksl.lex",
509 ]
510
511 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
512 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
513 outputs = [
514 "$target_out_dir/" +
515 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
516 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
517 # confused due to the same file being named by two different paths
518 ]
519 sksllex_path = "$root_out_dir/"
520 sksllex_path += "sksllex"
521 if (host_os == "win") {
522 sksllex_path += ".exe"
523 }
524 args = [
525 rebase_path(sksllex_path),
526 rebase_path("bin/clang-format"),
527 rebase_path("src"),
528 ]
529 }
530} else {
531 group("run_sksllex") {
532 }
533}
534
535if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400536 executable("skslc") {
537 defines = [ "SKSL_STANDALONE" ]
538 sources = [
539 "src/sksl/SkSLMain.cpp",
540 ]
541 sources += skia_sksl_sources
542 include_dirs = [
543 "src/gpu",
544 "src/sksl",
545 ]
546 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500547 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400548 "//third_party/spirv-tools",
549 ]
550 }
551
552 skia_gpu_processor_outputs = []
553 foreach(src, skia_gpu_processor_sources) {
554 dir = get_path_info(src, "dir")
555 name = get_path_info(src, "name")
556
557 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
558 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
559 skia_gpu_processor_outputs += [
560 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
561 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
562 # confused due to the same file being named by two different paths
563 ]
564 }
565
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500566 action("create_sksl_enums") {
567 script = "gn/create_sksl_enums.py"
568 sources = [
569 "include/private/GrSharedEnums.h",
570 ]
571 outputs = [
572 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500573 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500574 ]
575 args = [
576 rebase_path(sources[0]),
577 rebase_path(outputs[0]),
578 ]
579 }
580
Ethan Nicholas762466e2017-06-29 10:03:38 -0400581 action("compile_processors") {
582 script = "gn/compile_processors.py"
583 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500584 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400585 ":skslc(//gn/toolchain:$host_toolchain)",
586 ]
587 sources = skia_gpu_processor_sources
588 outputs = skia_gpu_processor_outputs
589 skslc_path = "$root_out_dir/"
590 if (host_toolchain != default_toolchain_name) {
591 skslc_path += "$host_toolchain/"
592 }
593 skslc_path += "skslc"
594 if (host_os == "win") {
595 skslc_path += ".exe"
596 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400597 args = [
598 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400599 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400600 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400601 args += rebase_path(skia_gpu_processor_sources)
602 }
603} else {
604 skia_gpu_processor_outputs = []
605 group("compile_processors") {
606 }
607}
608
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500609optional("gpu") {
mtklein06c35c02016-09-20 12:28:12 -0700610 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400611 deps = [
612 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700613 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400614 ]
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700615 if (skia_generate_workarounds) {
616 deps += [ ":workaround_list" ]
617 }
mtkleine9fb3d52016-09-20 15:11:46 -0700618 public_defines = []
Chris Dalton3a67b8e2018-05-03 09:30:29 -0600619 public_configs = []
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400620 public_deps = []
mtkleine9fb3d52016-09-20 15:11:46 -0700621
Brian Salomon3d6801e2017-12-11 10:06:31 -0500622 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
Kevin Lubick93faa672018-10-10 15:54:53 -0400623 if (!skia_enable_ccpr) {
624 sources -= skia_ccpr_sources
625 sources += [ "src/gpu/ccpr/GrCoverageCountingPathRenderer_none.cpp" ]
626 }
Kevin Lubick4bf2c262018-10-15 09:35:54 -0400627 if (!skia_enable_nvpr) {
628 sources -= skia_nvpr_sources
629 sources += [ "src/gpu/GrPathRendering_none.cpp" ]
630 }
mtklein06c35c02016-09-20 12:28:12 -0700631
632 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500633 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700634 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400635 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700636 if (is_android) {
Hal Canary25375e82018-03-14 15:16:56 -0400637 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400638
639 # this lib is required to link against AHardwareBuffer
640 if (defined(ndk_api) && ndk_api >= 26) {
641 libs += [ "android" ]
642 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400643 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500644 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400645 libs += [ "EGL" ]
Chinmay Garded92d0352018-09-17 10:23:28 -0700646 } else if (is_linux && skia_use_x11) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500647 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -0400648 libs += [ "GL" ]
mtklein06c35c02016-09-20 12:28:12 -0700649 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500650 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800651 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500652 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400653 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500654 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -0500655 if (target_cpu != "arm64") {
656 libs += [ "OpenGL32.lib" ]
657 }
mtklein06c35c02016-09-20 12:28:12 -0700658 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500659 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700660 }
mtkleine9fb3d52016-09-20 15:11:46 -0700661
662 if (skia_use_vulkan) {
Greg Danielda16cce2018-08-01 09:23:57 -0400663 public_defines += [ "SK_VULKAN" ]
Greg Daniel18dbfd02018-05-29 10:46:51 -0400664 deps += [ "third_party/vulkanmemoryallocator" ]
mtkleine9fb3d52016-09-20 15:11:46 -0700665 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700666 if (skia_enable_vulkan_debug_layers) {
667 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
668 }
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800669 if (is_fuchsia) {
Kevin Lubickec1c6202018-12-14 11:42:53 -0500670 public_deps +=
671 [ "//third_party/vulkan_loader_and_validation_layers:vulkan" ]
Craig Stoutcb6b4bd2018-12-13 10:20:07 -0800672 }
mtkleine9fb3d52016-09-20 15:11:46 -0700673 }
Greg Daniel91dfa3b2018-05-22 13:25:15 -0400674
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400675 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400676 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400677 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
678 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400679
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400680 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400681 if (skia_use_metal) {
682 public_defines += [ "SK_METAL" ]
683 sources += skia_metal_sources
684 libs += [ "Metal.framework" ]
Greg Daniel53956d92018-08-08 14:41:19 -0400685 libs += [ "Foundation.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400686 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400687 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500688
689 if (skia_enable_atlas_text) {
690 sources += skia_atlas_text_sources
691 }
Kevin Lubickf4def342018-10-04 12:52:50 -0400692
693 if (is_debug) {
694 public_defines += [ "SK_ENABLE_DUMP_GPU" ]
695 }
mtklein06c35c02016-09-20 12:28:12 -0700696}
697
Leon Scroggins III41169202019-01-29 09:29:57 -0500698optional("gif") {
699 enabled = !skia_use_wuffs
700 sources = [
701 "src/codec/SkGifCodec.cpp",
702 "third_party/gif/SkGifImageReader.cpp",
703 ]
704}
705
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400706optional("heif") {
707 enabled = skia_use_libheif
708 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
709
710 deps = []
711
712 sources = [
713 "src/codec/SkHeifCodec.cpp",
714 ]
715}
716
mtklein63213812016-08-24 09:55:56 -0700717optional("jpeg") {
718 enabled = skia_use_libjpeg_turbo
719 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
720
mtklein63213812016-08-24 09:55:56 -0700721 deps = [
722 "//third_party/libjpeg-turbo:libjpeg",
723 ]
Mike Kleinf105dc72018-06-05 15:22:54 -0400724 public = [
725 "include/encode/SkJpegEncoder.h",
726 ]
mtklein63213812016-08-24 09:55:56 -0700727 sources = [
728 "src/codec/SkJpegCodec.cpp",
729 "src/codec/SkJpegDecoderMgr.cpp",
730 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700731 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400732 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700733 ]
734}
735
736optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500737 enabled = skia_use_zlib && skia_enable_pdf
738 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700739
mtklein63213812016-08-24 09:55:56 -0700740 deps = [
741 "//third_party/zlib",
742 ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400743 if (skia_use_libjpeg_turbo) {
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700744 deps += [ ":jpeg" ]
Hal Canary83e0f1b2018-04-05 16:58:41 -0400745 }
brettwb9447282016-09-01 14:24:39 -0700746 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700747 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700748
749 if (skia_use_sfntly) {
750 deps += [ "//third_party/sfntly" ]
Hal Canary32498f02019-02-04 15:36:31 -0500751 defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700752 }
753}
754
755optional("png") {
756 enabled = skia_use_libpng
757 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
758
mtklein63213812016-08-24 09:55:56 -0700759 deps = [
760 "//third_party/libpng",
761 ]
762 sources = [
763 "src/codec/SkIcoCodec.cpp",
764 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400765 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700766 ]
767}
768
scroggof84ad642016-10-31 09:02:57 -0700769optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400770 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700771 public_defines = [ "SK_CODEC_DECODES_RAW" ]
772
773 deps = [
774 "//third_party/dng_sdk",
775 "//third_party/libjpeg-turbo:libjpeg",
776 "//third_party/piex",
777 ]
778
779 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
780 # Skia.
781 configs_to_remove = [ "//gn:no_exceptions" ]
782
783 sources = [
scroggof84ad642016-10-31 09:02:57 -0700784 "src/codec/SkRawCodec.cpp",
785 ]
786}
787
Mike Klein852a8cb2018-05-15 10:46:58 -0400788import("third_party/skcms/skcms.gni")
Brian Osman8dc68c62018-05-30 12:57:45 -0400789source_set("skcms") {
Mike Klein852a8cb2018-05-15 10:46:58 -0400790 cflags = []
791 if (!is_win || is_clang) {
792 cflags += [
793 "-w",
794 "-std=c11",
795 ]
796 }
797
798 public = [
799 "third_party/skcms/skcms.h",
800 ]
801 sources = rebase_path(skcms_sources, ".", "third_party/skcms")
802}
803
mtklein3cc22182016-08-29 13:26:14 -0700804optional("typeface_freetype") {
805 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700806
807 deps = [
808 "//third_party/freetype2",
809 ]
810 sources = [
811 "src/ports/SkFontHost_FreeType.cpp",
812 "src/ports/SkFontHost_FreeType_common.cpp",
813 ]
814}
815
mtklein457b42a2016-08-23 13:56:37 -0700816optional("webp") {
817 enabled = skia_use_libwebp
818 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
819
mtklein457b42a2016-08-23 13:56:37 -0700820 deps = [
821 "//third_party/libwebp",
822 ]
823 sources = [
mtklein457b42a2016-08-23 13:56:37 -0700824 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400825 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700826 ]
mtkleineb3c4252016-08-23 07:38:09 -0700827}
828
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400829optional("wuffs") {
830 enabled = skia_use_wuffs
831 public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
832
833 deps = [
834 "//third_party/wuffs",
835 ]
836 sources = [
837 "src/codec/SkWuffsCodec.cpp",
838 ]
839}
840
mtklein63213812016-08-24 09:55:56 -0700841optional("xml") {
842 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000843 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700844
mtklein63213812016-08-24 09:55:56 -0700845 deps = [
846 "//third_party/expat",
847 ]
848 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500849 "src/svg/SkSVGCanvas.cpp",
850 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700851 "src/xml/SkDOM.cpp",
852 "src/xml/SkXMLParser.cpp",
853 "src/xml/SkXMLWriter.cpp",
854 ]
855}
856
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700857if (skia_enable_gpu && skia_generate_workarounds) {
858 action("workaround_list") {
859 script = "tools/build_workaround_header.py"
860
861 inputs = [
862 "src/gpu/gpu_workaround_list.txt",
863 ]
864
865 # see comments in skia_compile_processors about out dir path shenanigans.
866 output_file =
Adrienne Walkerab7181d2018-05-14 14:02:03 -0700867 rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
Adrienne Walker1df7cd82018-04-18 13:46:25 -0700868
869 outputs = [
870 "$root_out_dir/$output_file",
871 ]
872 args = [
873 "--output-file",
874 "$output_file",
875 ]
876
877 foreach(file, inputs) {
878 args += [ rebase_path(file, root_build_dir) ]
879 }
880 }
881}
882
mtkleinc04ff472016-06-23 10:29:30 -0700883component("skia") {
884 public_configs = [ ":skia_public" ]
885 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700886
Mike Klein607b0a72018-11-07 16:17:34 -0500887 public_deps = [
Ben Wagnere27ee6c2019-02-15 14:59:30 -0500888 ":gpu",
Mike Klein607b0a72018-11-07 16:17:34 -0500889 ":pdf",
890 ":skcms",
891 ]
892
mtkleinc04ff472016-06-23 10:29:30 -0700893 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700894 ":arm64",
895 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700896 ":avx",
Mike Klein54378232018-11-08 12:08:05 +0000897 ":compile_processors",
anmittalb8b3f712016-08-25 04:55:19 -0700898 ":crc32",
mtkleina45be612016-08-29 15:22:10 -0700899 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700900 ":fontmgr_custom",
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -0500901 ":fontmgr_custom_empty",
Hal Canaryff2742e2018-01-30 11:35:47 -0500902 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700903 ":fontmgr_fontconfig",
Sergey Ulanovf3babcd2018-11-30 17:42:00 -0800904 ":fontmgr_fuchsia",
Kevin Lubickddd0a332018-12-12 10:35:13 -0500905 ":fontmgr_wasm",
Leon Scroggins III631dbc82019-03-04 13:54:02 -0500906 ":fontmgr_win",
907 ":fontmgr_win_gdi",
Leon Scroggins III41169202019-01-29 09:29:57 -0500908 ":gif",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400909 ":heif",
Mike Klein1b9b7d52018-02-27 10:37:40 -0500910 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700911 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700912 ":none",
mtklein63213812016-08-24 09:55:56 -0700913 ":png",
scroggof84ad642016-10-31 09:02:57 -0700914 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700915 ":sse2",
916 ":sse41",
917 ":sse42",
918 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700919 ":webp",
Leon Scroggins IIIe93ec682018-10-26 09:25:51 -0400920 ":wuffs",
mtklein63213812016-08-24 09:55:56 -0700921 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700922 ]
923
Kevin Lubick134be1d2018-10-30 15:05:04 -0400924 if (skia_enable_nima) {
925 deps += [ "//third_party/Nima-Cpp" ]
926 }
927
Chinmay Garde43f115c2016-11-16 15:04:12 -0800928 # This file (and all GN files in Skia) are designed to work with an
929 # empty sources assignment filter; we handle all that explicitly.
930 # We clear the filter here for clients who may have set up a global filter.
931 set_sources_assignment_filter([])
932
mtkleinc04ff472016-06-23 10:29:30 -0700933 sources = []
brettwb9447282016-09-01 14:24:39 -0700934 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700935 sources += skia_utils_sources
Leon Scroggins IIIee0e5d02019-02-27 10:59:11 -0500936 if (skia_use_xps) {
937 sources += skia_xps_sources
938 }
Mike Klein54378232018-11-08 12:08:05 +0000939 sources += skia_effects_sources
940 sources += skia_effects_imagefilter_sources
mtkleinc04ff472016-06-23 10:29:30 -0700941 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400942 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500943 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700944 "src/android/SkBitmapRegionCodec.cpp",
945 "src/android/SkBitmapRegionDecoder.cpp",
946 "src/codec/SkAndroidCodec.cpp",
Nigel Tao612a65d2018-11-09 10:10:31 +1100947 "src/codec/SkAndroidCodecAdapter.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400948 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700949 "src/codec/SkBmpCodec.cpp",
950 "src/codec/SkBmpMaskCodec.cpp",
951 "src/codec/SkBmpRLECodec.cpp",
952 "src/codec/SkBmpStandardCodec.cpp",
953 "src/codec/SkCodec.cpp",
954 "src/codec/SkCodecImageGenerator.cpp",
Leon Scroggins III22f673d2018-05-30 15:33:46 -0400955 "src/codec/SkColorTable.cpp",
Leon Scroggins III36f7e322018-08-27 11:55:46 -0400956 "src/codec/SkEncodedInfo.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700957 "src/codec/SkMaskSwizzler.cpp",
958 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700959 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700960 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700961 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700962 "src/codec/SkSwizzler.cpp",
963 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700964 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700965 "src/ports/SkDiscardableMemory_none.cpp",
Mike Klein54378232018-11-08 12:08:05 +0000966 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700967 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700968 "src/ports/SkMemory_malloc.cpp",
969 "src/ports/SkOSFile_stdio.cpp",
970 "src/sfnt/SkOTTable_name.cpp",
971 "src/sfnt/SkOTUtils.cpp",
972 "src/utils/mac/SkStream_mac.cpp",
Jim Van Verth1676cb92019-01-15 13:24:45 -0500973 "third_party/etc1/etc1.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700974 ]
brettwb9447282016-09-01 14:24:39 -0700975
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400976 defines = []
977 if (!skia_enable_skpicture) {
978 defines = [ "SK_DISABLE_SKPICTURE" ]
979 sources -= skia_skpicture_sources
Mike Klein54378232018-11-08 12:08:05 +0000980 sources -= [ "//src/effects/imagefilters/SkPictureImageFilter.cpp" ]
Kevin Lubick32dfdbe2018-10-18 09:47:01 -0400981 sources += [ "src/core/SkPicture_none.cpp" ]
982 }
983
mtklein7d6fb2c2016-08-25 14:50:44 -0700984 libs = []
985
mtkleinc04ff472016-06-23 10:29:30 -0700986 if (is_win) {
987 sources += [
988 "src/ports/SkDebug_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700989 "src/ports/SkImageEncoder_WIC.cpp",
990 "src/ports/SkImageGeneratorWIC.cpp",
991 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700992 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700993 "src/ports/SkTLS_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700994 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400995 libs += [
996 "FontSub.lib",
997 "Ole32.lib",
998 "OleAut32.lib",
999 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -05001000 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -04001001 ]
mtkleinc04ff472016-06-23 10:29:30 -07001002 } else {
1003 sources += [
mtkleinc04ff472016-06-23 10:29:30 -07001004 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -07001005 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001006 "src/ports/SkTLS_pthread.cpp",
1007 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -04001008 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -07001009 }
1010
mtklein7d6fb2c2016-08-25 14:50:44 -07001011 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -05001012 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -05001013 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -05001014 deps += [ "//third_party/cpu-features" ]
1015 }
mtklein06c35c02016-09-20 12:28:12 -07001016 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -07001017 libs += [
1018 "EGL",
1019 "GLESv2",
1020 "log",
1021 ]
1022 }
1023
Kevin Lubick217056c2018-09-20 17:39:31 -04001024 if (is_linux || target_cpu == "wasm") {
mtklein06c35c02016-09-20 12:28:12 -07001025 sources += [ "src/ports/SkDebug_stdio.cpp" ]
Hal Canary25375e82018-03-14 15:16:56 -04001026 if (skia_use_egl) {
1027 libs += [ "GLESv2" ]
1028 }
mtkleinc04ff472016-06-23 10:29:30 -07001029 }
1030
Leon Scroggins III85e22fc2018-11-28 08:58:47 -05001031 if (skia_use_fonthost_mac) {
Sergey Ulanovf3babcd2018-11-30 17:42:00 -08001032 sources += [ "src/ports/SkFontHost_mac.cpp" ]
Leon Scroggins III85e22fc2018-11-28 08:58:47 -05001033 }
1034
mtkleinc04ff472016-06-23 10:29:30 -07001035 if (is_mac) {
1036 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -07001037 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -07001038 "src/ports/SkImageEncoder_CG.cpp",
1039 "src/ports/SkImageGeneratorCG.cpp",
1040 ]
mtklein09e61f72016-08-23 13:35:28 -07001041 libs += [
bungeman3e306f62017-03-29 11:32:02 -04001042 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
1043 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -07001044 "ApplicationServices.framework",
1045 "OpenGL.framework",
1046 ]
mtkleinc04ff472016-06-23 10:29:30 -07001047 }
abarth6fc8ff02016-07-15 15:15:15 -07001048
Mike Klein7d302882016-11-03 14:06:31 -04001049 if (is_ios) {
1050 sources += [
1051 "src/ports/SkDebug_stdio.cpp",
1052 "src/ports/SkFontHost_mac.cpp",
1053 "src/ports/SkImageEncoder_CG.cpp",
1054 "src/ports/SkImageGeneratorCG.cpp",
1055 ]
1056 libs += [
1057 "CoreFoundation.framework",
1058 "CoreGraphics.framework",
1059 "CoreText.framework",
1060 "ImageIO.framework",
1061 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -04001062
1063 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
1064 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -04001065 ]
1066 }
1067
abarth6fc8ff02016-07-15 15:15:15 -07001068 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -07001069 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -07001070 }
mtkleinc04ff472016-06-23 10:29:30 -07001071}
1072
Nathaniel Nifongad5f6cd2019-03-05 10:45:40 -05001073# DebugCanvas used in experimental/wasm-skp-debugger
1074if (target_cpu == "wasm") {
1075 static_library("debugcanvas") {
1076 public_configs = [ ":skia_public" ]
1077
1078 include_dirs = [
1079 "include/gpu",
1080 "include/private",
1081 "src/gpu",
1082 "src/core",
1083 "src/shaders",
1084 "src/utils",
1085 "tools",
1086 "tools/debugger",
1087 ]
1088
1089 sources = [
1090 "tools/UrlDataManager.cpp",
1091 "tools/debugger/SkDebugCanvas.cpp",
1092 "tools/debugger/SkDrawCommand.cpp",
1093 "tools/debugger/SkJsonWriteBuffer.cpp",
1094 ]
1095
1096 deps = [
1097 ":fontmgr_wasm",
1098 ]
1099 }
1100}
1101
Kevin Lubickcbcff382018-10-02 09:02:18 -04001102static_library("pathkit") {
1103 public_configs = [ ":skia_public" ]
1104 configs += skia_library_configs
1105
1106 deps = [
1107 ":arm64",
1108 ":armv7",
1109 ":avx",
1110 ":crc32",
1111 ":hsw",
1112 ":none",
1113 ":sse2",
1114 ":sse41",
1115 ":sse42",
1116 ":ssse3",
1117 ]
1118
1119 # This file (and all GN files in Skia) are designed to work with an
1120 # empty sources assignment filter; we handle all that explicitly.
1121 # We clear the filter here for clients who may have set up a global filter.
1122 set_sources_assignment_filter([])
1123
1124 sources = []
1125 sources += skia_pathops_sources
1126 sources += [
1127 "src/core/SkAnalyticEdge.cpp",
1128 "src/core/SkArenaAlloc.cpp",
Mike Reedcc88f3a2019-02-06 11:40:27 -05001129 "src/core/SkContourMeasure.cpp",
Kevin Lubickcbcff382018-10-02 09:02:18 -04001130 "src/core/SkCubicMap.cpp",
1131 "src/core/SkEdge.cpp",
1132 "src/core/SkEdgeBuilder.cpp",
1133 "src/core/SkEdgeClipper.cpp",
1134 "src/core/SkGeometry.cpp",
1135 "src/core/SkLineClipper.cpp",
1136 "src/core/SkMallocPixelRef.cpp",
1137 "src/core/SkMath.cpp",
1138 "src/core/SkMatrix.cpp",
1139 "src/core/SkOpts.cpp",
1140 "src/core/SkPaint.cpp",
1141 "src/core/SkPath.cpp",
1142 "src/core/SkPathEffect.cpp",
1143 "src/core/SkPathMeasure.cpp",
1144 "src/core/SkPathRef.cpp",
1145 "src/core/SkPoint.cpp",
1146 "src/core/SkRRect.cpp",
1147 "src/core/SkRect.cpp",
1148 "src/core/SkSemaphore.cpp",
1149 "src/core/SkStream.cpp",
1150 "src/core/SkString.cpp",
1151 "src/core/SkStringUtils.cpp",
1152 "src/core/SkStroke.cpp",
1153 "src/core/SkStrokeRec.cpp",
1154 "src/core/SkStrokerPriv.cpp",
1155 "src/core/SkThreadID.cpp",
1156 "src/core/SkUtils.cpp",
1157 "src/effects/SkDashPathEffect.cpp",
1158 "src/effects/SkTrimPathEffect.cpp",
1159 "src/ports/SkDebug_stdio.cpp",
1160 "src/ports/SkMemory_malloc.cpp",
1161 "src/utils/SkDashPath.cpp",
1162 "src/utils/SkParse.cpp",
1163 "src/utils/SkParsePath.cpp",
1164 "src/utils/SkUTF.cpp",
1165 ]
1166}
1167
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001168group("modules") {
1169 deps = [
Kevin Lubick96634842019-03-05 14:09:24 -05001170 "modules/particles",
Kevin Lubick1ba9c4d2019-02-22 10:04:06 -05001171 "modules/skottie",
1172 "modules/skshaper",
1173 ]
1174}
1175
mtkleinc095df52016-08-24 12:23:52 -07001176# Targets guarded by skia_enable_tools may use //third_party freely.
1177if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -05001178 # Used by gn_to_bp.py to list our public include dirs.
1179 source_set("public") {
1180 configs += [ ":skia_public" ]
1181 }
1182
Mike Kleinc36dedf2016-11-18 09:35:28 -05001183 config("skia.h_config") {
1184 include_dirs = [ "$target_gen_dir" ]
1185 }
1186 action("skia.h") {
1187 public_configs = [ ":skia.h_config" ]
1188 skia_h = "$target_gen_dir/skia.h"
1189 script = "gn/find_headers.py"
Florin Malita6e4d95f2018-05-30 09:27:32 -04001190
1191 # TODO: would be cool to not hard-code these here, but how?
1192 module_public_includes = [
1193 "modules/sksg/include",
1194 "modules/skottie/include",
1195 ]
1196 args =
1197 [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
1198 [ rebase_path(skia_h, root_build_dir) ] +
1199 rebase_path(skia_public_includes) + rebase_path(module_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -05001200 depfile = "$skia_h.deps"
1201 outputs = [
1202 skia_h,
1203 ]
1204 }
1205
Brian Osmanc9a42472018-05-31 13:17:12 -04001206 if (target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -05001207 executable("fiddle") {
1208 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -05001209 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -05001210 "tools/fiddle/draw.cpp",
1211 "tools/fiddle/fiddle_main.cpp",
1212 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001213
1214 if (skia_use_egl) {
1215 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -04001216 } else {
1217 sources += [ "tools/fiddle/null_context.cpp" ]
1218 }
Joe Gregorio1e735c02017-04-19 14:05:14 -04001219 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -05001220 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -04001221 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -05001222 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001223 ":skia",
1224 ":skia.h",
Florin Malita6e4d95f2018-05-30 09:27:32 -04001225 "modules/skottie",
Mike Kleinc36dedf2016-11-18 09:35:28 -05001226 ]
1227 }
1228 }
1229
Brian Osmanc9a42472018-05-31 13:17:12 -04001230 source_set("public_headers_warnings_check") {
1231 sources = [
1232 "tools/public_headers_warnings_check.cpp",
1233 ]
1234 configs -= [ "//gn:warnings_except_public_headers" ]
1235 deps = [
1236 ":skia",
1237 ":skia.h",
1238 "modules/skottie",
1239 ]
Greg Daniel54bfb182018-11-20 17:12:36 -05001240
1241 # We add this directory to simulate the client already have
1242 # vulkan/vulkan_core.h on their path.
Greg Daniel54200e42018-12-11 17:03:39 -05001243 include_dirs = [ "include/third_party/vulkan" ]
Mike Kleinc36dedf2016-11-18 09:35:28 -05001244 }
1245
mtkleinc095df52016-08-24 12:23:52 -07001246 template("test_lib") {
1247 config(target_name + "_config") {
1248 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -07001249 if (defined(invoker.public_defines)) {
1250 defines = invoker.public_defines
1251 }
mtklein25c81d42016-07-27 13:55:26 -07001252 }
mtkleinc095df52016-08-24 12:23:52 -07001253 source_set(target_name) {
1254 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
1255 public_configs = [
1256 ":" + target_name + "_config",
1257 ":skia_private",
1258 ]
1259
1260 if (!defined(deps)) {
1261 deps = []
1262 }
1263 deps += [ ":skia" ]
1264 testonly = true
1265 }
mtklein25c81d42016-07-27 13:55:26 -07001266 }
mtklein25c81d42016-07-27 13:55:26 -07001267
Mike Kleine6682eb2017-01-05 10:54:57 -05001268 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001269 if (is_ios) {
1270 app_name = target_name
1271 gen_path = target_gen_dir
1272
1273 action("${app_name}_generate_info_plist") {
1274 script = "//gn/gen_plist_ios.py"
1275 outputs = [
1276 "$gen_path/${app_name}_Info.plist",
1277 ]
1278 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1279 }
1280
1281 bundle_data("${app_name}_bundle_info_plist") {
1282 public_deps = [
1283 ":${app_name}_generate_info_plist",
1284 ]
1285 sources = [
1286 "$gen_path/${app_name}_Info.plist",
1287 ]
1288 outputs = [
1289 "{{bundle_root_dir}}/Info.plist",
1290 ]
1291 }
1292
Jim Van Verth329c5a62017-11-29 11:42:33 -05001293 bundle_ios_data =
1294 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1295
1296 if (bundle_ios_data) {
1297 has_skps =
1298 "True" == exec_script("//gn/checkdir.py",
1299 [ rebase_path("skps", root_build_dir) ],
1300 "trim string")
1301 bundle_data("${app_name}_bundle_resources") {
1302 sources = [
1303 "resources",
1304 ]
1305 outputs = [
1306 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1307 "{{bundle_resources_dir}}/data/resources",
1308 ]
1309 }
1310
1311 if (has_skps) {
1312 bundle_data("${app_name}_bundle_skps") {
1313 sources = [
1314 "skps",
1315 ]
1316 outputs = [
1317 # Store in same folder as resources
1318 "{{bundle_resources_dir}}/data/skps",
1319 ]
1320 }
1321 }
1322 }
1323
Jim Van Verth443a9132017-11-28 09:45:26 -05001324 executable("${app_name}_generate_executable") {
1325 forward_variables_from(invoker,
1326 "*",
1327 [
1328 "output_name",
1329 "visibility",
1330 "is_shared_library",
1331 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001332 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001333 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001334 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1335 }
1336
1337 bundle_data("${app_name}_bundle_executable") {
1338 public_deps = [
1339 ":${app_name}_generate_executable",
1340 ]
1341 sources = [
1342 "$gen_path/$app_name",
1343 ]
1344 outputs = [
1345 "{{bundle_executable_dir}}/$app_name",
1346 ]
1347 testonly = true
1348 }
1349
1350 create_bundle("$app_name") {
1351 product_type = "com.apple.product-type.application"
1352 testonly = true
1353
1354 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1355 bundle_resources_dir = bundle_root_dir
1356 bundle_executable_dir = bundle_root_dir
1357 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1358
1359 deps = [
1360 ":${app_name}_bundle_executable",
1361 ":${app_name}_bundle_info_plist",
1362 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001363 if (bundle_ios_data) {
1364 deps += [ ":${app_name}_bundle_resources" ]
1365 if (has_skps) {
1366 deps += [ ":${app_name}_bundle_skps" ]
1367 }
1368 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001369
1370 # should only code sign when running on a device, not the simulator
1371 if (target_cpu != "x64") {
1372 code_signing_script = "//gn/codesign_ios.py"
1373 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1374 code_signing_outputs = [
1375 "$bundle_root_dir/_CodeSignature/CodeResources",
1376 "$bundle_root_dir/embedded.mobileprovision",
1377 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001378 code_signing_args = [
1379 rebase_path("$bundle_root_dir", root_build_dir),
1380 skia_ios_identity,
1381 skia_ios_profile,
1382 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001383 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001384 }
1385 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001386 # !is_ios
1387
1388 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1389 shared_library("lib" + target_name) {
1390 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1391 configs += [ ":skia_private" ]
1392 testonly = true
1393 }
1394 } else {
1395 _executable = target_name
1396 executable(_executable) {
1397 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1398 configs += [ ":skia_private" ]
1399 testonly = true
1400 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001401 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001402 if (is_android && skia_android_serial != "" && defined(_executable)) {
1403 action("push_" + target_name) {
1404 script = "gn/push_to_android.py"
1405 deps = [
1406 ":" + _executable,
1407 ]
1408 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1409 outputs = [
1410 _stamp,
1411 ]
1412 args = [
1413 rebase_path("$root_build_dir/$_executable"),
1414 skia_android_serial,
1415 rebase_path(_stamp),
1416 ]
1417 testonly = true
1418 }
Mike Klein7d921032017-01-05 12:20:41 -05001419 }
1420 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001421 }
1422
Greg Danielda16cce2018-08-01 09:23:57 -04001423 config("moltenvk_config") {
1424 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1425 if (is_ios) {
1426 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/iOS"
1427 } else {
1428 moltenvk_framework_path = "$skia_moltenvk_path/MoltenVK/macOS"
1429 }
1430 cflags = [ "-F$moltenvk_framework_path" ]
1431 ldflags = [ "-F$moltenvk_framework_path" ]
1432 libs = [
1433 "MoltenVK.framework",
1434 "Metal.framework",
1435 "IOSurface.framework",
1436 "QuartzCore.framework",
1437 "Foundation.framework",
1438 ]
1439 if (is_ios) {
1440 libs += [ "UIKit.framework" ]
1441 } else {
1442 libs += [ "IOKit.framework" ]
1443 }
1444 defines = [ "SK_MOLTENVK" ]
1445 }
1446 }
1447
1448 source_set("moltenvk") {
1449 public_configs = [ ":moltenvk_config" ]
1450 }
1451
mtkleinc095df52016-08-24 12:23:52 -07001452 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001453 public_include_dirs = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001454 public_defines = []
1455 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001456
Brian Osmanc9a42472018-05-31 13:17:12 -04001457 deps = []
Greg Danielda16cce2018-08-01 09:23:57 -04001458 public_deps = []
Brian Osmanc9a42472018-05-31 13:17:12 -04001459 sources = [
1460 "tools/gpu/GrContextFactory.cpp",
1461 "tools/gpu/GrTest.cpp",
Brian Salomon00a5eb82018-07-11 15:32:05 -04001462 "tools/gpu/MemoryCache.cpp",
1463 "tools/gpu/MemoryCache.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04001464 "tools/gpu/ProxyUtils.cpp",
1465 "tools/gpu/TestContext.cpp",
1466 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
1467 "tools/gpu/gl/GLTestContext.cpp",
1468 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04001469 "tools/gpu/gl/null/NullGLTestContext.cpp",
1470 "tools/gpu/mock/MockTestContext.cpp",
1471 ]
1472 libs = []
1473
1474 if (is_android || skia_use_egl) {
1475 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
1476 } else if (is_ios) {
1477 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1478 libs += [ "OpenGLES.framework" ]
1479 } else if (is_linux) {
1480 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina27f2692018-06-20 11:06:39 -04001481 libs += [
1482 "GLU",
1483 "X11",
1484 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001485 } else if (is_mac) {
1486 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
1487 } else if (is_win) {
1488 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
Brian Osman0c757272018-12-10 10:27:26 -05001489 libs += [ "Gdi32.lib" ]
1490 if (target_cpu != "arm64") {
1491 libs += [ "OpenGL32.lib" ]
1492 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001493 }
mtklein25c81d42016-07-27 13:55:26 -07001494
Brian Osmanc9a42472018-05-31 13:17:12 -04001495 cflags_objcc = [ "-fobjc-arc" ]
mtklein6ef69992016-09-14 06:12:09 -07001496
Brian Osmanc9a42472018-05-31 13:17:12 -04001497 if (skia_use_angle) {
1498 deps += [ "//third_party/angle2" ]
1499 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1500 }
Greg Daniel54200e42018-12-11 17:03:39 -05001501
Greg Daniel487132b2018-12-20 14:09:36 -05001502 public_include_dirs += [ "include/third_party/vulkan" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04001503 if (skia_use_vulkan) {
1504 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
1505 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
Greg Danielda16cce2018-08-01 09:23:57 -04001506 if (defined(skia_moltenvk_path) && skia_moltenvk_path != "") {
1507 public_deps += [ ":moltenvk" ]
1508 }
Brian Osmanc9a42472018-05-31 13:17:12 -04001509 }
1510 if (skia_use_metal) {
1511 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
mtkleina627b5c2016-09-20 13:36:47 -07001512 }
mtklein25c81d42016-07-27 13:55:26 -07001513 }
mtklein25c81d42016-07-27 13:55:26 -07001514
mtkleinc095df52016-08-24 12:23:52 -07001515 test_lib("flags") {
1516 public_include_dirs = [ "tools/flags" ]
1517 sources = [
1518 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001519 ]
1520 }
1521 test_lib("common_flags") {
1522 public_include_dirs = [ "tools/flags" ]
1523 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001524 "tools/flags/SkCommonFlags.cpp",
1525 "tools/flags/SkCommonFlagsConfig.cpp",
1526 ]
1527 deps = [
mtklein046cb562016-09-16 10:23:12 -07001528 ":flags",
Greg Danielda16cce2018-08-01 09:23:57 -04001529 ]
1530 public_deps = [
mtkleinc095df52016-08-24 12:23:52 -07001531 ":gpu_tool_utils",
1532 ]
1533 }
mtklein25c81d42016-07-27 13:55:26 -07001534
mtkleinc095df52016-08-24 12:23:52 -07001535 test_lib("tool_utils") {
1536 public_include_dirs = [
1537 "tools",
1538 "tools/debugger",
Ben Wagner483c7722018-02-20 17:06:07 -05001539 "tools/fonts",
mtkleinc095df52016-08-24 12:23:52 -07001540 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001541 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001542 ]
1543 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001544 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001545 "tools/CrashHandler.cpp",
Robert Phillips96601082018-05-29 16:13:26 -04001546 "tools/DDLPromiseImageHelper.cpp",
1547 "tools/DDLTileHelper.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001548 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001549 "tools/ProcStats.cpp",
1550 "tools/Resources.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001551 "tools/UrlDataManager.cpp",
1552 "tools/debugger/SkDebugCanvas.cpp",
1553 "tools/debugger/SkDrawCommand.cpp",
1554 "tools/debugger/SkJsonWriteBuffer.cpp",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001555 "tools/fonts/SkRandomScalerContext.cpp",
Herb Derby33ac15e2018-08-29 12:36:22 -04001556 "tools/fonts/SkTestEmptyTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001557 "tools/fonts/SkTestFontMgr.cpp",
Ben Wagner97182cc2018-02-15 10:20:04 -05001558 "tools/fonts/SkTestFontMgr.h",
1559 "tools/fonts/SkTestSVGTypeface.cpp",
1560 "tools/fonts/SkTestSVGTypeface.h",
1561 "tools/fonts/SkTestTypeface.cpp",
1562 "tools/fonts/SkTestTypeface.h",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001563 "tools/fonts/sk_tool_utils_font.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001564 "tools/random_parse_path.cpp",
1565 "tools/sk_tool_utils.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001566 "tools/timer/SkAnimTimer.h",
mtkleinc095df52016-08-24 12:23:52 -07001567 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001568 "tools/trace/SkChromeTracingTracer.cpp",
1569 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001570 "tools/trace/SkDebugfTracer.cpp",
1571 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001572 "tools/trace/SkEventTracingPriv.cpp",
1573 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001574 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001575 libs = []
1576 if (is_ios) {
1577 sources += [ "tools/ios_utils.m" ]
1578 libs += [ "Foundation.framework" ]
1579 }
Hal Canaryfd9bcab2018-04-24 11:47:23 -04001580 defines = []
1581 if (skia_tools_require_resources) {
1582 defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
1583 }
mtkleinc095df52016-08-24 12:23:52 -07001584 deps = [
Ben Wagner97182cc2018-02-15 10:20:04 -05001585 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001586 ":flags",
1587 "//third_party/libpng",
1588 ]
1589 public_deps = [
Greg Danielda16cce2018-08-01 09:23:57 -04001590 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001591 ]
1592 }
mtklein25c81d42016-07-27 13:55:26 -07001593
Mike Klein6e744122016-10-27 12:21:40 -04001594 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001595 test_lib("gm") {
1596 public_include_dirs = [ "gm" ]
1597 sources = gm_sources
1598 deps = [
scroggo19b91532016-10-24 09:03:26 -07001599 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001600 ":skia",
1601 ":tool_utils",
Mike Reed2f0edd52018-05-31 14:22:30 -04001602 "modules/skottie",
Florin Malita26870722018-09-20 14:35:30 -04001603 "modules/skottie:gm",
Florin Malita3b526b02018-05-25 12:43:51 -04001604 "modules/sksg",
mtkleinc095df52016-08-24 12:23:52 -07001605 ]
Greg Danielda16cce2018-08-01 09:23:57 -04001606 public_deps = [
1607 ":gpu_tool_utils",
1608 ]
Hal Canaryb6f53782019-02-13 10:29:50 -05001609 if (skia_enable_skshaper) {
1610 deps += [ "modules/skshaper" ]
1611 defines = [ "SK_USING_SKSHAPER" ]
1612 }
mtkleinc095df52016-08-24 12:23:52 -07001613 }
mtklein25c81d42016-07-27 13:55:26 -07001614
Mike Klein6e744122016-10-27 12:21:40 -04001615 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001616 test_lib("tests") {
1617 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001618 sources = tests_sources + pathops_tests_sources
Leon Scroggins IIIbe85c192018-11-13 13:50:12 -05001619 if (!skia_enable_fontmgr_android) {
Mike Klein6e744122016-10-27 12:21:40 -04001620 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001621 }
Ben Wagner37a06c02018-06-22 21:11:00 +00001622 if (!(skia_use_freetype && skia_use_fontconfig)) {
1623 sources -= [ "//tests/FontMgrFontConfigTest.cpp" ]
1624 }
mtkleinc095df52016-08-24 12:23:52 -07001625 deps = [
Hal Canary0f666812018-03-22 15:21:12 -04001626 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001627 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001628 ":skia",
1629 ":tool_utils",
Florin Malita94d4d3e2018-06-18 13:10:51 -04001630 "modules/skottie:tests",
Brian Osmanccb87522018-06-01 19:20:00 +00001631 "modules/sksg:tests",
mtkleinc095df52016-08-24 12:23:52 -07001632 "//third_party/libpng",
Leon Scroggins III194580d2019-02-22 12:32:16 -05001633 "//third_party/libwebp",
mtkleinc095df52016-08-24 12:23:52 -07001634 "//third_party/zlib",
1635 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001636 public_deps = [
1637 ":gpu_tool_utils", # Test.h #includes headers from this target.
1638 ]
Hal Canaryb6f53782019-02-13 10:29:50 -05001639 if (skia_enable_skshaper) {
1640 deps += [ "modules/skshaper" ]
1641 defines = [ "SK_USING_SKSHAPER" ]
1642 }
mtkleinc095df52016-08-24 12:23:52 -07001643 }
mtklein2f3416d2016-08-02 16:02:05 -07001644
Mike Klein6e744122016-10-27 12:21:40 -04001645 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001646 test_lib("bench") {
1647 public_include_dirs = [ "bench" ]
1648 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001649 deps = [
1650 ":flags",
1651 ":gm",
1652 ":gpu_tool_utils",
1653 ":skia",
1654 ":tool_utils",
1655 ]
1656 }
mtklein2b6870c2016-07-28 14:17:33 -07001657
mtkleinc095df52016-08-24 12:23:52 -07001658 test_lib("experimental_svg_model") {
Hal Canary0f666812018-03-22 15:21:12 -04001659 public_include_dirs = []
1660 if (skia_use_expat) {
1661 public_include_dirs += [ "experimental/svg/model" ]
1662 sources = [
1663 "experimental/svg/model/SkSVGAttribute.cpp",
1664 "experimental/svg/model/SkSVGAttributeParser.cpp",
1665 "experimental/svg/model/SkSVGCircle.cpp",
1666 "experimental/svg/model/SkSVGClipPath.cpp",
1667 "experimental/svg/model/SkSVGContainer.cpp",
1668 "experimental/svg/model/SkSVGDOM.cpp",
1669 "experimental/svg/model/SkSVGEllipse.cpp",
1670 "experimental/svg/model/SkSVGGradient.cpp",
1671 "experimental/svg/model/SkSVGLine.cpp",
1672 "experimental/svg/model/SkSVGLinearGradient.cpp",
1673 "experimental/svg/model/SkSVGNode.cpp",
1674 "experimental/svg/model/SkSVGPath.cpp",
1675 "experimental/svg/model/SkSVGPattern.cpp",
1676 "experimental/svg/model/SkSVGPoly.cpp",
1677 "experimental/svg/model/SkSVGRadialGradient.cpp",
1678 "experimental/svg/model/SkSVGRect.cpp",
1679 "experimental/svg/model/SkSVGRenderContext.cpp",
1680 "experimental/svg/model/SkSVGSVG.cpp",
1681 "experimental/svg/model/SkSVGShape.cpp",
1682 "experimental/svg/model/SkSVGStop.cpp",
1683 "experimental/svg/model/SkSVGTransformableNode.cpp",
1684 "experimental/svg/model/SkSVGUse.cpp",
1685 "experimental/svg/model/SkSVGValue.cpp",
1686 ]
1687 deps = [
1688 ":skia",
1689 ":xml",
1690 ]
1691 }
mtkleinc095df52016-08-24 12:23:52 -07001692 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001693
Mike Klein38af9432016-11-11 11:39:44 -05001694 if (skia_use_lua) {
1695 test_lib("lua") {
1696 public_include_dirs = []
1697 sources = [
1698 "src/utils/SkLua.cpp",
1699 "src/utils/SkLuaCanvas.cpp",
1700 ]
1701 deps = [
Herb Derby264182c2018-05-29 15:53:40 -04001702 "modules/skshaper",
Mike Klein38af9432016-11-11 11:39:44 -05001703 "//third_party/lua",
1704 ]
1705 }
1706
Mike Kleine6682eb2017-01-05 10:54:57 -05001707 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001708 sources = [
1709 "tools/lua/lua_app.cpp",
1710 ]
1711 deps = [
1712 ":lua",
1713 ":skia",
1714 "//third_party/lua",
1715 ]
Mike Klein38af9432016-11-11 11:39:44 -05001716 }
1717
Mike Kleine6682eb2017-01-05 10:54:57 -05001718 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001719 sources = [
1720 "tools/lua/lua_pictures.cpp",
1721 ]
1722 deps = [
1723 ":flags",
1724 ":lua",
1725 ":skia",
1726 ":tool_utils",
1727 "//third_party/lua",
1728 ]
Mike Klein38af9432016-11-11 11:39:44 -05001729 }
1730 }
1731
Cary Clark8032b982017-07-28 11:04:54 -04001732 test_app("bookmaker") {
1733 sources = [
Cary Clark2da9fb82018-11-01 09:29:36 -04001734 "tools/bookmaker/bmhParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001735 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001736 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001737 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001738 "tools/bookmaker/fiddleParser.cpp",
Cary Clark2da9fb82018-11-01 09:29:36 -04001739 "tools/bookmaker/hackParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001740 "tools/bookmaker/includeParser.cpp",
1741 "tools/bookmaker/includeWriter.cpp",
1742 "tools/bookmaker/mdOut.cpp",
1743 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001744 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001745 "tools/bookmaker/spellCheck.cpp",
Cary Clark2da9fb82018-11-01 09:29:36 -04001746 "tools/bookmaker/textParser.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001747 ]
1748 deps = [
1749 ":flags",
1750 ":skia",
1751 ":tool_utils",
1752 ]
1753 }
1754
Florin Malitabfe876a2018-09-02 12:33:59 -04001755 if (is_linux || is_mac) {
Florin Malita79725d32018-06-05 16:16:57 -04001756 test_app("skottie_tool") {
1757 deps = [
1758 "modules/skottie:tool",
1759 ]
1760 }
1761 }
1762
Kevin Lubickebf648e2017-09-21 13:45:16 -04001763 if (target_cpu != "wasm") {
1764 import("gn/samples.gni")
1765 test_lib("samples") {
1766 public_include_dirs = [ "samplecode" ]
1767 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001768 sources = samples_sources
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04001769 public_deps = [
1770 ":tool_utils",
1771 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001772 deps = [
1773 ":experimental_svg_model",
1774 ":flags",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001775 ":xml",
Mike Reedec80d902019-02-12 11:31:27 -05001776 "modules/sksg",
Herb Derby264182c2018-05-29 15:53:40 -04001777 "modules/skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001778 ]
Mike Klein38af9432016-11-11 11:39:44 -05001779
Ruiqi Maof5101492018-06-29 14:32:21 -04001780 # NIMA does not build on Windows clang
1781 if (!is_win || !is_clang) {
Kevin Lubickd9699322018-10-30 15:08:53 -04001782 sources += [ "experimental/nima/NimaActor.cpp" ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001783 deps += [ "//third_party/Nima-Cpp" ]
1784 }
1785
Kevin Lubickebf648e2017-09-21 13:45:16 -04001786 if (skia_use_lua) {
1787 sources += [ "samplecode/SampleLua.cpp" ]
1788 deps += [
1789 ":lua",
1790 "//third_party/lua",
1791 ]
1792 }
1793 }
Mike Klein7af351a2018-07-27 09:54:43 -04001794 test_app("imgcvt") {
1795 sources = [
1796 "tools/imgcvt.cpp",
1797 ]
1798 deps = [
1799 ":skcms",
1800 ":skia",
1801 ]
1802 }
Kevin Lubickebf648e2017-09-21 13:45:16 -04001803 test_app("dm") {
1804 sources = [
1805 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001806 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001807 "dm/DMJsonWriter.cpp",
1808 "dm/DMSrcSink.cpp",
1809 ]
Kevin Lubickebf648e2017-09-21 13:45:16 -04001810 deps = [
1811 ":common_flags",
1812 ":experimental_svg_model",
1813 ":flags",
1814 ":gm",
1815 ":gpu_tool_utils",
1816 ":skia",
1817 ":tests",
1818 ":tool_utils",
Florin Malita3d856bd2018-05-26 09:49:28 -04001819 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05001820 "modules/skottie:utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001821 "modules/sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001822 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001823 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04001824
1825 # NIMA does not build on Windows clang
1826 if (!is_win || !is_clang) {
1827 deps += [ "//third_party/Nima-Cpp" ]
1828 }
Mike Klein38af9432016-11-11 11:39:44 -05001829 }
Brian Osman16adfa32016-10-18 14:42:44 -04001830 }
1831
Mike Kleina8a51ce2018-01-09 12:34:11 -05001832 if (!is_win) {
1833 test_app("remote_demo") {
1834 sources = [
1835 "tools/remote_demo.cpp",
1836 ]
1837 deps = [
1838 ":skia",
1839 ]
1840 }
1841 }
1842
Mike Kleine6682eb2017-01-05 10:54:57 -05001843 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001844 sources = [
1845 "bench/nanobench.cpp",
1846 ]
1847 deps = [
1848 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001849 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001850 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001851 ":flags",
1852 ":gm",
1853 ":gpu_tool_utils",
1854 ":skia",
1855 ":tool_utils",
Florin Malita3b526b02018-05-25 12:43:51 -04001856 "modules/sksg",
mtklein2b6870c2016-07-28 14:17:33 -07001857 ]
mtklein2b6870c2016-07-28 14:17:33 -07001858 }
halcanary19a97202016-08-03 15:08:04 -07001859
Ravi Mistry10d36c52017-01-31 09:49:18 -05001860 test_app("skpinfo") {
1861 sources = [
1862 "tools/skpinfo.cpp",
1863 ]
1864 deps = [
1865 ":flags",
1866 ":skia",
1867 ]
1868 }
1869
Brian Osmanc9a42472018-05-31 13:17:12 -04001870 test_app("skpbench") {
1871 sources = [
1872 "tools/skpbench/skpbench.cpp",
1873 ]
1874 deps = [
1875 ":flags",
1876 ":gpu_tool_utils",
1877 ":skia",
1878 ":tool_utils",
1879 ]
csmartdalton4b5179b2016-09-19 11:03:58 -07001880 }
1881
Mike Kleine6682eb2017-01-05 10:54:57 -05001882 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001883 sources = [
Herb Derby264182c2018-05-29 15:53:40 -04001884 "tools/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001885 ]
1886 deps = [
1887 ":skia",
Herb Derby264182c2018-05-29 15:53:40 -04001888 "modules/skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001889 ]
halcanary3eee9d92016-09-10 07:01:53 -07001890 }
mtklein046cb562016-09-16 10:23:12 -07001891
Ben Wagner219f3622017-07-17 15:32:25 -04001892 test_app("create_test_font") {
1893 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001894 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001895 ]
1896 deps = [
1897 ":skia",
1898 ]
1899 assert_no_deps = [
1900 # tool_utils requires the output of this app.
1901 ":tool_utils",
1902 ]
1903 }
1904
Florin Malita5d3ff432018-07-31 16:38:43 -04001905 if (skia_use_expat) {
1906 test_app("create_test_font_color") {
1907 sources = [
1908 "tools/fonts/create_test_font_color.cpp",
1909 ]
1910 deps = [
1911 ":flags",
1912 ":skia",
1913 ":tool_utils",
1914 ]
1915 }
Ben Wagner97182cc2018-02-15 10:20:04 -05001916 }
1917
Mike Kleine6682eb2017-01-05 10:54:57 -05001918 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001919 sources = [
1920 "tools/get_images_from_skps.cpp",
1921 ]
1922 deps = [
1923 ":flags",
1924 ":skia",
mtklein046cb562016-09-16 10:23:12 -07001925 ]
mtklein046cb562016-09-16 10:23:12 -07001926 }
mtkleinecbc5262016-09-22 11:51:24 -07001927
Brian Osman6788a542018-12-10 11:56:01 -05001928 if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001929 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001930 sources = [
1931 "tools/skiaserve/Request.cpp",
1932 "tools/skiaserve/Response.cpp",
1933 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001934 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1935 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1936 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1937 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1938 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1939 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1940 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1941 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1942 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001943 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1944 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001945 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1946 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1947 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1948 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1949 ]
1950 deps = [
1951 ":flags",
1952 ":gpu_tool_utils",
1953 ":skia",
1954 ":tool_utils",
Mike Klein7d302882016-11-03 14:06:31 -04001955 "//third_party/libmicrohttpd",
1956 "//third_party/libpng",
1957 ]
Mike Klein7d302882016-11-03 14:06:31 -04001958 }
mtkleinecbc5262016-09-22 11:51:24 -07001959 }
kjlubick14f984b2016-10-03 11:49:45 -07001960
Mike Kleine6682eb2017-01-05 10:54:57 -05001961 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001962 include_dirs = [
1963 "tools",
1964 "tools/debugger",
Kevin Lubickec1c6202018-12-14 11:42:53 -05001965 "tools/fonts",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001966 ]
kjlubick14f984b2016-10-03 11:49:45 -07001967 sources = [
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001968 "fuzz/Fuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001969 "fuzz/FuzzCanvas.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001970 "fuzz/FuzzCommon.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001971 "fuzz/FuzzDrawFunctions.cpp",
Kevin Lubicke4be55d2018-03-30 15:05:13 -04001972 "fuzz/FuzzEncoders.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001973 "fuzz/FuzzGradients.cpp",
Kevin Lubickbc9a1a82018-09-17 14:46:57 -04001974 "fuzz/FuzzMain.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001975 "fuzz/FuzzParsePath.cpp",
Cary Clark91390c82018-03-09 14:02:46 -05001976 "fuzz/FuzzPathMeasure.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001977 "fuzz/FuzzPathop.cpp",
Jim Van Verth061cc212018-07-11 14:09:09 -04001978 "fuzz/FuzzPolyUtils.cpp",
Hal Canary13872dd2018-04-06 10:25:12 -04001979 "fuzz/FuzzRegionOp.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001980 "fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001981 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1982 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001983 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
Leon Scroggins III0b8fcbc2018-10-16 15:52:17 -04001984 "fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
Florin Malita80452be2018-06-19 11:27:20 -04001985 "fuzz/oss_fuzz/FuzzJSON.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001986 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001987 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1988 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001989 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001990 "tools/UrlDataManager.cpp",
1991 "tools/debugger/SkDebugCanvas.cpp",
1992 "tools/debugger/SkDrawCommand.cpp",
1993 "tools/debugger/SkJsonWriteBuffer.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001994 ]
1995 deps = [
1996 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001997 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001998 ":skia",
Florin Malita3d856bd2018-05-26 09:49:28 -04001999 "modules/skottie:fuzz",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05002000 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07002001 ]
kjlubick14f984b2016-10-03 11:49:45 -07002002 }
Mike Klein38312422016-10-05 15:41:01 -04002003
Mike Kleine6682eb2017-01-05 10:54:57 -05002004 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04002005 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04002006 rebase_path("tests/skia_test.cpp"),
2007 rebase_path("tests/Test.cpp"),
2008 ]
caryclark9feb6322016-10-25 08:58:26 -07002009 deps = [
2010 ":flags",
2011 ":gpu_tool_utils",
2012 ":skia",
2013 ":tool_utils",
2014 ]
caryclark9feb6322016-10-25 08:58:26 -07002015 }
2016
Mike Kleine6682eb2017-01-05 10:54:57 -05002017 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04002018 sources = [
2019 "tools/DumpRecord.cpp",
2020 "tools/dump_record.cpp",
2021 ]
2022 deps = [
2023 ":flags",
2024 ":skia",
2025 ]
Mike Klein38312422016-10-05 15:41:01 -04002026 }
bungemanfe917272016-10-13 17:36:40 -04002027
Mike Kleine6682eb2017-01-05 10:54:57 -05002028 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04002029 sources = [
2030 "tools/skdiff/skdiff.cpp",
2031 "tools/skdiff/skdiff_html.cpp",
2032 "tools/skdiff/skdiff_main.cpp",
2033 "tools/skdiff/skdiff_utils.cpp",
2034 ]
2035 deps = [
2036 ":skia",
2037 ":tool_utils",
2038 ]
bungemanfe917272016-10-13 17:36:40 -04002039 }
halcanarya73d76a2016-10-17 13:19:02 -07002040
Mike Kleine6682eb2017-01-05 10:54:57 -05002041 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07002042 sources = [
2043 "tools/skp_parser.cpp",
2044 ]
2045 deps = [
2046 ":skia",
2047 ":tool_utils",
halcanarya73d76a2016-10-17 13:19:02 -07002048 ]
halcanarya73d76a2016-10-17 13:19:02 -07002049 }
Brian Osman16adfa32016-10-18 14:42:44 -04002050
Brian Osmanc9a42472018-05-31 13:17:12 -04002051 if (!is_win) {
Hal Canaryd7b38452017-12-11 17:46:26 -05002052 test_lib("skqp_lib") {
Hal Canaryac7f23c2018-11-26 14:07:41 -05002053 public_include_dirs = [ "tools/skqp/src" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05002054 defines =
2055 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary75427132017-10-11 16:00:31 -04002056 sources = [
2057 "dm/DMGpuTestProcs.cpp",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002058 "tools/skqp/src/skqp.cpp",
2059 "tools/skqp/src/skqp_model.cpp",
Hal Canary75427132017-10-11 16:00:31 -04002060 ]
2061 deps = [
2062 ":gm",
2063 ":gpu_tool_utils",
2064 ":skia",
2065 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05002066 ":tool_utils",
2067 ]
2068 }
2069 test_app("skqp") {
2070 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002071 "tools/skqp/src/skqp_main.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05002072 ]
2073 deps = [
2074 ":skia",
2075 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05002076 ":tool_utils",
Hal Canaryac7f23c2018-11-26 14:07:41 -05002077 ]
2078 }
2079 test_app("jitter_gms") {
2080 sources = [
2081 "tools/skqp/jitter_gms.cpp",
2082 ]
2083 deps = [
2084 ":gm",
2085 ":skia",
2086 ":skqp_lib",
Hal Canary75427132017-10-11 16:00:31 -04002087 ]
2088 }
2089 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002090 if (is_android) {
Hal Canary28f89382017-12-12 09:42:14 -05002091 test_app("skqp_app") {
2092 is_shared_library = true
2093 sources = [
Hal Canaryac7f23c2018-11-26 14:07:41 -05002094 "tools/skqp/src/jni_skqp.cpp",
Hal Canary28f89382017-12-12 09:42:14 -05002095 ]
2096 deps = [
2097 ":skia",
2098 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05002099 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05002100 ]
2101 libs = [ "android" ]
2102 }
2103 }
Stan Iliev93151722018-08-02 11:10:52 -04002104 if (is_android && skia_enable_gpu) {
2105 test_app("skottie_android") {
2106 is_shared_library = true
2107
2108 sources = [
2109 "platform_tools/android/apps/skottie/src/main/cpp/JavaInputStreamAdaptor.cpp",
2110 "platform_tools/android/apps/skottie/src/main/cpp/native-lib.cpp",
2111 ]
2112 libs = []
2113
2114 include_dirs = []
2115 deps = [
2116 ":skia",
2117 "modules/skottie",
Stan Ilieva7a52b92018-10-01 15:36:32 -04002118 "modules/sksg:samples",
Stan Iliev93151722018-08-02 11:10:52 -04002119 ]
2120 }
2121 }
Hal Canary75427132017-10-11 16:00:31 -04002122
Hal Canarya9de7602018-01-19 13:08:23 -05002123 test_app("list_gms") {
2124 sources = [
2125 "tools/list_gms.cpp",
2126 ]
2127 deps = [
2128 ":gm",
2129 ":skia",
2130 ]
2131 }
2132 test_app("list_gpu_unit_tests") {
2133 sources = [
2134 "dm/DMGpuTestProcs.cpp",
2135 "tools/list_gpu_unit_tests.cpp",
2136 ]
2137 deps = [
2138 ":skia",
2139 ":tests",
2140 ]
2141 }
2142
Brian Osmanc9a42472018-05-31 13:17:12 -04002143 test_lib("sk_app") {
2144 public_include_dirs = [ "tools/sk_app" ]
2145 sources = [
2146 "tools/sk_app/CommandSet.cpp",
2147 "tools/sk_app/GLWindowContext.cpp",
2148 "tools/sk_app/Window.cpp",
2149 ]
2150 libs = []
2151
2152 if (is_android) {
2153 sources += [
2154 "tools/sk_app/android/GLWindowContext_android.cpp",
2155 "tools/sk_app/android/RasterWindowContext_android.cpp",
2156 "tools/sk_app/android/Window_android.cpp",
2157 "tools/sk_app/android/main_android.cpp",
2158 "tools/sk_app/android/surface_glue_android.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002159 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002160 libs += [ "android" ]
2161 } else if (is_linux) {
2162 sources += [
2163 "tools/sk_app/unix/GLWindowContext_unix.cpp",
2164 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
2165 "tools/sk_app/unix/Window_unix.cpp",
2166 "tools/sk_app/unix/keysym2ucs.c",
2167 "tools/sk_app/unix/main_unix.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04002168 ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002169 libs += [
2170 "GL",
2171 "X11",
2172 ]
2173 } else if (is_win) {
2174 sources += [
2175 "tools/sk_app/win/GLWindowContext_win.cpp",
2176 "tools/sk_app/win/RasterWindowContext_win.cpp",
2177 "tools/sk_app/win/Window_win.cpp",
2178 "tools/sk_app/win/main_win.cpp",
2179 ]
Brian Salomon194db172017-08-17 14:37:06 -04002180 if (skia_use_angle) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002181 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04002182 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002183 } else if (is_mac) {
2184 sources += [
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002185 "tools/sk_app/mac/GLWindowContext_mac.mm",
2186 "tools/sk_app/mac/RasterWindowContext_mac.mm",
2187 "tools/sk_app/mac/Window_mac.mm",
2188 "tools/sk_app/mac/main_mac.mm",
Brian Osmanc9a42472018-05-31 13:17:12 -04002189 ]
2190 libs += [
2191 "QuartzCore.framework",
2192 "Cocoa.framework",
2193 "Foundation.framework",
2194 ]
2195 } else if (is_ios) {
2196 sources += [
2197 "tools/sk_app/ios/GLWindowContext_ios.cpp",
2198 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
2199 "tools/sk_app/ios/Window_ios.cpp",
2200 "tools/sk_app/ios/main_ios.cpp",
2201 ]
2202 }
2203
2204 if (skia_use_vulkan) {
2205 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
2206 if (is_android) {
2207 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
2208 } else if (is_linux) {
2209 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
2210 libs += [ "X11-xcb" ]
2211 } else if (is_win) {
2212 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Jim Van Verthce51c142019-02-14 14:07:46 -05002213 } else if (is_mac) {
2214 sources += [ "tools/sk_app/mac/VulkanWindowContext_mac.mm" ]
2215 libs += [ "MetalKit.framework" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002216 }
2217 }
2218
Jim Van Verthbe39f712019-02-08 15:36:14 -05002219 if (skia_use_metal) {
2220 sources += [ "tools/sk_app/MetalWindowContext.mm" ]
2221 if (is_mac) {
2222 sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
2223 }
2224 libs += [ "MetalKit.framework" ]
2225 }
2226
Brian Osmanc9a42472018-05-31 13:17:12 -04002227 deps = [
2228 ":gpu_tool_utils",
2229 ":skia",
2230 ":tool_utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002231 ]
2232 if (is_android) {
2233 deps += [ "//third_party/native_app_glue" ]
Jim Van Verth1f086ca2019-01-28 14:46:04 -05002234 } else if (is_ios) {
Brian Osmanc9a42472018-05-31 13:17:12 -04002235 deps += [ "//third_party/libsdl" ]
2236 }
2237 if (skia_use_angle) {
2238 deps += [ "//third_party/angle2" ]
Mike Kleina92c3832016-12-08 09:49:39 -05002239 }
Brian Osman16adfa32016-10-18 14:42:44 -04002240 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05002241
Brian Osmanc9a42472018-05-31 13:17:12 -04002242 test_app("viewer") {
2243 is_shared_library = is_android
2244 if (is_ios) {
2245 bundle_ios_data = true
Brian Osmaneff04b52017-11-21 13:18:02 -05002246 }
Brian Osmanc9a42472018-05-31 13:17:12 -04002247 sources = [
2248 "tools/viewer/BisectSlide.cpp",
2249 "tools/viewer/GMSlide.cpp",
2250 "tools/viewer/ImGuiLayer.cpp",
2251 "tools/viewer/ImageSlide.cpp",
Brian Osman7c979f52019-02-12 13:27:51 -05002252 "tools/viewer/ParticlesSlide.cpp",
Brian Osmanc9a42472018-05-31 13:17:12 -04002253 "tools/viewer/SKPSlide.cpp",
2254 "tools/viewer/SampleSlide.cpp",
2255 "tools/viewer/SkottieSlide.cpp",
2256 "tools/viewer/SlideDir.cpp",
2257 "tools/viewer/StatsLayer.cpp",
2258 "tools/viewer/SvgSlide.cpp",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002259 "tools/viewer/TouchGesture.cpp",
Leon Scroggins III81886e82018-08-22 11:18:08 -04002260 "tools/viewer/TouchGesture.h",
Brian Osmanc9a42472018-05-31 13:17:12 -04002261 "tools/viewer/Viewer.cpp",
2262 ]
2263 libs = []
2264
Kevin Lubickd9699322018-10-30 15:08:53 -04002265 include_dirs = [ "experimental" ]
Brian Osmanc9a42472018-05-31 13:17:12 -04002266 deps = [
2267 ":experimental_svg_model",
2268 ":flags",
2269 ":gm",
2270 ":gpu_tool_utils",
2271 ":samples",
2272 ":sk_app",
2273 ":skia",
2274 ":tool_utils",
Brian Osman7c979f52019-02-12 13:27:51 -05002275 "modules/particles",
Brian Osmanc9a42472018-05-31 13:17:12 -04002276 "modules/skottie",
Florin Malitaa8316552018-11-09 16:19:44 -05002277 "modules/skottie:utils",
Brian Osmanc9a42472018-05-31 13:17:12 -04002278 "modules/sksg",
Ben Wagnerb2c4ea62018-08-08 11:36:17 -04002279 "modules/sksg:samples",
Brian Osmanc9a42472018-05-31 13:17:12 -04002280 "//third_party/imgui",
Brian Osmanc9a42472018-05-31 13:17:12 -04002281 ]
Ruiqi Maof5101492018-06-29 14:32:21 -04002282
2283 # NIMA does not build on Windows clang
2284 if (!is_win || !is_clang) {
2285 sources += [ "tools/viewer/NIMASlide.cpp" ]
2286 deps += [ "//third_party/Nima-Cpp" ]
2287 }
Brian Osmaneff04b52017-11-21 13:18:02 -05002288 }
2289
ziadbbceddbc2018-06-19 13:57:15 -04002290 if (is_android) {
2291 test_app("arcore") {
2292 is_shared_library = true
2293 configs = [
2294 ":skia_public",
2295 "gn:default",
2296 ]
2297
2298 # For internship expedience, yes, we're rebuilding Skia rather than depending on :skia.
2299 # At the moment there's no way to use Skia and Skottie/SkShaper unless they're in the same .so.
2300 sources = []
2301 sources += skia_core_sources
2302 sources += skia_utils_sources
2303 sources += skia_xps_sources
2304 sources += [
2305 "src/android/SkAndroidFrameworkUtils.cpp",
2306 "src/android/SkAnimatedImage.cpp",
2307 "src/android/SkBitmapRegionCodec.cpp",
2308 "src/android/SkBitmapRegionDecoder.cpp",
2309 "src/codec/SkAndroidCodec.cpp",
2310 "src/codec/SkBmpBaseCodec.cpp",
2311 "src/codec/SkBmpCodec.cpp",
2312 "src/codec/SkBmpMaskCodec.cpp",
2313 "src/codec/SkBmpRLECodec.cpp",
2314 "src/codec/SkBmpStandardCodec.cpp",
2315 "src/codec/SkCodec.cpp",
2316 "src/codec/SkCodecImageGenerator.cpp",
2317 "src/codec/SkColorTable.cpp",
2318 "src/codec/SkGifCodec.cpp",
2319 "src/codec/SkMaskSwizzler.cpp",
2320 "src/codec/SkMasks.cpp",
2321 "src/codec/SkSampledCodec.cpp",
2322 "src/codec/SkSampler.cpp",
2323 "src/codec/SkStreamBuffer.cpp",
2324 "src/codec/SkSwizzler.cpp",
2325 "src/codec/SkWbmpCodec.cpp",
2326 "src/images/SkImageEncoder.cpp",
2327 "src/ports/SkDiscardableMemory_none.cpp",
2328 "src/ports/SkImageGenerator_skia.cpp",
2329 "src/ports/SkMemory_malloc.cpp",
2330 "src/ports/SkOSFile_stdio.cpp",
2331 "src/sfnt/SkOTTable_name.cpp",
2332 "src/sfnt/SkOTUtils.cpp",
2333 "src/utils/mac/SkStream_mac.cpp",
Jim Van Verth1676cb92019-01-15 13:24:45 -05002334 "third_party/etc1/etc1.cpp",
ziadbbceddbc2018-06-19 13:57:15 -04002335 "third_party/gif/SkGifImageReader.cpp",
2336 ]
2337 deps = [
2338 ":tool_utils",
2339 "modules/skottie",
2340 "modules/skshaper",
2341 ]
2342 }
2343 }
2344
Brian Osmanc9a42472018-05-31 13:17:12 -04002345 if (!skia_use_angle && (is_linux || is_win || is_mac)) {
Brian Osmaneff04b52017-11-21 13:18:02 -05002346 test_app("HelloWorld") {
2347 sources = [
2348 "example/HelloWorld.cpp",
2349 ]
2350 libs = []
2351
2352 include_dirs = []
2353 deps = [
2354 ":flags",
2355 ":gpu_tool_utils",
2356 ":sk_app",
2357 ":skia",
2358 ":tool_utils",
Brian Osmaneff04b52017-11-21 13:18:02 -05002359 ]
2360 }
2361 }
2362
Brian Osmanc9a42472018-05-31 13:17:12 -04002363 if (is_linux || is_mac || is_ios) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002364 test_app("SkiaSDLExample") {
2365 sources = [
2366 "example/SkiaSDLExample.cpp",
2367 ]
2368 libs = []
2369 include_dirs = []
2370 deps = [
2371 ":gpu_tool_utils",
2372 ":skia",
2373 "//third_party/libsdl",
2374 ]
2375 }
2376 }
2377
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002378 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2379 action_foreach("generate_mocs") {
2380 script = "gn/call.py"
2381 sources = [
2382 "tools/mdbviz/MainWindow.h",
2383 ]
2384 outputs = [
2385 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2386 ]
2387 args = [
2388 "$skia_qt_path" + "/bin/moc",
2389 "{{source}}",
2390 "-o",
2391 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2392 ]
2393 }
2394 action_foreach("generate_resources") {
2395 script = "gn/call.py"
2396 sources = [
2397 "tools/mdbviz/resources.qrc",
2398 ]
2399 outputs = [
2400 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2401 ]
2402 args = [
2403 "$skia_qt_path" + "/bin/rcc",
2404 "{{source}}",
2405 "-o",
2406 "gen/mdbviz/{{source_name_part}}_res.cpp",
2407 ]
2408 }
2409 test_app("mdbviz") {
2410 if (is_win) {
2411 # on Windows we need to disable some exception handling warnings due to the Qt headers
2412 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2413 }
2414 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002415 "tools/UrlDataManager.cpp",
2416 "tools/debugger/SkDebugCanvas.cpp",
2417 "tools/debugger/SkDrawCommand.cpp",
2418 "tools/debugger/SkJsonWriteBuffer.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002419 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002420 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002421 "tools/mdbviz/main.cpp",
2422
2423 # generated files
2424 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2425 "$target_gen_dir/mdbviz/resources_res.cpp",
2426 ]
2427 lib_dirs = [ "$skia_qt_path/lib" ]
2428 libs = [
2429 "Qt5Core.lib",
2430 "Qt5Gui.lib",
2431 "Qt5Widgets.lib",
2432 ]
2433 include_dirs = [
2434 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002435 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002436 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002437 "tools",
2438 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002439 ]
2440 deps = [
2441 ":generate_mocs",
2442 ":generate_resources",
2443 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002444 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002445 ]
2446 }
2447 }
2448
Mike Kleine459afd2017-03-03 09:21:30 -05002449 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002450 copy("gdbserver") {
2451 sources = [
2452 "$ndk/$ndk_gdbserver",
2453 ]
2454 outputs = [
2455 "$root_out_dir/gdbserver",
2456 ]
2457 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002458 }
Mike Kleinf9ae6702018-06-20 14:05:05 -04002459
2460 if (skia_use_opencl) {
2461 test_app("hello-opencl") {
2462 sources = [
Mike Kleinf9ae6702018-06-20 14:05:05 -04002463 "tools/hello-opencl.cpp",
2464 ]
Mike Klein8a1f15d2019-02-11 11:59:41 -05002465 deps = [
2466 "//third_party/opencl",
2467 ]
Mike Kleinf9ae6702018-06-20 14:05:05 -04002468 }
2469 }
mtklein25c81d42016-07-27 13:55:26 -07002470}