blob: 0401d0801ad515956fe34974e8e20e96b8086077 [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
Mike Kleincfc4f442016-10-26 17:19:03 -04006import("gn/android_framework_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 Klein69f6ed42016-10-13 15:45:07 -040024 skia_use_gdi = false
Mike Klein7d302882016-11-03 14:06:31 -040025 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
mtklein63213812016-08-24 09:55:56 -070026 skia_use_libjpeg_turbo = true
27 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070028 skia_use_libwebp = !is_fuchsia
Mike Klein38af9432016-11-11 11:39:44 -050029 skia_use_lua = false
mtkleina627b5c2016-09-20 13:36:47 -070030 skia_use_mesa = false
Mike Klein10d665d2016-11-01 11:46:10 -040031 skia_use_piex = !is_win
mtklein63213812016-08-24 09:55:56 -070032 skia_use_zlib = true
mtklein1bd72ba2016-09-16 07:45:52 -070033
Mike Klein7d921032017-01-05 12:20:41 -050034 skia_android_serial = ""
mtklein1bd72ba2016-09-16 07:45:52 -070035 skia_enable_android_framework_defines = false
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
mtklein06c35c02016-09-20 12:28:12 -070038 skia_enable_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050039 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040040 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Mike Klein3669a822017-03-03 10:55:02 -050041 skia_enable_tools = is_skia_dev_build
42 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Greg Daniel686bb212016-10-27 10:48:48 -040043 skia_vulkan_sdk = getenv("VULKAN_SDK")
Mike Kleinc55a6cb2017-06-28 13:21:47 -040044
45 skia_jumper_clang = ""
46 skia_jumper_objdump = ""
47 skia_jumper_ccache = ""
mtkleinc04ff472016-06-23 10:29:30 -070048}
Brian Salomon23d73ea2016-10-27 13:31:37 -040049declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040050 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040051 skia_use_sfntly = skia_use_icu
52
Mike Klein4d598a32016-10-31 13:44:49 -040053 if (is_android) {
54 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
Forrest Reiling30229ac2017-04-17 13:36:39 -070055 } else if (is_fuchsia) {
56 skia_use_vulkan = fuchsia_use_vulkan
Mike Klein4d598a32016-10-31 13:44:49 -040057 } else {
58 skia_use_vulkan = skia_vulkan_sdk != ""
59 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040060}
Greg Danielec6ae522017-04-25 13:38:26 -040061declare_args() {
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +000062 skia_vulkan_headers = ""
Greg Danielec6ae522017-04-25 13:38:26 -040063 if (skia_use_vulkan) {
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +000064 # 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 -040065 if (is_fuchsia) {
66 skia_vulkan_headers = "$fuchsia_vulkan_sdk/include"
67 } else if (is_linux || is_win) {
68 skia_vulkan_headers = "$skia_vulkan_sdk/include"
Greg Danielec6ae522017-04-25 13:38:26 -040069 }
Greg Danielec6ae522017-04-25 13:38:26 -040070 }
71}
Brian Salomon789e25e2016-09-30 13:41:03 -040072
mtklein38925aa2016-09-21 10:11:25 -070073# Our tools require static linking (they use non-exported symbols).
74skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070075
mtkleina45be612016-08-29 15:22:10 -070076fontmgr_android_enabled = skia_use_expat && skia_use_freetype
77
mtklein1211e0c2016-07-26 13:55:45 -070078skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070079 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070080 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070081 "include/codec",
82 "include/config",
83 "include/core",
84 "include/effects",
Matt Sarett94fd06f2017-05-08 17:31:00 -040085 "include/encode",
mtklein1211e0c2016-07-26 13:55:45 -070086 "include/gpu",
87 "include/gpu/gl",
mtklein1211e0c2016-07-26 13:55:45 -070088 "include/pathops",
89 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070090 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -070091 "include/utils",
92 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -070093]
94
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +000095if (skia_use_vulkan) {
96 skia_public_includes += [ "include/gpu/vk" ]
97}
98
mtkleinc04ff472016-06-23 10:29:30 -070099# Skia public API, generally provided by :skia.
100config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -0700101 include_dirs = skia_public_includes
Greg Danielec6ae522017-04-25 13:38:26 -0400102 if (skia_vulkan_headers != "") {
103 include_dirs += [ skia_vulkan_headers ]
104 }
Mike Kleinae7e6712016-10-11 17:49:33 -0400105 defines = []
106 if (is_component_build) {
107 defines += [ "SKIA_DLL" ]
108 }
Mike Kleinc4cbd742016-09-26 21:37:09 -0400109 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -0700110 defines += [ "SK_SAMPLES_FOR_X" ]
111 }
mtkleincae1be52016-09-20 08:24:34 -0700112 if (skia_enable_android_framework_defines) {
Mike Kleincfc4f442016-10-26 17:19:03 -0400113 defines += android_framework_defines
mtkleincae1be52016-09-20 08:24:34 -0700114 }
mtklein06c35c02016-09-20 12:28:12 -0700115 if (!skia_enable_gpu) {
116 defines += [ "SK_SUPPORT_GPU=0" ]
117 }
mtkleinc04ff472016-06-23 10:29:30 -0700118}
119
120# Skia internal APIs, used by Skia itself and a few test tools.
121config("skia_private") {
122 visibility = [ ":*" ]
123
124 include_dirs = [
125 "include/private",
126 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -0700127 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700128 "src/core",
129 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700130 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700131 "src/image",
132 "src/images",
133 "src/lazy",
134 "src/opts",
135 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700136 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700137 "src/ports",
138 "src/sfnt",
Florin Malita5edba452017-05-30 16:39:47 -0400139 "src/shaders",
140 "src/shaders/gradients",
mtklein9e0d9dd2016-08-30 10:37:19 -0700141 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700142 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700143 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500144 "src/xml",
scroggo19b91532016-10-24 09:03:26 -0700145 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700146 ]
mtklein150d1132016-08-01 06:56:40 -0700147
Mike Reeda9e241d2017-05-03 10:52:00 -0400148 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700149 if (is_android) {
150 defines += [
151 "SK_GAMMA_EXPONENT=1.4",
152 "SK_GAMMA_CONTRAST=0.0",
153 ]
154 }
mtklein88a7ac02016-09-14 11:16:49 -0700155 if (is_official_build || is_android) {
156 # TODO(bsalomon): it'd be nice to make Android normal.
157 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
158 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400159 libs = []
160 lib_dirs = []
161 if (skia_use_vulkan) {
Michael Jurkada3e5962017-04-14 17:44:09 -0700162 if (skia_vulkan_sdk != "" && !is_android && !is_fuchsia) {
Mike Klein487bfc22016-10-14 14:04:56 -0400163 if (is_win) {
Brian Salomon3b5bf352017-03-20 15:54:41 -0400164 lib_dirs += [
165 "$skia_vulkan_sdk/Bin",
166 "$skia_vulkan_sdk/Lib",
167 ]
Mike Klein487bfc22016-10-14 14:04:56 -0400168 } else {
Greg Daniel686bb212016-10-27 10:48:48 -0400169 lib_dirs += [ "$skia_vulkan_sdk/lib/" ]
Mike Klein487bfc22016-10-14 14:04:56 -0400170 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400171 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400172 }
Brian Salomon03e05842017-02-23 12:23:47 -0500173 if (skia_enable_gpu) {
174 include_dirs += [ "src/gpu" ]
175 }
Brian Osman34755e22016-12-05 09:46:02 -0500176 if (skia_use_angle) {
177 defines += [ "SK_ANGLE" ]
178 }
Brian Osman3f375d02016-12-28 11:19:22 -0500179 if (skia_enable_discrete_gpu) {
180 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
181 }
mtkleinc04ff472016-06-23 10:29:30 -0700182}
183
184# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
185config("skia_library") {
186 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700187 defines = [ "SKIA_IMPLEMENTATION=1" ]
188}
189
190skia_library_configs = [
191 ":skia_public",
192 ":skia_private",
193 ":skia_library",
194]
195
mtklein9b8583d2016-08-24 17:32:30 -0700196# Use for CPU-specific Skia code that needs particular compiler flags.
197template("opts") {
198 if (invoker.enabled) {
199 source_set(target_name) {
200 forward_variables_from(invoker, "*")
201 configs += skia_library_configs
202 }
203 } else {
204 # If not enabled, a phony empty target that swallows all otherwise unused variables.
205 source_set(target_name) {
206 forward_variables_from(invoker,
207 "*",
208 [
209 "sources",
210 "cflags",
211 ])
212 }
213 }
anmittala7eaf2e2016-08-17 13:57:26 -0700214}
215
mtklein422310d2016-08-16 18:28:43 -0700216is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700217
mtklein7d6fb2c2016-08-25 14:50:44 -0700218opts("none") {
219 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700220 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700221 cflags = []
222}
223
mtklein7d6fb2c2016-08-25 14:50:44 -0700224opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700225 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700226 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700227 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700228}
229
230opts("arm64") {
231 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700232 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700233 cflags = []
234}
235
236opts("crc32") {
237 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700238 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700239 cflags = [ "-march=armv8-a+crc" ]
240}
241
mtklein9b8583d2016-08-24 17:32:30 -0700242opts("sse2") {
243 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700244 sources = skia_opts.sse2_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400245 if (is_win) {
246 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
247 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400248 cflags = [ "-msse2" ]
249 }
mtklein9b8583d2016-08-24 17:32:30 -0700250}
mtkleinc04ff472016-06-23 10:29:30 -0700251
mtklein9b8583d2016-08-24 17:32:30 -0700252opts("ssse3") {
253 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700254 sources = skia_opts.ssse3_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400255 if (is_win) {
256 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
257 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400258 cflags = [ "-mssse3" ]
259 }
mtklein9b8583d2016-08-24 17:32:30 -0700260}
mtkleinc04ff472016-06-23 10:29:30 -0700261
mtklein9b8583d2016-08-24 17:32:30 -0700262opts("sse41") {
263 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700264 sources = skia_opts.sse41_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400265 if (is_win) {
266 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
267 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400268 cflags = [ "-msse4.1" ]
269 }
mtklein9b8583d2016-08-24 17:32:30 -0700270}
mtklein4e976072016-08-08 09:06:27 -0700271
mtklein9b8583d2016-08-24 17:32:30 -0700272opts("sse42") {
273 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700274 sources = skia_opts.sse42_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400275 if (is_win) {
276 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
277 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400278 cflags = [ "-msse4.2" ]
279 }
mtklein9b8583d2016-08-24 17:32:30 -0700280}
281
282opts("avx") {
283 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700284 sources = skia_opts.avx_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400285 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000286 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400287 } else {
288 cflags = [ "-mavx" ]
289 }
mtkleinc04ff472016-06-23 10:29:30 -0700290}
291
Mike Klein78d5a3b2016-09-30 10:48:01 -0400292opts("hsw") {
293 enabled = is_x86
294 sources = skia_opts.hsw_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400295 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000296 cflags = [ "/arch:AVX2" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400297 } else {
298 cflags = [
299 "-mavx2",
300 "-mbmi",
301 "-mbmi2",
302 "-mf16c",
303 "-mfma",
304 ]
305 }
Mike Klein78d5a3b2016-09-30 10:48:01 -0400306}
307
mtkleinc095df52016-08-24 12:23:52 -0700308# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700309template("optional") {
310 if (invoker.enabled) {
311 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700312 if (defined(invoker.public_defines)) {
313 defines = invoker.public_defines
314 }
mtklein457b42a2016-08-23 13:56:37 -0700315 }
316 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700317 forward_variables_from(invoker,
318 "*",
319 [
320 "public_defines",
321 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700322 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700323 ])
mtklein457b42a2016-08-23 13:56:37 -0700324 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700325 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700326 if (defined(invoker.configs_to_remove)) {
327 configs -= invoker.configs_to_remove
328 }
mtklein457b42a2016-08-23 13:56:37 -0700329 }
330 } else {
mtklein457b42a2016-08-23 13:56:37 -0700331 source_set(target_name) {
332 forward_variables_from(invoker,
333 "*",
334 [
335 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700336 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700337 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700338 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700339 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700340 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700341 ])
mtkleincd01b032016-08-31 04:58:19 -0700342 if (defined(invoker.sources_when_disabled)) {
343 sources = invoker.sources_when_disabled
344 }
345 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700346 }
mtkleineb3c4252016-08-23 07:38:09 -0700347 }
mtklein457b42a2016-08-23 13:56:37 -0700348}
mtklein457b42a2016-08-23 13:56:37 -0700349
Mike Kleina04bb452017-02-09 12:24:07 -0500350optional("effects") {
351 enabled = skia_enable_effects
352 sources =
353 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
354 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
355}
356
mtkleina45be612016-08-29 15:22:10 -0700357optional("fontmgr_android") {
358 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700359
360 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500361 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700362 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700363 ]
364 sources = [
365 "src/ports/SkFontMgr_android.cpp",
366 "src/ports/SkFontMgr_android_factory.cpp",
367 "src/ports/SkFontMgr_android_parser.cpp",
368 ]
369}
370
mtkleind2e39db2016-09-07 07:52:55 -0700371optional("fontmgr_custom") {
372 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
373
374 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500375 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700376 ]
377 sources = [
378 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500379 "src/ports/SkFontMgr_custom.h",
380 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700381 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500382 "src/ports/SkFontMgr_custom_embedded.cpp",
383 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700384 ]
385}
386
mtklein3cc22182016-08-29 13:26:14 -0700387optional("fontmgr_fontconfig") {
388 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700389
390 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500391 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700392 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700393 ]
394 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700395 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700396 "src/ports/SkFontConfigInterface_direct.cpp",
397 "src/ports/SkFontConfigInterface_direct_factory.cpp",
398 "src/ports/SkFontMgr_FontConfigInterface.cpp",
399 "src/ports/SkFontMgr_fontconfig.cpp",
400 "src/ports/SkFontMgr_fontconfig_factory.cpp",
401 ]
402}
403
mtkleincdedd0e2016-09-12 15:15:44 -0700404optional("fontmgr_fuchsia") {
405 enabled = is_fuchsia && skia_use_freetype
406
407 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500408 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700409 ]
410 sources = [
411 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500412 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700413 "src/ports/SkFontMgr_custom_empty_factory.cpp",
414 ]
415}
416
mtklein06c35c02016-09-20 12:28:12 -0700417optional("gpu") {
418 enabled = skia_enable_gpu
mtkleine9fb3d52016-09-20 15:11:46 -0700419 public_defines = []
420
Mike Klein29b3e582017-02-09 11:57:32 -0500421 sources = skia_gpu_sources + skia_sksl_sources +
Mike Klein5ce39722017-06-27 22:52:03 +0000422 [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700423
424 # These paths need to be absolute to match the ones produced by shared_sources.gni.
425 sources -= get_path_info([
426 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
427 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
428 ],
429 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400430 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700431 if (is_android) {
432 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
Derek Sollenberger7a869872017-06-27 15:37:25 -0400433
434 # this lib is required to link against AHardwareBuffer
435 if (defined(ndk_api) && ndk_api >= 26) {
436 libs += [ "android" ]
437 }
Kevin Lubick4a24e102017-03-29 11:19:01 -0400438 } else if (skia_use_egl) {
439 sources += [ "src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp" ]
440 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700441 } else if (is_linux) {
442 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500443 libs += [
444 "GL",
445 "GLU",
446 ]
mtklein06c35c02016-09-20 12:28:12 -0700447 } else if (is_mac) {
448 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800449 } else if (is_ios) {
450 sources += [ "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400451 } else if (is_win) {
452 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
453 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700454 } else {
455 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
456 }
mtkleine9fb3d52016-09-20 15:11:46 -0700457
458 if (skia_use_vulkan) {
459 public_defines += [ "SK_VULKAN" ]
460 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700461 if (skia_enable_vulkan_debug_layers) {
462 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
463 }
mtkleine9fb3d52016-09-20 15:11:46 -0700464 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400465 if (skia_enable_spirv_validation) {
Mike Klein5ce39722017-06-27 22:52:03 +0000466 deps = [
467 "//third_party/spirv-tools",
468 ]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400469 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
470 }
mtklein06c35c02016-09-20 12:28:12 -0700471}
472
mtklein63213812016-08-24 09:55:56 -0700473optional("jpeg") {
474 enabled = skia_use_libjpeg_turbo
475 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
476
mtklein63213812016-08-24 09:55:56 -0700477 deps = [
478 "//third_party/libjpeg-turbo:libjpeg",
479 ]
480 sources = [
481 "src/codec/SkJpegCodec.cpp",
482 "src/codec/SkJpegDecoderMgr.cpp",
483 "src/codec/SkJpegUtility.cpp",
mtklein63213812016-08-24 09:55:56 -0700484 "src/images/SkJPEGWriteUtility.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400485 "src/images/SkJpegEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700486 ]
487}
488
489optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500490 enabled = skia_use_zlib && skia_enable_pdf
491 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700492
mtklein63213812016-08-24 09:55:56 -0700493 deps = [
494 "//third_party/zlib",
495 ]
brettwb9447282016-09-01 14:24:39 -0700496 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700497 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700498
499 if (skia_use_sfntly) {
500 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500501 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700502 }
503}
504
505optional("png") {
506 enabled = skia_use_libpng
507 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
508
mtklein63213812016-08-24 09:55:56 -0700509 deps = [
510 "//third_party/libpng",
511 ]
512 sources = [
513 "src/codec/SkIcoCodec.cpp",
514 "src/codec/SkPngCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400515 "src/images/SkPngEncoder.cpp",
mtklein63213812016-08-24 09:55:56 -0700516 ]
517}
518
scroggof84ad642016-10-31 09:02:57 -0700519optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400520 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700521 public_defines = [ "SK_CODEC_DECODES_RAW" ]
522
523 deps = [
524 "//third_party/dng_sdk",
525 "//third_party/libjpeg-turbo:libjpeg",
526 "//third_party/piex",
527 ]
528
529 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
530 # Skia.
531 configs_to_remove = [ "//gn:no_exceptions" ]
532
533 sources = [
534 "src/codec/SkRawAdapterCodec.cpp",
535 "src/codec/SkRawCodec.cpp",
536 ]
537}
538
mtklein3cc22182016-08-29 13:26:14 -0700539optional("typeface_freetype") {
540 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700541
542 deps = [
543 "//third_party/freetype2",
544 ]
545 sources = [
546 "src/ports/SkFontHost_FreeType.cpp",
547 "src/ports/SkFontHost_FreeType_common.cpp",
548 ]
549}
550
mtklein457b42a2016-08-23 13:56:37 -0700551optional("webp") {
552 enabled = skia_use_libwebp
553 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
554
mtklein457b42a2016-08-23 13:56:37 -0700555 deps = [
556 "//third_party/libwebp",
557 ]
558 sources = [
559 "src/codec/SkWebpAdapterCodec.cpp",
560 "src/codec/SkWebpCodec.cpp",
Matt Sarett04c37312017-05-05 14:02:13 -0400561 "src/images/SkWebpEncoder.cpp",
mtklein457b42a2016-08-23 13:56:37 -0700562 ]
mtkleineb3c4252016-08-23 07:38:09 -0700563}
564
mtklein63213812016-08-24 09:55:56 -0700565optional("xml") {
566 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000567 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700568
mtklein63213812016-08-24 09:55:56 -0700569 deps = [
570 "//third_party/expat",
571 ]
572 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500573 "src/svg/SkSVGCanvas.cpp",
574 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700575 "src/xml/SkDOM.cpp",
576 "src/xml/SkXMLParser.cpp",
577 "src/xml/SkXMLWriter.cpp",
578 ]
579}
580
mtkleinc04ff472016-06-23 10:29:30 -0700581component("skia") {
582 public_configs = [ ":skia_public" ]
583 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700584
585 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700586 ":arm64",
587 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700588 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700589 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500590 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700591 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700592 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700593 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700594 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700595 ":gpu",
Mike Klein78d5a3b2016-09-30 10:48:01 -0400596 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700597 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700598 ":none",
mtklein63213812016-08-24 09:55:56 -0700599 ":pdf",
600 ":png",
scroggof84ad642016-10-31 09:02:57 -0700601 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700602 ":sse2",
603 ":sse41",
604 ":sse42",
605 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700606 ":webp",
mtklein63213812016-08-24 09:55:56 -0700607 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700608 ]
609
Chinmay Garde43f115c2016-11-16 15:04:12 -0800610 # This file (and all GN files in Skia) are designed to work with an
611 # empty sources assignment filter; we handle all that explicitly.
612 # We clear the filter here for clients who may have set up a global filter.
613 set_sources_assignment_filter([])
614
mtkleinc04ff472016-06-23 10:29:30 -0700615 sources = []
brettwb9447282016-09-01 14:24:39 -0700616 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700617 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500618 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700619 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700620 "src/android/SkBitmapRegionCodec.cpp",
621 "src/android/SkBitmapRegionDecoder.cpp",
622 "src/codec/SkAndroidCodec.cpp",
Leon Scroggins IIId81fed92017-06-01 13:42:28 -0400623 "src/codec/SkBmpBaseCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700624 "src/codec/SkBmpCodec.cpp",
625 "src/codec/SkBmpMaskCodec.cpp",
626 "src/codec/SkBmpRLECodec.cpp",
627 "src/codec/SkBmpStandardCodec.cpp",
628 "src/codec/SkCodec.cpp",
629 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700630 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700631 "src/codec/SkMaskSwizzler.cpp",
632 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700633 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700634 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700635 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700636 "src/codec/SkSwizzler.cpp",
637 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700638 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700639 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700640 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700641 "src/ports/SkMemory_malloc.cpp",
642 "src/ports/SkOSFile_stdio.cpp",
643 "src/sfnt/SkOTTable_name.cpp",
644 "src/sfnt/SkOTUtils.cpp",
645 "src/utils/mac/SkStream_mac.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700646 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700647 ]
brettwb9447282016-09-01 14:24:39 -0700648
mtklein7d6fb2c2016-08-25 14:50:44 -0700649 libs = []
650
mtkleinc04ff472016-06-23 10:29:30 -0700651 if (is_win) {
652 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400653 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700654 "src/ports/SkDebug_win.cpp",
655 "src/ports/SkFontHost_win.cpp",
656 "src/ports/SkFontMgr_win_dw.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700657 "src/ports/SkImageEncoder_WIC.cpp",
658 "src/ports/SkImageGeneratorWIC.cpp",
659 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700660 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700661 "src/ports/SkScalerContext_win_dw.cpp",
662 "src/ports/SkTLS_win.cpp",
663 "src/ports/SkTypeface_win_dw.cpp",
664 ]
Mike Klein69f6ed42016-10-13 15:45:07 -0400665 if (skia_use_gdi) {
666 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
667 libs += [
668 "Gdi32.lib",
669 "Usp10.lib",
670 ]
671 } else {
672 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
673 }
mtkleinb9be9792016-09-16 14:44:18 -0700674 sources -=
675 [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400676 libs += [
677 "FontSub.lib",
678 "Ole32.lib",
679 "OleAut32.lib",
680 "User32.lib",
681 ]
mtkleinc04ff472016-06-23 10:29:30 -0700682 } else {
683 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700684 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700685 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700686 "src/ports/SkTLS_pthread.cpp",
687 ]
688 }
689
mtklein7d6fb2c2016-08-25 14:50:44 -0700690 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500691 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500692 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500693 deps += [ "//third_party/cpu-features" ]
694 }
mtklein06c35c02016-09-20 12:28:12 -0700695 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700696 libs += [
697 "EGL",
698 "GLESv2",
699 "log",
700 ]
701 }
702
mtkleinc04ff472016-06-23 10:29:30 -0700703 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700704 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700705 }
706
707 if (is_mac) {
708 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700709 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700710 "src/ports/SkFontHost_mac.cpp",
711 "src/ports/SkImageEncoder_CG.cpp",
712 "src/ports/SkImageGeneratorCG.cpp",
713 ]
mtklein09e61f72016-08-23 13:35:28 -0700714 libs += [
bungeman3e306f62017-03-29 11:32:02 -0400715 # AppKit symbols NSFontWeightXXX may be dlsym'ed.
716 "AppKit.framework",
mtklein09e61f72016-08-23 13:35:28 -0700717 "ApplicationServices.framework",
718 "OpenGL.framework",
719 ]
mtkleinc04ff472016-06-23 10:29:30 -0700720 }
abarth6fc8ff02016-07-15 15:15:15 -0700721
Mike Klein7d302882016-11-03 14:06:31 -0400722 if (is_ios) {
723 sources += [
724 "src/ports/SkDebug_stdio.cpp",
725 "src/ports/SkFontHost_mac.cpp",
726 "src/ports/SkImageEncoder_CG.cpp",
727 "src/ports/SkImageGeneratorCG.cpp",
728 ]
729 libs += [
730 "CoreFoundation.framework",
731 "CoreGraphics.framework",
732 "CoreText.framework",
733 "ImageIO.framework",
734 "MobileCoreServices.framework",
bungeman3e306f62017-03-29 11:32:02 -0400735
736 # UIKit symbols UIFontWeightXXX may be dlsym'ed.
737 "UIKit.framework",
Mike Klein7d302882016-11-03 14:06:31 -0400738 ]
739 }
740
abarth6fc8ff02016-07-15 15:15:15 -0700741 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700742 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700743 }
mtkleinc04ff472016-06-23 10:29:30 -0700744}
745
mtkleinc095df52016-08-24 12:23:52 -0700746# Targets guarded by skia_enable_tools may use //third_party freely.
747if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500748 # Used by gn_to_bp.py to list our public include dirs.
749 source_set("public") {
750 configs += [ ":skia_public" ]
751 }
752
Mike Kleinc36dedf2016-11-18 09:35:28 -0500753 config("skia.h_config") {
754 include_dirs = [ "$target_gen_dir" ]
755 }
756 action("skia.h") {
757 public_configs = [ ":skia.h_config" ]
758 skia_h = "$target_gen_dir/skia.h"
759 script = "gn/find_headers.py"
Greg Danielc819e662017-04-19 16:39:45 -0400760 args = [ rebase_path(skia_h, root_build_dir) ] +
Robert Phillipsfcd5fdd2017-06-14 01:43:29 +0000761 rebase_path(skia_public_includes)
Mike Kleinc36dedf2016-11-18 09:35:28 -0500762 depfile = "$skia_h.deps"
763 outputs = [
764 skia_h,
765 ]
766 }
767
768 if (skia_enable_gpu && target_cpu == "x64") {
769 # Our bots only have 64-bit libOSMesa installed.
770 # TODO: worth fixing?
771 executable("fiddle") {
772 libs = []
Mike Kleinc36dedf2016-11-18 09:35:28 -0500773 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500774 "tools/fiddle/draw.cpp",
775 "tools/fiddle/fiddle_main.cpp",
776 ]
Joe Gregorioa8fabd32017-05-31 09:45:19 -0400777
778 if (skia_use_egl) {
779 sources += [ "tools/fiddle/egl_context.cpp" ]
780 } else if (skia_use_mesa) {
781 sources += [ "tools/fiddle/mesa_context.cpp" ]
782 if (is_linux) {
783 libs += [ "OSMesa" ]
784 }
785 } else {
786 sources += [ "tools/fiddle/null_context.cpp" ]
787 }
Joe Gregorio1e735c02017-04-19 14:05:14 -0400788 testonly = true
Mike Kleinc36dedf2016-11-18 09:35:28 -0500789 deps = [
Joe Gregorio1e735c02017-04-19 14:05:14 -0400790 ":flags",
Mike Kleinc36dedf2016-11-18 09:35:28 -0500791 ":skia",
792 ":skia.h",
793 ]
794 }
795 }
796
797 if (skia_enable_gpu) {
798 source_set("public_headers_warnings_check") {
799 sources = [
800 "tools/public_headers_warnings_check.cpp",
801 ]
802 configs -= [ "//gn:warnings_except_public_headers" ]
803 deps = [
804 ":skia",
805 ":skia.h",
806 ]
807 }
808 }
809
mtkleinc095df52016-08-24 12:23:52 -0700810 template("test_lib") {
811 config(target_name + "_config") {
812 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700813 if (defined(invoker.public_defines)) {
814 defines = invoker.public_defines
815 }
mtklein25c81d42016-07-27 13:55:26 -0700816 }
mtkleinc095df52016-08-24 12:23:52 -0700817 source_set(target_name) {
818 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
819 public_configs = [
820 ":" + target_name + "_config",
821 ":skia_private",
822 ]
823
824 if (!defined(deps)) {
825 deps = []
826 }
827 deps += [ ":skia" ]
828 testonly = true
829 }
mtklein25c81d42016-07-27 13:55:26 -0700830 }
mtklein25c81d42016-07-27 13:55:26 -0700831
Mike Kleine6682eb2017-01-05 10:54:57 -0500832 template("test_app") {
833 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
834 shared_library("lib" + target_name) {
835 forward_variables_from(invoker, "*", [ "is_shared_library" ])
836 testonly = true
837 }
838 } else {
Mike Klein7d921032017-01-05 12:20:41 -0500839 _executable = target_name
840 executable(_executable) {
Mike Kleine6682eb2017-01-05 10:54:57 -0500841 forward_variables_from(invoker, "*", [ "is_shared_library" ])
842 testonly = true
843 }
844 }
Mike Klein7d921032017-01-05 12:20:41 -0500845 if (is_android && skia_android_serial != "" && defined(_executable)) {
846 action("push_" + target_name) {
847 script = "gn/push_to_android.py"
848 deps = [
849 ":" + _executable,
850 ]
851 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
852 outputs = [
853 _stamp,
854 ]
855 args = [
856 rebase_path("$root_build_dir/$_executable"),
857 skia_android_serial,
858 rebase_path(_stamp),
859 ]
860 testonly = true
861 }
862 }
Mike Kleine6682eb2017-01-05 10:54:57 -0500863 }
864
mtkleinc095df52016-08-24 12:23:52 -0700865 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700866 public_include_dirs = []
867 if (skia_enable_gpu) {
868 public_defines = []
869 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700870
871 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700872 sources = [
873 "tools/gpu/GrContextFactory.cpp",
874 "tools/gpu/GrTest.cpp",
875 "tools/gpu/TestContext.cpp",
876 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -0700877 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700878 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
879 "tools/gpu/gl/debug/GrBufferObj.cpp",
880 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
881 "tools/gpu/gl/debug/GrProgramObj.cpp",
882 "tools/gpu/gl/debug/GrShaderObj.cpp",
883 "tools/gpu/gl/debug/GrTextureObj.cpp",
884 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
885 "tools/gpu/gl/null/NullGLTestContext.cpp",
886 ]
887 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700888
Kevin Lubick4a24e102017-03-29 11:19:01 -0400889 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -0700890 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -0400891 } else if (is_ios) {
892 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
893 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -0700894 } else if (is_linux) {
895 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500896 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -0700897 } else if (is_mac) {
898 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400899 } else if (is_win) {
900 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
901 libs += [
902 "Gdi32.lib",
903 "OpenGL32.lib",
904 ]
mtklein38925aa2016-09-21 10:11:25 -0700905 }
mtklein6ef69992016-09-14 06:12:09 -0700906
Mike Kleinc168a3a2016-11-14 14:53:13 +0000907 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +0000908 deps += [ "//third_party/angle2" ]
909 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
910 }
mtklein38925aa2016-09-21 10:11:25 -0700911 if (skia_use_mesa) {
912 public_defines += [ "SK_MESA" ]
913 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
914 libs += [ "OSMesa" ]
915 }
mtkleind68f9b02016-09-23 13:18:41 -0700916 if (skia_use_vulkan) {
917 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
Brian Salomon5db010b2017-04-25 16:05:29 -0400918 if (is_win) {
919 libs += [ "vulkan-1.lib" ]
920 } else {
921 libs += [ "vulkan" ]
922 }
mtkleind68f9b02016-09-23 13:18:41 -0700923 }
mtkleina627b5c2016-09-20 13:36:47 -0700924 }
mtklein25c81d42016-07-27 13:55:26 -0700925 }
mtklein25c81d42016-07-27 13:55:26 -0700926
mtkleinc095df52016-08-24 12:23:52 -0700927 test_lib("flags") {
928 public_include_dirs = [ "tools/flags" ]
929 sources = [
930 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -0700931 ]
932 }
933 test_lib("common_flags") {
934 public_include_dirs = [ "tools/flags" ]
935 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700936 "tools/flags/SkCommonFlags.cpp",
937 "tools/flags/SkCommonFlagsConfig.cpp",
938 ]
939 deps = [
mtklein046cb562016-09-16 10:23:12 -0700940 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700941 ":gpu_tool_utils",
942 ]
943 }
mtklein25c81d42016-07-27 13:55:26 -0700944
mtkleinc095df52016-08-24 12:23:52 -0700945 test_lib("tool_utils") {
946 public_include_dirs = [
947 "tools",
948 "tools/debugger",
949 "tools/timer",
950 ]
951 sources = [
mtkleinb37c0342016-09-09 11:07:45 -0700952 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700953 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700954 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700955 "tools/ProcStats.cpp",
956 "tools/Resources.cpp",
957 "tools/ThermalManager.cpp",
958 "tools/UrlDataManager.cpp",
959 "tools/debugger/SkDebugCanvas.cpp",
960 "tools/debugger/SkDrawCommand.cpp",
961 "tools/debugger/SkJsonWriteBuffer.cpp",
962 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700963 "tools/picture_utils.cpp",
964 "tools/random_parse_path.cpp",
965 "tools/sk_tool_utils.cpp",
966 "tools/sk_tool_utils_font.cpp",
967 "tools/timer/Timer.cpp",
968 ]
Mike Kleinadacaef2017-02-06 09:26:14 -0500969 libs = []
970 if (is_ios) {
971 sources += [ "tools/ios_utils.m" ]
972 libs += [ "Foundation.framework" ]
973 }
mtkleinc095df52016-08-24 12:23:52 -0700974 deps = [
mtklein046cb562016-09-16 10:23:12 -0700975 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -0700976 ":flags",
977 "//third_party/libpng",
978 ]
979 public_deps = [
980 "//third_party/jsoncpp",
981 ]
982 }
mtklein25c81d42016-07-27 13:55:26 -0700983
Mike Klein6e744122016-10-27 12:21:40 -0400984 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -0700985 test_lib("gm") {
986 public_include_dirs = [ "gm" ]
987 sources = gm_sources
988 deps = [
scroggo19b91532016-10-24 09:03:26 -0700989 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700990 ":gpu_tool_utils",
991 ":skia",
992 ":tool_utils",
993 ]
994 }
mtklein25c81d42016-07-27 13:55:26 -0700995
Mike Klein6e744122016-10-27 12:21:40 -0400996 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -0700997 test_lib("tests") {
998 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -0400999 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -07001000 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -04001001 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -07001002 }
mtkleinc095df52016-08-24 12:23:52 -07001003 deps = [
fmalita6cf896d2016-08-25 08:44:35 -07001004 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -07001005 ":flags",
mtkleinc095df52016-08-24 12:23:52 -07001006 ":skia",
1007 ":tool_utils",
1008 "//third_party/libpng",
1009 "//third_party/zlib",
1010 ]
Mike Kleind63442d2017-03-27 14:16:04 -04001011 public_deps = [
1012 ":gpu_tool_utils", # Test.h #includes headers from this target.
1013 ]
mtkleinc095df52016-08-24 12:23:52 -07001014 }
mtklein2f3416d2016-08-02 16:02:05 -07001015
Mike Klein6e744122016-10-27 12:21:40 -04001016 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -07001017 test_lib("bench") {
1018 public_include_dirs = [ "bench" ]
1019 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -07001020 deps = [
1021 ":flags",
1022 ":gm",
1023 ":gpu_tool_utils",
1024 ":skia",
1025 ":tool_utils",
1026 ]
1027 }
mtklein2b6870c2016-07-28 14:17:33 -07001028
mtkleinc095df52016-08-24 12:23:52 -07001029 test_lib("experimental_svg_model") {
1030 public_include_dirs = [ "experimental/svg/model" ]
1031 sources = [
1032 "experimental/svg/model/SkSVGAttribute.cpp",
1033 "experimental/svg/model/SkSVGAttributeParser.cpp",
1034 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -05001035 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001036 "experimental/svg/model/SkSVGContainer.cpp",
1037 "experimental/svg/model/SkSVGDOM.cpp",
1038 "experimental/svg/model/SkSVGEllipse.cpp",
1039 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001040 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001041 "experimental/svg/model/SkSVGNode.cpp",
1042 "experimental/svg/model/SkSVGPath.cpp",
1043 "experimental/svg/model/SkSVGPoly.cpp",
1044 "experimental/svg/model/SkSVGRect.cpp",
1045 "experimental/svg/model/SkSVGRenderContext.cpp",
1046 "experimental/svg/model/SkSVGSVG.cpp",
1047 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001048 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001049 "experimental/svg/model/SkSVGTransformableNode.cpp",
1050 "experimental/svg/model/SkSVGValue.cpp",
1051 ]
1052 deps = [
1053 ":skia",
1054 ]
1055 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001056
Brian Osman16adfa32016-10-18 14:42:44 -04001057 test_lib("views") {
1058 public_include_dirs = [ "include/views" ]
1059 sources = [
1060 "src/views/SkEvent.cpp",
1061 "src/views/SkEventSink.cpp",
1062 "src/views/SkOSMenu.cpp",
1063 "src/views/SkTagList.cpp",
1064 "src/views/SkTouchGesture.cpp",
1065 "src/views/SkView.cpp",
1066 "src/views/SkViewPriv.cpp",
1067 ]
1068 libs = []
Brian Osman34755e22016-12-05 09:46:02 -05001069 deps = []
Brian Osman16adfa32016-10-18 14:42:44 -04001070 if (!is_android) {
1071 sources += [ "src/views/SkWindow.cpp" ]
1072 }
Jim Van Verth4e56a912016-10-21 10:58:52 -04001073 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001074 public_include_dirs += [ "src/views/unix" ]
1075 sources += [
1076 "src/views/unix/SkOSWindow_Unix.cpp",
1077 "src/views/unix/keysym2ucs.c",
1078 ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001079 libs += [
1080 "GL",
1081 "X11",
1082 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001083 } else if (is_mac) {
1084 sources += [
1085 "src/views/mac/SkEventNotifier.mm",
1086 "src/views/mac/SkNSView.mm",
1087 "src/views/mac/SkOSWindow_Mac.mm",
1088 "src/views/mac/SkTextFieldCell.m",
1089 ]
1090 libs += [
1091 "QuartzCore.framework",
1092 "Cocoa.framework",
1093 "Foundation.framework",
1094 ]
1095 } else if (is_win) {
1096 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
1097 }
Brian Osman34755e22016-12-05 09:46:02 -05001098 if (skia_use_angle) {
1099 deps += [ "//third_party/angle2" ]
1100 }
Brian Osman16adfa32016-10-18 14:42:44 -04001101 }
1102
Mike Klein38af9432016-11-11 11:39:44 -05001103 if (skia_use_lua) {
1104 test_lib("lua") {
1105 public_include_dirs = []
1106 sources = [
1107 "src/utils/SkLua.cpp",
1108 "src/utils/SkLuaCanvas.cpp",
1109 ]
1110 deps = [
1111 "//third_party/lua",
1112 ]
1113 }
1114
Mike Kleine6682eb2017-01-05 10:54:57 -05001115 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001116 sources = [
1117 "tools/lua/lua_app.cpp",
1118 ]
1119 deps = [
1120 ":lua",
1121 ":skia",
1122 "//third_party/lua",
1123 ]
Mike Klein38af9432016-11-11 11:39:44 -05001124 }
1125
Mike Kleine6682eb2017-01-05 10:54:57 -05001126 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001127 sources = [
1128 "tools/lua/lua_pictures.cpp",
1129 ]
1130 deps = [
1131 ":flags",
1132 ":lua",
1133 ":skia",
1134 ":tool_utils",
1135 "//third_party/lua",
1136 ]
Mike Klein38af9432016-11-11 11:39:44 -05001137 }
1138 }
1139
Mike Klein6e744122016-10-27 12:21:40 -04001140 import("gn/samples.gni")
Brian Osman16adfa32016-10-18 14:42:44 -04001141 test_lib("samples") {
Brian Osman16adfa32016-10-18 14:42:44 -04001142 public_include_dirs = [ "samplecode" ]
Mike Klein6e744122016-10-27 12:21:40 -04001143 include_dirs = [ "experimental" ]
1144 sources = samples_sources + [
Mike Klein6e744122016-10-27 12:21:40 -04001145 "experimental/SkSetPoly3To3.cpp",
1146 "experimental/SkSetPoly3To3_A.cpp",
1147 "experimental/SkSetPoly3To3_D.cpp",
Brian Osmancff94e42017-06-26 13:12:37 -04001148
1149 # Relocating these files here, so that clients don't try to build them while they're
1150 # still in active development. Clang's thread safety analysis gets tripped up by
1151 # conditional locks.
1152 "src/core/SkThreadedBMPDevice.cpp",
1153 "src/core/SkThreadedBMPDevice.h",
Mike Klein6e744122016-10-27 12:21:40 -04001154 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001155 deps = [
1156 ":experimental_svg_model",
csmartdalton8c679092017-03-27 12:32:29 -06001157 ":flags",
Mike Klein6e744122016-10-27 12:21:40 -04001158 ":gm",
Brian Osman16adfa32016-10-18 14:42:44 -04001159 ":tool_utils",
1160 ":views",
1161 ":xml",
1162 ]
Mike Klein38af9432016-11-11 11:39:44 -05001163
1164 if (skia_use_lua) {
1165 sources += [ "samplecode/SampleLua.cpp" ]
1166 deps += [
1167 ":lua",
1168 "//third_party/lua",
1169 ]
1170 }
Brian Osman16adfa32016-10-18 14:42:44 -04001171 }
1172
Mike Kleine6682eb2017-01-05 10:54:57 -05001173 test_app("dm") {
mtklein2b6870c2016-07-28 14:17:33 -07001174 sources = [
1175 "dm/DM.cpp",
1176 "dm/DMJsonWriter.cpp",
1177 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -07001178 ]
1179 include_dirs = [ "tests" ]
1180 deps = [
mtklein046cb562016-09-16 10:23:12 -07001181 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -07001182 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001183 ":flags",
1184 ":gm",
1185 ":gpu_tool_utils",
1186 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -07001187 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -07001188 ":tool_utils",
1189 "//third_party/jsoncpp",
1190 "//third_party/libpng",
1191 ]
mtklein2b6870c2016-07-28 14:17:33 -07001192 }
1193
Mike Klein06432b22017-03-21 13:14:33 -04001194 test_app("ok") {
1195 sources = [
1196 "tools/ok.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001197 "tools/ok_dsts.cpp",
1198 "tools/ok_srcs.cpp",
Mike Kleind63442d2017-03-27 14:16:04 -04001199 "tools/ok_test.cpp",
Mike Kleinf5d1a552017-03-25 12:32:22 -04001200 "tools/ok_vias.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001201 ]
1202 deps = [
1203 ":gm",
1204 ":skia",
Mike Kleind63442d2017-03-27 14:16:04 -04001205 ":tests",
Mike Klein62669ad2017-05-09 16:03:07 -04001206 ":tool_utils",
Mike Klein06432b22017-03-21 13:14:33 -04001207 ]
1208 }
1209
Mike Kleina3430172016-09-27 16:46:29 -04001210 if (!is_debug) { # I've benchmarked debug code once too many times...
Mike Kleine6682eb2017-01-05 10:54:57 -05001211 test_app("monobench") {
Mike Kleina3430172016-09-27 16:46:29 -04001212 sources = [
1213 "tools/monobench.cpp",
1214 ]
1215 deps = [
1216 ":bench",
1217 ":skia",
1218 ]
Mike Kleina3430172016-09-27 16:46:29 -04001219 }
mtklein2b6870c2016-07-28 14:17:33 -07001220 }
1221
Mike Kleine6682eb2017-01-05 10:54:57 -05001222 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001223 sources = [
1224 "bench/nanobench.cpp",
1225 ]
1226 deps = [
1227 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001228 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001229 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001230 ":flags",
1231 ":gm",
1232 ":gpu_tool_utils",
1233 ":skia",
1234 ":tool_utils",
1235 "//third_party/jsoncpp",
1236 ]
mtklein2b6870c2016-07-28 14:17:33 -07001237 }
halcanary19a97202016-08-03 15:08:04 -07001238
Ravi Mistry10d36c52017-01-31 09:49:18 -05001239 test_app("skpinfo") {
1240 sources = [
1241 "tools/skpinfo.cpp",
1242 ]
1243 deps = [
1244 ":flags",
1245 ":skia",
1246 ]
1247 }
1248
Jim Van Verth57a98fc2016-10-28 13:35:50 -04001249 if (is_linux || is_win || is_mac) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001250 test_app("SampleApp") {
mtklein38925aa2016-09-21 10:11:25 -07001251 sources = [
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001252 "samplecode/SampleApp.cpp",
1253 "samplecode/SamplePictFile.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001254 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001255 if (is_mac) {
1256 sources += [ "src/views/mac/skia_mac.mm" ]
1257 } else if (is_win) {
1258 sources += [ "src/views/win/skia_win.cpp" ]
1259 } else if (is_linux) {
1260 sources += [ "src/views/unix/skia_unix.cpp" ]
1261 }
mtklein38925aa2016-09-21 10:11:25 -07001262 deps = [
1263 ":flags",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001264 ":gm",
mtklein38925aa2016-09-21 10:11:25 -07001265 ":gpu_tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001266 ":samples",
mtklein38925aa2016-09-21 10:11:25 -07001267 ":skia",
1268 ":tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001269 ":views",
mtklein38925aa2016-09-21 10:11:25 -07001270 ]
Mike Kleinc168a3a2016-11-14 14:53:13 +00001271 if (skia_use_angle) {
1272 deps += [ "//third_party/angle2" ]
1273 }
mtklein38925aa2016-09-21 10:11:25 -07001274 }
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001275 }
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001276
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001277 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001278 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001279 sources = [
1280 "tools/skpbench/skpbench.cpp",
1281 ]
1282 deps = [
1283 ":flags",
1284 ":gpu_tool_utils",
1285 ":skia",
1286 ":tool_utils",
1287 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001288 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001289 }
1290
Mike Klein7d302882016-11-03 14:06:31 -04001291 # We can't yet build ICU on iOS or Windows.
1292 if (!is_ios && !is_win) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001293 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001294 sources = [
1295 "tools/SkShaper_harfbuzz.cpp",
1296 "tools/using_skia_and_harfbuzz.cpp",
1297 ]
1298 deps = [
1299 ":skia",
1300 "//third_party/harfbuzz",
1301 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001302 }
halcanary19a97202016-08-03 15:08:04 -07001303 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001304 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001305 sources = [
1306 "tools/SkShaper_primitive.cpp",
1307 "tools/using_skia_and_harfbuzz.cpp",
1308 ]
1309 deps = [
1310 ":skia",
1311 ]
halcanary3eee9d92016-09-10 07:01:53 -07001312 }
mtklein046cb562016-09-16 10:23:12 -07001313
Matt Sarett9f1c4032017-05-17 10:06:32 -04001314 test_app("create_flutter_test_images") {
1315 sources = [
1316 "tools/create_flutter_test_images.cpp",
1317 ]
1318 deps = [
1319 ":skia",
1320 ":tool_utils",
1321 ]
1322 }
1323
Mike Kleine6682eb2017-01-05 10:54:57 -05001324 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001325 sources = [
1326 "tools/get_images_from_skps.cpp",
1327 ]
1328 deps = [
1329 ":flags",
1330 ":skia",
1331 "//third_party/jsoncpp",
1332 ]
mtklein046cb562016-09-16 10:23:12 -07001333 }
mtkleinecbc5262016-09-22 11:51:24 -07001334
Mike Kleine6682eb2017-01-05 10:54:57 -05001335 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001336 sources = [
1337 "tools/colorspaceinfo.cpp",
1338 ]
1339 deps = [
1340 ":flags",
1341 ":skia",
1342 ":tool_utils",
1343 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001344 }
1345
Mike Klein7d302882016-11-03 14:06:31 -04001346 if (!is_ios) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001347 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001348 sources = [
1349 "tools/skiaserve/Request.cpp",
1350 "tools/skiaserve/Response.cpp",
1351 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001352 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1353 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1354 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1355 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1356 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1357 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1358 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1359 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1360 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001361 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1362 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001363 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1364 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1365 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1366 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1367 ]
1368 deps = [
1369 ":flags",
1370 ":gpu_tool_utils",
1371 ":skia",
1372 ":tool_utils",
1373 "//third_party/jsoncpp",
1374 "//third_party/libmicrohttpd",
1375 "//third_party/libpng",
1376 ]
Mike Klein7d302882016-11-03 14:06:31 -04001377 }
mtkleinecbc5262016-09-22 11:51:24 -07001378 }
kjlubick14f984b2016-10-03 11:49:45 -07001379
Mike Kleine6682eb2017-01-05 10:54:57 -05001380 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07001381 sources = [
1382 "fuzz/FilterFuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001383 "fuzz/FuzzCanvas.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001384 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001385 "fuzz/FuzzGradients.cpp",
1386 "fuzz/FuzzParsePath.cpp",
1387 "fuzz/FuzzPathop.cpp",
1388 "fuzz/FuzzScaleToSides.cpp",
1389 "fuzz/fuzz.cpp",
1390 ]
1391 deps = [
1392 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001393 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001394 ":skia",
Hal Canarydb683012016-11-23 08:55:18 -07001395 ":tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001396 ]
kjlubick14f984b2016-10-03 11:49:45 -07001397 }
Mike Klein38312422016-10-05 15:41:01 -04001398
Mike Kleine6682eb2017-01-05 10:54:57 -05001399 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001400 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001401 rebase_path("tests/skia_test.cpp"),
1402 rebase_path("tests/Test.cpp"),
1403 ]
caryclark9feb6322016-10-25 08:58:26 -07001404 deps = [
1405 ":flags",
1406 ":gpu_tool_utils",
1407 ":skia",
1408 ":tool_utils",
1409 ]
caryclark9feb6322016-10-25 08:58:26 -07001410 }
1411
Mike Kleine6682eb2017-01-05 10:54:57 -05001412 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001413 sources = [
1414 "tools/DumpRecord.cpp",
1415 "tools/dump_record.cpp",
1416 ]
1417 deps = [
1418 ":flags",
1419 ":skia",
1420 ]
Mike Klein38312422016-10-05 15:41:01 -04001421 }
bungemanfe917272016-10-13 17:36:40 -04001422
Mike Kleine6682eb2017-01-05 10:54:57 -05001423 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001424 sources = [
1425 "tools/skdiff/skdiff.cpp",
1426 "tools/skdiff/skdiff_html.cpp",
1427 "tools/skdiff/skdiff_main.cpp",
1428 "tools/skdiff/skdiff_utils.cpp",
1429 ]
1430 deps = [
1431 ":skia",
1432 ":tool_utils",
1433 ]
bungemanfe917272016-10-13 17:36:40 -04001434 }
halcanarya73d76a2016-10-17 13:19:02 -07001435
Mike Kleine6682eb2017-01-05 10:54:57 -05001436 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001437 sources = [
1438 "tools/skp_parser.cpp",
1439 ]
1440 deps = [
1441 ":skia",
1442 ":tool_utils",
1443 "//third_party/jsoncpp",
1444 ]
halcanarya73d76a2016-10-17 13:19:02 -07001445 }
Brian Osman16adfa32016-10-18 14:42:44 -04001446
Mike Kleina92c3832016-12-08 09:49:39 -05001447 if (skia_enable_gpu && (is_android || is_linux || is_win || is_mac)) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001448 test_app("viewer") {
1449 is_shared_library = is_android
Brian Osman16adfa32016-10-18 14:42:44 -04001450 sources = [
1451 "tools/viewer/GMSlide.cpp",
1452 "tools/viewer/ImageSlide.cpp",
1453 "tools/viewer/SKPSlide.cpp",
1454 "tools/viewer/SampleSlide.cpp",
1455 "tools/viewer/Viewer.cpp",
1456 "tools/viewer/sk_app/CommandSet.cpp",
1457 "tools/viewer/sk_app/GLWindowContext.cpp",
1458 "tools/viewer/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001459 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001460 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001461
Jim Van Verth4e56a912016-10-21 10:58:52 -04001462 if (is_android) {
1463 sources += [
1464 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1465 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1466 "tools/viewer/sk_app/android/Window_android.cpp",
1467 "tools/viewer/sk_app/android/main_android.cpp",
1468 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1469 ]
Brian Osman462334e2017-02-09 11:22:57 -05001470 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001471 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001472 sources += [
1473 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1474 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1475 "tools/viewer/sk_app/unix/Window_unix.cpp",
1476 "tools/viewer/sk_app/unix/main_unix.cpp",
1477 ]
1478 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001479 sources += [
1480 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1481 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1482 "tools/viewer/sk_app/win/Window_win.cpp",
1483 "tools/viewer/sk_app/win/main_win.cpp",
1484 ]
Mike Klein43c25262016-10-20 10:17:47 -04001485 } else if (is_mac) {
1486 sources += [
1487 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1488 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1489 "tools/viewer/sk_app/mac/Window_mac.cpp",
1490 "tools/viewer/sk_app/mac/main_mac.cpp",
1491 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001492 }
1493
1494 if (skia_use_vulkan) {
1495 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001496 if (is_android) {
1497 sources +=
1498 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001499 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001500 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1501 libs += [ "X11-xcb" ]
1502 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001503 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1504 }
1505 }
1506
1507 include_dirs = []
1508 deps = [
1509 ":flags",
1510 ":gm",
1511 ":gpu_tool_utils",
1512 ":samples",
1513 ":skia",
1514 ":tool_utils",
1515 ":views",
Brian Osman79086b92017-02-10 13:36:16 -05001516 "//third_party/imgui",
Brian Osman16adfa32016-10-18 14:42:44 -04001517 "//third_party/jsoncpp",
1518 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001519 if (is_android) {
1520 deps += [ "//third_party/native_app_glue" ]
1521 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001522 deps += [ "//third_party/libsdl" ]
1523 }
Mike Kleina92c3832016-12-08 09:49:39 -05001524 }
Brian Osman16adfa32016-10-18 14:42:44 -04001525 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001526
Mike Kleine459afd2017-03-03 09:21:30 -05001527 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05001528 copy("gdbserver") {
1529 sources = [
1530 "$ndk/$ndk_gdbserver",
1531 ]
1532 outputs = [
1533 "$root_out_dir/gdbserver",
1534 ]
1535 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05001536 }
Mike Klein5ce39722017-06-27 22:52:03 +00001537
1538 if (skia_enable_gpu) {
1539 test_app("skslc") {
1540 defines = [ "SKSL_STANDALONE" ]
1541 sources = [
1542 "src/sksl/SkSLMain.cpp",
1543 ]
1544 sources += skia_sksl_sources
1545 include_dirs = [ "src/sksl" ]
1546 }
1547 }
mtklein25c81d42016-07-27 13:55:26 -07001548}
Mike Kleinc55a6cb2017-06-28 13:21:47 -04001549
1550if (skia_jumper_clang != "") {
1551 action("regen_jumper") {
1552 script = "src/jumper/build_stages.py"
1553
1554 inputs = [
1555 "src/jumper/SkJumper_stages.cpp",
1556 "src/jumper/SkJumper_stages_lowp.cpp",
1557 ]
1558
1559 # GN insists its outputs should go somewhere underneath target_out_dir, so we trick it.
1560 outputs = [
1561 "$target_out_dir/" +
1562 rebase_path("src/jumper/SkJumper_generated.S", target_out_dir),
1563 "$target_out_dir/" +
1564 rebase_path("src/jumper/SkJumper_generated_win.S", target_out_dir),
1565 ]
1566
1567 args = [
1568 skia_jumper_clang,
1569 skia_jumper_objdump,
1570 skia_jumper_ccache,
1571 ] + rebase_path(inputs) + rebase_path(outputs)
1572 }
1573}