blob: af6bbda92b54c6c74e27b97f21a89e8b540083e0 [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
Mike Klein3669a822017-03-03 10:55:02 -05009if (!defined(is_skia_standalone)) {
10 is_skia_standalone = false
11}
12is_skia_dev_build = is_skia_standalone && !is_official_build
13
mtkleinc04ff472016-06-23 10:29:30 -070014declare_args() {
Mike Kleinc168a3a2016-11-14 14:53:13 +000015 skia_use_angle = false
Kevin Lubick4a24e102017-03-29 11:19:01 -040016 skia_use_egl = false
mtklein63213812016-08-24 09:55:56 -070017 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070018 skia_use_fontconfig = is_linux
mtkleincdedd0e2016-09-12 15:15:44 -070019 skia_use_freetype = is_android || is_fuchsia || is_linux
Mike Klein69f6ed42016-10-13 15:45:07 -040020 skia_use_gdi = false
Mike Klein7d302882016-11-03 14:06:31 -040021 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
mtklein63213812016-08-24 09:55:56 -070022 skia_use_libjpeg_turbo = true
23 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070024 skia_use_libwebp = !is_fuchsia
Mike Klein38af9432016-11-11 11:39:44 -050025 skia_use_lua = false
mtkleina627b5c2016-09-20 13:36:47 -070026 skia_use_mesa = false
Mike Klein10d665d2016-11-01 11:46:10 -040027 skia_use_piex = !is_win
mtklein63213812016-08-24 09:55:56 -070028 skia_use_zlib = true
mtklein1bd72ba2016-09-16 07:45:52 -070029
Mike Klein7d921032017-01-05 12:20:41 -050030 skia_android_serial = ""
mtklein1bd72ba2016-09-16 07:45:52 -070031 skia_enable_android_framework_defines = false
Brian Osman3f375d02016-12-28 11:19:22 -050032 skia_enable_discrete_gpu = true
Mike Kleina04bb452017-02-09 12:24:07 -050033 skia_enable_effects = true
Mike Klein2fcd1702017-03-08 18:54:25 +000034 skia_enable_jumper = is_skia_dev_build
mtklein06c35c02016-09-20 12:28:12 -070035 skia_enable_gpu = true
Hal Canary43fb7a02016-12-30 13:09:03 -050036 skia_enable_pdf = true
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040037 skia_enable_spirv_validation = is_skia_dev_build && is_debug
Mike Klein3669a822017-03-03 10:55:02 -050038 skia_enable_tools = is_skia_dev_build
39 skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
Greg Daniel686bb212016-10-27 10:48:48 -040040 skia_vulkan_sdk = getenv("VULKAN_SDK")
mtkleinc04ff472016-06-23 10:29:30 -070041}
Brian Salomon23d73ea2016-10-27 13:31:37 -040042declare_args() {
Matt Sarett189491c2017-03-20 18:09:30 -040043 skia_use_dng_sdk = !is_fuchsia && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040044 skia_use_sfntly = skia_use_icu
45
Mike Klein4d598a32016-10-31 13:44:49 -040046 if (is_android) {
47 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
48 } else {
49 skia_use_vulkan = skia_vulkan_sdk != ""
50 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040051}
Brian Salomon789e25e2016-09-30 13:41:03 -040052
mtklein38925aa2016-09-21 10:11:25 -070053# Our tools require static linking (they use non-exported symbols).
54skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070055
mtkleina45be612016-08-29 15:22:10 -070056fontmgr_android_enabled = skia_use_expat && skia_use_freetype
57
mtklein1211e0c2016-07-26 13:55:45 -070058skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070059 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070060 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070061 "include/codec",
62 "include/config",
63 "include/core",
64 "include/effects",
65 "include/gpu",
66 "include/gpu/gl",
mtklein1211e0c2016-07-26 13:55:45 -070067 "include/pathops",
68 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070069 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -070070 "include/utils",
71 "include/utils/mac",
mtklein1211e0c2016-07-26 13:55:45 -070072]
73
mtkleinc04ff472016-06-23 10:29:30 -070074# Skia public API, generally provided by :skia.
75config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -070076 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -040077 defines = []
78 if (is_component_build) {
79 defines += [ "SKIA_DLL" ]
80 }
Mike Kleinc4cbd742016-09-26 21:37:09 -040081 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -070082 defines += [ "SK_SAMPLES_FOR_X" ]
83 }
mtkleincae1be52016-09-20 08:24:34 -070084 if (skia_enable_android_framework_defines) {
Mike Kleincfc4f442016-10-26 17:19:03 -040085 defines += android_framework_defines
mtkleincae1be52016-09-20 08:24:34 -070086 }
mtklein06c35c02016-09-20 12:28:12 -070087 if (!skia_enable_gpu) {
88 defines += [ "SK_SUPPORT_GPU=0" ]
89 }
mtkleinc04ff472016-06-23 10:29:30 -070090}
91
92# Skia internal APIs, used by Skia itself and a few test tools.
93config("skia_private") {
94 visibility = [ ":*" ]
95
96 include_dirs = [
97 "include/private",
98 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -070099 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -0700100 "src/core",
101 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -0700102 "src/effects/gradients",
103 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700104 "src/image",
105 "src/images",
106 "src/lazy",
107 "src/opts",
108 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700109 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700110 "src/ports",
111 "src/sfnt",
mtklein9e0d9dd2016-08-30 10:37:19 -0700112 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700113 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700114 "src/utils/win",
Herb Derby5a8fe972017-02-14 14:42:30 -0500115 "src/xml",
mtkleinc04ff472016-06-23 10:29:30 -0700116 "third_party/etc1",
scroggo19b91532016-10-24 09:03:26 -0700117 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700118 ]
mtklein150d1132016-08-01 06:56:40 -0700119
Jim Van Verthb6c5e532016-10-28 10:38:08 -0400120 defines = [
121 "SK_GAMMA_APPLY_TO_A8",
122 "SK_INTERNAL",
123 ]
mtkleinb37c0342016-09-09 11:07:45 -0700124 if (is_android) {
125 defines += [
126 "SK_GAMMA_EXPONENT=1.4",
127 "SK_GAMMA_CONTRAST=0.0",
128 ]
129 }
mtklein88a7ac02016-09-14 11:16:49 -0700130 if (is_official_build || is_android) {
131 # TODO(bsalomon): it'd be nice to make Android normal.
132 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
133 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400134 libs = []
135 lib_dirs = []
136 if (skia_use_vulkan) {
Greg Danielab563d42016-10-31 11:19:59 -0400137 if (skia_vulkan_sdk != "" && !is_android) {
Mike Klein487bfc22016-10-14 14:04:56 -0400138 if (is_win) {
139 include_dirs += [ "$skia_vulkan_sdk/Include/" ]
Brian Salomon3b5bf352017-03-20 15:54:41 -0400140 lib_dirs += [
141 "$skia_vulkan_sdk/Bin",
142 "$skia_vulkan_sdk/Lib",
143 ]
Mike Klein487bfc22016-10-14 14:04:56 -0400144 } else {
Greg Daniel686bb212016-10-27 10:48:48 -0400145 include_dirs += [ "$skia_vulkan_sdk/include/" ]
146 lib_dirs += [ "$skia_vulkan_sdk/lib/" ]
Mike Klein487bfc22016-10-14 14:04:56 -0400147 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400148 }
Mike Klein487bfc22016-10-14 14:04:56 -0400149 if (is_win) {
150 libs += [ "vulkan-1.lib" ]
151 } else {
152 libs += [ "vulkan" ]
153 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400154 }
Brian Salomon03e05842017-02-23 12:23:47 -0500155 if (skia_enable_gpu) {
156 include_dirs += [ "src/gpu" ]
157 }
Brian Osman34755e22016-12-05 09:46:02 -0500158 if (skia_use_angle) {
159 defines += [ "SK_ANGLE" ]
160 }
Brian Osman3f375d02016-12-28 11:19:22 -0500161 if (skia_enable_discrete_gpu) {
162 defines += [ "SK_ENABLE_DISCRETE_GPU" ]
163 }
mtkleinc04ff472016-06-23 10:29:30 -0700164}
165
166# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
167config("skia_library") {
168 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700169 defines = [ "SKIA_IMPLEMENTATION=1" ]
170}
171
172skia_library_configs = [
173 ":skia_public",
174 ":skia_private",
175 ":skia_library",
176]
177
mtklein9b8583d2016-08-24 17:32:30 -0700178# Use for CPU-specific Skia code that needs particular compiler flags.
179template("opts") {
180 if (invoker.enabled) {
181 source_set(target_name) {
182 forward_variables_from(invoker, "*")
183 configs += skia_library_configs
184 }
185 } else {
186 # If not enabled, a phony empty target that swallows all otherwise unused variables.
187 source_set(target_name) {
188 forward_variables_from(invoker,
189 "*",
190 [
191 "sources",
192 "cflags",
193 ])
194 }
195 }
anmittala7eaf2e2016-08-17 13:57:26 -0700196}
197
mtklein422310d2016-08-16 18:28:43 -0700198is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700199
mtklein7d6fb2c2016-08-25 14:50:44 -0700200opts("none") {
201 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700202 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700203 cflags = []
204}
205
mtklein7d6fb2c2016-08-25 14:50:44 -0700206opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700207 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700208 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700209 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700210}
211
212opts("arm64") {
213 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700214 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700215 cflags = []
216}
217
218opts("crc32") {
219 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700220 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700221 cflags = [ "-march=armv8-a+crc" ]
222}
223
mtklein9b8583d2016-08-24 17:32:30 -0700224opts("sse2") {
225 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700226 sources = skia_opts.sse2_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400227 if (is_win) {
228 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
229 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400230 cflags = [ "-msse2" ]
231 }
mtklein9b8583d2016-08-24 17:32:30 -0700232}
mtkleinc04ff472016-06-23 10:29:30 -0700233
mtklein9b8583d2016-08-24 17:32:30 -0700234opts("ssse3") {
235 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700236 sources = skia_opts.ssse3_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400237 if (is_win) {
238 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
239 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400240 cflags = [ "-mssse3" ]
241 }
mtklein9b8583d2016-08-24 17:32:30 -0700242}
mtkleinc04ff472016-06-23 10:29:30 -0700243
mtklein9b8583d2016-08-24 17:32:30 -0700244opts("sse41") {
245 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700246 sources = skia_opts.sse41_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400247 if (is_win) {
248 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
249 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400250 cflags = [ "-msse4.1" ]
251 }
mtklein9b8583d2016-08-24 17:32:30 -0700252}
mtklein4e976072016-08-08 09:06:27 -0700253
mtklein9b8583d2016-08-24 17:32:30 -0700254opts("sse42") {
255 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700256 sources = skia_opts.sse42_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400257 if (is_win) {
258 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
259 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400260 cflags = [ "-msse4.2" ]
261 }
mtklein9b8583d2016-08-24 17:32:30 -0700262}
263
264opts("avx") {
265 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700266 sources = skia_opts.avx_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400267 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000268 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400269 } else {
270 cflags = [ "-mavx" ]
271 }
mtkleinc04ff472016-06-23 10:29:30 -0700272}
273
Mike Klein78d5a3b2016-09-30 10:48:01 -0400274opts("hsw") {
275 enabled = is_x86
276 sources = skia_opts.hsw_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400277 if (is_win) {
Mike Klein17b6e482016-11-18 22:11:41 +0000278 cflags = [ "/arch:AVX2" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400279 } else {
280 cflags = [
281 "-mavx2",
282 "-mbmi",
283 "-mbmi2",
284 "-mf16c",
285 "-mfma",
286 ]
287 }
Mike Klein78d5a3b2016-09-30 10:48:01 -0400288}
289
mtkleinc095df52016-08-24 12:23:52 -0700290# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700291template("optional") {
292 if (invoker.enabled) {
293 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700294 if (defined(invoker.public_defines)) {
295 defines = invoker.public_defines
296 }
mtklein457b42a2016-08-23 13:56:37 -0700297 }
298 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700299 forward_variables_from(invoker,
300 "*",
301 [
302 "public_defines",
303 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700304 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700305 ])
mtklein457b42a2016-08-23 13:56:37 -0700306 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700307 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700308 if (defined(invoker.configs_to_remove)) {
309 configs -= invoker.configs_to_remove
310 }
mtklein457b42a2016-08-23 13:56:37 -0700311 }
312 } else {
mtklein457b42a2016-08-23 13:56:37 -0700313 source_set(target_name) {
314 forward_variables_from(invoker,
315 "*",
316 [
317 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700318 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700319 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700320 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700321 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700322 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700323 ])
mtkleincd01b032016-08-31 04:58:19 -0700324 if (defined(invoker.sources_when_disabled)) {
325 sources = invoker.sources_when_disabled
326 }
327 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700328 }
mtkleineb3c4252016-08-23 07:38:09 -0700329 }
mtklein457b42a2016-08-23 13:56:37 -0700330}
mtklein457b42a2016-08-23 13:56:37 -0700331
Mike Kleina04bb452017-02-09 12:24:07 -0500332optional("effects") {
333 enabled = skia_enable_effects
334 sources =
335 skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
336 sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
337}
338
mtkleina45be612016-08-29 15:22:10 -0700339optional("fontmgr_android") {
340 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700341
342 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500343 ":typeface_freetype",
mtkleina45be612016-08-29 15:22:10 -0700344 "//third_party/expat",
mtkleina45be612016-08-29 15:22:10 -0700345 ]
346 sources = [
347 "src/ports/SkFontMgr_android.cpp",
348 "src/ports/SkFontMgr_android_factory.cpp",
349 "src/ports/SkFontMgr_android_parser.cpp",
350 ]
351}
352
mtkleind2e39db2016-09-07 07:52:55 -0700353optional("fontmgr_custom") {
354 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
355
356 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500357 ":typeface_freetype",
mtkleind2e39db2016-09-07 07:52:55 -0700358 ]
359 sources = [
360 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500361 "src/ports/SkFontMgr_custom.h",
362 "src/ports/SkFontMgr_custom_directory.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700363 "src/ports/SkFontMgr_custom_directory_factory.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500364 "src/ports/SkFontMgr_custom_embedded.cpp",
365 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleind2e39db2016-09-07 07:52:55 -0700366 ]
367}
368
mtklein3cc22182016-08-29 13:26:14 -0700369optional("fontmgr_fontconfig") {
370 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700371
372 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500373 ":typeface_freetype",
mtklein3cc22182016-08-29 13:26:14 -0700374 "//third_party:fontconfig",
mtklein3cc22182016-08-29 13:26:14 -0700375 ]
376 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700377 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700378 "src/ports/SkFontConfigInterface_direct.cpp",
379 "src/ports/SkFontConfigInterface_direct_factory.cpp",
380 "src/ports/SkFontMgr_FontConfigInterface.cpp",
381 "src/ports/SkFontMgr_fontconfig.cpp",
382 "src/ports/SkFontMgr_fontconfig_factory.cpp",
383 ]
384}
385
mtkleincdedd0e2016-09-12 15:15:44 -0700386optional("fontmgr_fuchsia") {
387 enabled = is_fuchsia && skia_use_freetype
388
389 deps = [
Ben Wagnerfc497342017-02-24 11:15:26 -0500390 ":typeface_freetype",
mtkleincdedd0e2016-09-12 15:15:44 -0700391 ]
392 sources = [
393 "src/ports/SkFontMgr_custom.cpp",
Ben Wagner8ab590f2017-02-08 17:29:33 -0500394 "src/ports/SkFontMgr_custom_empty.cpp",
mtkleincdedd0e2016-09-12 15:15:44 -0700395 "src/ports/SkFontMgr_custom_empty_factory.cpp",
396 ]
397}
398
mtklein06c35c02016-09-20 12:28:12 -0700399optional("gpu") {
400 enabled = skia_enable_gpu
mtkleine9fb3d52016-09-20 15:11:46 -0700401 public_defines = []
402
Mike Klein29b3e582017-02-09 11:57:32 -0500403 sources = skia_gpu_sources + skia_sksl_sources +
404 [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ]
mtklein06c35c02016-09-20 12:28:12 -0700405
406 # These paths need to be absolute to match the ones produced by shared_sources.gni.
407 sources -= get_path_info([
408 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
409 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
410 ],
411 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400412 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700413 if (is_android) {
414 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
Kevin Lubick4a24e102017-03-29 11:19:01 -0400415 } else if (skia_use_egl) {
416 sources += [ "src/gpu/gl/egl/GrGLCreateNativeInterface_egl.cpp" ]
417 libs += [ "EGL" ]
mtklein06c35c02016-09-20 12:28:12 -0700418 } else if (is_linux) {
419 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500420 libs += [
421 "GL",
422 "GLU",
423 ]
mtklein06c35c02016-09-20 12:28:12 -0700424 } else if (is_mac) {
425 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800426 } else if (is_ios) {
427 sources += [ "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400428 } else if (is_win) {
429 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
430 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700431 } else {
432 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
433 }
mtkleine9fb3d52016-09-20 15:11:46 -0700434
435 if (skia_use_vulkan) {
436 public_defines += [ "SK_VULKAN" ]
437 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700438 if (skia_enable_vulkan_debug_layers) {
439 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
440 }
mtkleine9fb3d52016-09-20 15:11:46 -0700441 }
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400442 if (skia_enable_spirv_validation) {
443 deps = [
444 "//third_party/spirv-tools",
445 ]
446 public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
447 }
mtklein06c35c02016-09-20 12:28:12 -0700448}
449
mtklein63213812016-08-24 09:55:56 -0700450optional("jpeg") {
451 enabled = skia_use_libjpeg_turbo
452 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
453
mtklein63213812016-08-24 09:55:56 -0700454 deps = [
455 "//third_party/libjpeg-turbo:libjpeg",
456 ]
457 sources = [
458 "src/codec/SkJpegCodec.cpp",
459 "src/codec/SkJpegDecoderMgr.cpp",
460 "src/codec/SkJpegUtility.cpp",
461 "src/images/SkJPEGImageEncoder.cpp",
462 "src/images/SkJPEGWriteUtility.cpp",
463 ]
464}
465
466optional("pdf") {
Hal Canary43fb7a02016-12-30 13:09:03 -0500467 enabled = skia_use_zlib && skia_enable_pdf
468 public_defines = [ "SK_SUPPORT_PDF" ]
mtklein63213812016-08-24 09:55:56 -0700469
mtklein63213812016-08-24 09:55:56 -0700470 deps = [
471 "//third_party/zlib",
472 ]
brettwb9447282016-09-01 14:24:39 -0700473 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700474 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700475
476 if (skia_use_sfntly) {
477 deps += [ "//third_party/sfntly" ]
Hal Canary43fb7a02016-12-30 13:09:03 -0500478 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700479 }
480}
481
482optional("png") {
483 enabled = skia_use_libpng
484 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
485
mtklein63213812016-08-24 09:55:56 -0700486 deps = [
487 "//third_party/libpng",
488 ]
489 sources = [
490 "src/codec/SkIcoCodec.cpp",
491 "src/codec/SkPngCodec.cpp",
492 "src/images/SkPNGImageEncoder.cpp",
493 ]
494}
495
scroggof84ad642016-10-31 09:02:57 -0700496optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400497 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700498 public_defines = [ "SK_CODEC_DECODES_RAW" ]
499
500 deps = [
501 "//third_party/dng_sdk",
502 "//third_party/libjpeg-turbo:libjpeg",
503 "//third_party/piex",
504 ]
505
506 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
507 # Skia.
508 configs_to_remove = [ "//gn:no_exceptions" ]
509
510 sources = [
511 "src/codec/SkRawAdapterCodec.cpp",
512 "src/codec/SkRawCodec.cpp",
513 ]
514}
515
Mike Klein2fcd1702017-03-08 18:54:25 +0000516optional("jumper") {
517 enabled = skia_enable_jumper
518 public_defines = [ "SK_JUMPER" ]
519 sources = [
520 "src/jumper/SkJumper.cpp",
521 "src/jumper/SkJumper_generated.cpp",
522 "src/jumper/SkJumper_stages.cpp",
523 ]
524}
525
mtklein3cc22182016-08-29 13:26:14 -0700526optional("typeface_freetype") {
527 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700528
529 deps = [
530 "//third_party/freetype2",
531 ]
532 sources = [
533 "src/ports/SkFontHost_FreeType.cpp",
534 "src/ports/SkFontHost_FreeType_common.cpp",
535 ]
536}
537
mtklein457b42a2016-08-23 13:56:37 -0700538optional("webp") {
539 enabled = skia_use_libwebp
540 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
541
mtklein457b42a2016-08-23 13:56:37 -0700542 deps = [
543 "//third_party/libwebp",
544 ]
545 sources = [
546 "src/codec/SkWebpAdapterCodec.cpp",
547 "src/codec/SkWebpCodec.cpp",
548 "src/images/SkWEBPImageEncoder.cpp",
549 ]
mtkleineb3c4252016-08-23 07:38:09 -0700550}
551
mtklein63213812016-08-24 09:55:56 -0700552optional("xml") {
553 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000554 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700555
mtklein63213812016-08-24 09:55:56 -0700556 deps = [
557 "//third_party/expat",
558 ]
559 sources = [
Mike Kleinbd41bcc2017-02-09 16:38:15 -0500560 "src/svg/SkSVGCanvas.cpp",
561 "src/svg/SkSVGDevice.cpp",
mtklein63213812016-08-24 09:55:56 -0700562 "src/xml/SkDOM.cpp",
563 "src/xml/SkXMLParser.cpp",
564 "src/xml/SkXMLWriter.cpp",
565 ]
566}
567
mtkleinc04ff472016-06-23 10:29:30 -0700568component("skia") {
569 public_configs = [ ":skia_public" ]
570 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700571
572 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700573 ":arm64",
574 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700575 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700576 ":crc32",
Mike Kleina04bb452017-02-09 12:24:07 -0500577 ":effects",
mtkleina45be612016-08-29 15:22:10 -0700578 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700579 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700580 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700581 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700582 ":gpu",
Mike Klein78d5a3b2016-09-30 10:48:01 -0400583 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700584 ":jpeg",
Mike Klein2fcd1702017-03-08 18:54:25 +0000585 ":jumper",
mtklein9b8583d2016-08-24 17:32:30 -0700586 ":none",
mtklein63213812016-08-24 09:55:56 -0700587 ":pdf",
588 ":png",
scroggof84ad642016-10-31 09:02:57 -0700589 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700590 ":sse2",
591 ":sse41",
592 ":sse42",
593 ":ssse3",
mtkleineb3c4252016-08-23 07:38:09 -0700594 ":webp",
mtklein63213812016-08-24 09:55:56 -0700595 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700596 ]
597
Chinmay Garde43f115c2016-11-16 15:04:12 -0800598 # This file (and all GN files in Skia) are designed to work with an
599 # empty sources assignment filter; we handle all that explicitly.
600 # We clear the filter here for clients who may have set up a global filter.
601 set_sources_assignment_filter([])
602
mtkleinc04ff472016-06-23 10:29:30 -0700603 sources = []
brettwb9447282016-09-01 14:24:39 -0700604 sources += skia_core_sources
brettwb9447282016-09-01 14:24:39 -0700605 sources += skia_utils_sources
Hal Canary6ad3d2f2016-12-20 16:15:56 -0500606 sources += skia_xps_sources
mtkleinc04ff472016-06-23 10:29:30 -0700607 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700608 "src/android/SkBitmapRegionCodec.cpp",
609 "src/android/SkBitmapRegionDecoder.cpp",
610 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700611 "src/codec/SkBmpCodec.cpp",
612 "src/codec/SkBmpMaskCodec.cpp",
613 "src/codec/SkBmpRLECodec.cpp",
614 "src/codec/SkBmpStandardCodec.cpp",
615 "src/codec/SkCodec.cpp",
616 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700617 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700618 "src/codec/SkMaskSwizzler.cpp",
619 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700620 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700621 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700622 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700623 "src/codec/SkSwizzler.cpp",
624 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700625 "src/images/SkImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700626 "src/ports/SkDiscardableMemory_none.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700627 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700628 "src/ports/SkMemory_malloc.cpp",
629 "src/ports/SkOSFile_stdio.cpp",
630 "src/sfnt/SkOTTable_name.cpp",
631 "src/sfnt/SkOTUtils.cpp",
632 "src/utils/mac/SkStream_mac.cpp",
633 "third_party/etc1/etc1.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700634 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700635 ]
brettwb9447282016-09-01 14:24:39 -0700636
mtklein7d6fb2c2016-08-25 14:50:44 -0700637 libs = []
638
mtkleinc04ff472016-06-23 10:29:30 -0700639 if (is_win) {
640 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400641 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700642 "src/ports/SkDebug_win.cpp",
643 "src/ports/SkFontHost_win.cpp",
644 "src/ports/SkFontMgr_win_dw.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700645 "src/ports/SkImageEncoder_WIC.cpp",
646 "src/ports/SkImageGeneratorWIC.cpp",
647 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700648 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700649 "src/ports/SkScalerContext_win_dw.cpp",
650 "src/ports/SkTLS_win.cpp",
651 "src/ports/SkTypeface_win_dw.cpp",
652 ]
Mike Klein69f6ed42016-10-13 15:45:07 -0400653 if (skia_use_gdi) {
654 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
655 libs += [
656 "Gdi32.lib",
657 "Usp10.lib",
658 ]
659 } else {
660 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
661 }
mtkleinb9be9792016-09-16 14:44:18 -0700662 sources -=
663 [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400664 libs += [
665 "FontSub.lib",
666 "Ole32.lib",
667 "OleAut32.lib",
668 "User32.lib",
669 ]
mtkleinc04ff472016-06-23 10:29:30 -0700670 } else {
671 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700672 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700673 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700674 "src/ports/SkTLS_pthread.cpp",
675 ]
676 }
677
mtklein7d6fb2c2016-08-25 14:50:44 -0700678 if (is_android) {
Mike Klein1c471872017-01-13 15:27:45 -0500679 deps += [ "//third_party/expat" ]
Mike Kleine459afd2017-03-03 09:21:30 -0500680 if (defined(ndk) && ndk != "") {
Mike Klein1c471872017-01-13 15:27:45 -0500681 deps += [ "//third_party/cpu-features" ]
682 }
mtklein06c35c02016-09-20 12:28:12 -0700683 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700684 libs += [
685 "EGL",
686 "GLESv2",
687 "log",
688 ]
689 }
690
mtkleinc04ff472016-06-23 10:29:30 -0700691 if (is_linux) {
mtklein06c35c02016-09-20 12:28:12 -0700692 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700693 }
694
695 if (is_mac) {
696 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700697 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700698 "src/ports/SkFontHost_mac.cpp",
699 "src/ports/SkImageEncoder_CG.cpp",
700 "src/ports/SkImageGeneratorCG.cpp",
701 ]
mtklein09e61f72016-08-23 13:35:28 -0700702 libs += [
703 "ApplicationServices.framework",
704 "OpenGL.framework",
705 ]
mtkleinc04ff472016-06-23 10:29:30 -0700706 }
abarth6fc8ff02016-07-15 15:15:15 -0700707
Mike Klein7d302882016-11-03 14:06:31 -0400708 if (is_ios) {
709 sources += [
710 "src/ports/SkDebug_stdio.cpp",
711 "src/ports/SkFontHost_mac.cpp",
712 "src/ports/SkImageEncoder_CG.cpp",
713 "src/ports/SkImageGeneratorCG.cpp",
714 ]
715 libs += [
716 "CoreFoundation.framework",
717 "CoreGraphics.framework",
718 "CoreText.framework",
719 "ImageIO.framework",
720 "MobileCoreServices.framework",
721 ]
722 }
723
abarth6fc8ff02016-07-15 15:15:15 -0700724 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700725 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700726 }
mtkleinc04ff472016-06-23 10:29:30 -0700727}
728
mtkleinc095df52016-08-24 12:23:52 -0700729# Targets guarded by skia_enable_tools may use //third_party freely.
730if (skia_enable_tools) {
Mike Klein308b5ac2016-12-06 16:03:52 -0500731 # Used by gn_to_bp.py to list our public include dirs.
732 source_set("public") {
733 configs += [ ":skia_public" ]
734 }
735
Mike Kleinc36dedf2016-11-18 09:35:28 -0500736 config("skia.h_config") {
737 include_dirs = [ "$target_gen_dir" ]
738 }
739 action("skia.h") {
740 public_configs = [ ":skia.h_config" ]
741 skia_h = "$target_gen_dir/skia.h"
742 script = "gn/find_headers.py"
743 args = [ rebase_path(skia_h, root_build_dir) ] +
744 rebase_path(skia_public_includes)
745 depfile = "$skia_h.deps"
746 outputs = [
747 skia_h,
748 ]
749 }
750
751 if (skia_enable_gpu && target_cpu == "x64") {
752 # Our bots only have 64-bit libOSMesa installed.
753 # TODO: worth fixing?
754 executable("fiddle") {
755 libs = []
756 if (is_linux) {
757 libs += [ "OSMesa" ]
758 }
759
760 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500761 "tools/fiddle/draw.cpp",
762 "tools/fiddle/fiddle_main.cpp",
763 ]
764 deps = [
765 ":skia",
766 ":skia.h",
767 ]
768 }
769 }
770
771 if (skia_enable_gpu) {
772 source_set("public_headers_warnings_check") {
773 sources = [
774 "tools/public_headers_warnings_check.cpp",
775 ]
776 configs -= [ "//gn:warnings_except_public_headers" ]
777 deps = [
778 ":skia",
779 ":skia.h",
780 ]
781 }
782 }
783
mtkleinc095df52016-08-24 12:23:52 -0700784 template("test_lib") {
785 config(target_name + "_config") {
786 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700787 if (defined(invoker.public_defines)) {
788 defines = invoker.public_defines
789 }
mtklein25c81d42016-07-27 13:55:26 -0700790 }
mtkleinc095df52016-08-24 12:23:52 -0700791 source_set(target_name) {
792 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
793 public_configs = [
794 ":" + target_name + "_config",
795 ":skia_private",
796 ]
797
798 if (!defined(deps)) {
799 deps = []
800 }
801 deps += [ ":skia" ]
802 testonly = true
803 }
mtklein25c81d42016-07-27 13:55:26 -0700804 }
mtklein25c81d42016-07-27 13:55:26 -0700805
Mike Kleine6682eb2017-01-05 10:54:57 -0500806 template("test_app") {
807 if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
808 shared_library("lib" + target_name) {
809 forward_variables_from(invoker, "*", [ "is_shared_library" ])
810 testonly = true
811 }
812 } else {
Mike Klein7d921032017-01-05 12:20:41 -0500813 _executable = target_name
814 executable(_executable) {
Mike Kleine6682eb2017-01-05 10:54:57 -0500815 forward_variables_from(invoker, "*", [ "is_shared_library" ])
816 testonly = true
817 }
818 }
Mike Klein7d921032017-01-05 12:20:41 -0500819 if (is_android && skia_android_serial != "" && defined(_executable)) {
820 action("push_" + target_name) {
821 script = "gn/push_to_android.py"
822 deps = [
823 ":" + _executable,
824 ]
825 _stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
826 outputs = [
827 _stamp,
828 ]
829 args = [
830 rebase_path("$root_build_dir/$_executable"),
831 skia_android_serial,
832 rebase_path(_stamp),
833 ]
834 testonly = true
835 }
836 }
Mike Kleine6682eb2017-01-05 10:54:57 -0500837 }
838
mtkleinc095df52016-08-24 12:23:52 -0700839 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700840 public_include_dirs = []
841 if (skia_enable_gpu) {
842 public_defines = []
843 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700844
845 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700846 sources = [
847 "tools/gpu/GrContextFactory.cpp",
848 "tools/gpu/GrTest.cpp",
849 "tools/gpu/TestContext.cpp",
850 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -0700851 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700852 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
853 "tools/gpu/gl/debug/GrBufferObj.cpp",
854 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
855 "tools/gpu/gl/debug/GrProgramObj.cpp",
856 "tools/gpu/gl/debug/GrShaderObj.cpp",
857 "tools/gpu/gl/debug/GrTextureObj.cpp",
858 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
859 "tools/gpu/gl/null/NullGLTestContext.cpp",
860 ]
861 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700862
Kevin Lubick4a24e102017-03-29 11:19:01 -0400863 if (is_android || skia_use_egl) {
mtklein38925aa2016-09-21 10:11:25 -0700864 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -0400865 } else if (is_ios) {
866 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
867 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -0700868 } else if (is_linux) {
869 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
Mike Kleina979a1d2017-02-23 10:31:13 -0500870 libs += [ "X11" ]
mtklein38925aa2016-09-21 10:11:25 -0700871 } else if (is_mac) {
872 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400873 } else if (is_win) {
874 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
875 libs += [
876 "Gdi32.lib",
877 "OpenGL32.lib",
878 ]
mtklein38925aa2016-09-21 10:11:25 -0700879 }
mtklein6ef69992016-09-14 06:12:09 -0700880
Mike Kleinc168a3a2016-11-14 14:53:13 +0000881 if (skia_use_angle) {
Mike Kleinc168a3a2016-11-14 14:53:13 +0000882 deps += [ "//third_party/angle2" ]
883 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
884 }
mtklein38925aa2016-09-21 10:11:25 -0700885 if (skia_use_mesa) {
886 public_defines += [ "SK_MESA" ]
887 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
888 libs += [ "OSMesa" ]
889 }
mtkleind68f9b02016-09-23 13:18:41 -0700890 if (skia_use_vulkan) {
891 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
892 }
mtkleina627b5c2016-09-20 13:36:47 -0700893 }
mtklein25c81d42016-07-27 13:55:26 -0700894 }
mtklein25c81d42016-07-27 13:55:26 -0700895
mtkleinc095df52016-08-24 12:23:52 -0700896 test_lib("flags") {
897 public_include_dirs = [ "tools/flags" ]
898 sources = [
899 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -0700900 ]
901 }
902 test_lib("common_flags") {
903 public_include_dirs = [ "tools/flags" ]
904 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700905 "tools/flags/SkCommonFlags.cpp",
906 "tools/flags/SkCommonFlagsConfig.cpp",
907 ]
908 deps = [
mtklein046cb562016-09-16 10:23:12 -0700909 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700910 ":gpu_tool_utils",
911 ]
912 }
mtklein25c81d42016-07-27 13:55:26 -0700913
mtkleinc095df52016-08-24 12:23:52 -0700914 test_lib("tool_utils") {
915 public_include_dirs = [
916 "tools",
917 "tools/debugger",
918 "tools/timer",
919 ]
920 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700921 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
mtkleinb37c0342016-09-09 11:07:45 -0700922 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700923 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700924 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700925 "tools/ProcStats.cpp",
926 "tools/Resources.cpp",
927 "tools/ThermalManager.cpp",
928 "tools/UrlDataManager.cpp",
929 "tools/debugger/SkDebugCanvas.cpp",
930 "tools/debugger/SkDrawCommand.cpp",
931 "tools/debugger/SkJsonWriteBuffer.cpp",
932 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700933 "tools/picture_utils.cpp",
934 "tools/random_parse_path.cpp",
935 "tools/sk_tool_utils.cpp",
936 "tools/sk_tool_utils_font.cpp",
937 "tools/timer/Timer.cpp",
938 ]
Mike Kleinadacaef2017-02-06 09:26:14 -0500939 libs = []
940 if (is_ios) {
941 sources += [ "tools/ios_utils.m" ]
942 libs += [ "Foundation.framework" ]
943 }
mtkleinc095df52016-08-24 12:23:52 -0700944 deps = [
mtklein046cb562016-09-16 10:23:12 -0700945 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -0700946 ":flags",
947 "//third_party/libpng",
948 ]
949 public_deps = [
950 "//third_party/jsoncpp",
951 ]
952 }
mtklein25c81d42016-07-27 13:55:26 -0700953
Mike Klein6e744122016-10-27 12:21:40 -0400954 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -0700955 test_lib("gm") {
956 public_include_dirs = [ "gm" ]
957 sources = gm_sources
958 deps = [
scroggo19b91532016-10-24 09:03:26 -0700959 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700960 ":gpu_tool_utils",
961 ":skia",
962 ":tool_utils",
963 ]
964 }
mtklein25c81d42016-07-27 13:55:26 -0700965
Mike Klein6e744122016-10-27 12:21:40 -0400966 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -0700967 test_lib("tests") {
968 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -0400969 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -0700970 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -0400971 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700972 }
mtkleinc095df52016-08-24 12:23:52 -0700973 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700974 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700975 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700976 ":skia",
977 ":tool_utils",
978 "//third_party/libpng",
979 "//third_party/zlib",
980 ]
Mike Kleind63442d2017-03-27 14:16:04 -0400981 public_deps = [
982 ":gpu_tool_utils", # Test.h #includes headers from this target.
983 ]
mtkleinc095df52016-08-24 12:23:52 -0700984 }
mtklein2f3416d2016-08-02 16:02:05 -0700985
Mike Klein6e744122016-10-27 12:21:40 -0400986 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -0700987 test_lib("bench") {
988 public_include_dirs = [ "bench" ]
989 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -0700990 deps = [
991 ":flags",
992 ":gm",
993 ":gpu_tool_utils",
994 ":skia",
995 ":tool_utils",
996 ]
997 }
mtklein2b6870c2016-07-28 14:17:33 -0700998
mtkleinc095df52016-08-24 12:23:52 -0700999 test_lib("experimental_svg_model") {
1000 public_include_dirs = [ "experimental/svg/model" ]
1001 sources = [
1002 "experimental/svg/model/SkSVGAttribute.cpp",
1003 "experimental/svg/model/SkSVGAttributeParser.cpp",
1004 "experimental/svg/model/SkSVGCircle.cpp",
Florin Malitace8840e2016-12-08 09:26:47 -05001005 "experimental/svg/model/SkSVGClipPath.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001006 "experimental/svg/model/SkSVGContainer.cpp",
1007 "experimental/svg/model/SkSVGDOM.cpp",
1008 "experimental/svg/model/SkSVGEllipse.cpp",
1009 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001010 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001011 "experimental/svg/model/SkSVGNode.cpp",
1012 "experimental/svg/model/SkSVGPath.cpp",
1013 "experimental/svg/model/SkSVGPoly.cpp",
1014 "experimental/svg/model/SkSVGRect.cpp",
1015 "experimental/svg/model/SkSVGRenderContext.cpp",
1016 "experimental/svg/model/SkSVGSVG.cpp",
1017 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -07001018 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -07001019 "experimental/svg/model/SkSVGTransformableNode.cpp",
1020 "experimental/svg/model/SkSVGValue.cpp",
1021 ]
1022 deps = [
1023 ":skia",
1024 ]
1025 }
fmalitaa2b9fdf2016-08-03 19:53:36 -07001026
Brian Osman16adfa32016-10-18 14:42:44 -04001027 test_lib("views") {
1028 public_include_dirs = [ "include/views" ]
1029 sources = [
1030 "src/views/SkEvent.cpp",
1031 "src/views/SkEventSink.cpp",
1032 "src/views/SkOSMenu.cpp",
1033 "src/views/SkTagList.cpp",
1034 "src/views/SkTouchGesture.cpp",
1035 "src/views/SkView.cpp",
1036 "src/views/SkViewPriv.cpp",
1037 ]
1038 libs = []
Brian Osman34755e22016-12-05 09:46:02 -05001039 deps = []
Brian Osman16adfa32016-10-18 14:42:44 -04001040 if (!is_android) {
1041 sources += [ "src/views/SkWindow.cpp" ]
1042 }
Jim Van Verth4e56a912016-10-21 10:58:52 -04001043 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001044 public_include_dirs += [ "src/views/unix" ]
1045 sources += [
1046 "src/views/unix/SkOSWindow_Unix.cpp",
1047 "src/views/unix/keysym2ucs.c",
1048 ]
Mike Kleina979a1d2017-02-23 10:31:13 -05001049 libs += [
1050 "GL",
1051 "X11",
1052 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001053 } else if (is_mac) {
1054 sources += [
1055 "src/views/mac/SkEventNotifier.mm",
1056 "src/views/mac/SkNSView.mm",
1057 "src/views/mac/SkOSWindow_Mac.mm",
1058 "src/views/mac/SkTextFieldCell.m",
1059 ]
1060 libs += [
1061 "QuartzCore.framework",
1062 "Cocoa.framework",
1063 "Foundation.framework",
1064 ]
1065 } else if (is_win) {
1066 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
1067 }
Brian Osman34755e22016-12-05 09:46:02 -05001068 if (skia_use_angle) {
1069 deps += [ "//third_party/angle2" ]
1070 }
Brian Osman16adfa32016-10-18 14:42:44 -04001071 }
1072
Mike Klein38af9432016-11-11 11:39:44 -05001073 if (skia_use_lua) {
1074 test_lib("lua") {
1075 public_include_dirs = []
1076 sources = [
1077 "src/utils/SkLua.cpp",
1078 "src/utils/SkLuaCanvas.cpp",
1079 ]
1080 deps = [
1081 "//third_party/lua",
1082 ]
1083 }
1084
Mike Kleine6682eb2017-01-05 10:54:57 -05001085 test_app("lua_app") {
Mike Klein38af9432016-11-11 11:39:44 -05001086 sources = [
1087 "tools/lua/lua_app.cpp",
1088 ]
1089 deps = [
1090 ":lua",
1091 ":skia",
1092 "//third_party/lua",
1093 ]
Mike Klein38af9432016-11-11 11:39:44 -05001094 }
1095
Mike Kleine6682eb2017-01-05 10:54:57 -05001096 test_app("lua_pictures") {
Mike Klein38af9432016-11-11 11:39:44 -05001097 sources = [
1098 "tools/lua/lua_pictures.cpp",
1099 ]
1100 deps = [
1101 ":flags",
1102 ":lua",
1103 ":skia",
1104 ":tool_utils",
1105 "//third_party/lua",
1106 ]
Mike Klein38af9432016-11-11 11:39:44 -05001107 }
1108 }
1109
Mike Klein6e744122016-10-27 12:21:40 -04001110 import("gn/samples.gni")
Brian Osman16adfa32016-10-18 14:42:44 -04001111 test_lib("samples") {
Brian Osman16adfa32016-10-18 14:42:44 -04001112 public_include_dirs = [ "samplecode" ]
Mike Klein6e744122016-10-27 12:21:40 -04001113 include_dirs = [ "experimental" ]
1114 sources = samples_sources + [
1115 "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp",
1116 "experimental/SkSetPoly3To3.cpp",
1117 "experimental/SkSetPoly3To3_A.cpp",
1118 "experimental/SkSetPoly3To3_D.cpp",
1119 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001120 deps = [
1121 ":experimental_svg_model",
csmartdalton8c679092017-03-27 12:32:29 -06001122 ":flags",
Mike Klein6e744122016-10-27 12:21:40 -04001123 ":gm",
Brian Osman16adfa32016-10-18 14:42:44 -04001124 ":tool_utils",
1125 ":views",
1126 ":xml",
1127 ]
Mike Klein38af9432016-11-11 11:39:44 -05001128
1129 if (skia_use_lua) {
1130 sources += [ "samplecode/SampleLua.cpp" ]
1131 deps += [
1132 ":lua",
1133 "//third_party/lua",
1134 ]
1135 }
Brian Osman16adfa32016-10-18 14:42:44 -04001136 }
1137
Mike Kleine6682eb2017-01-05 10:54:57 -05001138 test_app("dm") {
mtklein2b6870c2016-07-28 14:17:33 -07001139 sources = [
1140 "dm/DM.cpp",
1141 "dm/DMJsonWriter.cpp",
1142 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -07001143 ]
1144 include_dirs = [ "tests" ]
1145 deps = [
mtklein046cb562016-09-16 10:23:12 -07001146 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -07001147 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001148 ":flags",
1149 ":gm",
1150 ":gpu_tool_utils",
1151 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -07001152 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -07001153 ":tool_utils",
1154 "//third_party/jsoncpp",
1155 "//third_party/libpng",
1156 ]
mtklein2b6870c2016-07-28 14:17:33 -07001157 }
1158
Mike Klein06432b22017-03-21 13:14:33 -04001159 test_app("ok") {
1160 sources = [
1161 "tools/ok.cpp",
Mike Klein7ac04832017-03-25 11:29:41 -04001162 "tools/ok_dsts.cpp",
1163 "tools/ok_srcs.cpp",
Mike Kleind63442d2017-03-27 14:16:04 -04001164 "tools/ok_test.cpp",
Mike Kleinf5d1a552017-03-25 12:32:22 -04001165 "tools/ok_vias.cpp",
Mike Klein06432b22017-03-21 13:14:33 -04001166 ]
1167 deps = [
1168 ":gm",
1169 ":skia",
Mike Kleind63442d2017-03-27 14:16:04 -04001170 ":tests",
Mike Klein06432b22017-03-21 13:14:33 -04001171 ]
1172 }
1173
Mike Kleina3430172016-09-27 16:46:29 -04001174 if (!is_debug) { # I've benchmarked debug code once too many times...
Mike Kleine6682eb2017-01-05 10:54:57 -05001175 test_app("monobench") {
Mike Kleina3430172016-09-27 16:46:29 -04001176 sources = [
1177 "tools/monobench.cpp",
1178 ]
1179 deps = [
1180 ":bench",
1181 ":skia",
1182 ]
Mike Kleina3430172016-09-27 16:46:29 -04001183 }
mtklein2b6870c2016-07-28 14:17:33 -07001184 }
1185
Mike Kleine6682eb2017-01-05 10:54:57 -05001186 test_app("nanobench") {
mtklein2b6870c2016-07-28 14:17:33 -07001187 sources = [
1188 "bench/nanobench.cpp",
1189 ]
1190 deps = [
1191 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001192 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001193 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001194 ":flags",
1195 ":gm",
1196 ":gpu_tool_utils",
1197 ":skia",
1198 ":tool_utils",
1199 "//third_party/jsoncpp",
1200 ]
mtklein2b6870c2016-07-28 14:17:33 -07001201 }
halcanary19a97202016-08-03 15:08:04 -07001202
Ravi Mistry10d36c52017-01-31 09:49:18 -05001203 test_app("skpinfo") {
1204 sources = [
1205 "tools/skpinfo.cpp",
1206 ]
1207 deps = [
1208 ":flags",
1209 ":skia",
1210 ]
1211 }
1212
Jim Van Verth57a98fc2016-10-28 13:35:50 -04001213 if (is_linux || is_win || is_mac) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001214 test_app("SampleApp") {
mtklein38925aa2016-09-21 10:11:25 -07001215 sources = [
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001216 "samplecode/SampleApp.cpp",
1217 "samplecode/SamplePictFile.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001218 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001219 if (is_mac) {
1220 sources += [ "src/views/mac/skia_mac.mm" ]
1221 } else if (is_win) {
1222 sources += [ "src/views/win/skia_win.cpp" ]
1223 } else if (is_linux) {
1224 sources += [ "src/views/unix/skia_unix.cpp" ]
1225 }
mtklein38925aa2016-09-21 10:11:25 -07001226 deps = [
1227 ":flags",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001228 ":gm",
mtklein38925aa2016-09-21 10:11:25 -07001229 ":gpu_tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001230 ":samples",
mtklein38925aa2016-09-21 10:11:25 -07001231 ":skia",
1232 ":tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001233 ":views",
mtklein38925aa2016-09-21 10:11:25 -07001234 ]
Mike Kleinc168a3a2016-11-14 14:53:13 +00001235 if (skia_use_angle) {
1236 deps += [ "//third_party/angle2" ]
1237 }
mtklein38925aa2016-09-21 10:11:25 -07001238 }
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001239 }
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001240
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001241 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001242 test_app("skpbench") {
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001243 sources = [
1244 "tools/skpbench/skpbench.cpp",
1245 ]
1246 deps = [
1247 ":flags",
1248 ":gpu_tool_utils",
1249 ":skia",
1250 ":tool_utils",
1251 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001252 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001253 }
1254
Mike Klein7d302882016-11-03 14:06:31 -04001255 # We can't yet build ICU on iOS or Windows.
1256 if (!is_ios && !is_win) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001257 test_app("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001258 sources = [
1259 "tools/SkShaper_harfbuzz.cpp",
1260 "tools/using_skia_and_harfbuzz.cpp",
1261 ]
1262 deps = [
1263 ":skia",
1264 "//third_party/harfbuzz",
1265 ]
mtklein6f5df6a2016-08-29 16:01:10 -07001266 }
halcanary19a97202016-08-03 15:08:04 -07001267 }
Mike Kleine6682eb2017-01-05 10:54:57 -05001268 test_app("sktexttopdf") {
halcanary3eee9d92016-09-10 07:01:53 -07001269 sources = [
1270 "tools/SkShaper_primitive.cpp",
1271 "tools/using_skia_and_harfbuzz.cpp",
1272 ]
1273 deps = [
1274 ":skia",
1275 ]
halcanary3eee9d92016-09-10 07:01:53 -07001276 }
mtklein046cb562016-09-16 10:23:12 -07001277
Mike Kleine6682eb2017-01-05 10:54:57 -05001278 test_app("get_images_from_skps") {
mtklein046cb562016-09-16 10:23:12 -07001279 sources = [
1280 "tools/get_images_from_skps.cpp",
1281 ]
1282 deps = [
1283 ":flags",
1284 ":skia",
1285 "//third_party/jsoncpp",
1286 ]
mtklein046cb562016-09-16 10:23:12 -07001287 }
mtkleinecbc5262016-09-22 11:51:24 -07001288
Mike Kleine6682eb2017-01-05 10:54:57 -05001289 test_app("colorspaceinfo") {
Matt Sarett8740d582016-11-11 13:59:14 -05001290 sources = [
1291 "tools/colorspaceinfo.cpp",
1292 ]
1293 deps = [
1294 ":flags",
1295 ":skia",
1296 ":tool_utils",
1297 ]
Matt Sarett8740d582016-11-11 13:59:14 -05001298 }
1299
Mike Klein7d302882016-11-03 14:06:31 -04001300 if (!is_ios) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001301 test_app("skiaserve") {
Mike Klein7d302882016-11-03 14:06:31 -04001302 sources = [
1303 "tools/skiaserve/Request.cpp",
1304 "tools/skiaserve/Response.cpp",
1305 "tools/skiaserve/skiaserve.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001306 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1307 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1308 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1309 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1310 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1311 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1312 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1313 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1314 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Brian Salomon144a5c52016-12-20 16:48:59 -05001315 "tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
1316 "tools/skiaserve/urlhandlers/OpsHandler.cpp",
Mike Klein7d302882016-11-03 14:06:31 -04001317 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1318 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1319 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1320 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1321 ]
1322 deps = [
1323 ":flags",
1324 ":gpu_tool_utils",
1325 ":skia",
1326 ":tool_utils",
1327 "//third_party/jsoncpp",
1328 "//third_party/libmicrohttpd",
1329 "//third_party/libpng",
1330 ]
Mike Klein7d302882016-11-03 14:06:31 -04001331 }
mtkleinecbc5262016-09-22 11:51:24 -07001332 }
kjlubick14f984b2016-10-03 11:49:45 -07001333
Mike Kleine6682eb2017-01-05 10:54:57 -05001334 test_app("fuzz") {
kjlubick14f984b2016-10-03 11:49:45 -07001335 sources = [
1336 "fuzz/FilterFuzz.cpp",
Hal Canary24ac42b2017-02-14 13:35:14 -05001337 "fuzz/FuzzCanvas.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001338 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001339 "fuzz/FuzzGradients.cpp",
1340 "fuzz/FuzzParsePath.cpp",
1341 "fuzz/FuzzPathop.cpp",
1342 "fuzz/FuzzScaleToSides.cpp",
1343 "fuzz/fuzz.cpp",
1344 ]
1345 deps = [
1346 ":flags",
Hal Canary44801ca2017-03-15 11:39:06 -04001347 ":gpu_tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001348 ":skia",
Hal Canarydb683012016-11-23 08:55:18 -07001349 ":tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001350 ]
kjlubick14f984b2016-10-03 11:49:45 -07001351 }
Mike Klein38312422016-10-05 15:41:01 -04001352
Mike Kleine6682eb2017-01-05 10:54:57 -05001353 test_app("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001354 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001355 rebase_path("tests/skia_test.cpp"),
1356 rebase_path("tests/Test.cpp"),
1357 ]
caryclark9feb6322016-10-25 08:58:26 -07001358 deps = [
1359 ":flags",
1360 ":gpu_tool_utils",
1361 ":skia",
1362 ":tool_utils",
1363 ]
caryclark9feb6322016-10-25 08:58:26 -07001364 }
1365
Mike Kleine6682eb2017-01-05 10:54:57 -05001366 test_app("dump_record") {
Mike Klein38312422016-10-05 15:41:01 -04001367 sources = [
1368 "tools/DumpRecord.cpp",
1369 "tools/dump_record.cpp",
1370 ]
1371 deps = [
1372 ":flags",
1373 ":skia",
1374 ]
Mike Klein38312422016-10-05 15:41:01 -04001375 }
bungemanfe917272016-10-13 17:36:40 -04001376
Mike Kleine6682eb2017-01-05 10:54:57 -05001377 test_app("skdiff") {
bungemanfe917272016-10-13 17:36:40 -04001378 sources = [
1379 "tools/skdiff/skdiff.cpp",
1380 "tools/skdiff/skdiff_html.cpp",
1381 "tools/skdiff/skdiff_main.cpp",
1382 "tools/skdiff/skdiff_utils.cpp",
1383 ]
1384 deps = [
1385 ":skia",
1386 ":tool_utils",
1387 ]
bungemanfe917272016-10-13 17:36:40 -04001388 }
halcanarya73d76a2016-10-17 13:19:02 -07001389
Mike Kleine6682eb2017-01-05 10:54:57 -05001390 test_app("skp_parser") {
halcanarya73d76a2016-10-17 13:19:02 -07001391 sources = [
1392 "tools/skp_parser.cpp",
1393 ]
1394 deps = [
1395 ":skia",
1396 ":tool_utils",
1397 "//third_party/jsoncpp",
1398 ]
halcanarya73d76a2016-10-17 13:19:02 -07001399 }
Brian Osman16adfa32016-10-18 14:42:44 -04001400
Mike Kleina92c3832016-12-08 09:49:39 -05001401 if (skia_enable_gpu && (is_android || is_linux || is_win || is_mac)) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001402 test_app("viewer") {
1403 is_shared_library = is_android
Brian Osman16adfa32016-10-18 14:42:44 -04001404 sources = [
1405 "tools/viewer/GMSlide.cpp",
1406 "tools/viewer/ImageSlide.cpp",
1407 "tools/viewer/SKPSlide.cpp",
1408 "tools/viewer/SampleSlide.cpp",
1409 "tools/viewer/Viewer.cpp",
1410 "tools/viewer/sk_app/CommandSet.cpp",
1411 "tools/viewer/sk_app/GLWindowContext.cpp",
1412 "tools/viewer/sk_app/Window.cpp",
Brian Osman16adfa32016-10-18 14:42:44 -04001413 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001414 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001415
Jim Van Verth4e56a912016-10-21 10:58:52 -04001416 if (is_android) {
1417 sources += [
1418 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1419 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1420 "tools/viewer/sk_app/android/Window_android.cpp",
1421 "tools/viewer/sk_app/android/main_android.cpp",
1422 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1423 ]
Brian Osman462334e2017-02-09 11:22:57 -05001424 libs += [ "android" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001425 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001426 sources += [
1427 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1428 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1429 "tools/viewer/sk_app/unix/Window_unix.cpp",
1430 "tools/viewer/sk_app/unix/main_unix.cpp",
1431 ]
1432 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001433 sources += [
1434 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1435 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1436 "tools/viewer/sk_app/win/Window_win.cpp",
1437 "tools/viewer/sk_app/win/main_win.cpp",
1438 ]
Mike Klein43c25262016-10-20 10:17:47 -04001439 } else if (is_mac) {
1440 sources += [
1441 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1442 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1443 "tools/viewer/sk_app/mac/Window_mac.cpp",
1444 "tools/viewer/sk_app/mac/main_mac.cpp",
1445 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001446 }
1447
1448 if (skia_use_vulkan) {
1449 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001450 if (is_android) {
1451 sources +=
1452 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001453 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001454 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1455 libs += [ "X11-xcb" ]
1456 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001457 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1458 }
1459 }
1460
1461 include_dirs = []
1462 deps = [
1463 ":flags",
1464 ":gm",
1465 ":gpu_tool_utils",
1466 ":samples",
1467 ":skia",
1468 ":tool_utils",
1469 ":views",
Brian Osman79086b92017-02-10 13:36:16 -05001470 "//third_party/imgui",
Brian Osman16adfa32016-10-18 14:42:44 -04001471 "//third_party/jsoncpp",
1472 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001473 if (is_android) {
1474 deps += [ "//third_party/native_app_glue" ]
1475 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001476 deps += [ "//third_party/libsdl" ]
1477 }
Mike Kleina92c3832016-12-08 09:49:39 -05001478 }
Brian Osman16adfa32016-10-18 14:42:44 -04001479 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001480
Mike Kleine459afd2017-03-03 09:21:30 -05001481 if (is_android && defined(ndk) && ndk != "") {
Derek Sollenberger70120c72017-01-05 11:39:04 -05001482 copy("gdbserver") {
1483 sources = [
1484 "$ndk/$ndk_gdbserver",
1485 ]
1486 outputs = [
1487 "$root_out_dir/gdbserver",
1488 ]
1489 }
Derek Sollenberger70120c72017-01-05 11:39:04 -05001490 }
1491
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001492 if (skia_enable_gpu) {
Mike Kleine6682eb2017-01-05 10:54:57 -05001493 test_app("skslc") {
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001494 sources = [
1495 "src/sksl/SkSLMain.cpp",
1496 ]
1497 deps = [
1498 ":flags",
1499 ":skia",
1500 ]
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001501 }
1502 }
mtklein25c81d42016-07-27 13:55:26 -07001503}