blob: cbac744d51a5c6984e5481b6ff5fbd4e303f985c [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
mtkleinc04ff472016-06-23 10:29:30 -070056}
Brian Salomon23d73ea2016-10-27 13:31:37 -040057declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040058 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040059 skia_use_sfntly = skia_use_icu
Brian Salomoncbcb0a12017-11-19 13:20:13 -050060 skia_enable_atlas_text = is_skia_dev_build && skia_enable_gpu
Mike Klein10d665d2016-11-01 11:46:10 -040061
Mike Klein4d598a32016-10-31 13:44:49 -040062 if (is_android) {
63 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070064 } else if (is_fuchsia) {
65 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040066 } else {
67 skia_use_vulkan = skia_vulkan_sdk != ""
68 }
Jim Van Verth4e502972017-12-07 15:16:10 -050069
70 if (is_ios) {
71 skia_ios_identity = ".*Google.*"
72 skia_ios_profile = "Google Development"
73 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040074}
Greg Danielec6ae522017-04-25 13:38:26 -040075declare_args() {
Greg Danielafb7ec72017-12-07 12:48:30 -050076 skia_tools_vulkan_header_dir = ""
Greg Danielec6ae522017-04-25 13:38:26 -040077 if (skia_use_vulkan) {
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +000078 # 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 -040079 if (is_fuchsia) {
Greg Danielafb7ec72017-12-07 12:48:30 -050080 skia_tools_vulkan_header_dir = "$fuchsia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040081 } else if (is_linux || is_win) {
Greg Danielafb7ec72017-12-07 12:48:30 -050082 skia_tools_vulkan_header_dir = "$skia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040083 }
Greg Danielec6ae522017-04-25 13:38:26 -040084 }
85}
Brian Salomon789e25e2016-09-30 13:41:03 -040086
Adam Barth54ef74a2017-10-13 10:59:38 -070087if (defined(skia_settings)) {
88 import(skia_settings)
89}
90
mtklein38925aa2016-09-21 10:11:25 -070091# Our tools require static linking (they use non-exported symbols).
92skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070093
mtkleina45be612016-08-29 15:22:10 -070094fontmgr_android_enabled = skia_use_expat && skia_use_freetype
95
mtklein1211e0c2016-07-26 13:55:45 -070096skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070097 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070098 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070099 "include/codec",
100 "include/config",
101 "include/core",
102 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -0400103 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -0700104 "include/gpu",
105 "include/gpu/gl",
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500106 "include/atlastext",
mtklein1211e0c2016-07-26 13:55:45 -0700107 "include/pathops",
108 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -0700109 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -0700110 "include/utils",
111 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -0700112]
113
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000114if (skia_use_vulkan) {
115 skia_public_includes += [ "include/gpu/vk" ]
116}
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500117if (skia_enable_atlas_text) {
118 skia_public_includes += [ "include/atlastext" ]
119}
Greg Daniele5ddff52017-07-05 16:49:36 -0400120if (skia_use_metal) {
121 skia_public_includes += [ "include/gpu/mtl" ]
122}
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000123
mtkleinc04ff472016-06-23 10:29:30 -0700124# Skia public API, generally provided by :skia.
125config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700126 include_dirs = skia_public_includes
Greg Danielafb7ec72017-12-07 12:48:30 -0500127 if (skia_tools_vulkan_header_dir != "") {
128 include_dirs += [ skia_tools_vulkan_header_dir ]
Greg Danielec6ae522017-04-25 13:38:26 -0400129 }
Mike Kleinae7e6712016-10-11 17:49:33 -0400130 defines = []
131 if (is_component_build) {
132 defines += [ "SKIA_DLL" ]
133 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400134 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700135 defines += [ "SK_SAMPLES_FOR_X" ]
136 }
Brian Osmanf2c90142017-07-13 15:50:03 -0400137 if (skia_enable_flutter_defines) {
138 defines += flutter_defines
139 }
mtklein06c35c02016-09-20 12:28:12 -0700140 if (!skia_enable_gpu) {
141 defines += [ "SK_SUPPORT_GPU=0" ]
142 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500143 if (skia_enable_atlas_text) {
144 defines += [ "SK_SUPPORT_ATLAS_TEXT=1" ]
145 }
mtkleinc04ff472016-06-23 10:29:30 -0700146}
147
148# Skia internal APIs, used by Skia itself and a few test tools.
149config("skia_private") {
150 visibility = [ ":*" ]
151
152 include_dirs = [
153 "include/private",
154 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700155 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700156 "src/core",
157 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700158 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700159 "src/image",
160 "src/images",
161 "src/lazy",
162 "src/opts",
163 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700164 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700165 "src/ports",
166 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400167 "src/shaders",
168 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700169 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700170 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700171 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500172 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700173 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700174 ]
mtklein150d1132016-08-01 06:56:40 -0700175
Mike Reeda9e241d2017-05-03 10:52:00 -0400176 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700177 if (is_android) {
178 defines += [
179 "SK_GAMMA_EXPONENT=1.4",
180 "SK_GAMMA_CONTRAST=0.0",
181 ]
182 }
mtklein88a7ac02016-09-14 11:16:49 -0700183 if (is_official_build || is_android) {
184 # TODO(bsalomon): it'd be nice to make Android normal.
185 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
186 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400187 libs = []
188 lib_dirs = []
Brian Salomon03e05842017-02-23 12:23:47 -0500189 if (skia_enable_gpu) {
190 include_dirs += [ "src/gpu" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500191 if (is_skia_dev_build && skia_use_vulkan) {
192 include_dirs += [ "tools/gpu/vk" ]
193 }
Brian Salomon03e05842017-02-23 12:23:47 -0500194 }
Brian Osman34755e22016-12-05 09:46:02 -0500195 if (skia_use_angle) {
196 defines += [ "SK_ANGLE" ]
197 }
Brian Osman3f375d02016-12-28 11:19:22 -0500198 if (skia_enable_discrete_gpu) {
199 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
200 }
Brian Salomon0c26a9d2017-07-06 10:09:38 -0400201 if (!is_official_build) {
202 defines += [ "GR_TEST_UTILS=1" ]
203 }
mtkleinc04ff472016-06-23 10:29:30 -0700204}
205
206# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
207config("skia_library") {
208 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700209 defines = [ "SKIA_IMPLEMENTATION=1" ]
210}
211
212skia_library_configs = [
213 ":skia_public",
214 ":skia_private",
215 ":skia_library",
216]
217
mtklein9b8583d2016-08-24 17:32:30 -0700218# Use for CPU-specific Skia code that needs particular compiler flags.
219template("opts") {
220 if (invoker.enabled) {
221 source_set(target_name) {
222 forward_variables_from(invoker, "*")
223 configs += skia_library_configs
224 }
225 } else {
226 # If not enabled, a phony empty target that swallows all otherwise unused variables.
227 source_set(target_name) {
228 forward_variables_from(invoker,
229 "*",
230 [
231 "sources",
232 "cflags",
233 ])
234 }
235 }
anmittala7eaf2e2016-08-17 13:57:26 -0700236}
237
mtklein422310d2016-08-16 18:28:43 -0700238is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700239
mtklein7d6fb2c2016-08-25 14:50:44 -0700240opts("none") {
241 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700242 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700243 cflags = []
244}
245
mtklein7d6fb2c2016-08-25 14:50:44 -0700246opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700247 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700248 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700249 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700250}
251
252opts("arm64") {
253 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700254 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700255 cflags = []
256}
257
258opts("crc32") {
259 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700260 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700261 cflags = [ "-march=armv8-a+crc" ]
262}
263
mtklein9b8583d2016-08-24 17:32:30 -0700264opts("sse2") {
265 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700266 sources = skia_opts.sse2_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400267 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400268 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
269 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400270 cflags = [ "-msse2" ]
271 }
mtklein9b8583d2016-08-24 17:32:30 -0700272}
mtkleinc04ff472016-06-23 10:29:30 -0700273
mtklein9b8583d2016-08-24 17:32:30 -0700274opts("ssse3") {
275 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700276 sources = skia_opts.ssse3_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400277 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400278 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
279 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400280 cflags = [ "-mssse3" ]
281 }
mtklein9b8583d2016-08-24 17:32:30 -0700282}
mtkleinc04ff472016-06-23 10:29:30 -0700283
mtklein9b8583d2016-08-24 17:32:30 -0700284opts("sse41") {
285 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700286 sources = skia_opts.sse41_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400287 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400288 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
289 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400290 cflags = [ "-msse4.1" ]
291 }
mtklein9b8583d2016-08-24 17:32:30 -0700292}
mtklein4e976072016-08-08 09:06:27 -0700293
mtklein9b8583d2016-08-24 17:32:30 -0700294opts("sse42") {
295 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700296 sources = skia_opts.sse42_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400297 if (!is_clang && is_win) {
Mike Kleind8765e32016-10-19 13:39:13 -0400298 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
299 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400300 cflags = [ "-msse4.2" ]
301 }
mtklein9b8583d2016-08-24 17:32:30 -0700302}
303
304opts("avx") {
305 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700306 sources = skia_opts.avx_sources
Mike Kleinc722f792017-07-31 11:57:21 -0400307 if (!is_clang && is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000308 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400309 } else {
310 cflags = [ "-mavx" ]
311 }
mtkleinc04ff472016-06-23 10:29:30 -0700312}
313
mtkleinc095df52016-08-24 12:23:52 -0700314# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700315template("optional") {
316 if (invoker.enabled) {
317 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700318 if (defined(invoker.public_defines)) {
319 defines = invoker.public_defines
320 }
mtklein457b42a2016-08-23 13:56:37 -0700321 }
322 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700323 forward_variables_from(invoker,
324 "*",
325 [
326 "public_defines",
327 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700328 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700329 ])
mtklein457b42a2016-08-23 13:56:37 -0700330 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700331 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700332 if (defined(invoker.configs_to_remove)) {
333 configs -= invoker.configs_to_remove
334 }
mtklein457b42a2016-08-23 13:56:37 -0700335 }
336 } else {
mtklein457b42a2016-08-23 13:56:37 -0700337 source_set(target_name) {
338 forward_variables_from(invoker,
339 "*",
340 [
341 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700342 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700343 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700344 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700345 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700346 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700347 ])
mtkleincd01b032016-08-31 04:58:19 -0700348 if (defined(invoker.sources_when_disabled)) {
349 sources = invoker.sources_when_disabled
350 }
351 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700352 }
mtkleineb3c4252016-08-23 07:38:09 -0700353 }
mtklein457b42a2016-08-23 13:56:37 -0700354}
mtklein457b42a2016-08-23 13:56:37 -0700355
Mike Kleina04bb452017-02-09 12:24:07 -0500356optional("effects") {
357 enabled = skia_enable_effects
Ethan Nicholas762466e2017-06-29 10:03:38 -0400358 deps = [
359 ":compile_processors",
360 ]
Mike Kleina04bb452017-02-09 12:24:07 -0500361 sources =
362 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
363 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
364}
365
mtkleina45be612016-08-29 15:22:10 -0700366optional("fontmgr_android") {
367 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700368
369 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500370 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700371 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700372 ]
373 sources = [
374 "src/ports/SkFontMgr_android.cpp",
375 "src/ports/SkFontMgr_android_factory.cpp",
376 "src/ports/SkFontMgr_android_parser.cpp",
377 ]
378}
379
mtkleind2e39db2016-09-07 07:52:55 -0700380optional("fontmgr_custom") {
381 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
382
383 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500384 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700385 ]
386 sources = [
387 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500388 "src/ports/SkFontMgr_custom.h",
389 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700390 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500391 "src/ports/SkFontMgr_custom_embedded.cpp",
392 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700393 ]
394}
395
Hal Canaryff2742e2018-01-30 11:35:47 -0500396optional("fontmgr_empty") {
397 enabled = skia_enable_fontmgr_empty
398 sources = [
399 "src/ports/SkFontMgr_empty_factory.cpp",
400 ]
401}
402
mtklein3cc22182016-08-29 13:26:14 -0700403optional("fontmgr_fontconfig") {
404 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700405
406 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500407 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700408 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700409 ]
410 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700411 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700412 "src/ports/SkFontConfigInterface_direct.cpp",
413 "src/ports/SkFontConfigInterface_direct_factory.cpp",
414 "src/ports/SkFontMgr_FontConfigInterface.cpp",
415 "src/ports/SkFontMgr_fontconfig.cpp",
416 "src/ports/SkFontMgr_fontconfig_factory.cpp",
417 ]
418}
419
mtkleincdedd0e2016-09-12 15:15:44 -0700420optional("fontmgr_fuchsia") {
421 enabled = is_fuchsia && skia_use_freetype
422
423 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500424 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700425 ]
426 sources = [
427 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500428 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700429 "src/ports/SkFontMgr_custom_empty_factory.cpp",
430 ]
431}
432
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700433if (skia_lex) {
Ethan Nicholasca82a922017-09-07 09:39:50 -0400434 executable("sksllex") {
435 sources = [
436 "src/sksl/lex/Main.cpp",
437 "src/sksl/lex/NFA.cpp",
438 "src/sksl/lex/RegexNode.cpp",
439 "src/sksl/lex/RegexParser.cpp",
440 ]
441 include_dirs = [ "src/sksl/lex" ]
442 }
443
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700444 action("run_sksllex") {
445 script = "gn/run_sksllex.py"
Ethan Nicholase148bf72017-10-06 14:22:22 -0400446 deps = [
447 ":sksllex(//gn/toolchain:$host_toolchain)",
448 ]
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700449 sources = [
450 "src/sksl/lex/layout.lex",
451 "src/sksl/lex/sksl.lex",
452 ]
453
454 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
455 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
456 outputs = [
457 "$target_out_dir/" +
458 rebase_path("src/sksl/lex/SkSLLexer.h", target_out_dir),
459 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
460 # confused due to the same file being named by two different paths
461 ]
462 sksllex_path = "$root_out_dir/"
463 sksllex_path += "sksllex"
464 if (host_os == "win") {
465 sksllex_path += ".exe"
466 }
467 args = [
468 rebase_path(sksllex_path),
469 rebase_path("bin/clang-format"),
470 rebase_path("src"),
471 ]
472 }
473} else {
474 group("run_sksllex") {
475 }
476}
477
478if (skia_compile_processors) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400479 executable("skslc") {
480 defines = [ "SKSL_STANDALONE" ]
481 sources = [
482 "src/sksl/SkSLMain.cpp",
483 ]
484 sources += skia_sksl_sources
485 include_dirs = [
486 "src/gpu",
487 "src/sksl",
488 ]
489 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500490 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400491 "//third_party/spirv-tools",
492 ]
493 }
494
495 skia_gpu_processor_outputs = []
496 foreach(src, skia_gpu_processor_sources) {
497 dir = get_path_info(src, "dir")
498 name = get_path_info(src, "name")
499
500 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
501 # path that starts with target_out_dir and then uses ".." to back up into the src dir.
502 skia_gpu_processor_outputs += [
503 "$target_out_dir/" + rebase_path("$dir/$name.h", target_out_dir),
504 # the script also modifies the corresponding .cpp file, but if we tell GN that it gets
505 # confused due to the same file being named by two different paths
506 ]
507 }
508
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500509 action("create_sksl_enums") {
510 script = "gn/create_sksl_enums.py"
511 sources = [
512 "include/private/GrSharedEnums.h",
513 ]
514 outputs = [
515 "$target_out_dir/" +
Ben Wagnera56c4d22018-01-24 17:32:17 -0500516 rebase_path("src/sksl/sksl_enums.inc", target_out_dir),
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500517 ]
518 args = [
519 rebase_path(sources[0]),
520 rebase_path(outputs[0]),
521 ]
522 }
523
Ethan Nicholas762466e2017-06-29 10:03:38 -0400524 action("compile_processors") {
525 script = "gn/compile_processors.py"
526 deps = [
Ethan Nicholasaae47c82017-11-10 15:34:03 -0500527 ":create_sksl_enums",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400528 ":skslc(//gn/toolchain:$host_toolchain)",
529 ]
530 sources = skia_gpu_processor_sources
531 outputs = skia_gpu_processor_outputs
532 skslc_path = "$root_out_dir/"
533 if (host_toolchain != default_toolchain_name) {
534 skslc_path += "$host_toolchain/"
535 }
536 skslc_path += "skslc"
537 if (host_os == "win") {
538 skslc_path += ".exe"
539 }
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400540 args = [
541 rebase_path(skslc_path),
Eric Borenb121be72017-07-28 10:00:51 -0400542 rebase_path("bin/clang-format"),
Ethan Nicholasb9f6afb2017-07-27 16:02:37 -0400543 ]
Ethan Nicholas762466e2017-06-29 10:03:38 -0400544 args += rebase_path(skia_gpu_processor_sources)
545 }
546} else {
547 skia_gpu_processor_outputs = []
548 group("compile_processors") {
549 }
550}
551
mtklein06c35c02016-09-20 12:28:12 -0700552optional("gpu") {
553 enabled = skia_enable_gpu
Ethan Nicholas762466e2017-06-29 10:03:38 -0400554 deps = [
555 ":compile_processors",
Ethan Nicholas5b5f0962017-09-11 13:50:14 -0700556 ":run_sksllex",
Ethan Nicholas762466e2017-06-29 10:03:38 -0400557 ]
mtkleine9fb3d52016-09-20 15:11:46 -0700558 public_defines = []
559
Brian Salomon3d6801e2017-12-11 10:06:31 -0500560 sources = skia_gpu_sources + skia_sksl_sources + skia_gpu_processor_outputs
mtklein06c35c02016-09-20 12:28:12 -0700561
562 # These paths need to be absolute to match the ones produced by shared_sources.gni.
Brian Salomon3d6801e2017-12-11 10:06:31 -0500563 sources -= get_path_info([ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ],
mtklein06c35c02016-09-20 12:28:12 -0700564 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400565 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700566 if (is_android) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500567 sources += [ "src/gpu/gl/android/GrGLMakeNativeInterface_android.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400568
569 # this lib is required to link against AHardwareBuffer
570 if (defined(ndk_api) && ndk_api >= 26) {
571 libs += [ "android" ]
572 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400573 } else if (skia_use_egl) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500574 sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400575 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700576 } else if (is_linux) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500577 sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500578 libs += [
579 "GL",
580 "GLU",
581 ]
mtklein06c35c02016-09-20 12:28:12 -0700582 } else if (is_mac) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500583 sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800584 } else if (is_ios) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500585 sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400586 } else if (is_win) {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500587 sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400588 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700589 } else {
Brian Salomon3d6801e2017-12-11 10:06:31 -0500590 sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700591 }
mtkleine9fb3d52016-09-20 15:11:46 -0700592
593 if (skia_use_vulkan) {
594 public_defines += [ "SK_VULKAN" ]
595 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700596 if (skia_enable_vulkan_debug_layers) {
597 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
598 }
Greg Danielafb7ec72017-12-07 12:48:30 -0500599 if (skia_vulkan_header != "") {
600 public_defines += [ "SK_VULKAN_HEADER=\"$skia_vulkan_header\"" ]
601 } else {
602 if (is_skia_dev_build) {
603 public_defines += [ "SK_VULKAN_HEADER=\"GrVulkanDefines.h\"" ]
604 }
605 }
mtkleine9fb3d52016-09-20 15:11:46 -0700606 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400607 if (skia_enable_spirv_validation) {
Ethan Nicholas762466e2017-06-29 10:03:38 -0400608 deps += [ "//third_party/spirv-tools" ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400609 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
610 }
Greg Daniele5ddff52017-07-05 16:49:36 -0400611
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400612 cflags_objcc = []
Greg Daniele5ddff52017-07-05 16:49:36 -0400613 if (skia_use_metal) {
614 public_defines += [ "SK_METAL" ]
615 sources += skia_metal_sources
616 libs += [ "Metal.framework" ]
Greg Daniel6b7e0e22017-07-12 16:21:09 -0400617 cflags_objcc += [ "-fobjc-arc" ]
Greg Daniele5ddff52017-07-05 16:49:36 -0400618 }
Brian Salomoncbcb0a12017-11-19 13:20:13 -0500619
620 if (skia_enable_atlas_text) {
621 sources += skia_atlas_text_sources
622 }
mtklein06c35c02016-09-20 12:28:12 -0700623}
624
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400625optional("heif") {
626 enabled = skia_use_libheif
627 public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
628
629 deps = []
630
631 sources = [
632 "src/codec/SkHeifCodec.cpp",
633 ]
634}
635
mtklein63213812016-08-24 09:55:56 -0700636optional("jpeg") {
637 enabled = skia_use_libjpeg_turbo
638 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
639
mtklein63213812016-08-24 09:55:56 -0700640 deps = [
641 "//third_party/libjpeg-turbo:libjpeg",
642 ]
643 sources = [
644 "src/codec/SkJpegCodec.cpp",
645 "src/codec/SkJpegDecoderMgr.cpp",
646 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700647 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400648 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700649 ]
650}
651
652optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500653 enabled = skia_use_zlib && skia_enable_pdf
654 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700655
mtklein63213812016-08-24 09:55:56 -0700656 deps = [
657 "//third_party/zlib",
658 ]
brettwb9447282016-09-01 14:24:39 -0700659 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700660 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700661
662 if (skia_use_sfntly) {
663 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500664 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700665 }
666}
667
668optional("png") {
669 enabled = skia_use_libpng
670 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
671
mtklein63213812016-08-24 09:55:56 -0700672 deps = [
673 "//third_party/libpng",
674 ]
675 sources = [
676 "src/codec/SkIcoCodec.cpp",
677 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400678 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700679 ]
680}
681
scroggof84ad642016-10-31 09:02:57 -0700682optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400683 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700684 public_defines = [ "SK_CODEC_DECODES_RAW" ]
685
686 deps = [
687 "//third_party/dng_sdk",
688 "//third_party/libjpeg-turbo:libjpeg",
689 "//third_party/piex",
690 ]
691
692 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
693 # Skia.
694 configs_to_remove = [ "//gn:no_exceptions" ]
695
696 sources = [
697 "src/codec/SkRawAdapterCodec.cpp",
698 "src/codec/SkRawCodec.cpp",
699 ]
700}
701
Mike Kleinfb333552018-01-25 12:49:37 -0500702optional("skcms") {
703 enabled = skia_use_skcms
704
705 deps = [
706 "//third_party/skcms",
707 ]
708 sources = [
709 # TODO
710 ]
711}
712
mtklein3cc22182016-08-29 13:26:14 -0700713optional("typeface_freetype") {
714 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700715
716 deps = [
717 "//third_party/freetype2",
718 ]
719 sources = [
720 "src/ports/SkFontHost_FreeType.cpp",
721 "src/ports/SkFontHost_FreeType_common.cpp",
722 ]
723}
724
mtklein457b42a2016-08-23 13:56:37 -0700725optional("webp") {
726 enabled = skia_use_libwebp
727 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
728
mtklein457b42a2016-08-23 13:56:37 -0700729 deps = [
730 "//third_party/libwebp",
731 ]
732 sources = [
733 "src/codec/SkWebpAdapterCodec.cpp",
734 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400735 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700736 ]
mtkleineb3c4252016-08-23 07:38:09 -0700737}
738
mtklein63213812016-08-24 09:55:56 -0700739optional("xml") {
740 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000741 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700742
mtklein63213812016-08-24 09:55:56 -0700743 deps = [
744 "//third_party/expat",
745 ]
746 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500747 "src/svg/SkSVGCanvas.cpp",
748 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700749 "src/xml/SkDOM.cpp",
750 "src/xml/SkXMLParser.cpp",
751 "src/xml/SkXMLWriter.cpp",
752 ]
753}
754
mtkleinc04ff472016-06-23 10:29:30 -0700755component("skia") {
756 public_configs = [ ":skia_public" ]
757 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700758
759 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700760 ":arm64",
761 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700762 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700763 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500764 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700765 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700766 ":fontmgr_custom",
Hal Canaryff2742e2018-01-30 11:35:47 -0500767 ":fontmgr_empty",
mtklein3cc22182016-08-29 13:26:14 -0700768 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700769 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700770 ":gpu",
Leon Scroggins III04be2b52017-08-17 15:13:20 -0400771 ":heif",
mtklein63213812016-08-24 09:55:56 -0700772 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700773 ":none",
mtklein63213812016-08-24 09:55:56 -0700774 ":pdf",
775 ":png",
scroggof84ad642016-10-31 09:02:57 -0700776 ":raw",
Mike Kleinfb333552018-01-25 12:49:37 -0500777 ":skcms",
mtklein9b8583d2016-08-24 17:32:30 -0700778 ":sse2",
779 ":sse41",
780 ":sse42",
781 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700782 ":webp",
mtklein63213812016-08-24 09:55:56 -0700783 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700784 ]
785
Chinmay Garde43f115c2016-11-16 15:04:12 -0800786 # This file (and all GN files in Skia) are designed to work with an
787 # empty sources assignment filter; we handle all that explicitly.
788 # We clear the filter here for clients who may have set up a global filter.
789 set_sources_assignment_filter([])
790
mtkleinc04ff472016-06-23 10:29:30 -0700791 sources = []
brettwb9447282016-09-01 14:24:39 -0700792 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700793 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500794 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700795 sources += [
Stan Iliev73d8fd92017-08-02 15:36:24 -0400796 "src/android/SkAndroidFrameworkUtils.cpp",
Leon Scroggins III42ee2842018-01-14 14:46:51 -0500797 "src/android/SkAnimatedImage.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700798 "src/android/SkBitmapRegionCodec.cpp",
799 "src/android/SkBitmapRegionDecoder.cpp",
800 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400801 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700802 "src/codec/SkBmpCodec.cpp",
803 "src/codec/SkBmpMaskCodec.cpp",
804 "src/codec/SkBmpRLECodec.cpp",
805 "src/codec/SkBmpStandardCodec.cpp",
806 "src/codec/SkCodec.cpp",
807 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700808 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700809 "src/codec/SkMaskSwizzler.cpp",
810 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700811 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700812 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700813 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700814 "src/codec/SkSwizzler.cpp",
815 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700816 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700817 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700818 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700819 "src/ports/SkMemory_malloc.cpp",
820 "src/ports/SkOSFile_stdio.cpp",
821 "src/sfnt/SkOTTable_name.cpp",
822 "src/sfnt/SkOTUtils.cpp",
823 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700824 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700825 ]
brettwb9447282016-09-01 14:24:39 -0700826
mtklein7d6fb2c2016-08-25 14:50:44 -0700827 libs = []
828
mtkleinc04ff472016-06-23 10:29:30 -0700829 if (is_win) {
830 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400831 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700832 "src/ports/SkDebug_win.cpp",
833 "src/ports/SkFontHost_win.cpp",
834 "src/ports/SkFontMgr_win_dw.cpp",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500835 "src/ports/SkFontMgr_win_dw_factory.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700836 "src/ports/SkImageEncoder_WIC.cpp",
837 "src/ports/SkImageGeneratorWIC.cpp",
838 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700839 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700840 "src/ports/SkScalerContext_win_dw.cpp",
841 "src/ports/SkTLS_win.cpp",
842 "src/ports/SkTypeface_win_dw.cpp",
843 ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400844 libs += [
845 "FontSub.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500846 "Gdi32.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400847 "Ole32.lib",
848 "OleAut32.lib",
849 "User32.lib",
Mike Klein0c5fdcb2017-11-13 12:40:46 -0500850 "Usp10.lib",
Mike Klein4b167fc2016-10-11 18:13:53 -0400851 ]
mtkleinc04ff472016-06-23 10:29:30 -0700852 } else {
853 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700854 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700855 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700856 "src/ports/SkTLS_pthread.cpp",
857 ]
Ben Wagnerbe6ae5b2017-08-31 16:45:23 -0400858 libs += [ "dl" ]
mtkleinc04ff472016-06-23 10:29:30 -0700859 }
860
mtklein7d6fb2c2016-08-25 14:50:44 -0700861 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500862 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500863 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500864 deps += [ "//third_party/cpu-features" ]
865 }
mtklein06c35c02016-09-20 12:28:12 -0700866 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700867 libs += [
868 "EGL",
869 "GLESv2",
870 "log",
871 ]
872 }
873
mtkleinc04ff472016-06-23 10:29:30 -0700874 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700875 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700876 }
877
878 if (is_mac) {
879 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700880 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700881 "src/ports/SkFontHost_mac.cpp",
882 "src/ports/SkImageEncoder_CG.cpp",
883 "src/ports/SkImageGeneratorCG.cpp",
884 ]
mtklein09e61f72016-08-23 13:35:28 -0700885 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400886 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
887 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700888 "ApplicationServices.framework",
889 "OpenGL.framework",
890 ]
mtkleinc04ff472016-06-23 10:29:30 -0700891 }
abarth6fc8ff02016-07-15 15:15:15 -0700892
Mike Klein7d302882016-11-03 14:06:31 -0400893 if (is_ios) {
894 sources += [
895 "src/ports/SkDebug_stdio.cpp",
896 "src/ports/SkFontHost_mac.cpp",
897 "src/ports/SkImageEncoder_CG.cpp",
898 "src/ports/SkImageGeneratorCG.cpp",
899 ]
900 libs += [
901 "CoreFoundation.framework",
902 "CoreGraphics.framework",
903 "CoreText.framework",
904 "ImageIO.framework",
905 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400906
907 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
908 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400909 ]
910 }
911
abarth6fc8ff02016-07-15 15:15:15 -0700912 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700913 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700914 }
mtkleinc04ff472016-06-23 10:29:30 -0700915}
916
mtkleinc095df52016-08-24 12:23:52 -0700917# Targets guarded by skia_enable_tools may use //third_party freely.
918if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500919 # Used by gn_to_bp.py to list our public include dirs.
920 source_set("public") {
921 configs += [ ":skia_public" ]
922 }
923
Mike Kleinc36dedf2016-11-18 09:35:28 -0500924 config("skia.h_config") {
925 include_dirs = [ "$target_gen_dir" ]
Greg Danielafb7ec72017-12-07 12:48:30 -0500926 if (skia_use_vulkan) {
927 # So we can get the header which includes vulkan
928 include_dirs += [ "tools/gpu/vk" ]
929 }
Mike Kleinc36dedf2016-11-18 09:35:28 -0500930 }
931 action("skia.h") {
932 public_configs = [ ":skia.h_config" ]
933 skia_h = "$target_gen_dir/skia.h"
934 script = "gn/find_headers.py"
Greg Danielc819e662017-04-19 16:39:45 -0400935 args = [ rebase_path(skia_h, root_build_dir) ] +
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000936 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -0500937 depfile = "$skia_h.deps"
938 outputs = [
939 skia_h,
940 ]
941 }
942
943 if (skia_enable_gpu && target_cpu == "x64") {
Mike Kleinc36dedf2016-11-18 09:35:28 -0500944 executable("fiddle") {
945 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -0500946 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500947 "tools/fiddle/draw.cpp",
948 "tools/fiddle/fiddle_main.cpp",
949 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400950
951 if (skia_use_egl) {
952 sources += [ "tools/fiddle/egl_context.cpp" ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400953 } else {
954 sources += [ "tools/fiddle/null_context.cpp" ]
955 }
Joe Gregorio1e735c02017-04-19 14:05:14 -0400956 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -0500957 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -0400958 ":flags",
Robert Phillips57e08282017-11-16 14:59:48 -0500959 ":gpu_tool_utils",
Mike Kleinc36dedf2016-11-18 09:35:28 -0500960 ":skia",
961 ":skia.h",
962 ]
963 }
964 }
965
966 if (skia_enable_gpu) {
967 source_set("public_headers_warnings_check") {
968 sources = [
969 "tools/public_headers_warnings_check.cpp",
970 ]
971 configs -= [ "//gn:warnings_except_public_headers" ]
972 deps = [
973 ":skia",
974 ":skia.h",
975 ]
976 }
977 }
978
mtkleinc095df52016-08-24 12:23:52 -0700979 template("test_lib") {
980 config(target_name + "_config") {
981 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700982 if (defined(invoker.public_defines)) {
983 defines = invoker.public_defines
984 }
mtklein25c81d42016-07-27 13:55:26 -0700985 }
mtkleinc095df52016-08-24 12:23:52 -0700986 source_set(target_name) {
987 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
988 public_configs = [
989 ":" + target_name + "_config",
990 ":skia_private",
991 ]
992
993 if (!defined(deps)) {
994 deps = []
995 }
996 deps += [ ":skia" ]
997 testonly = true
998 }
mtklein25c81d42016-07-27 13:55:26 -0700999 }
mtklein25c81d42016-07-27 13:55:26 -07001000
Mike Kleine6682eb2017-01-05 10:54:57 -05001001 template("test_app") {
Jim Van Verth443a9132017-11-28 09:45:26 -05001002 if (is_ios) {
1003 app_name = target_name
1004 gen_path = target_gen_dir
1005
1006 action("${app_name}_generate_info_plist") {
1007 script = "//gn/gen_plist_ios.py"
1008 outputs = [
1009 "$gen_path/${app_name}_Info.plist",
1010 ]
1011 args = [ rebase_path("$gen_path/$app_name", root_build_dir) ]
1012 }
1013
1014 bundle_data("${app_name}_bundle_info_plist") {
1015 public_deps = [
1016 ":${app_name}_generate_info_plist",
1017 ]
1018 sources = [
1019 "$gen_path/${app_name}_Info.plist",
1020 ]
1021 outputs = [
1022 "{{bundle_root_dir}}/Info.plist",
1023 ]
1024 }
1025
Jim Van Verth329c5a62017-11-29 11:42:33 -05001026 bundle_ios_data =
1027 defined(invoker.bundle_ios_data) && invoker.bundle_ios_data
1028
1029 if (bundle_ios_data) {
1030 has_skps =
1031 "True" == exec_script("//gn/checkdir.py",
1032 [ rebase_path("skps", root_build_dir) ],
1033 "trim string")
1034 bundle_data("${app_name}_bundle_resources") {
1035 sources = [
1036 "resources",
1037 ]
1038 outputs = [
1039 # iOS reserves the folders 'Resources' and 'resources' so store one level deeper
1040 "{{bundle_resources_dir}}/data/resources",
1041 ]
1042 }
1043
1044 if (has_skps) {
1045 bundle_data("${app_name}_bundle_skps") {
1046 sources = [
1047 "skps",
1048 ]
1049 outputs = [
1050 # Store in same folder as resources
1051 "{{bundle_resources_dir}}/data/skps",
1052 ]
1053 }
1054 }
1055 }
1056
Jim Van Verth443a9132017-11-28 09:45:26 -05001057 executable("${app_name}_generate_executable") {
1058 forward_variables_from(invoker,
1059 "*",
1060 [
1061 "output_name",
1062 "visibility",
1063 "is_shared_library",
1064 ])
Mike Klein154e6da2017-07-26 15:13:47 -04001065 configs += [ ":skia_private" ]
Mike Kleine6682eb2017-01-05 10:54:57 -05001066 testonly = true
Jim Van Verth443a9132017-11-28 09:45:26 -05001067 output_name = rebase_path("$gen_path/$app_name", root_build_dir)
1068 }
1069
1070 bundle_data("${app_name}_bundle_executable") {
1071 public_deps = [
1072 ":${app_name}_generate_executable",
1073 ]
1074 sources = [
1075 "$gen_path/$app_name",
1076 ]
1077 outputs = [
1078 "{{bundle_executable_dir}}/$app_name",
1079 ]
1080 testonly = true
1081 }
1082
1083 create_bundle("$app_name") {
1084 product_type = "com.apple.product-type.application"
1085 testonly = true
1086
1087 bundle_root_dir = "${root_build_dir}/${target_name}.app"
1088 bundle_resources_dir = bundle_root_dir
1089 bundle_executable_dir = bundle_root_dir
1090 bundle_plugins_dir = bundle_root_dir + "/Plugins"
1091
1092 deps = [
1093 ":${app_name}_bundle_executable",
1094 ":${app_name}_bundle_info_plist",
1095 ]
Jim Van Verth329c5a62017-11-29 11:42:33 -05001096 if (bundle_ios_data) {
1097 deps += [ ":${app_name}_bundle_resources" ]
1098 if (has_skps) {
1099 deps += [ ":${app_name}_bundle_skps" ]
1100 }
1101 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001102
1103 # should only code sign when running on a device, not the simulator
1104 if (target_cpu != "x64") {
1105 code_signing_script = "//gn/codesign_ios.py"
1106 code_signing_sources = [ "$target_gen_dir/$app_name" ]
1107 code_signing_outputs = [
1108 "$bundle_root_dir/_CodeSignature/CodeResources",
1109 "$bundle_root_dir/embedded.mobileprovision",
1110 ]
Jim Van Verth4e502972017-12-07 15:16:10 -05001111 code_signing_args = [
1112 rebase_path("$bundle_root_dir", root_build_dir),
1113 skia_ios_identity,
1114 skia_ios_profile,
1115 ]
Jim Van Verth443a9132017-11-28 09:45:26 -05001116 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001117 }
1118 } else {
Jim Van Verth443a9132017-11-28 09:45:26 -05001119 # !is_ios
1120
1121 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
1122 shared_library("lib" + target_name) {
1123 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1124 configs += [ ":skia_private" ]
1125 testonly = true
1126 }
1127 } else {
1128 _executable = target_name
1129 executable(_executable) {
1130 forward_variables_from(invoker, "*", [ "is_shared_library" ])
1131 configs += [ ":skia_private" ]
1132 testonly = true
1133 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001134 }
Jim Van Verth443a9132017-11-28 09:45:26 -05001135 if (is_android && skia_android_serial != "" && defined(_executable)) {
1136 action("push_" + target_name) {
1137 script = "gn/push_to_android.py"
1138 deps = [
1139 ":" + _executable,
1140 ]
1141 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
1142 outputs = [
1143 _stamp,
1144 ]
1145 args = [
1146 rebase_path("$root_build_dir/$_executable"),
1147 skia_android_serial,
1148 rebase_path(_stamp),
1149 ]
1150 testonly = true
1151 }
Mike Klein7d921032017-01-05 12:20:41 -05001152 }
1153 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001154 }
1155
mtkleinc095df52016-08-24 12:23:52 -07001156 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -07001157 public_include_dirs = []
1158 if (skia_enable_gpu) {
1159 public_defines = []
1160 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -07001161
1162 deps = []
mtklein38925aa2016-09-21 10:11:25 -07001163 sources = [
1164 "tools/gpu/GrContextFactory.cpp",
1165 "tools/gpu/GrTest.cpp",
1166 "tools/gpu/TestContext.cpp",
Brian Salomoncbcb0a12017-11-19 13:20:13 -05001167 "tools/gpu/atlastext/GLTestAtlasTextRenderer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001168 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -07001169 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001170 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
1171 "tools/gpu/gl/debug/GrBufferObj.cpp",
1172 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
1173 "tools/gpu/gl/debug/GrProgramObj.cpp",
1174 "tools/gpu/gl/debug/GrShaderObj.cpp",
1175 "tools/gpu/gl/debug/GrTextureObj.cpp",
1176 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
1177 "tools/gpu/gl/null/NullGLTestContext.cpp",
Brian Salomoncfe910d2017-07-06 16:40:18 -04001178 "tools/gpu/mock/MockTestContext.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001179 ]
1180 libs = []
mtklein25c81d42016-07-27 13:55:26 -07001181
Kevin Lubick4a24e102017-03-29 11:19:01 -04001182 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -07001183 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -04001184 } else if (is_ios) {
1185 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
1186 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -07001187 } else if (is_linux) {
1188 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001189 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -07001190 } else if (is_mac) {
1191 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -04001192 } else if (is_win) {
1193 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
1194 libs += [
1195 "Gdi32.lib",
1196 "OpenGL32.lib",
1197 ]
mtklein38925aa2016-09-21 10:11:25 -07001198 }
mtklein6ef69992016-09-14 06:12:09 -07001199
Greg Daniel6b7e0e22017-07-12 16:21:09 -04001200 cflags_objcc = [ "-fobjc-arc" ]
1201
Mike Kleinc168a3a2016-11-14 14:53:13 +00001202 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +00001203 deps += [ "//third_party/angle2" ]
1204 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
1205 }
mtkleind68f9b02016-09-23 13:18:41 -07001206 if (skia_use_vulkan) {
1207 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Greg Daniel35970ec2017-11-10 10:03:05 -05001208 sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
mtkleind68f9b02016-09-23 13:18:41 -07001209 }
Greg Danielb76a72a2017-07-13 15:07:54 -04001210 if (skia_use_metal) {
1211 sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
1212 }
mtkleina627b5c2016-09-20 13:36:47 -07001213 }
mtklein25c81d42016-07-27 13:55:26 -07001214 }
mtklein25c81d42016-07-27 13:55:26 -07001215
mtkleinc095df52016-08-24 12:23:52 -07001216 test_lib("flags") {
1217 public_include_dirs = [ "tools/flags" ]
1218 sources = [
1219 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -07001220 ]
1221 }
1222 test_lib("common_flags") {
1223 public_include_dirs = [ "tools/flags" ]
1224 sources = [
mtkleinc095df52016-08-24 12:23:52 -07001225 "tools/flags/SkCommonFlags.cpp",
1226 "tools/flags/SkCommonFlagsConfig.cpp",
1227 ]
1228 deps = [
mtklein046cb562016-09-16 10:23:12 -07001229 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001230 ":gpu_tool_utils",
1231 ]
1232 }
mtklein25c81d42016-07-27 13:55:26 -07001233
mtkleinc095df52016-08-24 12:23:52 -07001234 test_lib("tool_utils") {
1235 public_include_dirs = [
1236 "tools",
1237 "tools/debugger",
1238 "tools/timer",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001239 "tools/trace",
mtkleinc095df52016-08-24 12:23:52 -07001240 ]
1241 sources = [
mtkleinb37c0342016-09-09 11:07:45 -07001242 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001243 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -07001244 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001245 "tools/ProcStats.cpp",
1246 "tools/Resources.cpp",
Mike Klein10d66cc2017-11-10 11:33:43 -05001247 "tools/SkRandomScalerContext.cpp",
1248 "tools/SkTestScalerContext.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001249 "tools/UrlDataManager.cpp",
1250 "tools/debugger/SkDebugCanvas.cpp",
1251 "tools/debugger/SkDrawCommand.cpp",
1252 "tools/debugger/SkJsonWriteBuffer.cpp",
1253 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001254 "tools/picture_utils.cpp",
1255 "tools/random_parse_path.cpp",
1256 "tools/sk_tool_utils.cpp",
1257 "tools/sk_tool_utils_font.cpp",
1258 "tools/timer/Timer.cpp",
Brian Osman53136aa2017-07-20 15:43:35 -04001259 "tools/trace/SkChromeTracingTracer.cpp",
1260 "tools/trace/SkChromeTracingTracer.h",
Brian Salomondcbb9d92017-07-19 10:53:20 -04001261 "tools/trace/SkDebugfTracer.cpp",
1262 "tools/trace/SkDebugfTracer.h",
Brian Osman53136aa2017-07-20 15:43:35 -04001263 "tools/trace/SkEventTracingPriv.cpp",
1264 "tools/trace/SkEventTracingPriv.h",
mtkleinc095df52016-08-24 12:23:52 -07001265 ]
Mike Kleinadacaef2017-02-06 09:26:14 -05001266 libs = []
1267 if (is_ios) {
1268 sources += [ "tools/ios_utils.m" ]
1269 libs += [ "Foundation.framework" ]
1270 }
mtkleinc095df52016-08-24 12:23:52 -07001271 deps = [
mtklein046cb562016-09-16 10:23:12 -07001272 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -07001273 ":flags",
1274 "//third_party/libpng",
1275 ]
1276 public_deps = [
1277 "//third_party/jsoncpp",
1278 ]
1279 }
mtklein25c81d42016-07-27 13:55:26 -07001280
Mike Klein6e744122016-10-27 12:21:40 -04001281 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -07001282 test_lib("gm") {
1283 public_include_dirs = [ "gm" ]
1284 sources = gm_sources
1285 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001286 ":experimental_sksg",
scroggo19b91532016-10-24 09:03:26 -07001287 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001288 ":gpu_tool_utils",
1289 ":skia",
1290 ":tool_utils",
1291 ]
1292 }
mtklein25c81d42016-07-27 13:55:26 -07001293
Mike Klein6e744122016-10-27 12:21:40 -04001294 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -07001295 test_lib("tests") {
1296 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -04001297 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001298 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001299 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001300 }
mtkleinc095df52016-08-24 12:23:52 -07001301 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001302 ":experimental_sksg",
mtkleinc095df52016-08-24 12:23:52 -07001303 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001304 ":skia",
1305 ":tool_utils",
1306 "//third_party/libpng",
1307 "//third_party/zlib",
1308 ]
Hal Canaryff2742e2018-01-30 11:35:47 -05001309 if (skia_use_expat) {
1310 deps += [ ":experimental_svg_model" ]
1311 }
Mike Kleind63442d2017-03-27 14:16:04 -04001312 public_deps = [
1313 ":gpu_tool_utils", # Test.h #includes headers from this target.
1314 ]
mtkleinc095df52016-08-24 12:23:52 -07001315 }
mtklein2f3416d2016-08-02 16:02:05 -07001316
Mike Klein6e744122016-10-27 12:21:40 -04001317 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001318 test_lib("bench") {
1319 public_include_dirs = [ "bench" ]
1320 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001321 deps = [
1322 ":flags",
1323 ":gm",
1324 ":gpu_tool_utils",
1325 ":skia",
1326 ":tool_utils",
1327 ]
1328 }
mtklein2b6870c2016-07-28 14:17:33 -07001329
Florin Malita54f65c42018-01-16 17:04:30 -05001330 test_lib("experimental_skottie") {
1331 public_include_dirs = [ "experimental/skottie" ]
Florin Malita094ccde2017-12-30 12:27:00 -05001332 include_dirs = [ "tools" ]
1333 sources = [
Florin Malita54f65c42018-01-16 17:04:30 -05001334 "experimental/skottie/Skottie.cpp",
1335 "experimental/skottie/SkottieAnimator.cpp",
Florin Malitacf8ed522018-01-25 15:27:33 -05001336 "experimental/skottie/SkottieParser.cpp",
Florin Malita54f65c42018-01-16 17:04:30 -05001337 "experimental/skottie/SkottieProperties.cpp",
Florin Malita094ccde2017-12-30 12:27:00 -05001338 ]
1339 deps = [
1340 ":experimental_sksg",
1341 ":skia",
1342 "//third_party/jsoncpp",
1343 ]
1344 }
1345
mtkleinc095df52016-08-24 12:23:52 -07001346 test_lib("experimental_svg_model") {
1347 public_include_dirs = [ "experimental/svg/model" ]
1348 sources = [
1349 "experimental/svg/model/SkSVGAttribute.cpp",
1350 "experimental/svg/model/SkSVGAttributeParser.cpp",
1351 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -05001352 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001353 "experimental/svg/model/SkSVGContainer.cpp",
1354 "experimental/svg/model/SkSVGDOM.cpp",
1355 "experimental/svg/model/SkSVGEllipse.cpp",
Florin Malitadf007e12017-10-09 15:14:13 -04001356 "experimental/svg/model/SkSVGGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001357 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001358 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001359 "experimental/svg/model/SkSVGNode.cpp",
1360 "experimental/svg/model/SkSVGPath.cpp",
Florin Malita1aa1bb62017-10-11 14:34:33 -04001361 "experimental/svg/model/SkSVGPattern.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001362 "experimental/svg/model/SkSVGPoly.cpp",
Florin Malitacc6cc292017-10-09 16:05:30 -04001363 "experimental/svg/model/SkSVGRadialGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001364 "experimental/svg/model/SkSVGRect.cpp",
1365 "experimental/svg/model/SkSVGRenderContext.cpp",
1366 "experimental/svg/model/SkSVGSVG.cpp",
1367 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001368 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001369 "experimental/svg/model/SkSVGTransformableNode.cpp",
Florin Malita6a69c052017-10-11 14:02:11 -04001370 "experimental/svg/model/SkSVGUse.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001371 "experimental/svg/model/SkSVGValue.cpp",
1372 ]
1373 deps = [
1374 ":skia",
1375 ]
1376 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001377
Florin Malita4aa44412017-12-19 12:21:02 -05001378 test_lib("experimental_sksg") {
1379 public_include_dirs = [
1380 "experimental/sksg",
1381 "experimental/sksg/effects",
1382 "experimental/sksg/geometry",
1383 "experimental/sksg/paint",
1384 ]
1385 sources = [
1386 "experimental/sksg/SkSGDraw.cpp",
1387 "experimental/sksg/SkSGEffectNode.cpp",
1388 "experimental/sksg/SkSGGeometryNode.cpp",
1389 "experimental/sksg/SkSGGroup.cpp",
Florin Malita49328072018-01-08 12:51:12 -05001390 "experimental/sksg/SkSGImage.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001391 "experimental/sksg/SkSGInvalidationController.cpp",
1392 "experimental/sksg/SkSGNode.cpp",
1393 "experimental/sksg/SkSGPaintNode.cpp",
1394 "experimental/sksg/SkSGRenderNode.cpp",
Florin Malita35efaa82018-01-22 12:57:06 -05001395 "experimental/sksg/SkSGScene.cpp",
Florin Malita38ea40e2018-01-29 16:31:14 -05001396 "experimental/sksg/effects/SkSGClipEffect.cpp",
Florin Malita5f9102f2018-01-10 13:36:22 -05001397 "experimental/sksg/effects/SkSGMaskEffect.cpp",
Florin Malitac0034172018-01-08 16:42:59 -05001398 "experimental/sksg/effects/SkSGOpacityEffect.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001399 "experimental/sksg/effects/SkSGTransform.cpp",
Florin Malita16d0ad02018-01-19 15:07:29 -05001400 "experimental/sksg/geometry/SkSGGeometryTransform.cpp",
Florin Malitae6345d92018-01-03 23:37:54 -05001401 "experimental/sksg/geometry/SkSGMerge.cpp",
Florin Malita047ae272017-12-27 11:13:13 -05001402 "experimental/sksg/geometry/SkSGPath.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001403 "experimental/sksg/geometry/SkSGRect.cpp",
Florin Malita51b8c892018-01-07 08:54:24 -05001404 "experimental/sksg/geometry/SkSGTrimEffect.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001405 "experimental/sksg/paint/SkSGColor.cpp",
Florin Malita6aaee592018-01-12 12:25:09 -05001406 "experimental/sksg/paint/SkSGGradient.cpp",
Florin Malita4aa44412017-12-19 12:21:02 -05001407 ]
1408 deps = [
1409 ":skia",
1410 ]
1411 }
1412
Kevin Lubickebf648e2017-09-21 13:45:16 -04001413 if (target_cpu != "wasm") {
1414 test_lib("views") {
1415 public_include_dirs = [ "include/views" ]
1416 sources = [
1417 "src/views/SkEvent.cpp",
1418 "src/views/SkEventSink.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001419 "src/views/SkTouchGesture.cpp",
1420 "src/views/SkView.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001421 ]
Brian Osman34755e22016-12-05 09:46:02 -05001422 }
Brian Osman16adfa32016-10-18 14:42:44 -04001423 }
1424
Mike Klein38af9432016-11-11 11:39:44 -05001425 if (skia_use_lua) {
1426 test_lib("lua") {
1427 public_include_dirs = []
1428 sources = [
1429 "src/utils/SkLua.cpp",
1430 "src/utils/SkLuaCanvas.cpp",
1431 ]
1432 deps = [
1433 "//third_party/lua",
1434 ]
1435 }
1436
Mike Kleine6682eb2017-01-05 10:54:57 -05001437 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001438 sources = [
1439 "tools/lua/lua_app.cpp",
1440 ]
1441 deps = [
1442 ":lua",
1443 ":skia",
1444 "//third_party/lua",
1445 ]
Mike Klein38af9432016-11-11 11:39:44 -05001446 }
1447
Mike Kleine6682eb2017-01-05 10:54:57 -05001448 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001449 sources = [
1450 "tools/lua/lua_pictures.cpp",
1451 ]
1452 deps = [
1453 ":flags",
1454 ":lua",
1455 ":skia",
1456 ":tool_utils",
1457 "//third_party/lua",
1458 ]
Mike Klein38af9432016-11-11 11:39:44 -05001459 }
1460 }
1461
Cary Clark8032b982017-07-28 11:04:54 -04001462 test_app("bookmaker") {
1463 sources = [
1464 "tools/bookmaker/bookmaker.cpp",
Cary Clarkbef063a2017-10-31 15:44:45 -04001465 "tools/bookmaker/cataloger.cpp",
Cary Clarka560c472017-11-27 10:44:06 -05001466 "tools/bookmaker/definition.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001467 "tools/bookmaker/fiddleParser.cpp",
1468 "tools/bookmaker/includeParser.cpp",
1469 "tools/bookmaker/includeWriter.cpp",
1470 "tools/bookmaker/mdOut.cpp",
1471 "tools/bookmaker/parserCommon.cpp",
Cary Clarkac47b882018-01-11 10:35:44 -05001472 "tools/bookmaker/selfCheck.cpp",
Cary Clark8032b982017-07-28 11:04:54 -04001473 "tools/bookmaker/spellCheck.cpp",
1474 ]
1475 deps = [
1476 ":flags",
1477 ":skia",
1478 ":tool_utils",
Cary Clark2f466242017-12-11 16:03:17 -05001479 "//third_party/jsoncpp",
Cary Clark8032b982017-07-28 11:04:54 -04001480 ]
1481 }
1482
Kevin Lubickebf648e2017-09-21 13:45:16 -04001483 if (target_cpu != "wasm") {
1484 import("gn/samples.gni")
1485 test_lib("samples") {
1486 public_include_dirs = [ "samplecode" ]
1487 include_dirs = [ "experimental" ]
1488 sources = samples_sources + [
Kevin Lubickebf648e2017-09-21 13:45:16 -04001489 # Relocating these files here, so that clients don't try to build them while they're
1490 # still in active development. Clang's thread safety analysis gets tripped up by
1491 # conditional locks.
1492 "src/core/SkThreadedBMPDevice.cpp",
1493 "src/core/SkThreadedBMPDevice.h",
1494 ]
1495 deps = [
Florin Malita4aa44412017-12-19 12:21:02 -05001496 ":experimental_sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001497 ":experimental_svg_model",
1498 ":flags",
1499 ":gm",
1500 ":tool_utils",
1501 ":views",
1502 ":xml",
1503 ]
Mike Klein38af9432016-11-11 11:39:44 -05001504
Kevin Lubickebf648e2017-09-21 13:45:16 -04001505 if (skia_use_lua) {
1506 sources += [ "samplecode/SampleLua.cpp" ]
1507 deps += [
1508 ":lua",
1509 "//third_party/lua",
1510 ]
1511 }
1512 }
1513 test_app("dm") {
1514 sources = [
1515 "dm/DM.cpp",
Mike Klein31868212017-11-06 12:02:47 -05001516 "dm/DMFontMgr.cpp",
Hal Canaryb6c5e5b2017-10-09 16:13:02 -04001517 "dm/DMGpuTestProcs.cpp",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001518 "dm/DMJsonWriter.cpp",
1519 "dm/DMSrcSink.cpp",
1520 ]
1521 include_dirs = [ "tests" ]
1522 deps = [
1523 ":common_flags",
Florin Malita54f65c42018-01-16 17:04:30 -05001524 ":experimental_skottie",
Florin Malita4aa44412017-12-19 12:21:02 -05001525 ":experimental_sksg",
Kevin Lubickebf648e2017-09-21 13:45:16 -04001526 ":experimental_svg_model",
1527 ":flags",
1528 ":gm",
1529 ":gpu_tool_utils",
1530 ":skia",
1531 ":tests",
1532 ":tool_utils",
1533 "//third_party/jsoncpp",
1534 "//third_party/libpng",
Mike Klein38af9432016-11-11 11:39:44 -05001535 ]
1536 }
Brian Osman16adfa32016-10-18 14:42:44 -04001537 }
1538
Mike Kleina8a51ce2018-01-09 12:34:11 -05001539 if (!is_win) {
1540 test_app("remote_demo") {
1541 sources = [
1542 "tools/remote_demo.cpp",
1543 ]
1544 deps = [
1545 ":skia",
1546 ]
1547 }
1548 }
1549
Mike Klein06432b22017-03-21 13:14:33 -04001550 test_app("ok") {
1551 sources = [
Mike Klein361dde02017-11-07 08:14:52 -05001552 "dm/DMFontMgr.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001553 "tools/ok.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001554 "tools/ok_dsts.cpp",
Mike Klein154e6da2017-07-26 15:13:47 -04001555 "tools/ok_engines.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001556 "tools/ok_srcs.cpp",
Mike Kleind63442d2017-03-27 14:16:04 -04001557 "tools/ok_test.cpp",
Mike Kleinf5d1a552017-03-25 12:32:22 -04001558 "tools/ok_vias.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001559 ]
1560 deps = [
Mike Klein4f6e2712017-08-11 10:37:35 -04001561 ":bench",
Mike Klein06432b22017-03-21 13:14:33 -04001562 ":gm",
1563 ":skia",
Mike Kleind63442d2017-03-27 14:16:04 -04001564 ":tests",
Mike Klein62669ad2017-05-09 16:03:07 -04001565 ":tool_utils",
Mike Klein06432b22017-03-21 13:14:33 -04001566 ]
1567 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001568 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001569 sources = [
1570 "bench/nanobench.cpp",
1571 ]
1572 deps = [
1573 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001574 ":common_flags",
Florin Malita4aa44412017-12-19 12:21:02 -05001575 ":experimental_sksg",
fmalita6519c212016-09-14 08:05:17 -07001576 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001577 ":flags",
1578 ":gm",
1579 ":gpu_tool_utils",
1580 ":skia",
1581 ":tool_utils",
1582 "//third_party/jsoncpp",
1583 ]
mtklein2b6870c2016-07-28 14:17:33 -07001584 }
halcanary19a97202016-08-03 15:08:04 -07001585
Ravi Mistry10d36c52017-01-31 09:49:18 -05001586 test_app("skpinfo") {
1587 sources = [
1588 "tools/skpinfo.cpp",
1589 ]
1590 deps = [
1591 ":flags",
1592 ":skia",
1593 ]
1594 }
1595
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001596 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001597 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001598 sources = [
1599 "tools/skpbench/skpbench.cpp",
1600 ]
1601 deps = [
1602 ":flags",
1603 ":gpu_tool_utils",
1604 ":skia",
1605 ":tool_utils",
1606 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001607 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001608 }
1609
Mike Klein7d302882016-11-03 14:06:31 -04001610 # We can't yet build ICU on iOS or Windows.
Kevin Lubickebf648e2017-09-21 13:45:16 -04001611 if (!is_ios && !is_win && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001612 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001613 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001614 "tools/shape/SkShaper_harfbuzz.cpp",
1615 "tools/shape/using_skia_and_harfbuzz.cpp",
mtklein6f5df6a2016-08-29 16:01:10 -07001616 ]
1617 deps = [
1618 ":skia",
1619 "//third_party/harfbuzz",
Ben Wagnera25fbef2017-08-30 13:56:19 -04001620 "//third_party/icu",
mtklein6f5df6a2016-08-29 16:01:10 -07001621 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001622 }
halcanary19a97202016-08-03 15:08:04 -07001623 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001624 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001625 sources = [
Ben Wagnera25fbef2017-08-30 13:56:19 -04001626 "tools/shape/SkShaper_primitive.cpp",
1627 "tools/shape/using_skia_and_harfbuzz.cpp",
halcanary3eee9d92016-09-10 07:01:53 -07001628 ]
1629 deps = [
1630 ":skia",
1631 ]
halcanary3eee9d92016-09-10 07:01:53 -07001632 }
mtklein046cb562016-09-16 10:23:12 -07001633
Matt Sarett9f1c4032017-05-17 10:06:32 -04001634 test_app("create_flutter_test_images") {
1635 sources = [
1636 "tools/create_flutter_test_images.cpp",
1637 ]
1638 deps = [
1639 ":skia",
1640 ":tool_utils",
1641 ]
1642 }
1643
Ben Wagner219f3622017-07-17 15:32:25 -04001644 test_app("create_test_font") {
1645 sources = [
1646 "tools/create_test_font.cpp",
1647 ]
1648 deps = [
1649 ":skia",
1650 ]
1651 assert_no_deps = [
1652 # tool_utils requires the output of this app.
1653 ":tool_utils",
1654 ]
1655 }
1656
Mike Kleine6682eb2017-01-05 10:54:57 -05001657 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001658 sources = [
1659 "tools/get_images_from_skps.cpp",
1660 ]
1661 deps = [
1662 ":flags",
1663 ":skia",
1664 "//third_party/jsoncpp",
1665 ]
mtklein046cb562016-09-16 10:23:12 -07001666 }
mtkleinecbc5262016-09-22 11:51:24 -07001667
Mike Kleine6682eb2017-01-05 10:54:57 -05001668 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001669 sources = [
1670 "tools/colorspaceinfo.cpp",
1671 ]
1672 deps = [
1673 ":flags",
1674 ":skia",
1675 ":tool_utils",
1676 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001677 }
1678
Kevin Lubickebf648e2017-09-21 13:45:16 -04001679 if (!is_ios && target_cpu != "wasm") {
Mike Kleine6682eb2017-01-05 10:54:57 -05001680 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001681 sources = [
1682 "tools/skiaserve/Request.cpp",
1683 "tools/skiaserve/Response.cpp",
1684 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001685 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1686 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1687 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1688 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1689 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1690 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1691 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1692 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1693 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001694 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1695 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001696 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1697 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1698 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1699 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1700 ]
1701 deps = [
1702 ":flags",
1703 ":gpu_tool_utils",
1704 ":skia",
1705 ":tool_utils",
1706 "//third_party/jsoncpp",
1707 "//third_party/libmicrohttpd",
1708 "//third_party/libpng",
1709 ]
Mike Klein7d302882016-11-03 14:06:31 -04001710 }
mtkleinecbc5262016-09-22 11:51:24 -07001711 }
kjlubick14f984b2016-10-03 11:49:45 -07001712
Mike Kleine6682eb2017-01-05 10:54:57 -05001713 test_app("fuzz") {
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001714 include_dirs = [
1715 "tools",
1716 "tools/debugger",
1717 ]
kjlubick14f984b2016-10-03 11:49:45 -07001718 sources = [
Hal Canary24ac42b2017-02-14 13:35:14 -05001719 "fuzz/FuzzCanvas.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001720 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001721 "fuzz/FuzzGradients.cpp",
1722 "fuzz/FuzzParsePath.cpp",
1723 "fuzz/FuzzPathop.cpp",
1724 "fuzz/FuzzScaleToSides.cpp",
1725 "fuzz/fuzz.cpp",
Kevin Lubick2541edf2018-01-11 10:27:14 -05001726 "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
1727 "fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001728 "tools/UrlDataManager.cpp",
1729 "tools/debugger/SkDebugCanvas.cpp",
1730 "tools/debugger/SkDrawCommand.cpp",
1731 "tools/debugger/SkJsonWriteBuffer.cpp",
1732 "tools/debugger/SkObjectParser.cpp",
1733 "tools/picture_utils.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001734 ]
1735 deps = [
1736 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001737 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001738 ":skia",
Kevin Lubick9ff5dc92018-01-09 12:47:33 -05001739 "//third_party/jsoncpp",
1740 "//third_party/libpng",
kjlubick14f984b2016-10-03 11:49:45 -07001741 ]
kjlubick14f984b2016-10-03 11:49:45 -07001742 }
Mike Klein38312422016-10-05 15:41:01 -04001743
Mike Kleine6682eb2017-01-05 10:54:57 -05001744 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001745 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001746 rebase_path("tests/skia_test.cpp"),
1747 rebase_path("tests/Test.cpp"),
1748 ]
caryclark9feb6322016-10-25 08:58:26 -07001749 deps = [
1750 ":flags",
1751 ":gpu_tool_utils",
1752 ":skia",
1753 ":tool_utils",
1754 ]
caryclark9feb6322016-10-25 08:58:26 -07001755 }
1756
Mike Kleine6682eb2017-01-05 10:54:57 -05001757 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001758 sources = [
1759 "tools/DumpRecord.cpp",
1760 "tools/dump_record.cpp",
1761 ]
1762 deps = [
1763 ":flags",
1764 ":skia",
1765 ]
Mike Klein38312422016-10-05 15:41:01 -04001766 }
bungemanfe917272016-10-13 17:36:40 -04001767
Mike Kleine6682eb2017-01-05 10:54:57 -05001768 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001769 sources = [
1770 "tools/skdiff/skdiff.cpp",
1771 "tools/skdiff/skdiff_html.cpp",
1772 "tools/skdiff/skdiff_main.cpp",
1773 "tools/skdiff/skdiff_utils.cpp",
1774 ]
1775 deps = [
1776 ":skia",
1777 ":tool_utils",
1778 ]
bungemanfe917272016-10-13 17:36:40 -04001779 }
halcanarya73d76a2016-10-17 13:19:02 -07001780
Mike Kleine6682eb2017-01-05 10:54:57 -05001781 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001782 sources = [
1783 "tools/skp_parser.cpp",
1784 ]
1785 deps = [
1786 ":skia",
1787 ":tool_utils",
1788 "//third_party/jsoncpp",
1789 ]
halcanarya73d76a2016-10-17 13:19:02 -07001790 }
Brian Osman16adfa32016-10-18 14:42:44 -04001791
Hal Canaryd7b38452017-12-11 17:46:26 -05001792 if (!is_win && skia_enable_gpu) {
1793 test_lib("skqp_lib") {
1794 public_include_dirs = [ "tools/skqp" ]
Hal Canary4689b542018-01-31 11:54:14 -05001795 defines = []
1796 if (skia_skqp_enable_driver_correctness_workarounds) {
1797 defines += [ "SK_SKQP_ENABLE_DRIVER_CORRECTNESS_WORKAROUNDS" ]
1798 }
Hal Canary75427132017-10-11 16:00:31 -04001799 sources = [
Hal Canaryd7b38452017-12-11 17:46:26 -05001800 "dm/DMFontMgr.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001801 "dm/DMGpuTestProcs.cpp",
Hal Canaryd7b38452017-12-11 17:46:26 -05001802 "tools/skqp/gm_knowledge.cpp",
1803 "tools/skqp/gm_runner.cpp",
Hal Canary75427132017-10-11 16:00:31 -04001804 ]
1805 deps = [
1806 ":gm",
1807 ":gpu_tool_utils",
1808 ":skia",
1809 ":tests",
Hal Canaryd7b38452017-12-11 17:46:26 -05001810 ":tool_utils",
1811 ]
1812 }
1813 test_app("skqp") {
1814 sources = [
1815 "tools/skqp/skqp.cpp",
1816 ]
1817 deps = [
1818 ":skia",
1819 ":skqp_lib",
Hal Canary537d9c02018-01-30 11:30:48 -05001820 ":tool_utils",
Hal Canary75427132017-10-11 16:00:31 -04001821 "//third_party/googletest",
1822 ]
1823 }
1824 }
Hal Canary28f89382017-12-12 09:42:14 -05001825 if (is_android && skia_enable_gpu) {
1826 test_app("skqp_app") {
1827 is_shared_library = true
1828 sources = [
1829 "tools/skqp/jni/org_skia_skqp_SkQPRunner.cpp",
1830 ]
1831 deps = [
1832 ":skia",
1833 ":skqp_lib",
Hal Canaryb4d01a92018-01-29 13:10:08 -05001834 ":tool_utils",
Hal Canary28f89382017-12-12 09:42:14 -05001835 ]
1836 libs = [ "android" ]
1837 }
1838 }
Hal Canary75427132017-10-11 16:00:31 -04001839
Hal Canarya9de7602018-01-19 13:08:23 -05001840 test_app("list_gms") {
1841 sources = [
1842 "tools/list_gms.cpp",
1843 ]
1844 deps = [
1845 ":gm",
1846 ":skia",
1847 ]
1848 }
1849 test_app("list_gpu_unit_tests") {
1850 sources = [
1851 "dm/DMGpuTestProcs.cpp",
1852 "tools/list_gpu_unit_tests.cpp",
1853 ]
1854 deps = [
1855 ":skia",
1856 ":tests",
1857 ]
1858 }
1859
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001860 if (skia_enable_gpu) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001861 test_lib("sk_app") {
1862 public_include_dirs = [ "tools/sk_app" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001863 sources = [
Brian Osmaneff04b52017-11-21 13:18:02 -05001864 "tools/sk_app/CommandSet.cpp",
1865 "tools/sk_app/GLWindowContext.cpp",
1866 "tools/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001867 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001868 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001869
Jim Van Verth4e56a912016-10-21 10:58:52 -04001870 if (is_android) {
1871 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001872 "tools/sk_app/android/GLWindowContext_android.cpp",
1873 "tools/sk_app/android/RasterWindowContext_android.cpp",
1874 "tools/sk_app/android/Window_android.cpp",
1875 "tools/sk_app/android/main_android.cpp",
1876 "tools/sk_app/android/surface_glue_android.cpp",
Jim Van Verth4e56a912016-10-21 10:58:52 -04001877 ]
Brian Osman462334e2017-02-09 11:22:57 -05001878 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001879 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001880 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001881 "tools/sk_app/unix/GLWindowContext_unix.cpp",
1882 "tools/sk_app/unix/RasterWindowContext_unix.cpp",
1883 "tools/sk_app/unix/Window_unix.cpp",
Brian Osmanfa916272017-12-01 09:18:20 -05001884 "tools/sk_app/unix/keysym2ucs.c",
Brian Osmaneff04b52017-11-21 13:18:02 -05001885 "tools/sk_app/unix/main_unix.cpp",
Brian Osman2dd96932016-10-18 15:33:53 -04001886 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001887 libs += [
1888 "GL",
1889 "X11",
1890 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001891 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001892 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001893 "tools/sk_app/win/GLWindowContext_win.cpp",
1894 "tools/sk_app/win/RasterWindowContext_win.cpp",
1895 "tools/sk_app/win/Window_win.cpp",
1896 "tools/sk_app/win/main_win.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001897 ]
Brian Salomon194db172017-08-17 14:37:06 -04001898 if (skia_use_angle) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001899 sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
Brian Salomon194db172017-08-17 14:37:06 -04001900 }
Mike Klein43c25262016-10-20 10:17:47 -04001901 } else if (is_mac) {
1902 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001903 "tools/sk_app/mac/GLWindowContext_mac.cpp",
1904 "tools/sk_app/mac/RasterWindowContext_mac.cpp",
1905 "tools/sk_app/mac/Window_mac.cpp",
1906 "tools/sk_app/mac/main_mac.cpp",
Mike Klein43c25262016-10-20 10:17:47 -04001907 ]
Brian Osmanfa916272017-12-01 09:18:20 -05001908 libs += [
1909 "QuartzCore.framework",
1910 "Cocoa.framework",
1911 "Foundation.framework",
1912 ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001913 } else if (is_ios) {
1914 sources += [
Brian Osmaneff04b52017-11-21 13:18:02 -05001915 "tools/sk_app/ios/GLWindowContext_ios.cpp",
1916 "tools/sk_app/ios/RasterWindowContext_ios.cpp",
1917 "tools/sk_app/ios/Window_ios.cpp",
1918 "tools/sk_app/ios/main_ios.cpp",
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001919 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001920 }
1921
1922 if (skia_use_vulkan) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001923 sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001924 if (is_android) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001925 sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001926 } else if (is_linux) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001927 sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
Brian Osman2dd96932016-10-18 15:33:53 -04001928 libs += [ "X11-xcb" ]
1929 } else if (is_win) {
Brian Osmaneff04b52017-11-21 13:18:02 -05001930 sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
Brian Osman16adfa32016-10-18 14:42:44 -04001931 }
1932 }
1933
Brian Osman16adfa32016-10-18 14:42:44 -04001934 deps = [
Brian Osman16adfa32016-10-18 14:42:44 -04001935 ":gpu_tool_utils",
Brian Osman16adfa32016-10-18 14:42:44 -04001936 ":skia",
1937 ":tool_utils",
1938 ":views",
Brian Osman16adfa32016-10-18 14:42:44 -04001939 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001940 if (is_android) {
1941 deps += [ "//third_party/native_app_glue" ]
Jim Van Verthdbb24ef2017-09-01 11:01:51 -04001942 } else if (is_mac || is_ios) {
Mike Klein43c25262016-10-20 10:17:47 -04001943 deps += [ "//third_party/libsdl" ]
1944 }
Brian Salomon194db172017-08-17 14:37:06 -04001945 if (skia_use_angle) {
1946 deps += [ "//third_party/angle2" ]
1947 }
Mike Kleina92c3832016-12-08 09:49:39 -05001948 }
Brian Osman16adfa32016-10-18 14:42:44 -04001949 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001950
Brian Osmaneff04b52017-11-21 13:18:02 -05001951 if (skia_enable_gpu) {
1952 test_app("viewer") {
1953 is_shared_library = is_android
Jim Van Verth329c5a62017-11-29 11:42:33 -05001954 if (is_ios) {
1955 bundle_ios_data = true
1956 }
Brian Osmaneff04b52017-11-21 13:18:02 -05001957 sources = [
1958 "tools/viewer/GMSlide.cpp",
Brian Osmand67e5182017-12-08 16:46:09 -05001959 "tools/viewer/ImGuiLayer.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05001960 "tools/viewer/ImageSlide.cpp",
1961 "tools/viewer/SKPSlide.cpp",
1962 "tools/viewer/SampleSlide.cpp",
Florin Malita54f65c42018-01-16 17:04:30 -05001963 "tools/viewer/SkottieSlide.cpp",
1964 "tools/viewer/SkottieSlide2.cpp",
Brian Osman56a24812017-12-19 11:15:16 -05001965 "tools/viewer/StatsLayer.cpp",
Brian Osmaneff04b52017-11-21 13:18:02 -05001966 "tools/viewer/Viewer.cpp",
1967 ]
1968 libs = []
1969
1970 include_dirs = []
1971 deps = [
Florin Malita54f65c42018-01-16 17:04:30 -05001972 ":experimental_skottie",
Brian Osmaneff04b52017-11-21 13:18:02 -05001973 ":flags",
1974 ":gm",
1975 ":gpu_tool_utils",
1976 ":samples",
1977 ":sk_app",
1978 ":skia",
1979 ":tool_utils",
1980 ":views",
1981 "//third_party/imgui",
1982 "//third_party/jsoncpp",
1983 ]
1984 }
1985 }
1986
1987 if (skia_enable_gpu && !skia_use_angle && (is_linux || is_win || is_mac)) {
1988 test_app("HelloWorld") {
1989 sources = [
1990 "example/HelloWorld.cpp",
1991 ]
1992 libs = []
1993
1994 include_dirs = []
1995 deps = [
1996 ":flags",
1997 ":gpu_tool_utils",
1998 ":sk_app",
1999 ":skia",
2000 ":tool_utils",
2001 ":views",
2002 ]
2003 }
2004 }
2005
Jim Van Verthecfed2b2017-08-30 14:02:50 -04002006 if (skia_enable_gpu && (is_linux || is_mac || is_ios)) {
Jim Van Verth4c70c752017-07-11 12:03:01 -04002007 test_app("SkiaSDLExample") {
2008 sources = [
2009 "example/SkiaSDLExample.cpp",
2010 ]
2011 libs = []
2012 include_dirs = []
2013 deps = [
2014 ":gpu_tool_utils",
2015 ":skia",
2016 "//third_party/libsdl",
2017 ]
2018 }
2019 }
2020
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002021 if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
2022 action_foreach("generate_mocs") {
2023 script = "gn/call.py"
2024 sources = [
2025 "tools/mdbviz/MainWindow.h",
2026 ]
2027 outputs = [
2028 "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
2029 ]
2030 args = [
2031 "$skia_qt_path" + "/bin/moc",
2032 "{{source}}",
2033 "-o",
2034 "gen/mdbviz/{{source_name_part}}_moc.cpp",
2035 ]
2036 }
2037 action_foreach("generate_resources") {
2038 script = "gn/call.py"
2039 sources = [
2040 "tools/mdbviz/resources.qrc",
2041 ]
2042 outputs = [
2043 "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
2044 ]
2045 args = [
2046 "$skia_qt_path" + "/bin/rcc",
2047 "{{source}}",
2048 "-o",
2049 "gen/mdbviz/{{source_name_part}}_res.cpp",
2050 ]
2051 }
2052 test_app("mdbviz") {
2053 if (is_win) {
2054 # on Windows we need to disable some exception handling warnings due to the Qt headers
2055 cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
2056 }
2057 sources = [
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002058 "tools/UrlDataManager.cpp",
2059 "tools/debugger/SkDebugCanvas.cpp",
2060 "tools/debugger/SkDrawCommand.cpp",
2061 "tools/debugger/SkJsonWriteBuffer.cpp",
2062 "tools/debugger/SkObjectParser.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002063 "tools/mdbviz/MainWindow.cpp",
Robert Phillipsdeaf5682017-09-06 13:07:21 -04002064 "tools/mdbviz/Model.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002065 "tools/mdbviz/main.cpp",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002066 "tools/picture_utils.cpp",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002067
2068 # generated files
2069 "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
2070 "$target_gen_dir/mdbviz/resources_res.cpp",
2071 ]
2072 lib_dirs = [ "$skia_qt_path/lib" ]
2073 libs = [
2074 "Qt5Core.lib",
2075 "Qt5Gui.lib",
2076 "Qt5Widgets.lib",
2077 ]
2078 include_dirs = [
2079 "$skia_qt_path/include",
Robert Phillips276066b2017-09-06 17:17:44 -04002080 "$skia_qt_path/include/QtCore",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002081 "$skia_qt_path/include/QtWidgets",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002082 "tools",
2083 "tools/debugger",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002084 ]
2085 deps = [
2086 ":generate_mocs",
2087 ":generate_resources",
2088 ":skia",
Robert Phillips5fccf9d2017-09-05 15:10:12 -04002089 "//third_party/jsoncpp",
2090 "//third_party/libpng",
Robert Phillipsa6d2d702017-09-01 12:17:03 -04002091 ]
2092 }
2093 }
2094
Mike Kleine459afd2017-03-03 09:21:30 -05002095 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05002096 copy("gdbserver") {
2097 sources = [
2098 "$ndk/$ndk_gdbserver",
2099 ]
2100 outputs = [
2101 "$root_out_dir/gdbserver",
2102 ]
2103 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05002104 }
mtklein25c81d42016-07-27 13:55:26 -07002105}
Mike Kleinc55a6cb2017-06-28 13:21:47 -04002106
2107if (skia_jumper_clang != "") {
2108 action("regen_jumper") {
2109 script = "src/jumper/build_stages.py"
2110
2111 inputs = [
2112 "src/jumper/SkJumper_stages.cpp",
Mike Klein9b2f69b2017-09-12 16:40:53 -04002113 "src/jumper/SkJumper_stages_lowp.cpp",
Mike Kleinc55a6cb2017-06-28 13:21:47 -04002114 ]
2115
2116 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it.
2117 outputs = [
2118 "$target_out_dir/" +
2119 rebase_path("src/jumper/SkJumper_generated.S", target_out_dir),
2120 "$target_out_dir/" +
2121 rebase_path("src/jumper/SkJumper_generated_win.S", target_out_dir),
2122 ]
2123
2124 args = [
2125 skia_jumper_clang,
2126 skia_jumper_objdump,
2127 skia_jumper_ccache,
2128 ] + rebase_path(inputs) + rebase_path(outputs)
2129 }
2130}