blob: 0db8b14097c01de35e7854521175b27474fccdcb [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")
mikejurka8c24f4f2016-09-12 16:51:58 -07007import("gn/shared_sources.gni")
brettwb9447282016-09-01 14:24:39 -07008
Forrest Reiling30229ac2017-04-17 13:36:39 -07009if (is_fuchsia) {
10 import("//build/vulkan/config.gni")
11}
12
Mike Klein3669a822017-03-03 10:55:02 -050013if (!defined(is_skia_standalone)) {
14 is_skia_standalone = false
15}
16is_skia_dev_build = is_skia_standalone && !is_official_build
17
mtkleinc04ff472016-06-23 10:29:30 -070018declare_args() {
Mike Kleinc168a3a2016-11-14 14:53:13 +000019 skia_use_angle = false
Kevin Lubick4a24e102017-03-29 11:19:01 -040020 skia_use_egl = false
mtklein63213812016-08-24 09:55:56 -070021 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070022 skia_use_fontconfig = is_linux
mtkleincdedd0e2016-09-12 15:15:44 -070023 skia_use_freetype = is_android || is_fuchsia || is_linux
Mike Klein7d302882016-11-03 14:06:31 -040024 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
mtklein63213812016-08-24 09:55:56 -070025 skia_use_libjpeg_turbo = true
26 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070027 skia_use_libwebp = !is_fuchsia
Mike Kleinfae86b72018-01-08 15:49:09 -050028 skia_use_lua = is_skia_dev_build && !is_ios
Mike Klein10d665d2016-11-01 11:46:10 -040029 skia_use_piex = !is_win
mtklein63213812016-08-24 09:55:56 -070030 skia_use_zlib = true
Greg Daniele5ddff52017-07-05 16:49:36 -040031 skia_use_metal = false
Mike Klein36f182f2017-10-20 12:33:53 -040032 skia_use_libheif = is_skia_dev_build
Mike Kleinfb333552018-01-25 12:49:37 -050033 skia_use_skcms = is_skia_dev_build
mtklein1bd72ba2016-09-16 07:45:52 -070034
Mike Klein7d921032017-01-05 12:20:41 -050035 skia_android_serial = ""
Brian Osman3f375d02016-12-28 11:19:22 -050036 skia_enable_discrete_gpu = true
Mike Kleina04bb452017-02-09 12:24:07 -050037 skia_enable_effects = true
Brian Osmanf2c90142017-07-13 15:50:03 -040038 skia_enable_flutter_defines = false
Hal Canaryff2742e2018-01-30 11:35:47 -050039 skia_enable_fontmgr_empty = false
mtklein06c35c02016-09-20 12:28:12 -070040 skia_enable_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050041 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040042 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Mike Klein3669a822017-03-03 10:55:02 -050043 skia_enable_tools = is_skia_dev_build
44 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Greg Danielafb7ec72017-12-07 12:48:30 -050045 skia_vulkan_header = ""
Greg Daniel686bb212016-10-27 10:48:48 -040046 skia_vulkan_sdk = getenv("VULKAN_SDK")
Robert Phillipsa6d2d702017-09-01 12:17:03 -040047 skia_qt_path = getenv("QT_PATH")
Ethan Nicholas762466e2017-06-29 10:03:38 -040048 skia_compile_processors = false
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070049 skia_lex = false
Mike Kleinc55a6cb2017-06-28 13:21:47 -040050
51 skia_jumper_clang = ""
52 skia_jumper_objdump = ""
53 skia_jumper_ccache = ""
Hal Canary4689b542018-01-31 11:54:14 -050054
55 skia_skqp_enable_driver_correctness_workarounds = false
Hal Canary2331c822018-02-01 14:06:13 -050056 skia_skqp_global_error_tolerance = 0
mtkleinc04ff472016-06-23 10:29:30 -070057}
Brian Salomon23d73ea2016-10-27 13:31:37 -040058declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040059 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040060 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050061 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Mike Klein10d665d2016-11-01 11:46:10 -040062
Brian Salomon5f33a8c2018-02-26 14:32:39 -050063 skia_use_legacy_gpu_pixel_ops = is_skia_dev_build && is_win # Arbitrary to keep old code path tested until deletion.
64
Mike Klein4d598a32016-10-31 13:44:49 -040065 if (is_android) {
66 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070067 } else if (is_fuchsia) {
68 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040069 } else {
70 skia_use_vulkan = skia_vulkan_sdk != ""
71 }
Jim Van Verth4e502972017-12-07 15:16:10 -050072
73 if (is_ios) {
74 skia_ios_identity = ".*Google.*"
75 skia_ios_profile = "Google Development"
76 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040077}
Greg Danielec6ae522017-04-25 13:38:26 -040078declare_args() {
Greg Danielafb7ec72017-12-07 12:48:30 -050079 skia_tools_vulkan_header_dir = ""
Greg Danielec6ae522017-04-25 13:38:26 -040080 if (skia_use_vulkan) {
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +000081 # When buliding on Android we get the header via the NDK so no need for any extra path.
Greg Danielec6ae522017-04-25 13:38:26 -040082 if (is_fuchsia) {
Greg Danielafb7ec72017-12-07 12:48:30 -050083 skia_tools_vulkan_header_dir = "$fuchsia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040084 } else if (is_linux || is_win) {
Greg Danielafb7ec72017-12-07 12:48:30 -050085 skia_tools_vulkan_header_dir = "$skia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040086 }
Greg Danielec6ae522017-04-25 13:38:26 -040087 }
88}
Brian Salomon789e25e2016-09-30 13:41:03 -040089
Adam Barth54ef74a2017-10-13 10:59:38 -070090if (defined(skia_settings)) {
91 import(skia_settings)
92}
93
mtklein38925aa2016-09-21 10:11:25 -070094# Our tools require static linking (they use non-exported symbols).
95skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070096
mtkleina45be612016-08-29 15:22:10 -070097fontmgr_android_enabled = skia_use_expat && skia_use_freetype
98
mtklein1211e0c2016-07-26 13:55:45 -070099skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -0700100 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -0700101 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -0700102 "include/codec",
103 "include/config",
104 "include/core",
105 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -0400106 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -0700107 "include/gpu",
108 "include/gpu/gl",
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500109 "include/atlastext",
mtklein1211e0c2016-07-26 13:55:45 -0700110 "include/pathops",
111 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -0700112 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -0700113 "include/utils",
114 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -0700115]
116
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000117if (skia_use_vulkan) {
118 skia_public_includes += [ "include/gpu/vk" ]
119}
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500120if (skia_enable_atlas_text) {
121 skia_public_includes += [ "include/atlastext" ]
122}
Greg Daniele5ddff52017-07-05 16:49:36 -0400123if (skia_use_metal) {
124 skia_public_includes += [ "include/gpu/mtl" ]
125}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000126
mtkleinc04ff472016-06-23 10:29:30 -0700127# Skia public API, generally provided by :skia.
128config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700129 include_dirs = skia_public_includes
Greg Danielafb7ec72017-12-07 12:48:30 -0500130 if (skia_tools_vulkan_header_dir != "") {
131 include_dirs += [ skia_tools_vulkan_header_dir ]
Greg Danielec6ae522017-04-25 13:38:26 -0400132 }
Mike Kleinae7e6712016-10-11 17:49:33 -0400133 defines = []
134 if (is_component_build) {
135 defines += [ "SKIA_DLL" ]
136 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400137 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700138 defines += [ "SK_SAMPLES_FOR_X" ]
139 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400140 if (skia_enable_flutter_defines) {
141 defines += flutter_defines
142 }
mtklein06c35c02016-09-20 12:28:12 -0700143 if (!skia_enable_gpu) {
144 defines += [ "SK_SUPPORT_GPU=0" ]
145 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500146 if (skia_enable_atlas_text) {
147 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
148 }
mtkleinc04ff472016-06-23 10:29:30 -0700149}
150
151# Skia internal APIs, used by Skia itself and a few test tools.
152config("skia_private") {
153 visibility = [ ":*" ]
154
155 include_dirs = [
156 "include/private",
157 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700158 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700159 "src/core",
160 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700161 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700162 "src/image",
163 "src/images",
164 "src/lazy",
165 "src/opts",
166 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700167 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700168 "src/ports",
169 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400170 "src/shaders",
171 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700172 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700173 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700174 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500175 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700176 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700177 ]
mtklein150d1132016-08-01 06:56:40 -0700178
Mike Reeda9e241d2017-05-03 10:52:00 -0400179 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700180 if (is_android) {
181 defines += [
182 "SK_GAMMA_EXPONENT=1.4",
183 "SK_GAMMA_CONTRAST=0.0",
184 ]
185 }
mtklein88a7ac02016-09-14 11:16:49 -0700186 if (is_official_build || is_android) {
187 # TODO(bsalomon): it'd be nice to make Android normal.
188 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
189 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400190 libs = []
191 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500192 if (skia_enable_gpu) {
193 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500194 if (is_skia_dev_build && skia_use_vulkan) {
195 include_dirs += [ "tools/gpu/vk" ]
196 }
Brian Salomon03e05842017-02-23 12:23:47 -0500197 }
Brian Osman34755e22016-12-05 09:46:02 -0500198 if (skia_use_angle) {
199 defines += [ "SK_ANGLE" ]
200 }
Brian Osman3f375d02016-12-28 11:19:22 -0500201 if (skia_enable_discrete_gpu) {
202 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
203 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400204 if (!is_official_build) {
205 defines += [ "GR_TEST_UTILS=1" ]
206 }
mtkleinc04ff472016-06-23 10:29:30 -0700207}
208
209# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
210config("skia_library") {
211 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700212 defines = [ "SKIA_IMPLEMENTATION=1" ]
213}
214
215skia_library_configs = [
216 ":skia_public",
217 ":skia_private",
218 ":skia_library",
219]
220
mtklein9b8583d2016-08-24 17:32:30 -0700221# Use for CPU-specific Skia code that needs particular compiler flags.
222template("opts") {
223 if (invoker.enabled) {
224 source_set(target_name) {
225 forward_variables_from(invoker, "*")
226 configs += skia_library_configs
227 }
228 } else {
229 # If not enabled, a phony empty target that swallows all otherwise unused variables.
230 source_set(target_name) {
231 forward_variables_from(invoker,
232 "*",
233 [
234 "sources",
235 "cflags",
236 ])
237 }
238 }
anmittala7eaf2e2016-08-17 13:57:26 -0700239}
240
mtklein422310d2016-08-16 18:28:43 -0700241is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700242
mtklein7d6fb2c2016-08-25 14:50:44 -0700243opts("none") {
244 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700245 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700246 cflags = []
247}
248
mtklein7d6fb2c2016-08-25 14:50:44 -0700249opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700250 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700251 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700252 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700253}
254
255opts("arm64") {
256 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700257 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700258 cflags = []
259}
260
261opts("crc32") {
262 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700263 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700264 cflags = [ "-march=armv8-a+crc" ]
265}
266
mtklein9b8583d2016-08-24 17:32:30 -0700267opts("sse2") {
268 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700269 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400270 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400271 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
272 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400273 cflags = [ "-msse2" ]
274 }
mtklein9b8583d2016-08-24 17:32:30 -0700275}
mtkleinc04ff472016-06-23 10:29:30 -0700276
mtklein9b8583d2016-08-24 17:32:30 -0700277opts("ssse3") {
278 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700279 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400280 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400281 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
282 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400283 cflags = [ "-mssse3" ]
284 }
mtklein9b8583d2016-08-24 17:32:30 -0700285}
mtkleinc04ff472016-06-23 10:29:30 -0700286
mtklein9b8583d2016-08-24 17:32:30 -0700287opts("sse41") {
288 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700289 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400290 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400291 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
292 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400293 cflags = [ "-msse4.1" ]
294 }
mtklein9b8583d2016-08-24 17:32:30 -0700295}
mtklein4e976072016-08-08 09:06:27 -0700296
mtklein9b8583d2016-08-24 17:32:30 -0700297opts("sse42") {
298 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700299 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400300 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400301 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
302 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400303 cflags = [ "-msse4.2" ]
304 }
mtklein9b8583d2016-08-24 17:32:30 -0700305}
306
307opts("avx") {
308 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700309 sources = skia_opts.avx_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400310 if (!is_clang && is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000311 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400312 } else {
313 cflags = [ "-mavx" ]
314 }
mtkleinc04ff472016-06-23 10:29:30 -0700315}
316
mtkleinc095df52016-08-24 12:23:52 -0700317# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700318template("optional") {
319 if (invoker.enabled) {
320 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700321 if (defined(invoker.public_defines)) {
322 defines = invoker.public_defines
323 }
mtklein457b42a2016-08-23 13:56:37 -0700324 }
325 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700326 forward_variables_from(invoker,
327 "*",
328 [
329 "public_defines",
330 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700331 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700332 ])
mtklein457b42a2016-08-23 13:56:37 -0700333 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700334 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700335 if (defined(invoker.configs_to_remove)) {
336 configs -= invoker.configs_to_remove
337 }
mtklein457b42a2016-08-23 13:56:37 -0700338 }
339 } else {
mtklein457b42a2016-08-23 13:56:37 -0700340 source_set(target_name) {
341 forward_variables_from(invoker,
342 "*",
343 [
344 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700345 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700346 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700347 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700348 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700349 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700350 ])
mtkleincd01b032016-08-31 04:58:19 -0700351 if (defined(invoker.sources_when_disabled)) {
352 sources = invoker.sources_when_disabled
353 }
354 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700355 }
mtkleineb3c4252016-08-23 07:38:09 -0700356 }
mtklein457b42a2016-08-23 13:56:37 -0700357}
mtklein457b42a2016-08-23 13:56:37 -0700358
Mike Kleina04bb452017-02-09 12:24:07 -0500359optional("effects") {
360 enabled = skia_enable_effects
Ethan Nicholas762466e2017-06-29 10:03:38 -0400361 deps = [
362 ":compile_processors",
363 ]
Mike Kleina04bb452017-02-09 12:24:07 -0500364 sources =
365 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
366 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
367}
368
mtkleina45be612016-08-29 15:22:10 -0700369optional("fontmgr_android") {
370 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700371
372 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500373 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700374 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700375 ]
376 sources = [
377 "src/ports/SkFontMgr_android.cpp",
378 "src/ports/SkFontMgr_android_factory.cpp",
379 "src/ports/SkFontMgr_android_parser.cpp",
380 ]
381}
382
mtkleind2e39db2016-09-07 07:52:55 -0700383optional("fontmgr_custom") {
384 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
385
386 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500387 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700388 ]
389 sources = [
390 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500391 "src/ports/SkFontMgr_custom.h",
392 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700393 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500394 "src/ports/SkFontMgr_custom_embedded.cpp",
395 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700396 ]
397}
398
Hal Canaryff2742e2018-01-30 11:35:47 -0500399optional("fontmgr_empty") {
400 enabled = skia_enable_fontmgr_empty
401 sources = [
402 "src/ports/SkFontMgr_empty_factory.cpp",
403 ]
404}
405
mtklein3cc22182016-08-29 13:26:14 -0700406optional("fontmgr_fontconfig") {
407 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700408
409 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500410 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700411 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700412 ]
413 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700414 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700415 "src/ports/SkFontConfigInterface_direct.cpp",
416 "src/ports/SkFontConfigInterface_direct_factory.cpp",
417 "src/ports/SkFontMgr_FontConfigInterface.cpp",
418 "src/ports/SkFontMgr_fontconfig.cpp",
419 "src/ports/SkFontMgr_fontconfig_factory.cpp",
420 ]
421}
422
mtkleincdedd0e2016-09-12 15:15:44 -0700423optional("fontmgr_fuchsia") {
424 enabled = is_fuchsia && skia_use_freetype
425
426 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500427 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700428 ]
429 sources = [
430 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500431 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700432 "src/ports/SkFontMgr_custom_empty_factory.cpp",
433 ]
434}
435
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700436if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400437 executable("sksllex") {
438 sources = [
439 "src/sksl/lex/Main.cpp",
440 "src/sksl/lex/NFA.cpp",
441 "src/sksl/lex/RegexNode.cpp",
442 "src/sksl/lex/RegexParser.cpp",
443 ]
444 include_dirs = [ "src/sksl/lex" ]
445 }
446
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700447 action("run_sksllex") {
448 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400449 deps = [
450 ":sksllex(//gn/toolchain:$host_toolchain)",
451 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700452 sources = [
453 "src/sksl/lex/layout.lex",
454 "src/sksl/lex/sksl.lex",
455 ]
456
457 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
458 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
459 outputs = [
460 "$target_out_dir/" +
461 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
462 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
463 # confused due to the same file being named by two different paths
464 ]
465 sksllex_path = "$root_out_dir/"
466 sksllex_path += "sksllex"
467 if (host_os == "win") {
468 sksllex_path += ".exe"
469 }
470 args = [
471 rebase_path(sksllex_path),
472 rebase_path("bin/clang-format"),
473 rebase_path("src"),
474 ]
475 }
476} else {
477 group("run_sksllex") {
478 }
479}
480
481if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400482 executable("skslc") {
483 defines = [ "SKSL_STANDALONE" ]
484 sources = [
485 "src/sksl/SkSLMain.cpp",
486 ]
487 sources += skia_sksl_sources
488 include_dirs = [
489 "src/gpu",
490 "src/sksl",
491 ]
492 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500493 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400494 "//third_party/spirv-tools",
495 ]
496 }
497
498 skia_gpu_processor_outputs = []
499 foreach(src, skia_gpu_processor_sources) {
500 dir = get_path_info(src, "dir")
501 name = get_path_info(src, "name")
502
503 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
504 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
505 skia_gpu_processor_outputs += [
506 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
507 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
508 # confused due to the same file being named by two different paths
509 ]
510 }
511
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500512 action("create_sksl_enums") {
513 script = "gn/create_sksl_enums.py"
514 sources = [
515 "include/private/GrSharedEnums.h",
516 ]
517 outputs = [
518 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500519 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500520 ]
521 args = [
522 rebase_path(sources[0]),
523 rebase_path(outputs[0]),
524 ]
525 }
526
Ethan Nicholas762466e2017-06-29 10:03:38 -0400527 action("compile_processors") {
528 script = "gn/compile_processors.py"
529 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500530 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400531 ":skslc(//gn/toolchain:$host_toolchain)",
532 ]
533 sources = skia_gpu_processor_sources
534 outputs = skia_gpu_processor_outputs
535 skslc_path = "$root_out_dir/"
536 if (host_toolchain != default_toolchain_name) {
537 skslc_path += "$host_toolchain/"
538 }
539 skslc_path += "skslc"
540 if (host_os == "win") {
541 skslc_path += ".exe"
542 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400543 args = [
544 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400545 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400546 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400547 args += rebase_path(skia_gpu_processor_sources)
548 }
549} else {
550 skia_gpu_processor_outputs = []
551 group("compile_processors") {
552 }
553}
554
mtklein06c35c02016-09-20 12:28:12 -0700555optional("gpu") {
556 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400557 deps = [
558 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700559 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400560 ]
mtkleine9fb3d52016-09-20 15:11:46 -0700561 public_defines = []
562
Brian Salomon3d6801e2017-12-11 10:06:31 -0500563 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
mtklein06c35c02016-09-20 12:28:12 -0700564
565 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500566 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700567 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400568 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700569 if (is_android) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500570 sources += [ "src/gpu/gl/android/GrGLMakeNativeInterface_android.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400571
572 # this lib is required to link against AHardwareBuffer
573 if (defined(ndk_api) && ndk_api >= 26) {
574 libs += [ "android" ]
575 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400576 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500577 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400578 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700579 } else if (is_linux) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500580 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500581 libs += [
582 "GL",
583 "GLU",
584 ]
mtklein06c35c02016-09-20 12:28:12 -0700585 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500586 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800587 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500588 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400589 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500590 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400591 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700592 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500593 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700594 }
mtkleine9fb3d52016-09-20 15:11:46 -0700595
596 if (skia_use_vulkan) {
597 public_defines += [ "SK_VULKAN" ]
598 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700599 if (skia_enable_vulkan_debug_layers) {
600 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
601 }
Greg Danielafb7ec72017-12-07 12:48:30 -0500602 if (skia_vulkan_header != "") {
603 public_defines += [ "SK_VULKAN_HEADER=\"$skia_vulkan_header\"" ]
604 } else {
605 if (is_skia_dev_build) {
606 public_defines += [ "SK_VULKAN_HEADER=\"GrVulkanDefines.h\"" ]
607 }
608 }
mtkleine9fb3d52016-09-20 15:11:46 -0700609 }
Brian Salomon5f33a8c2018-02-26 14:32:39 -0500610 if (skia_use_legacy_gpu_pixel_ops) {
611 public_defines += [ "SK_LEGACY_GPU_PIXEL_OPS" ]
612 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400613 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400614 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400615 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
616 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400617
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400618 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400619 if (skia_use_metal) {
620 public_defines += [ "SK_METAL" ]
621 sources += skia_metal_sources
622 libs += [ "Metal.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400623 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400624 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500625
626 if (skia_enable_atlas_text) {
627 sources += skia_atlas_text_sources
628 }
mtklein06c35c02016-09-20 12:28:12 -0700629}
630
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400631optional("heif") {
632 enabled = skia_use_libheif
633 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
634
635 deps = []
636
637 sources = [
638 "src/codec/SkHeifCodec.cpp",
639 ]
640}
641
mtklein63213812016-08-24 09:55:56 -0700642optional("jpeg") {
643 enabled = skia_use_libjpeg_turbo
644 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
645
mtklein63213812016-08-24 09:55:56 -0700646 deps = [
647 "//third_party/libjpeg-turbo:libjpeg",
648 ]
649 sources = [
650 "src/codec/SkJpegCodec.cpp",
651 "src/codec/SkJpegDecoderMgr.cpp",
652 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700653 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400654 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700655 ]
656}
657
658optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500659 enabled = skia_use_zlib && skia_enable_pdf
660 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700661
mtklein63213812016-08-24 09:55:56 -0700662 deps = [
663 "//third_party/zlib",
664 ]
brettwb9447282016-09-01 14:24:39 -0700665 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700666 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700667
668 if (skia_use_sfntly) {
669 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500670 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700671 }
672}
673
674optional("png") {
675 enabled = skia_use_libpng
676 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
677
mtklein63213812016-08-24 09:55:56 -0700678 deps = [
679 "//third_party/libpng",
680 ]
681 sources = [
682 "src/codec/SkIcoCodec.cpp",
683 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400684 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700685 ]
686}
687
scroggof84ad642016-10-31 09:02:57 -0700688optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400689 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700690 public_defines = [ "SK_CODEC_DECODES_RAW" ]
691
692 deps = [
693 "//third_party/dng_sdk",
694 "//third_party/libjpeg-turbo:libjpeg",
695 "//third_party/piex",
696 ]
697
698 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
699 # Skia.
700 configs_to_remove = [ "//gn:no_exceptions" ]
701
702 sources = [
703 "src/codec/SkRawAdapterCodec.cpp",
704 "src/codec/SkRawCodec.cpp",
705 ]
706}
707
Mike Kleinfb333552018-01-25 12:49:37 -0500708optional("skcms") {
709 enabled = skia_use_skcms
710
711 deps = [
712 "//third_party/skcms",
713 ]
714 sources = [
715 # TODO
716 ]
717}
718
mtklein3cc22182016-08-29 13:26:14 -0700719optional("typeface_freetype") {
720 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700721
722 deps = [
723 "//third_party/freetype2",
724 ]
725 sources = [
726 "src/ports/SkFontHost_FreeType.cpp",
727 "src/ports/SkFontHost_FreeType_common.cpp",
728 ]
729}
730
mtklein457b42a2016-08-23 13:56:37 -0700731optional("webp") {
732 enabled = skia_use_libwebp
733 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
734
mtklein457b42a2016-08-23 13:56:37 -0700735 deps = [
736 "//third_party/libwebp",
737 ]
738 sources = [
739 "src/codec/SkWebpAdapterCodec.cpp",
740 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400741 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700742 ]
mtkleineb3c4252016-08-23 07:38:09 -0700743}
744
mtklein63213812016-08-24 09:55:56 -0700745optional("xml") {
746 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000747 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700748
mtklein63213812016-08-24 09:55:56 -0700749 deps = [
750 "//third_party/expat",
751 ]
752 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500753 "src/svg/SkSVGCanvas.cpp",
754 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700755 "src/xml/SkDOM.cpp",
756 "src/xml/SkXMLParser.cpp",
757 "src/xml/SkXMLWriter.cpp",
758 ]
759}
760
mtkleinc04ff472016-06-23 10:29:30 -0700761component("skia") {
762 public_configs = [ ":skia_public" ]
763 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700764
765 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700766 ":arm64",
767 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700768 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700769 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500770 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700771 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700772 ":fontmgr_custom",
Hal Canaryff2742e2018-01-30 11:35:47 -0500773 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700774 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700775 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700776 ":gpu",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400777 ":heif",
mtklein63213812016-08-24 09:55:56 -0700778 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700779 ":none",
mtklein63213812016-08-24 09:55:56 -0700780 ":pdf",
781 ":png",
scroggof84ad642016-10-31 09:02:57 -0700782 ":raw",
Mike Kleinfb333552018-01-25 12:49:37 -0500783 ":skcms",
mtklein9b8583d2016-08-24 17:32:30 -0700784 ":sse2",
785 ":sse41",
786 ":sse42",
787 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700788 ":webp",
mtklein63213812016-08-24 09:55:56 -0700789 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700790 ]
791
Chinmay Garde43f115c2016-11-16 15:04:12 -0800792 # This file (and all GN files in Skia) are designed to work with an
793 # empty sources assignment filter; we handle all that explicitly.
794 # We clear the filter here for clients who may have set up a global filter.
795 set_sources_assignment_filter([])
796
mtkleinc04ff472016-06-23 10:29:30 -0700797 sources = []
brettwb9447282016-09-01 14:24:39 -0700798 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700799 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500800 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700801 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400802 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500803 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700804 "src/android/SkBitmapRegionCodec.cpp",
805 "src/android/SkBitmapRegionDecoder.cpp",
806 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400807 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700808 "src/codec/SkBmpCodec.cpp",
809 "src/codec/SkBmpMaskCodec.cpp",
810 "src/codec/SkBmpRLECodec.cpp",
811 "src/codec/SkBmpStandardCodec.cpp",
812 "src/codec/SkCodec.cpp",
813 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700814 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700815 "src/codec/SkMaskSwizzler.cpp",
816 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700817 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700818 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700819 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700820 "src/codec/SkSwizzler.cpp",
821 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700822 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700823 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700824 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700825 "src/ports/SkMemory_malloc.cpp",
826 "src/ports/SkOSFile_stdio.cpp",
827 "src/sfnt/SkOTTable_name.cpp",
828 "src/sfnt/SkOTUtils.cpp",
829 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700830 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700831 ]
brettwb9447282016-09-01 14:24:39 -0700832
mtklein7d6fb2c2016-08-25 14:50:44 -0700833 libs = []
834
mtkleinc04ff472016-06-23 10:29:30 -0700835 if (is_win) {
836 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400837 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700838 "src/ports/SkDebug_win.cpp",
839 "src/ports/SkFontHost_win.cpp",
840 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500841 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700842 "src/ports/SkImageEncoder_WIC.cpp",
843 "src/ports/SkImageGeneratorWIC.cpp",
844 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700845 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700846 "src/ports/SkScalerContext_win_dw.cpp",
847 "src/ports/SkTLS_win.cpp",
848 "src/ports/SkTypeface_win_dw.cpp",
849 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400850 libs += [
851 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500852 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400853 "Ole32.lib",
854 "OleAut32.lib",
855 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500856 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400857 ]
mtkleinc04ff472016-06-23 10:29:30 -0700858 } else {
859 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700860 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700861 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700862 "src/ports/SkTLS_pthread.cpp",
863 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400864 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700865 }
866
mtklein7d6fb2c2016-08-25 14:50:44 -0700867 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500868 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500869 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500870 deps += [ "//third_party/cpu-features" ]
871 }
mtklein06c35c02016-09-20 12:28:12 -0700872 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700873 libs += [
874 "EGL",
875 "GLESv2",
876 "log",
877 ]
878 }
879
mtkleinc04ff472016-06-23 10:29:30 -0700880 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700881 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700882 }
883
884 if (is_mac) {
885 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700886 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700887 "src/ports/SkFontHost_mac.cpp",
888 "src/ports/SkImageEncoder_CG.cpp",
889 "src/ports/SkImageGeneratorCG.cpp",
890 ]
mtklein09e61f72016-08-23 13:35:28 -0700891 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400892 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
893 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700894 "ApplicationServices.framework",
895 "OpenGL.framework",
896 ]
mtkleinc04ff472016-06-23 10:29:30 -0700897 }
abarth6fc8ff02016-07-15 15:15:15 -0700898
Mike Klein7d302882016-11-03 14:06:31 -0400899 if (is_ios) {
900 sources += [
901 "src/ports/SkDebug_stdio.cpp",
902 "src/ports/SkFontHost_mac.cpp",
903 "src/ports/SkImageEncoder_CG.cpp",
904 "src/ports/SkImageGeneratorCG.cpp",
905 ]
906 libs += [
907 "CoreFoundation.framework",
908 "CoreGraphics.framework",
909 "CoreText.framework",
910 "ImageIO.framework",
911 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400912
913 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
914 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400915 ]
916 }
917
abarth6fc8ff02016-07-15 15:15:15 -0700918 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700919 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700920 }
mtkleinc04ff472016-06-23 10:29:30 -0700921}
922
mtkleinc095df52016-08-24 12:23:52 -0700923# Targets guarded by skia_enable_tools may use //third_party freely.
924if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500925 # Used by gn_to_bp.py to list our public include dirs.
926 source_set("public") {
927 configs += [ ":skia_public" ]
928 }
929
Mike Kleinc36dedf2016-11-18 09:35:28 -0500930 config("skia.h_config") {
931 include_dirs = [ "$target_gen_dir" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500932 if (skia_use_vulkan) {
933 # So we can get the header which includes vulkan
934 include_dirs += [ "tools/gpu/vk" ]
935 }
Mike Kleinc36dedf2016-11-18 09:35:28 -0500936 }
937 action("skia.h") {
938 public_configs = [ ":skia.h_config" ]
939 skia_h = "$target_gen_dir/skia.h"
940 script = "gn/find_headers.py"
Greg Danielc819e662017-04-19 16:39:45 -0400941 args = [ rebase_path(skia_h, root_build_dir) ] +
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000942 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -0500943 depfile = "$skia_h.deps"
944 outputs = [
945 skia_h,
946 ]
947 }
948
949 if (skia_enable_gpu && target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -0500950 executable("fiddle") {
951 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -0500952 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500953 "tools/fiddle/draw.cpp",
954 "tools/fiddle/fiddle_main.cpp",
955 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400956
957 if (skia_use_egl) {
958 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400959 } else {
960 sources += [ "tools/fiddle/null_context.cpp" ]
961 }
Joe Gregorio1e735c02017-04-19 14:05:14 -0400962 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -0500963 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -0400964 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -0500965 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -0500966 ":skia",
967 ":skia.h",
968 ]
969 }
970 }
971
972 if (skia_enable_gpu) {
973 source_set("public_headers_warnings_check") {
974 sources = [
975 "tools/public_headers_warnings_check.cpp",
976 ]
977 configs -= [ "//gn:warnings_except_public_headers" ]
978 deps = [
979 ":skia",
980 ":skia.h",
981 ]
982 }
983 }
984
mtkleinc095df52016-08-24 12:23:52 -0700985 template("test_lib") {
986 config(target_name + "_config") {
987 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700988 if (defined(invoker.public_defines)) {
989 defines = invoker.public_defines
990 }
mtklein25c81d42016-07-27 13:55:26 -0700991 }
mtkleinc095df52016-08-24 12:23:52 -0700992 source_set(target_name) {
993 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
994 public_configs = [
995 ":" + target_name + "_config",
996 ":skia_private",
997 ]
998
999 if (!defined(deps)) {
1000 deps = []
1001 }
1002 deps += [ ":skia" ]
1003 testonly = true
1004 }
mtklein25c81d42016-07-27 13:55:26 -07001005 }
mtklein25c81d42016-07-27 13:55:26 -07001006
Mike Kleine6682eb2017-01-05 10:54:57 -05001007 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001008 if (is_ios) {
1009 app_name = target_name
1010 gen_path = target_gen_dir
1011
1012 action("${app_name}_generate_info_plist") {
1013 script = "//gn/gen_plist_ios.py"
1014 outputs = [
1015 "$gen_path/${app_name}_Info.plist",
1016 ]
1017 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1018 }
1019
1020 bundle_data("${app_name}_bundle_info_plist") {
1021 public_deps = [
1022 ":${app_name}_generate_info_plist",
1023 ]
1024 sources = [
1025 "$gen_path/${app_name}_Info.plist",
1026 ]
1027 outputs = [
1028 "{{bundle_root_dir}}/Info.plist",
1029 ]
1030 }
1031
Jim Van Verth329c5a62017-11-29 11:42:33 -05001032 bundle_ios_data =
1033 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1034
1035 if (bundle_ios_data) {
1036 has_skps =
1037 "True" == exec_script("//gn/checkdir.py",
1038 [ rebase_path("skps", root_build_dir) ],
1039 "trim string")
1040 bundle_data("${app_name}_bundle_resources") {
1041 sources = [
1042 "resources",
1043 ]
1044 outputs = [
1045 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1046 "{{bundle_resources_dir}}/data/resources",
1047 ]
1048 }
1049
1050 if (has_skps) {
1051 bundle_data("${app_name}_bundle_skps") {
1052 sources = [
1053 "skps",
1054 ]
1055 outputs = [
1056 # Store in same folder as resources
1057 "{{bundle_resources_dir}}/data/skps",
1058 ]
1059 }
1060 }
1061 }
1062
Jim Van Verth443a9132017-11-28 09:45:26 -05001063 executable("${app_name}_generate_executable") {
1064 forward_variables_from(invoker,
1065 "*",
1066 [
1067 "output_name",
1068 "visibility",
1069 "is_shared_library",
1070 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001071 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001072 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001073 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1074 }
1075
1076 bundle_data("${app_name}_bundle_executable") {
1077 public_deps = [
1078 ":${app_name}_generate_executable",
1079 ]
1080 sources = [
1081 "$gen_path/$app_name",
1082 ]
1083 outputs = [
1084 "{{bundle_executable_dir}}/$app_name",
1085 ]
1086 testonly = true
1087 }
1088
1089 create_bundle("$app_name") {
1090 product_type = "com.apple.product-type.application"
1091 testonly = true
1092
1093 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1094 bundle_resources_dir = bundle_root_dir
1095 bundle_executable_dir = bundle_root_dir
1096 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1097
1098 deps = [
1099 ":${app_name}_bundle_executable",
1100 ":${app_name}_bundle_info_plist",
1101 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001102 if (bundle_ios_data) {
1103 deps += [ ":${app_name}_bundle_resources" ]
1104 if (has_skps) {
1105 deps += [ ":${app_name}_bundle_skps" ]
1106 }
1107 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001108
1109 # should only code sign when running on a device, not the simulator
1110 if (target_cpu != "x64") {
1111 code_signing_script = "//gn/codesign_ios.py"
1112 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1113 code_signing_outputs = [
1114 "$bundle_root_dir/_CodeSignature/CodeResources",
1115 "$bundle_root_dir/embedded.mobileprovision",
1116 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001117 code_signing_args = [
1118 rebase_path("$bundle_root_dir", root_build_dir),
1119 skia_ios_identity,
1120 skia_ios_profile,
1121 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001122 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001123 }
1124 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001125 # !is_ios
1126
1127 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1128 shared_library("lib" + target_name) {
1129 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1130 configs += [ ":skia_private" ]
1131 testonly = true
1132 }
1133 } else {
1134 _executable = target_name
1135 executable(_executable) {
1136 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1137 configs += [ ":skia_private" ]
1138 testonly = true
1139 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001140 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001141 if (is_android && skia_android_serial != "" && defined(_executable)) {
1142 action("push_" + target_name) {
1143 script = "gn/push_to_android.py"
1144 deps = [
1145 ":" + _executable,
1146 ]
1147 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1148 outputs = [
1149 _stamp,
1150 ]
1151 args = [
1152 rebase_path("$root_build_dir/$_executable"),
1153 skia_android_serial,
1154 rebase_path(_stamp),
1155 ]
1156 testonly = true
1157 }
Mike Klein7d921032017-01-05 12:20:41 -05001158 }
1159 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001160 }
1161
mtkleinc095df52016-08-24 12:23:52 -07001162 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001163 public_include_dirs = []
1164 if (skia_enable_gpu) {
1165 public_defines = []
1166 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001167
1168 deps = []
mtklein38925aa2016-09-21 10:11:25 -07001169 sources = [
1170 "tools/gpu/GrContextFactory.cpp",
1171 "tools/gpu/GrTest.cpp",
1172 "tools/gpu/TestContext.cpp",
Brian Salomoncbcb0a12017-11-19 13:20:13 -05001173 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001174 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -07001175 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001176 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
1177 "tools/gpu/gl/debug/GrBufferObj.cpp",
1178 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
1179 "tools/gpu/gl/debug/GrProgramObj.cpp",
1180 "tools/gpu/gl/debug/GrShaderObj.cpp",
1181 "tools/gpu/gl/debug/GrTextureObj.cpp",
1182 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
1183 "tools/gpu/gl/null/NullGLTestContext.cpp",
Brian Salomoncfe910d2017-07-06 16:40:18 -04001184 "tools/gpu/mock/MockTestContext.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001185 ]
1186 libs = []
mtklein25c81d42016-07-27 13:55:26 -07001187
Kevin Lubick4a24e102017-03-29 11:19:01 -04001188 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -07001189 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -04001190 } else if (is_ios) {
1191 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1192 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -07001193 } else if (is_linux) {
1194 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001195 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -07001196 } else if (is_mac) {
1197 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001198 } else if (is_win) {
1199 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1200 libs += [
1201 "Gdi32.lib",
1202 "OpenGL32.lib",
1203 ]
mtklein38925aa2016-09-21 10:11:25 -07001204 }
mtklein6ef69992016-09-14 06:12:09 -07001205
Greg Daniel6b7e0e22017-07-12 16:21:09 -04001206 cflags_objcc = [ "-fobjc-arc" ]
1207
Mike Kleinc168a3a2016-11-14 14:53:13 +00001208 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +00001209 deps += [ "//third_party/angle2" ]
1210 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1211 }
mtkleind68f9b02016-09-23 13:18:41 -07001212 if (skia_use_vulkan) {
1213 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Greg Daniel35970ec2017-11-10 10:03:05 -05001214 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
mtkleind68f9b02016-09-23 13:18:41 -07001215 }
Greg Danielb76a72a2017-07-13 15:07:54 -04001216 if (skia_use_metal) {
1217 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
1218 }
mtkleina627b5c2016-09-20 13:36:47 -07001219 }
mtklein25c81d42016-07-27 13:55:26 -07001220 }
mtklein25c81d42016-07-27 13:55:26 -07001221
mtkleinc095df52016-08-24 12:23:52 -07001222 test_lib("flags") {
1223 public_include_dirs = [ "tools/flags" ]
1224 sources = [
1225 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001226 ]
1227 }
1228 test_lib("common_flags") {
1229 public_include_dirs = [ "tools/flags" ]
1230 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001231 "tools/flags/SkCommonFlags.cpp",
1232 "tools/flags/SkCommonFlagsConfig.cpp",
1233 ]
1234 deps = [
mtklein046cb562016-09-16 10:23:12 -07001235 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001236 ":gpu_tool_utils",
1237 ]
1238 }
mtklein25c81d42016-07-27 13:55:26 -07001239
mtkleinc095df52016-08-24 12:23:52 -07001240 test_lib("tool_utils") {
1241 public_include_dirs = [
1242 "tools",
1243 "tools/debugger",
Ben Wagner483c7722018-02-20 17:06:07 -05001244 "tools/fonts",
mtkleinc095df52016-08-24 12:23:52 -07001245 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001246 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001247 ]
1248 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001249 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001250 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001251 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001252 "tools/ProcStats.cpp",
1253 "tools/Resources.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001254 "tools/UrlDataManager.cpp",
1255 "tools/debugger/SkDebugCanvas.cpp",
1256 "tools/debugger/SkDrawCommand.cpp",
1257 "tools/debugger/SkJsonWriteBuffer.cpp",
1258 "tools/debugger/SkObjectParser.cpp",
Brian Salomon5f33a8c2018-02-26 14:32:39 -05001259 "tools/fonts/SkRandomScalerContext.cpp",
1260 "tools/fonts/SkTestFontMgr.cpp",
1261 "tools/fonts/SkTestScalerContext.cpp",
1262 "tools/fonts/sk_tool_utils_font.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001263 "tools/picture_utils.cpp",
1264 "tools/random_parse_path.cpp",
1265 "tools/sk_tool_utils.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001266 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001267 "tools/trace/SkChromeTracingTracer.cpp",
1268 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001269 "tools/trace/SkDebugfTracer.cpp",
1270 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001271 "tools/trace/SkEventTracingPriv.cpp",
1272 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001273 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001274 libs = []
1275 if (is_ios) {
1276 sources += [ "tools/ios_utils.m" ]
1277 libs += [ "Foundation.framework" ]
1278 }
mtkleinc095df52016-08-24 12:23:52 -07001279 deps = [
mtklein046cb562016-09-16 10:23:12 -07001280 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001281 ":flags",
1282 "//third_party/libpng",
1283 ]
1284 public_deps = [
1285 "//third_party/jsoncpp",
1286 ]
1287 }
mtklein25c81d42016-07-27 13:55:26 -07001288
Mike Klein6e744122016-10-27 12:21:40 -04001289 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001290 test_lib("gm") {
1291 public_include_dirs = [ "gm" ]
1292 sources = gm_sources
1293 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001294 ":experimental_sksg",
scroggo19b91532016-10-24 09:03:26 -07001295 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001296 ":gpu_tool_utils",
1297 ":skia",
1298 ":tool_utils",
1299 ]
1300 }
mtklein25c81d42016-07-27 13:55:26 -07001301
Mike Klein6e744122016-10-27 12:21:40 -04001302 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001303 test_lib("tests") {
1304 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001305 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001306 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001307 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001308 }
mtkleinc095df52016-08-24 12:23:52 -07001309 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001310 ":experimental_sksg",
mtkleinc095df52016-08-24 12:23:52 -07001311 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001312 ":skia",
1313 ":tool_utils",
1314 "//third_party/libpng",
1315 "//third_party/zlib",
1316 ]
Hal Canaryff2742e2018-01-30 11:35:47 -05001317 if (skia_use_expat) {
1318 deps += [ ":experimental_svg_model" ]
1319 }
Mike Kleind63442d2017-03-27 14:16:04 -04001320 public_deps = [
1321 ":gpu_tool_utils", # Test.h #includes headers from this target.
1322 ]
mtkleinc095df52016-08-24 12:23:52 -07001323 }
mtklein2f3416d2016-08-02 16:02:05 -07001324
Mike Klein6e744122016-10-27 12:21:40 -04001325 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001326 test_lib("bench") {
1327 public_include_dirs = [ "bench" ]
1328 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001329 deps = [
1330 ":flags",
1331 ":gm",
1332 ":gpu_tool_utils",
1333 ":skia",
1334 ":tool_utils",
1335 ]
1336 }
mtklein2b6870c2016-07-28 14:17:33 -07001337
Florin Malita54f65c42018-01-16 17:04:30 -05001338 test_lib("experimental_skottie") {
1339 public_include_dirs = [ "experimental/skottie" ]
Florin Malita094ccde2017-12-30 12:27:00 -05001340 include_dirs = [ "tools" ]
1341 sources = [
Florin Malita54f65c42018-01-16 17:04:30 -05001342 "experimental/skottie/Skottie.cpp",
1343 "experimental/skottie/SkottieAnimator.cpp",
Florin Malitacf8ed522018-01-25 15:27:33 -05001344 "experimental/skottie/SkottieParser.cpp",
Florin Malita54f65c42018-01-16 17:04:30 -05001345 "experimental/skottie/SkottieProperties.cpp",
Florin Malita094ccde2017-12-30 12:27:00 -05001346 ]
1347 deps = [
1348 ":experimental_sksg",
1349 ":skia",
1350 "//third_party/jsoncpp",
1351 ]
1352 }
1353
mtkleinc095df52016-08-24 12:23:52 -07001354 test_lib("experimental_svg_model") {
1355 public_include_dirs = [ "experimental/svg/model" ]
1356 sources = [
1357 "experimental/svg/model/SkSVGAttribute.cpp",
1358 "experimental/svg/model/SkSVGAttributeParser.cpp",
1359 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -05001360 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001361 "experimental/svg/model/SkSVGContainer.cpp",
1362 "experimental/svg/model/SkSVGDOM.cpp",
1363 "experimental/svg/model/SkSVGEllipse.cpp",
Florin Malitadf007e12017-10-09 15:14:13 -04001364 "experimental/svg/model/SkSVGGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001365 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001366 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001367 "experimental/svg/model/SkSVGNode.cpp",
1368 "experimental/svg/model/SkSVGPath.cpp",
Florin Malita1aa1bb62017-10-11 14:34:33 -04001369 "experimental/svg/model/SkSVGPattern.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001370 "experimental/svg/model/SkSVGPoly.cpp",
Florin Malitacc6cc292017-10-09 16:05:30 -04001371 "experimental/svg/model/SkSVGRadialGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001372 "experimental/svg/model/SkSVGRect.cpp",
1373 "experimental/svg/model/SkSVGRenderContext.cpp",
1374 "experimental/svg/model/SkSVGSVG.cpp",
1375 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001376 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001377 "experimental/svg/model/SkSVGTransformableNode.cpp",
Florin Malita6a69c052017-10-11 14:02:11 -04001378 "experimental/svg/model/SkSVGUse.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001379 "experimental/svg/model/SkSVGValue.cpp",
1380 ]
1381 deps = [
1382 ":skia",
1383 ]
1384 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001385
Florin Malita4aa44412017-12-19 12:21:02 -05001386 test_lib("experimental_sksg") {
1387 public_include_dirs = [
1388 "experimental/sksg",
1389 "experimental/sksg/effects",
1390 "experimental/sksg/geometry",
1391 "experimental/sksg/paint",
1392 ]
1393 sources = [
1394 "experimental/sksg/SkSGDraw.cpp",
1395 "experimental/sksg/SkSGEffectNode.cpp",
1396 "experimental/sksg/SkSGGeometryNode.cpp",
1397 "experimental/sksg/SkSGGroup.cpp",
Florin Malita49328072018-01-08 12:51:12 -05001398 "experimental/sksg/SkSGImage.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001399 "experimental/sksg/SkSGInvalidationController.cpp",
1400 "experimental/sksg/SkSGNode.cpp",
1401 "experimental/sksg/SkSGPaintNode.cpp",
1402 "experimental/sksg/SkSGRenderNode.cpp",
Florin Malita35efaa82018-01-22 12:57:06 -05001403 "experimental/sksg/SkSGScene.cpp",
Florin Malita38ea40e2018-01-29 16:31:14 -05001404 "experimental/sksg/effects/SkSGClipEffect.cpp",
Florin Malita5f9102f2018-01-10 13:36:22 -05001405 "experimental/sksg/effects/SkSGMaskEffect.cpp",
Florin Malitac0034172018-01-08 16:42:59 -05001406 "experimental/sksg/effects/SkSGOpacityEffect.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001407 "experimental/sksg/effects/SkSGTransform.cpp",
Florin Malita16d0ad02018-01-19 15:07:29 -05001408 "experimental/sksg/geometry/SkSGGeometryTransform.cpp",
Florin Malitae6345d92018-01-03 23:37:54 -05001409 "experimental/sksg/geometry/SkSGMerge.cpp",
Florin Malita047ae272017-12-27 11:13:13 -05001410 "experimental/sksg/geometry/SkSGPath.cpp",
Florin Malita97b3d2b2018-02-20 11:26:15 -05001411 "experimental/sksg/geometry/SkSGPlane.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001412 "experimental/sksg/geometry/SkSGRect.cpp",
Florin Malita51012ce2018-01-31 17:06:59 -05001413 "experimental/sksg/geometry/SkSGText.cpp",
Florin Malita51b8c892018-01-07 08:54:24 -05001414 "experimental/sksg/geometry/SkSGTrimEffect.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001415 "experimental/sksg/paint/SkSGColor.cpp",
Florin Malita6aaee592018-01-12 12:25:09 -05001416 "experimental/sksg/paint/SkSGGradient.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001417 ]
1418 deps = [
1419 ":skia",
1420 ]
1421 }
1422
Kevin Lubickebf648e2017-09-21 13:45:16 -04001423 if (target_cpu != "wasm") {
1424 test_lib("views") {
1425 public_include_dirs = [ "include/views" ]
1426 sources = [
1427 "src/views/SkEvent.cpp",
1428 "src/views/SkEventSink.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001429 "src/views/SkTouchGesture.cpp",
1430 "src/views/SkView.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001431 ]
Brian Osman34755e22016-12-05 09:46:02 -05001432 }
Brian Osman16adfa32016-10-18 14:42:44 -04001433 }
1434
Mike Klein38af9432016-11-11 11:39:44 -05001435 if (skia_use_lua) {
1436 test_lib("lua") {
1437 public_include_dirs = []
1438 sources = [
1439 "src/utils/SkLua.cpp",
1440 "src/utils/SkLuaCanvas.cpp",
1441 ]
1442 deps = [
1443 "//third_party/lua",
1444 ]
1445 }
1446
Mike Kleine6682eb2017-01-05 10:54:57 -05001447 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001448 sources = [
1449 "tools/lua/lua_app.cpp",
1450 ]
1451 deps = [
1452 ":lua",
1453 ":skia",
1454 "//third_party/lua",
1455 ]
Mike Klein38af9432016-11-11 11:39:44 -05001456 }
1457
Mike Kleine6682eb2017-01-05 10:54:57 -05001458 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001459 sources = [
1460 "tools/lua/lua_pictures.cpp",
1461 ]
1462 deps = [
1463 ":flags",
1464 ":lua",
1465 ":skia",
1466 ":tool_utils",
1467 "//third_party/lua",
1468 ]
Mike Klein38af9432016-11-11 11:39:44 -05001469 }
1470 }
1471
Cary Clark8032b982017-07-28 11:04:54 -04001472 test_app("bookmaker") {
1473 sources = [
1474 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001475 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001476 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001477 "tools/bookmaker/fiddleParser.cpp",
1478 "tools/bookmaker/includeParser.cpp",
1479 "tools/bookmaker/includeWriter.cpp",
1480 "tools/bookmaker/mdOut.cpp",
1481 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001482 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001483 "tools/bookmaker/spellCheck.cpp",
1484 ]
1485 deps = [
1486 ":flags",
1487 ":skia",
1488 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001489 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001490 ]
1491 }
1492
Kevin Lubickebf648e2017-09-21 13:45:16 -04001493 if (target_cpu != "wasm") {
1494 import("gn/samples.gni")
1495 test_lib("samples") {
1496 public_include_dirs = [ "samplecode" ]
1497 include_dirs = [ "experimental" ]
Yuqian Li56a4a092018-02-12 14:47:34 +08001498 sources = samples_sources
Kevin Lubickebf648e2017-09-21 13:45:16 -04001499 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001500 ":experimental_sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001501 ":experimental_svg_model",
1502 ":flags",
1503 ":gm",
Mike Reed193d3a02018-02-08 15:45:51 -05001504 ":skshaper",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001505 ":tool_utils",
1506 ":views",
1507 ":xml",
1508 ]
Mike Klein38af9432016-11-11 11:39:44 -05001509
Kevin Lubickebf648e2017-09-21 13:45:16 -04001510 if (skia_use_lua) {
1511 sources += [ "samplecode/SampleLua.cpp" ]
1512 deps += [
1513 ":lua",
1514 "//third_party/lua",
1515 ]
1516 }
1517 }
1518 test_app("dm") {
1519 sources = [
1520 "dm/DM.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001521 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001522 "dm/DMJsonWriter.cpp",
1523 "dm/DMSrcSink.cpp",
1524 ]
1525 include_dirs = [ "tests" ]
1526 deps = [
1527 ":common_flags",
Florin Malita54f65c42018-01-16 17:04:30 -05001528 ":experimental_skottie",
Florin Malita4aa44412017-12-19 12:21:02 -05001529 ":experimental_sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001530 ":experimental_svg_model",
1531 ":flags",
1532 ":gm",
1533 ":gpu_tool_utils",
1534 ":skia",
1535 ":tests",
1536 ":tool_utils",
1537 "//third_party/jsoncpp",
1538 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001539 ]
1540 }
Brian Osman16adfa32016-10-18 14:42:44 -04001541 }
1542
Mike Kleina8a51ce2018-01-09 12:34:11 -05001543 if (!is_win) {
1544 test_app("remote_demo") {
1545 sources = [
1546 "tools/remote_demo.cpp",
1547 ]
1548 deps = [
1549 ":skia",
1550 ]
1551 }
1552 }
1553
Mike Kleine6682eb2017-01-05 10:54:57 -05001554 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001555 sources = [
1556 "bench/nanobench.cpp",
1557 ]
1558 deps = [
1559 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001560 ":common_flags",
Florin Malita4aa44412017-12-19 12:21:02 -05001561 ":experimental_sksg",
fmalita6519c212016-09-14 08:05:17 -07001562 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001563 ":flags",
1564 ":gm",
1565 ":gpu_tool_utils",
1566 ":skia",
1567 ":tool_utils",
1568 "//third_party/jsoncpp",
1569 ]
mtklein2b6870c2016-07-28 14:17:33 -07001570 }
halcanary19a97202016-08-03 15:08:04 -07001571
Ravi Mistry10d36c52017-01-31 09:49:18 -05001572 test_app("skpinfo") {
1573 sources = [
1574 "tools/skpinfo.cpp",
1575 ]
1576 deps = [
1577 ":flags",
1578 ":skia",
1579 ]
1580 }
1581
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001582 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001583 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001584 sources = [
1585 "tools/skpbench/skpbench.cpp",
1586 ]
1587 deps = [
1588 ":flags",
1589 ":gpu_tool_utils",
1590 ":skia",
1591 ":tool_utils",
1592 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001593 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001594 }
1595
Hal Canary96c57252018-02-09 11:43:05 -05001596 test_lib("skshaper") {
1597 public_include_dirs = [ "tools/shape" ]
1598 deps = [
1599 ":skia",
1600 ]
1601
Hal Canary8bb40832018-02-08 15:16:28 -05001602 if (target_cpu == "wasm") {
Hal Canary96c57252018-02-09 11:43:05 -05001603 sources = [
1604 "tools/shape/SkShaper_primitive.cpp",
1605 ]
1606 } else {
mtklein6f5df6a2016-08-29 16:01:10 -07001607 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001608 "tools/shape/SkShaper_harfbuzz.cpp",
mtklein6f5df6a2016-08-29 16:01:10 -07001609 ]
Hal Canary96c57252018-02-09 11:43:05 -05001610 deps += [
mtklein6f5df6a2016-08-29 16:01:10 -07001611 "//third_party/harfbuzz",
Ben Wagnera25fbef2017-08-30 13:56:19 -04001612 "//third_party/icu",
mtklein6f5df6a2016-08-29 16:01:10 -07001613 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001614 }
halcanary19a97202016-08-03 15:08:04 -07001615 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001616 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001617 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001618 "tools/shape/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001619 ]
1620 deps = [
1621 ":skia",
Hal Canary96c57252018-02-09 11:43:05 -05001622 ":skshaper",
halcanary3eee9d92016-09-10 07:01:53 -07001623 ]
halcanary3eee9d92016-09-10 07:01:53 -07001624 }
mtklein046cb562016-09-16 10:23:12 -07001625
Matt Sarett9f1c4032017-05-17 10:06:32 -04001626 test_app("create_flutter_test_images") {
1627 sources = [
1628 "tools/create_flutter_test_images.cpp",
1629 ]
1630 deps = [
1631 ":skia",
1632 ":tool_utils",
1633 ]
1634 }
1635
Ben Wagner219f3622017-07-17 15:32:25 -04001636 test_app("create_test_font") {
1637 sources = [
Ben Wagner483c7722018-02-20 17:06:07 -05001638 "tools/fonts/create_test_font.cpp",
Ben Wagner219f3622017-07-17 15:32:25 -04001639 ]
1640 deps = [
1641 ":skia",
1642 ]
1643 assert_no_deps = [
1644 # tool_utils requires the output of this app.
1645 ":tool_utils",
1646 ]
1647 }
1648
Mike Kleine6682eb2017-01-05 10:54:57 -05001649 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001650 sources = [
1651 "tools/get_images_from_skps.cpp",
1652 ]
1653 deps = [
1654 ":flags",
1655 ":skia",
1656 "//third_party/jsoncpp",
1657 ]
mtklein046cb562016-09-16 10:23:12 -07001658 }
mtkleinecbc5262016-09-22 11:51:24 -07001659
Mike Kleine6682eb2017-01-05 10:54:57 -05001660 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001661 sources = [
1662 "tools/colorspaceinfo.cpp",
1663 ]
1664 deps = [
1665 ":flags",
1666 ":skia",
1667 ":tool_utils",
1668 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001669 }
1670
Kevin Lubickebf648e2017-09-21 13:45:16 -04001671 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001672 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001673 sources = [
1674 "tools/skiaserve/Request.cpp",
1675 "tools/skiaserve/Response.cpp",
1676 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001677 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1678 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1679 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1680 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1681 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1682 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1683 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1684 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1685 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001686 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1687 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001688 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1689 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1690 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1691 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1692 ]
1693 deps = [
1694 ":flags",
1695 ":gpu_tool_utils",
1696 ":skia",
1697 ":tool_utils",
1698 "//third_party/jsoncpp",
1699 "//third_party/libmicrohttpd",
1700 "//third_party/libpng",
1701 ]
Mike Klein7d302882016-11-03 14:06:31 -04001702 }
mtkleinecbc5262016-09-22 11:51:24 -07001703 }
kjlubick14f984b2016-10-03 11:49:45 -07001704
Mike Kleine6682eb2017-01-05 10:54:57 -05001705 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001706 include_dirs = [
1707 "tools",
1708 "tools/debugger",
1709 ]
kjlubick14f984b2016-10-03 11:49:45 -07001710 sources = [
Hal Canary24ac42b2017-02-14 13:35:14 -05001711 "fuzz/FuzzCanvas.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001712 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001713 "fuzz/FuzzGradients.cpp",
1714 "fuzz/FuzzParsePath.cpp",
1715 "fuzz/FuzzPathop.cpp",
1716 "fuzz/FuzzScaleToSides.cpp",
1717 "fuzz/fuzz.cpp",
Kevin Lubick2416f962018-02-12 08:26:39 -05001718 "fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
1719 "fuzz/oss_fuzz/FuzzImage.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001720 "fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
1721 "fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001722 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1723 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubickf034d112018-02-08 14:31:24 -05001724 "fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001725 "tools/UrlDataManager.cpp",
1726 "tools/debugger/SkDebugCanvas.cpp",
1727 "tools/debugger/SkDrawCommand.cpp",
1728 "tools/debugger/SkJsonWriteBuffer.cpp",
1729 "tools/debugger/SkObjectParser.cpp",
1730 "tools/picture_utils.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001731 ]
1732 deps = [
1733 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001734 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001735 ":skia",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001736 "//third_party/jsoncpp",
1737 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001738 ]
kjlubick14f984b2016-10-03 11:49:45 -07001739 }
Mike Klein38312422016-10-05 15:41:01 -04001740
Mike Kleine6682eb2017-01-05 10:54:57 -05001741 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001742 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001743 rebase_path("tests/skia_test.cpp"),
1744 rebase_path("tests/Test.cpp"),
1745 ]
caryclark9feb6322016-10-25 08:58:26 -07001746 deps = [
1747 ":flags",
1748 ":gpu_tool_utils",
1749 ":skia",
1750 ":tool_utils",
1751 ]
caryclark9feb6322016-10-25 08:58:26 -07001752 }
1753
Mike Kleine6682eb2017-01-05 10:54:57 -05001754 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001755 sources = [
1756 "tools/DumpRecord.cpp",
1757 "tools/dump_record.cpp",
1758 ]
1759 deps = [
1760 ":flags",
1761 ":skia",
1762 ]
Mike Klein38312422016-10-05 15:41:01 -04001763 }
bungemanfe917272016-10-13 17:36:40 -04001764
Mike Kleine6682eb2017-01-05 10:54:57 -05001765 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001766 sources = [
1767 "tools/skdiff/skdiff.cpp",
1768 "tools/skdiff/skdiff_html.cpp",
1769 "tools/skdiff/skdiff_main.cpp",
1770 "tools/skdiff/skdiff_utils.cpp",
1771 ]
1772 deps = [
1773 ":skia",
1774 ":tool_utils",
1775 ]
bungemanfe917272016-10-13 17:36:40 -04001776 }
halcanarya73d76a2016-10-17 13:19:02 -07001777
Mike Kleine6682eb2017-01-05 10:54:57 -05001778 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001779 sources = [
1780 "tools/skp_parser.cpp",
1781 ]
1782 deps = [
1783 ":skia",
1784 ":tool_utils",
1785 "//third_party/jsoncpp",
1786 ]
halcanarya73d76a2016-10-17 13:19:02 -07001787 }
Brian Osman16adfa32016-10-18 14:42:44 -04001788
Hal Canaryd7b38452017-12-11 17:46:26 -05001789 if (!is_win && skia_enable_gpu) {
1790 test_lib("skqp_lib") {
1791 public_include_dirs = [ "tools/skqp" ]
Hal Canary0e07ad72018-02-08 13:06:56 -05001792 defines =
1793 [ "SK_SKQP_GLOBAL_ERROR_TOLERANCE=$skia_skqp_global_error_tolerance" ]
Hal Canary4689b542018-01-31 11:54:14 -05001794 if (skia_skqp_enable_driver_correctness_workarounds) {
1795 defines += [ "SK_SKQP_ENABLE_DRIVER_CORRECTNESS_WORKAROUNDS" ]
1796 }
Hal Canary75427132017-10-11 16:00:31 -04001797 sources = [
1798 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001799 "tools/skqp/gm_knowledge.cpp",
1800 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001801 ]
1802 deps = [
1803 ":gm",
1804 ":gpu_tool_utils",
1805 ":skia",
1806 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001807 ":tool_utils",
1808 ]
1809 }
1810 test_app("skqp") {
1811 sources = [
1812 "tools/skqp/skqp.cpp",
1813 ]
1814 deps = [
1815 ":skia",
1816 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05001817 ":tool_utils",
Hal Canary75427132017-10-11 16:00:31 -04001818 "//third_party/googletest",
1819 ]
1820 }
1821 }
Hal Canary28f89382017-12-12 09:42:14 -05001822 if (is_android && skia_enable_gpu) {
1823 test_app("skqp_app") {
1824 is_shared_library = true
1825 sources = [
1826 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
1827 ]
1828 deps = [
1829 ":skia",
1830 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05001831 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05001832 ]
1833 libs = [ "android" ]
1834 }
1835 }
Hal Canary75427132017-10-11 16:00:31 -04001836
Hal Canarya9de7602018-01-19 13:08:23 -05001837 test_app("list_gms") {
1838 sources = [
1839 "tools/list_gms.cpp",
1840 ]
1841 deps = [
1842 ":gm",
1843 ":skia",
1844 ]
1845 }
1846 test_app("list_gpu_unit_tests") {
1847 sources = [
1848 "dm/DMGpuTestProcs.cpp",
1849 "tools/list_gpu_unit_tests.cpp",
1850 ]
1851 deps = [
1852 ":skia",
1853 ":tests",
1854 ]
1855 }
1856
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001857 if (skia_enable_gpu) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001858 test_lib("sk_app") {
1859 public_include_dirs = [ "tools/sk_app" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001860 sources = [
Brian Osmaneff04b52017-11-21 13:18:02 -05001861 "tools/sk_app/CommandSet.cpp",
1862 "tools/sk_app/GLWindowContext.cpp",
1863 "tools/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001864 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001865 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001866
Jim Van Verth4e56a912016-10-21 10:58:52 -04001867 if (is_android) {
1868 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001869 "tools/sk_app/android/GLWindowContext_android.cpp",
1870 "tools/sk_app/android/RasterWindowContext_android.cpp",
1871 "tools/sk_app/android/Window_android.cpp",
1872 "tools/sk_app/android/main_android.cpp",
1873 "tools/sk_app/android/surface_glue_android.cpp",
Jim Van Verth4e56a912016-10-21 10:58:52 -04001874 ]
Brian Osman462334e2017-02-09 11:22:57 -05001875 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001876 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001877 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001878 "tools/sk_app/unix/GLWindowContext_unix.cpp",
1879 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
1880 "tools/sk_app/unix/Window_unix.cpp",
Brian Osmanfa916272017-12-01 09:18:20 -05001881 "tools/sk_app/unix/keysym2ucs.c",
Brian Osmaneff04b52017-11-21 13:18:02 -05001882 "tools/sk_app/unix/main_unix.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001883 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001884 libs += [
1885 "GL",
1886 "X11",
1887 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001888 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001889 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001890 "tools/sk_app/win/GLWindowContext_win.cpp",
1891 "tools/sk_app/win/RasterWindowContext_win.cpp",
1892 "tools/sk_app/win/Window_win.cpp",
1893 "tools/sk_app/win/main_win.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001894 ]
Brian Salomon194db172017-08-17 14:37:06 -04001895 if (skia_use_angle) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001896 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04001897 }
Mike Klein43c25262016-10-20 10:17:47 -04001898 } else if (is_mac) {
1899 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001900 "tools/sk_app/mac/GLWindowContext_mac.cpp",
1901 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
1902 "tools/sk_app/mac/Window_mac.cpp",
1903 "tools/sk_app/mac/main_mac.cpp",
Mike Klein43c25262016-10-20 10:17:47 -04001904 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001905 libs += [
1906 "QuartzCore.framework",
1907 "Cocoa.framework",
1908 "Foundation.framework",
1909 ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001910 } else if (is_ios) {
1911 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001912 "tools/sk_app/ios/GLWindowContext_ios.cpp",
1913 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
1914 "tools/sk_app/ios/Window_ios.cpp",
1915 "tools/sk_app/ios/main_ios.cpp",
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001916 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001917 }
1918
1919 if (skia_use_vulkan) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001920 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001921 if (is_android) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001922 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001923 } else if (is_linux) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001924 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
Brian Osman2dd96932016-10-18 15:33:53 -04001925 libs += [ "X11-xcb" ]
1926 } else if (is_win) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001927 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001928 }
1929 }
1930
Brian Osman16adfa32016-10-18 14:42:44 -04001931 deps = [
Brian Osman16adfa32016-10-18 14:42:44 -04001932 ":gpu_tool_utils",
Brian Osman16adfa32016-10-18 14:42:44 -04001933 ":skia",
1934 ":tool_utils",
1935 ":views",
Brian Osman16adfa32016-10-18 14:42:44 -04001936 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001937 if (is_android) {
1938 deps += [ "//third_party/native_app_glue" ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001939 } else if (is_mac || is_ios) {
Mike Klein43c25262016-10-20 10:17:47 -04001940 deps += [ "//third_party/libsdl" ]
1941 }
Brian Salomon194db172017-08-17 14:37:06 -04001942 if (skia_use_angle) {
1943 deps += [ "//third_party/angle2" ]
1944 }
Mike Kleina92c3832016-12-08 09:49:39 -05001945 }
Brian Osman16adfa32016-10-18 14:42:44 -04001946 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001947
Brian Osmaneff04b52017-11-21 13:18:02 -05001948 if (skia_enable_gpu) {
1949 test_app("viewer") {
1950 is_shared_library = is_android
Jim Van Verth329c5a62017-11-29 11:42:33 -05001951 if (is_ios) {
1952 bundle_ios_data = true
1953 }
Brian Osmaneff04b52017-11-21 13:18:02 -05001954 sources = [
Chris Dalton2d18f412018-02-20 13:23:32 -07001955 "tools/viewer/BisectSlide.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05001956 "tools/viewer/GMSlide.cpp",
Brian Osmand67e5182017-12-08 16:46:09 -05001957 "tools/viewer/ImGuiLayer.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05001958 "tools/viewer/ImageSlide.cpp",
1959 "tools/viewer/SKPSlide.cpp",
1960 "tools/viewer/SampleSlide.cpp",
Florin Malita54f65c42018-01-16 17:04:30 -05001961 "tools/viewer/SkottieSlide.cpp",
Florin Malita76a076b2018-02-15 18:40:48 -05001962 "tools/viewer/SlideDir.cpp",
Brian Osman56a24812017-12-19 11:15:16 -05001963 "tools/viewer/StatsLayer.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05001964 "tools/viewer/Viewer.cpp",
1965 ]
1966 libs = []
1967
1968 include_dirs = []
1969 deps = [
Florin Malita54f65c42018-01-16 17:04:30 -05001970 ":experimental_skottie",
Florin Malitabcd07232018-01-31 11:08:58 -05001971 ":experimental_sksg",
Brian Osmaneff04b52017-11-21 13:18:02 -05001972 ":flags",
1973 ":gm",
1974 ":gpu_tool_utils",
1975 ":samples",
1976 ":sk_app",
1977 ":skia",
1978 ":tool_utils",
1979 ":views",
1980 "//third_party/imgui",
1981 "//third_party/jsoncpp",
1982 ]
1983 }
1984 }
1985
1986 if (skia_enable_gpu && !skia_use_angle && (is_linux || is_win || is_mac)) {
1987 test_app("HelloWorld") {
1988 sources = [
1989 "example/HelloWorld.cpp",
1990 ]
1991 libs = []
1992
1993 include_dirs = []
1994 deps = [
1995 ":flags",
1996 ":gpu_tool_utils",
1997 ":sk_app",
1998 ":skia",
1999 ":tool_utils",
2000 ":views",
2001 ]
2002 }
2003 }
2004
Jim Van Verthecfed2b2017-08-30 14:02:50 -04002005 if (skia_enable_gpu && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002006 test_app("SkiaSDLExample") {
2007 sources = [
2008 "example/SkiaSDLExample.cpp",
2009 ]
2010 libs = []
2011 include_dirs = []
2012 deps = [
2013 ":gpu_tool_utils",
2014 ":skia",
2015 "//third_party/libsdl",
2016 ]
2017 }
2018 }
2019
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002020 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2021 action_foreach("generate_mocs") {
2022 script = "gn/call.py"
2023 sources = [
2024 "tools/mdbviz/MainWindow.h",
2025 ]
2026 outputs = [
2027 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2028 ]
2029 args = [
2030 "$skia_qt_path" + "/bin/moc",
2031 "{{source}}",
2032 "-o",
2033 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2034 ]
2035 }
2036 action_foreach("generate_resources") {
2037 script = "gn/call.py"
2038 sources = [
2039 "tools/mdbviz/resources.qrc",
2040 ]
2041 outputs = [
2042 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2043 ]
2044 args = [
2045 "$skia_qt_path" + "/bin/rcc",
2046 "{{source}}",
2047 "-o",
2048 "gen/mdbviz/{{source_name_part}}_res.cpp",
2049 ]
2050 }
2051 test_app("mdbviz") {
2052 if (is_win) {
2053 # on Windows we need to disable some exception handling warnings due to the Qt headers
2054 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2055 }
2056 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002057 "tools/UrlDataManager.cpp",
2058 "tools/debugger/SkDebugCanvas.cpp",
2059 "tools/debugger/SkDrawCommand.cpp",
2060 "tools/debugger/SkJsonWriteBuffer.cpp",
2061 "tools/debugger/SkObjectParser.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002062 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002063 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002064 "tools/mdbviz/main.cpp",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002065 "tools/picture_utils.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002066
2067 # generated files
2068 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2069 "$target_gen_dir/mdbviz/resources_res.cpp",
2070 ]
2071 lib_dirs = [ "$skia_qt_path/lib" ]
2072 libs = [
2073 "Qt5Core.lib",
2074 "Qt5Gui.lib",
2075 "Qt5Widgets.lib",
2076 ]
2077 include_dirs = [
2078 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002079 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002080 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002081 "tools",
2082 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002083 ]
2084 deps = [
2085 ":generate_mocs",
2086 ":generate_resources",
2087 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002088 "//third_party/jsoncpp",
2089 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002090 ]
2091 }
2092 }
2093
Mike Kleine459afd2017-03-03 09:21:30 -05002094 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002095 copy("gdbserver") {
2096 sources = [
2097 "$ndk/$ndk_gdbserver",
2098 ]
2099 outputs = [
2100 "$root_out_dir/gdbserver",
2101 ]
2102 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002103 }
mtklein25c81d42016-07-27 13:55:26 -07002104}
Mike Kleinc55a6cb2017-06-28 13:21:47 -04002105
2106if (skia_jumper_clang != "") {
2107 action("regen_jumper") {
2108 script = "src/jumper/build_stages.py"
2109
2110 inputs = [
2111 "src/jumper/SkJumper_stages.cpp",
Mike Klein9b2f69b2017-09-12 16:40:53 -04002112 "src/jumper/SkJumper_stages_lowp.cpp",
Mike Kleinc55a6cb2017-06-28 13:21:47 -04002113 ]
2114
2115 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it.
2116 outputs = [
2117 "$target_out_dir/" +
2118 rebase_path("src/jumper/SkJumper_generated.S", target_out_dir),
2119 "$target_out_dir/" +
2120 rebase_path("src/jumper/SkJumper_generated_win.S", target_out_dir),
2121 ]
2122
2123 args = [
2124 skia_jumper_clang,
2125 skia_jumper_objdump,
2126 skia_jumper_ccache,
2127 ] + rebase_path(inputs) + rebase_path(outputs)
2128 }
2129}