blob: 13884f2d14aa8b553a79d8511f3f837345c1b0d7 [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
mtklein3e8012e2016-09-21 09:14:19 -07009if (!defined(is_skia_standalone)) {
10 is_skia_standalone = false
11}
12
mtkleinc04ff472016-06-23 10:29:30 -070013declare_args() {
Mike Kleinc168a3a2016-11-14 14:53:13 +000014 skia_use_angle = false
mtklein63213812016-08-24 09:55:56 -070015 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070016 skia_use_fontconfig = is_linux
mtkleincdedd0e2016-09-12 15:15:44 -070017 skia_use_freetype = is_android || is_fuchsia || is_linux
Mike Klein69f6ed42016-10-13 15:45:07 -040018 skia_use_gdi = false
Mike Klein7d302882016-11-03 14:06:31 -040019 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
mtklein63213812016-08-24 09:55:56 -070020 skia_use_libjpeg_turbo = true
21 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070022 skia_use_libwebp = !is_fuchsia
Mike Klein38af9432016-11-11 11:39:44 -050023 skia_use_lua = false
mtkleina627b5c2016-09-20 13:36:47 -070024 skia_use_mesa = false
Mike Klein10d665d2016-11-01 11:46:10 -040025 skia_use_piex = !is_win
mtklein63213812016-08-24 09:55:56 -070026 skia_use_zlib = true
mtklein1bd72ba2016-09-16 07:45:52 -070027
28 skia_enable_android_framework_defines = false
mtklein06c35c02016-09-20 12:28:12 -070029 skia_enable_gpu = true
mtklein3e8012e2016-09-21 09:14:19 -070030 skia_enable_tools = is_skia_standalone
31 skia_enable_vulkan_debug_layers = is_skia_standalone && is_debug
Greg Daniel686bb212016-10-27 10:48:48 -040032 skia_vulkan_sdk = getenv("VULKAN_SDK")
mtkleinc04ff472016-06-23 10:29:30 -070033}
Brian Salomon23d73ea2016-10-27 13:31:37 -040034declare_args() {
James Robinson14b748d2016-11-12 18:29:39 -080035 skia_use_dng_sdk =
36 !is_fuchsia && !is_win && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040037 skia_use_sfntly = skia_use_icu
38
Mike Klein4d598a32016-10-31 13:44:49 -040039 if (is_android) {
40 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
41 } else {
42 skia_use_vulkan = skia_vulkan_sdk != ""
43 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040044}
Brian Salomon789e25e2016-09-30 13:41:03 -040045
mtklein38925aa2016-09-21 10:11:25 -070046# Our tools require static linking (they use non-exported symbols).
47skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070048
mtkleina45be612016-08-29 15:22:10 -070049fontmgr_android_enabled = skia_use_expat && skia_use_freetype
50
mtklein1211e0c2016-07-26 13:55:45 -070051skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070052 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070053 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070054 "include/codec",
55 "include/config",
56 "include/core",
57 "include/effects",
58 "include/gpu",
59 "include/gpu/gl",
60 "include/images",
61 "include/pathops",
62 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070063 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -070064 "include/utils",
65 "include/utils/mac",
mtklein25c81d42016-07-27 13:55:26 -070066 "include/xml",
mtklein1211e0c2016-07-26 13:55:45 -070067]
68
mtkleinc04ff472016-06-23 10:29:30 -070069# Skia public API, generally provided by :skia.
70config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -070071 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -040072 defines = []
73 if (is_component_build) {
74 defines += [ "SKIA_DLL" ]
75 }
Mike Kleinc4cbd742016-09-26 21:37:09 -040076 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -070077 defines += [ "SK_SAMPLES_FOR_X" ]
78 }
mtkleincae1be52016-09-20 08:24:34 -070079 if (skia_enable_android_framework_defines) {
Mike Kleincfc4f442016-10-26 17:19:03 -040080 defines += android_framework_defines
mtkleincae1be52016-09-20 08:24:34 -070081 }
mtklein06c35c02016-09-20 12:28:12 -070082 if (!skia_enable_gpu) {
83 defines += [ "SK_SUPPORT_GPU=0" ]
84 }
mtkleinc04ff472016-06-23 10:29:30 -070085}
86
87# Skia internal APIs, used by Skia itself and a few test tools.
88config("skia_private") {
89 visibility = [ ":*" ]
90
91 include_dirs = [
92 "include/private",
93 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -070094 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -070095 "src/config",
96 "src/core",
97 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -070098 "src/effects/gradients",
99 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -0700100 "src/gpu",
101 "src/image",
102 "src/images",
103 "src/lazy",
104 "src/opts",
105 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700106 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700107 "src/ports",
108 "src/sfnt",
mtklein9e0d9dd2016-08-30 10:37:19 -0700109 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700110 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700111 "src/utils/win",
mtkleinc04ff472016-06-23 10:29:30 -0700112 "third_party/etc1",
scroggo19b91532016-10-24 09:03:26 -0700113 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700114 "third_party/ktx",
115 ]
mtklein150d1132016-08-01 06:56:40 -0700116
Jim Van Verthb6c5e532016-10-28 10:38:08 -0400117 defines = [
118 "SK_GAMMA_APPLY_TO_A8",
119 "SK_INTERNAL",
120 ]
mtkleinb37c0342016-09-09 11:07:45 -0700121 if (is_android) {
122 defines += [
123 "SK_GAMMA_EXPONENT=1.4",
124 "SK_GAMMA_CONTRAST=0.0",
125 ]
126 }
mtklein88a7ac02016-09-14 11:16:49 -0700127 if (is_official_build || is_android) {
128 # TODO(bsalomon): it'd be nice to make Android normal.
129 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
130 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400131 libs = []
132 lib_dirs = []
133 if (skia_use_vulkan) {
Greg Danielab563d42016-10-31 11:19:59 -0400134 if (skia_vulkan_sdk != "" && !is_android) {
Mike Klein487bfc22016-10-14 14:04:56 -0400135 if (is_win) {
136 include_dirs += [ "$skia_vulkan_sdk/Include/" ]
137 lib_dirs += [ "$skia_vulkan_sdk/Bin" ]
138 } else {
Greg Daniel686bb212016-10-27 10:48:48 -0400139 include_dirs += [ "$skia_vulkan_sdk/include/" ]
140 lib_dirs += [ "$skia_vulkan_sdk/lib/" ]
Mike Klein487bfc22016-10-14 14:04:56 -0400141 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400142 }
Mike Klein487bfc22016-10-14 14:04:56 -0400143 if (is_win) {
144 libs += [ "vulkan-1.lib" ]
145 } else {
146 libs += [ "vulkan" ]
147 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400148 }
mtkleinc04ff472016-06-23 10:29:30 -0700149}
150
151# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
152config("skia_library") {
153 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700154 defines = [ "SKIA_IMPLEMENTATION=1" ]
155}
156
157skia_library_configs = [
158 ":skia_public",
159 ":skia_private",
160 ":skia_library",
161]
162
mtklein9b8583d2016-08-24 17:32:30 -0700163# Use for CPU-specific Skia code that needs particular compiler flags.
164template("opts") {
165 if (invoker.enabled) {
166 source_set(target_name) {
167 forward_variables_from(invoker, "*")
168 configs += skia_library_configs
169 }
170 } else {
171 # If not enabled, a phony empty target that swallows all otherwise unused variables.
172 source_set(target_name) {
173 forward_variables_from(invoker,
174 "*",
175 [
176 "sources",
177 "cflags",
178 ])
179 }
180 }
anmittala7eaf2e2016-08-17 13:57:26 -0700181}
182
mtklein422310d2016-08-16 18:28:43 -0700183is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700184
mtklein7d6fb2c2016-08-25 14:50:44 -0700185opts("none") {
186 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700187 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700188 cflags = []
189}
190
mtklein7d6fb2c2016-08-25 14:50:44 -0700191opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700192 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700193 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700194 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700195}
196
197opts("arm64") {
198 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700199 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700200 cflags = []
201}
202
203opts("crc32") {
204 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700205 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700206 cflags = [ "-march=armv8-a+crc" ]
207}
208
mtklein9b8583d2016-08-24 17:32:30 -0700209opts("sse2") {
210 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700211 sources = skia_opts.sse2_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400212 if (is_win) {
213 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
214 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400215 cflags = [ "-msse2" ]
216 }
mtklein9b8583d2016-08-24 17:32:30 -0700217}
mtkleinc04ff472016-06-23 10:29:30 -0700218
mtklein9b8583d2016-08-24 17:32:30 -0700219opts("ssse3") {
220 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700221 sources = skia_opts.ssse3_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400222 if (is_win) {
223 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
224 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400225 cflags = [ "-mssse3" ]
226 }
mtklein9b8583d2016-08-24 17:32:30 -0700227}
mtkleinc04ff472016-06-23 10:29:30 -0700228
mtklein9b8583d2016-08-24 17:32:30 -0700229opts("sse41") {
230 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700231 sources = skia_opts.sse41_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400232 if (is_win) {
233 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
234 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400235 cflags = [ "-msse4.1" ]
236 }
mtklein9b8583d2016-08-24 17:32:30 -0700237}
mtklein4e976072016-08-08 09:06:27 -0700238
mtklein9b8583d2016-08-24 17:32:30 -0700239opts("sse42") {
240 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700241 sources = skia_opts.sse42_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400242 if (is_win) {
243 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
244 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400245 cflags = [ "-msse4.2" ]
246 }
mtklein9b8583d2016-08-24 17:32:30 -0700247}
248
249opts("avx") {
250 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700251 sources = skia_opts.avx_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400252 if (is_win) {
253 cflags = [ "/arch:AVX" ]
254 } else {
255 cflags = [ "-mavx" ]
256 }
mtkleinc04ff472016-06-23 10:29:30 -0700257}
258
Mike Klein78d5a3b2016-09-30 10:48:01 -0400259opts("hsw") {
260 enabled = is_x86
261 sources = skia_opts.hsw_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400262 if (is_win) {
263 cflags = [ "/arch:AVX2" ]
264 } else {
265 cflags = [
266 "-mavx2",
267 "-mbmi",
268 "-mbmi2",
269 "-mf16c",
270 "-mfma",
271 ]
272 }
Mike Klein78d5a3b2016-09-30 10:48:01 -0400273}
274
mtklein349cece2016-08-26 08:13:04 -0700275opts("dsp") {
276 enabled = current_cpu == "mipsel"
brettwb9447282016-09-01 14:24:39 -0700277 sources = skia_opts.mips_dsp_sources
mtkleinb6064ef2016-08-30 11:49:24 -0700278 cflags = []
mtklein349cece2016-08-26 08:13:04 -0700279}
280
mtkleinc095df52016-08-24 12:23:52 -0700281# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700282template("optional") {
283 if (invoker.enabled) {
284 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700285 if (defined(invoker.public_defines)) {
286 defines = invoker.public_defines
287 }
mtklein457b42a2016-08-23 13:56:37 -0700288 }
289 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700290 forward_variables_from(invoker,
291 "*",
292 [
293 "public_defines",
294 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700295 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700296 ])
mtklein457b42a2016-08-23 13:56:37 -0700297 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700298 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700299 if (defined(invoker.configs_to_remove)) {
300 configs -= invoker.configs_to_remove
301 }
mtklein457b42a2016-08-23 13:56:37 -0700302 }
303 } else {
mtklein457b42a2016-08-23 13:56:37 -0700304 source_set(target_name) {
305 forward_variables_from(invoker,
306 "*",
307 [
308 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700309 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700310 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700311 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700312 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700313 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700314 ])
mtkleincd01b032016-08-31 04:58:19 -0700315 if (defined(invoker.sources_when_disabled)) {
316 sources = invoker.sources_when_disabled
317 }
318 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700319 }
mtkleineb3c4252016-08-23 07:38:09 -0700320 }
mtklein457b42a2016-08-23 13:56:37 -0700321}
mtklein457b42a2016-08-23 13:56:37 -0700322
mtkleina45be612016-08-29 15:22:10 -0700323optional("fontmgr_android") {
324 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700325
326 deps = [
327 "//third_party/expat",
328 "//third_party/freetype2",
329 ]
330 sources = [
331 "src/ports/SkFontMgr_android.cpp",
332 "src/ports/SkFontMgr_android_factory.cpp",
333 "src/ports/SkFontMgr_android_parser.cpp",
334 ]
335}
336
mtkleind2e39db2016-09-07 07:52:55 -0700337optional("fontmgr_custom") {
338 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
339
340 deps = [
341 "//third_party/freetype2",
342 ]
343 sources = [
344 "src/ports/SkFontMgr_custom.cpp",
345 "src/ports/SkFontMgr_custom_directory_factory.cpp",
346 ]
347}
348
mtklein3cc22182016-08-29 13:26:14 -0700349optional("fontmgr_fontconfig") {
350 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700351
352 deps = [
353 "//third_party:fontconfig",
354 "//third_party/freetype2",
355 ]
356 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700357 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700358 "src/ports/SkFontConfigInterface_direct.cpp",
359 "src/ports/SkFontConfigInterface_direct_factory.cpp",
360 "src/ports/SkFontMgr_FontConfigInterface.cpp",
361 "src/ports/SkFontMgr_fontconfig.cpp",
362 "src/ports/SkFontMgr_fontconfig_factory.cpp",
363 ]
364}
365
mtkleincdedd0e2016-09-12 15:15:44 -0700366optional("fontmgr_fuchsia") {
367 enabled = is_fuchsia && skia_use_freetype
368
369 deps = [
370 "//third_party/freetype2",
371 ]
372 sources = [
373 "src/ports/SkFontMgr_custom.cpp",
374 "src/ports/SkFontMgr_custom_empty_factory.cpp",
375 ]
376}
377
mtklein06c35c02016-09-20 12:28:12 -0700378optional("gpu") {
379 enabled = skia_enable_gpu
mtkleine9fb3d52016-09-20 15:11:46 -0700380 public_defines = []
381
mtklein06c35c02016-09-20 12:28:12 -0700382 sources = skia_gpu_sources + [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ]
383
384 # These paths need to be absolute to match the ones produced by shared_sources.gni.
385 sources -= get_path_info([
386 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
387 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
388 ],
389 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400390 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700391 if (is_android) {
392 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
393 } else if (is_linux) {
394 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
395 } else if (is_mac) {
396 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400397 } else if (is_win) {
398 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
399 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700400 } else {
401 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
402 }
mtkleine9fb3d52016-09-20 15:11:46 -0700403
404 if (skia_use_vulkan) {
405 public_defines += [ "SK_VULKAN" ]
406 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700407 if (skia_enable_vulkan_debug_layers) {
408 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
409 }
mtkleine9fb3d52016-09-20 15:11:46 -0700410 }
mtklein06c35c02016-09-20 12:28:12 -0700411}
412
mtklein63213812016-08-24 09:55:56 -0700413optional("jpeg") {
414 enabled = skia_use_libjpeg_turbo
415 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
416
mtklein63213812016-08-24 09:55:56 -0700417 deps = [
418 "//third_party/libjpeg-turbo:libjpeg",
419 ]
420 sources = [
421 "src/codec/SkJpegCodec.cpp",
422 "src/codec/SkJpegDecoderMgr.cpp",
423 "src/codec/SkJpegUtility.cpp",
424 "src/images/SkJPEGImageEncoder.cpp",
425 "src/images/SkJPEGWriteUtility.cpp",
426 ]
427}
428
429optional("pdf") {
430 enabled = skia_use_zlib
mtklein63213812016-08-24 09:55:56 -0700431
mtklein63213812016-08-24 09:55:56 -0700432 deps = [
433 "//third_party/zlib",
434 ]
brettwb9447282016-09-01 14:24:39 -0700435 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700436 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700437
438 if (skia_use_sfntly) {
439 deps += [ "//third_party/sfntly" ]
mtkleincd01b032016-08-31 04:58:19 -0700440 public_defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700441 }
442}
443
444optional("png") {
445 enabled = skia_use_libpng
446 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
447
mtklein63213812016-08-24 09:55:56 -0700448 deps = [
449 "//third_party/libpng",
450 ]
451 sources = [
452 "src/codec/SkIcoCodec.cpp",
453 "src/codec/SkPngCodec.cpp",
454 "src/images/SkPNGImageEncoder.cpp",
455 ]
456}
457
scroggof84ad642016-10-31 09:02:57 -0700458optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400459 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700460 public_defines = [ "SK_CODEC_DECODES_RAW" ]
461
462 deps = [
463 "//third_party/dng_sdk",
464 "//third_party/libjpeg-turbo:libjpeg",
465 "//third_party/piex",
466 ]
467
468 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
469 # Skia.
470 configs_to_remove = [ "//gn:no_exceptions" ]
471
472 sources = [
473 "src/codec/SkRawAdapterCodec.cpp",
474 "src/codec/SkRawCodec.cpp",
475 ]
476}
477
mtklein3cc22182016-08-29 13:26:14 -0700478optional("typeface_freetype") {
479 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700480
481 deps = [
482 "//third_party/freetype2",
483 ]
484 sources = [
485 "src/ports/SkFontHost_FreeType.cpp",
486 "src/ports/SkFontHost_FreeType_common.cpp",
487 ]
488}
489
mtklein457b42a2016-08-23 13:56:37 -0700490optional("webp") {
491 enabled = skia_use_libwebp
492 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
493
mtklein457b42a2016-08-23 13:56:37 -0700494 deps = [
495 "//third_party/libwebp",
496 ]
497 sources = [
498 "src/codec/SkWebpAdapterCodec.cpp",
499 "src/codec/SkWebpCodec.cpp",
500 "src/images/SkWEBPImageEncoder.cpp",
501 ]
mtkleineb3c4252016-08-23 07:38:09 -0700502}
503
mtklein63213812016-08-24 09:55:56 -0700504optional("xml") {
505 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000506 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700507
mtklein63213812016-08-24 09:55:56 -0700508 deps = [
509 "//third_party/expat",
510 ]
511 sources = [
512 "src/xml/SkDOM.cpp",
513 "src/xml/SkXMLParser.cpp",
514 "src/xml/SkXMLWriter.cpp",
515 ]
516}
517
mtkleinc04ff472016-06-23 10:29:30 -0700518component("skia") {
519 public_configs = [ ":skia_public" ]
520 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700521
522 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700523 ":arm64",
524 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700525 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700526 ":crc32",
mtklein349cece2016-08-26 08:13:04 -0700527 ":dsp",
mtkleina45be612016-08-29 15:22:10 -0700528 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700529 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700530 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700531 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700532 ":gpu",
Mike Klein78d5a3b2016-09-30 10:48:01 -0400533 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700534 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700535 ":none",
mtklein63213812016-08-24 09:55:56 -0700536 ":pdf",
537 ":png",
scroggof84ad642016-10-31 09:02:57 -0700538 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700539 ":sse2",
540 ":sse41",
541 ":sse42",
542 ":ssse3",
mtklein3cc22182016-08-29 13:26:14 -0700543 ":typeface_freetype",
mtkleineb3c4252016-08-23 07:38:09 -0700544 ":webp",
mtklein63213812016-08-24 09:55:56 -0700545 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700546 ]
547
mtkleinc04ff472016-06-23 10:29:30 -0700548 sources = []
brettwb9447282016-09-01 14:24:39 -0700549 sources += skia_core_sources
550 sources += skia_effects_sources
brettwb9447282016-09-01 14:24:39 -0700551 sources += skia_sksl_sources
552 sources += skia_utils_sources
mtkleinc04ff472016-06-23 10:29:30 -0700553 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700554 "src/android/SkBitmapRegionCodec.cpp",
555 "src/android/SkBitmapRegionDecoder.cpp",
556 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700557 "src/codec/SkBmpCodec.cpp",
558 "src/codec/SkBmpMaskCodec.cpp",
559 "src/codec/SkBmpRLECodec.cpp",
560 "src/codec/SkBmpStandardCodec.cpp",
561 "src/codec/SkCodec.cpp",
562 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700563 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700564 "src/codec/SkMaskSwizzler.cpp",
565 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700566 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700567 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700568 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700569 "src/codec/SkSwizzler.cpp",
570 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700571 "src/images/SkImageEncoder.cpp",
572 "src/images/SkImageEncoder_Factory.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700573 "src/images/SkKTXImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700574 "src/ports/SkDiscardableMemory_none.cpp",
575 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700576 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700577 "src/ports/SkMemory_malloc.cpp",
578 "src/ports/SkOSFile_stdio.cpp",
579 "src/sfnt/SkOTTable_name.cpp",
580 "src/sfnt/SkOTUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700581 "src/svg/SkSVGCanvas.cpp",
582 "src/svg/SkSVGDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700583 "src/utils/mac/SkStream_mac.cpp",
584 "third_party/etc1/etc1.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700585 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700586 "third_party/ktx/ktx.cpp",
587 ]
brettwb9447282016-09-01 14:24:39 -0700588
mtklein7d6fb2c2016-08-25 14:50:44 -0700589 libs = []
590
mtkleinc04ff472016-06-23 10:29:30 -0700591 if (is_win) {
592 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400593 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700594 "src/ports/SkDebug_win.cpp",
595 "src/ports/SkFontHost_win.cpp",
596 "src/ports/SkFontMgr_win_dw.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700597 "src/ports/SkImageEncoder_WIC.cpp",
598 "src/ports/SkImageGeneratorWIC.cpp",
599 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700600 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700601 "src/ports/SkScalerContext_win_dw.cpp",
602 "src/ports/SkTLS_win.cpp",
603 "src/ports/SkTypeface_win_dw.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700604 "src/xps/SkDocument_XPS.cpp",
Mike Klein4b167fc2016-10-11 18:13:53 -0400605 "src/xps/SkXPSDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700606 ]
Mike Klein69f6ed42016-10-13 15:45:07 -0400607 if (skia_use_gdi) {
608 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
609 libs += [
610 "Gdi32.lib",
611 "Usp10.lib",
612 ]
613 } else {
614 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
615 }
mtkleinb9be9792016-09-16 14:44:18 -0700616 sources -=
617 [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400618 libs += [
619 "FontSub.lib",
620 "Ole32.lib",
621 "OleAut32.lib",
622 "User32.lib",
623 ]
mtkleinc04ff472016-06-23 10:29:30 -0700624 } else {
625 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700626 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700627 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700628 "src/ports/SkTLS_pthread.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700629 "src/xps/SkDocument_XPS_None.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700630 ]
631 }
632
mtklein7d6fb2c2016-08-25 14:50:44 -0700633 if (is_android) {
634 deps += [
635 "//third_party/cpu-features",
636 "//third_party/expat",
mtklein7d6fb2c2016-08-25 14:50:44 -0700637 ]
mtklein06c35c02016-09-20 12:28:12 -0700638 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700639 libs += [
640 "EGL",
641 "GLESv2",
642 "log",
643 ]
644 }
645
mtkleinc04ff472016-06-23 10:29:30 -0700646 if (is_linux) {
mtklein09e61f72016-08-23 13:35:28 -0700647 libs += [
648 "GL",
649 "GLU",
650 "X11",
651 ]
mtklein06c35c02016-09-20 12:28:12 -0700652 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700653 }
654
655 if (is_mac) {
656 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700657 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700658 "src/ports/SkFontHost_mac.cpp",
659 "src/ports/SkImageEncoder_CG.cpp",
660 "src/ports/SkImageGeneratorCG.cpp",
661 ]
mtklein09e61f72016-08-23 13:35:28 -0700662 libs += [
663 "ApplicationServices.framework",
664 "OpenGL.framework",
665 ]
mtkleinc04ff472016-06-23 10:29:30 -0700666 }
abarth6fc8ff02016-07-15 15:15:15 -0700667
Mike Klein7d302882016-11-03 14:06:31 -0400668 if (is_ios) {
669 sources += [
670 "src/ports/SkDebug_stdio.cpp",
671 "src/ports/SkFontHost_mac.cpp",
672 "src/ports/SkImageEncoder_CG.cpp",
673 "src/ports/SkImageGeneratorCG.cpp",
674 ]
675 libs += [
676 "CoreFoundation.framework",
677 "CoreGraphics.framework",
678 "CoreText.framework",
679 "ImageIO.framework",
680 "MobileCoreServices.framework",
681 ]
682 }
683
abarth6fc8ff02016-07-15 15:15:15 -0700684 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700685 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700686 }
mtkleinc04ff472016-06-23 10:29:30 -0700687}
688
mtklein1211e0c2016-07-26 13:55:45 -0700689action("skia.h") {
Mike Klein89eda8a2016-11-02 09:14:55 -0400690 skia_h = "$target_gen_dir/skia.h"
691 script = "gn/find_headers.py"
692 args = [ rebase_path(skia_h, root_build_dir) ] +
693 rebase_path(skia_public_includes)
694 depfile = "$skia_h.deps"
mtklein1211e0c2016-07-26 13:55:45 -0700695 outputs = [
Mike Klein89eda8a2016-11-02 09:14:55 -0400696 skia_h,
mtklein1211e0c2016-07-26 13:55:45 -0700697 ]
698}
699
mtklein06c35c02016-09-20 12:28:12 -0700700if (skia_enable_gpu && target_cpu == "x64") {
mtklein1fbdf982016-09-15 12:07:48 -0700701 # Our bots only have 64-bit libOSMesa installed.
702 # TODO: worth fixing?
703 executable("fiddle") {
704 include_dirs = [ "$target_gen_dir" ]
705 libs = []
706 if (is_linux) {
707 libs += [ "OSMesa" ]
708 }
mtklein56d56692016-09-15 11:18:55 -0700709
mtklein1fbdf982016-09-15 12:07:48 -0700710 sources = [
711 "src/images/SkForceLinking.cpp",
712 "tools/fiddle/draw.cpp",
713 "tools/fiddle/fiddle_main.cpp",
714 ]
715 deps = [
716 ":skia",
717 ":skia.h",
718 ]
719 }
mtkleinc04ff472016-06-23 10:29:30 -0700720}
mtklein25c81d42016-07-27 13:55:26 -0700721
mtkleinc095df52016-08-24 12:23:52 -0700722# Targets guarded by skia_enable_tools may use //third_party freely.
723if (skia_enable_tools) {
724 template("test_lib") {
725 config(target_name + "_config") {
726 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700727 if (defined(invoker.public_defines)) {
728 defines = invoker.public_defines
729 }
mtklein25c81d42016-07-27 13:55:26 -0700730 }
mtkleinc095df52016-08-24 12:23:52 -0700731 source_set(target_name) {
732 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
733 public_configs = [
734 ":" + target_name + "_config",
735 ":skia_private",
736 ]
737
738 if (!defined(deps)) {
739 deps = []
740 }
741 deps += [ ":skia" ]
742 testonly = true
743 }
mtklein25c81d42016-07-27 13:55:26 -0700744 }
mtklein25c81d42016-07-27 13:55:26 -0700745
mtkleinc095df52016-08-24 12:23:52 -0700746 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700747 public_include_dirs = []
748 if (skia_enable_gpu) {
749 public_defines = []
750 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700751
752 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700753 sources = [
754 "tools/gpu/GrContextFactory.cpp",
755 "tools/gpu/GrTest.cpp",
756 "tools/gpu/TestContext.cpp",
757 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -0700758 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700759 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
760 "tools/gpu/gl/debug/GrBufferObj.cpp",
761 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
762 "tools/gpu/gl/debug/GrProgramObj.cpp",
763 "tools/gpu/gl/debug/GrShaderObj.cpp",
764 "tools/gpu/gl/debug/GrTextureObj.cpp",
765 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
766 "tools/gpu/gl/null/NullGLTestContext.cpp",
767 ]
768 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700769
mtklein38925aa2016-09-21 10:11:25 -0700770 if (is_android) {
771 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -0400772 } else if (is_ios) {
773 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
774 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -0700775 } else if (is_linux) {
776 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
777 } else if (is_mac) {
778 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400779 } else if (is_win) {
780 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
781 libs += [
782 "Gdi32.lib",
783 "OpenGL32.lib",
784 ]
mtklein38925aa2016-09-21 10:11:25 -0700785 }
mtklein6ef69992016-09-14 06:12:09 -0700786
Mike Kleinc168a3a2016-11-14 14:53:13 +0000787 if (skia_use_angle) {
788 public_defines += [ "SK_ANGLE" ]
789 deps += [ "//third_party/angle2" ]
790 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
791 }
mtklein38925aa2016-09-21 10:11:25 -0700792 if (skia_use_mesa) {
793 public_defines += [ "SK_MESA" ]
794 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
795 libs += [ "OSMesa" ]
796 }
mtkleind68f9b02016-09-23 13:18:41 -0700797 if (skia_use_vulkan) {
798 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
799 }
mtkleina627b5c2016-09-20 13:36:47 -0700800 }
mtklein25c81d42016-07-27 13:55:26 -0700801 }
mtklein25c81d42016-07-27 13:55:26 -0700802
mtkleinc095df52016-08-24 12:23:52 -0700803 test_lib("flags") {
804 public_include_dirs = [ "tools/flags" ]
805 sources = [
806 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -0700807 ]
808 }
809 test_lib("common_flags") {
810 public_include_dirs = [ "tools/flags" ]
811 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700812 "tools/flags/SkCommonFlags.cpp",
813 "tools/flags/SkCommonFlagsConfig.cpp",
814 ]
815 deps = [
mtklein046cb562016-09-16 10:23:12 -0700816 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700817 ":gpu_tool_utils",
818 ]
819 }
mtklein25c81d42016-07-27 13:55:26 -0700820
mtkleinc095df52016-08-24 12:23:52 -0700821 test_lib("tool_utils") {
822 public_include_dirs = [
823 "tools",
824 "tools/debugger",
825 "tools/timer",
826 ]
827 sources = [
828 "src/images/SkForceLinking.cpp",
829 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
mtkleinb37c0342016-09-09 11:07:45 -0700830 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700831 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700832 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700833 "tools/ProcStats.cpp",
834 "tools/Resources.cpp",
835 "tools/ThermalManager.cpp",
836 "tools/UrlDataManager.cpp",
837 "tools/debugger/SkDebugCanvas.cpp",
838 "tools/debugger/SkDrawCommand.cpp",
839 "tools/debugger/SkJsonWriteBuffer.cpp",
840 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700841 "tools/picture_utils.cpp",
842 "tools/random_parse_path.cpp",
843 "tools/sk_tool_utils.cpp",
844 "tools/sk_tool_utils_font.cpp",
845 "tools/timer/Timer.cpp",
846 ]
847 deps = [
mtklein046cb562016-09-16 10:23:12 -0700848 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -0700849 ":flags",
850 "//third_party/libpng",
851 ]
852 public_deps = [
853 "//third_party/jsoncpp",
854 ]
855 }
mtklein25c81d42016-07-27 13:55:26 -0700856
Mike Klein6e744122016-10-27 12:21:40 -0400857 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -0700858 test_lib("gm") {
859 public_include_dirs = [ "gm" ]
860 sources = gm_sources
861 deps = [
scroggo19b91532016-10-24 09:03:26 -0700862 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700863 ":gpu_tool_utils",
864 ":skia",
865 ":tool_utils",
866 ]
867 }
mtklein25c81d42016-07-27 13:55:26 -0700868
Mike Klein6e744122016-10-27 12:21:40 -0400869 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -0700870 test_lib("tests") {
871 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -0400872 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -0700873 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -0400874 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700875 }
mtkleinc095df52016-08-24 12:23:52 -0700876 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700877 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700878 ":flags",
879 ":gpu_tool_utils",
880 ":skia",
881 ":tool_utils",
882 "//third_party/libpng",
883 "//third_party/zlib",
884 ]
885 }
mtklein2f3416d2016-08-02 16:02:05 -0700886
Mike Klein6e744122016-10-27 12:21:40 -0400887 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -0700888 test_lib("bench") {
889 public_include_dirs = [ "bench" ]
890 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -0700891 deps = [
892 ":flags",
893 ":gm",
894 ":gpu_tool_utils",
895 ":skia",
896 ":tool_utils",
897 ]
898 }
mtklein2b6870c2016-07-28 14:17:33 -0700899
mtkleinc095df52016-08-24 12:23:52 -0700900 test_lib("experimental_svg_model") {
901 public_include_dirs = [ "experimental/svg/model" ]
902 sources = [
903 "experimental/svg/model/SkSVGAttribute.cpp",
904 "experimental/svg/model/SkSVGAttributeParser.cpp",
905 "experimental/svg/model/SkSVGCircle.cpp",
906 "experimental/svg/model/SkSVGContainer.cpp",
907 "experimental/svg/model/SkSVGDOM.cpp",
908 "experimental/svg/model/SkSVGEllipse.cpp",
909 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700910 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700911 "experimental/svg/model/SkSVGNode.cpp",
912 "experimental/svg/model/SkSVGPath.cpp",
913 "experimental/svg/model/SkSVGPoly.cpp",
914 "experimental/svg/model/SkSVGRect.cpp",
915 "experimental/svg/model/SkSVGRenderContext.cpp",
916 "experimental/svg/model/SkSVGSVG.cpp",
917 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700918 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700919 "experimental/svg/model/SkSVGTransformableNode.cpp",
920 "experimental/svg/model/SkSVGValue.cpp",
921 ]
922 deps = [
923 ":skia",
924 ]
925 }
fmalitaa2b9fdf2016-08-03 19:53:36 -0700926
Brian Osman16adfa32016-10-18 14:42:44 -0400927 test_lib("views") {
928 public_include_dirs = [ "include/views" ]
929 sources = [
930 "src/views/SkEvent.cpp",
931 "src/views/SkEventSink.cpp",
932 "src/views/SkOSMenu.cpp",
933 "src/views/SkTagList.cpp",
934 "src/views/SkTouchGesture.cpp",
935 "src/views/SkView.cpp",
936 "src/views/SkViewPriv.cpp",
937 ]
938 libs = []
939 if (!is_android) {
940 sources += [ "src/views/SkWindow.cpp" ]
941 }
Jim Van Verth4e56a912016-10-21 10:58:52 -0400942 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -0400943 public_include_dirs += [ "src/views/unix" ]
944 sources += [
945 "src/views/unix/SkOSWindow_Unix.cpp",
946 "src/views/unix/keysym2ucs.c",
947 ]
Brian Osman16adfa32016-10-18 14:42:44 -0400948 } else if (is_mac) {
949 sources += [
950 "src/views/mac/SkEventNotifier.mm",
951 "src/views/mac/SkNSView.mm",
952 "src/views/mac/SkOSWindow_Mac.mm",
953 "src/views/mac/SkTextFieldCell.m",
954 ]
955 libs += [
956 "QuartzCore.framework",
957 "Cocoa.framework",
958 "Foundation.framework",
959 ]
960 } else if (is_win) {
961 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
962 }
963 }
964
Mike Klein38af9432016-11-11 11:39:44 -0500965 if (skia_use_lua) {
966 test_lib("lua") {
967 public_include_dirs = []
968 sources = [
969 "src/utils/SkLua.cpp",
970 "src/utils/SkLuaCanvas.cpp",
971 ]
972 deps = [
973 "//third_party/lua",
974 ]
975 }
976
977 executable("lua_app") {
978 sources = [
979 "tools/lua/lua_app.cpp",
980 ]
981 deps = [
982 ":lua",
983 ":skia",
984 "//third_party/lua",
985 ]
986 testonly = true
987 }
988
989 executable("lua_pictures") {
990 sources = [
991 "tools/lua/lua_pictures.cpp",
992 ]
993 deps = [
994 ":flags",
995 ":lua",
996 ":skia",
997 ":tool_utils",
998 "//third_party/lua",
999 ]
1000 testonly = true
1001 }
1002 }
1003
Mike Klein6e744122016-10-27 12:21:40 -04001004 import("gn/samples.gni")
Brian Osman16adfa32016-10-18 14:42:44 -04001005 test_lib("samples") {
Brian Osman16adfa32016-10-18 14:42:44 -04001006 public_include_dirs = [ "samplecode" ]
Mike Klein6e744122016-10-27 12:21:40 -04001007 include_dirs = [ "experimental" ]
1008 sources = samples_sources + [
1009 "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp",
1010 "experimental/SkSetPoly3To3.cpp",
1011 "experimental/SkSetPoly3To3_A.cpp",
1012 "experimental/SkSetPoly3To3_D.cpp",
1013 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001014 deps = [
1015 ":experimental_svg_model",
Mike Klein6e744122016-10-27 12:21:40 -04001016 ":gm",
Brian Osman16adfa32016-10-18 14:42:44 -04001017 ":tool_utils",
1018 ":views",
1019 ":xml",
1020 ]
Mike Klein38af9432016-11-11 11:39:44 -05001021
1022 if (skia_use_lua) {
1023 sources += [ "samplecode/SampleLua.cpp" ]
1024 deps += [
1025 ":lua",
1026 "//third_party/lua",
1027 ]
1028 }
Brian Osman16adfa32016-10-18 14:42:44 -04001029 }
1030
mtklein2b6870c2016-07-28 14:17:33 -07001031 executable("dm") {
1032 sources = [
1033 "dm/DM.cpp",
1034 "dm/DMJsonWriter.cpp",
1035 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -07001036 ]
1037 include_dirs = [ "tests" ]
1038 deps = [
mtklein046cb562016-09-16 10:23:12 -07001039 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -07001040 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001041 ":flags",
1042 ":gm",
1043 ":gpu_tool_utils",
1044 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -07001045 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -07001046 ":tool_utils",
1047 "//third_party/jsoncpp",
1048 "//third_party/libpng",
1049 ]
1050 testonly = true
1051 }
1052
Mike Kleina3430172016-09-27 16:46:29 -04001053 if (!is_debug) { # I've benchmarked debug code once too many times...
1054 executable("monobench") {
1055 sources = [
1056 "tools/monobench.cpp",
1057 ]
1058 deps = [
1059 ":bench",
1060 ":skia",
1061 ]
1062 testonly = true
1063 }
mtklein2b6870c2016-07-28 14:17:33 -07001064 }
1065
1066 executable("nanobench") {
1067 sources = [
1068 "bench/nanobench.cpp",
1069 ]
1070 deps = [
1071 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001072 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001073 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001074 ":flags",
1075 ":gm",
1076 ":gpu_tool_utils",
1077 ":skia",
1078 ":tool_utils",
1079 "//third_party/jsoncpp",
1080 ]
1081 testonly = true
1082 }
halcanary19a97202016-08-03 15:08:04 -07001083
Jim Van Verth57a98fc2016-10-28 13:35:50 -04001084 if (is_linux || is_win || is_mac) {
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001085 executable("SampleApp") {
mtklein38925aa2016-09-21 10:11:25 -07001086 sources = [
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001087 "samplecode/SampleApp.cpp",
1088 "samplecode/SamplePictFile.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001089 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001090 if (is_mac) {
1091 sources += [ "src/views/mac/skia_mac.mm" ]
1092 } else if (is_win) {
1093 sources += [ "src/views/win/skia_win.cpp" ]
1094 } else if (is_linux) {
1095 sources += [ "src/views/unix/skia_unix.cpp" ]
1096 }
mtklein38925aa2016-09-21 10:11:25 -07001097 deps = [
1098 ":flags",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001099 ":gm",
mtklein38925aa2016-09-21 10:11:25 -07001100 ":gpu_tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001101 ":samples",
mtklein38925aa2016-09-21 10:11:25 -07001102 ":skia",
1103 ":tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001104 ":views",
mtklein38925aa2016-09-21 10:11:25 -07001105 ]
Mike Kleinc168a3a2016-11-14 14:53:13 +00001106 if (skia_use_angle) {
1107 deps += [ "//third_party/angle2" ]
1108 }
mtklein38925aa2016-09-21 10:11:25 -07001109 testonly = true
1110 }
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001111 }
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001112
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001113 if (skia_enable_gpu) {
1114 executable("skpbench") {
1115 sources = [
1116 "tools/skpbench/skpbench.cpp",
1117 ]
1118 deps = [
1119 ":flags",
1120 ":gpu_tool_utils",
1121 ":skia",
1122 ":tool_utils",
1123 ]
1124 testonly = true
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001125 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001126 }
1127
Mike Klein7d302882016-11-03 14:06:31 -04001128 # We can't yet build ICU on iOS or Windows.
1129 if (!is_ios && !is_win) {
halcanary3eee9d92016-09-10 07:01:53 -07001130 executable("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001131 sources = [
1132 "tools/SkShaper_harfbuzz.cpp",
1133 "tools/using_skia_and_harfbuzz.cpp",
1134 ]
1135 deps = [
1136 ":skia",
1137 "//third_party/harfbuzz",
1138 ]
1139 testonly = true
1140 }
halcanary19a97202016-08-03 15:08:04 -07001141 }
halcanary3eee9d92016-09-10 07:01:53 -07001142 executable("sktexttopdf") {
1143 sources = [
1144 "tools/SkShaper_primitive.cpp",
1145 "tools/using_skia_and_harfbuzz.cpp",
1146 ]
1147 deps = [
1148 ":skia",
1149 ]
1150 testonly = true
1151 }
mtklein046cb562016-09-16 10:23:12 -07001152
1153 executable("get_images_from_skps") {
1154 sources = [
1155 "tools/get_images_from_skps.cpp",
1156 ]
1157 deps = [
1158 ":flags",
1159 ":skia",
1160 "//third_party/jsoncpp",
1161 ]
1162 testonly = true
1163 }
mtkleinecbc5262016-09-22 11:51:24 -07001164
Matt Sarett8740d582016-11-11 13:59:14 -05001165 executable("colorspaceinfo") {
1166 sources = [
1167 "tools/colorspaceinfo.cpp",
1168 ]
1169 deps = [
1170 ":flags",
1171 ":skia",
1172 ":tool_utils",
1173 ]
1174 testonly = true
1175 }
1176
Mike Klein7d302882016-11-03 14:06:31 -04001177 if (!is_ios) {
1178 executable("skiaserve") {
1179 sources = [
1180 "tools/skiaserve/Request.cpp",
1181 "tools/skiaserve/Response.cpp",
1182 "tools/skiaserve/skiaserve.cpp",
1183 "tools/skiaserve/urlhandlers/BatchBoundsHandler.cpp",
1184 "tools/skiaserve/urlhandlers/BatchesHandler.cpp",
1185 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1186 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1187 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1188 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1189 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1190 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1191 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1192 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1193 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
1194 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1195 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1196 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1197 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1198 ]
1199 deps = [
1200 ":flags",
1201 ":gpu_tool_utils",
1202 ":skia",
1203 ":tool_utils",
1204 "//third_party/jsoncpp",
1205 "//third_party/libmicrohttpd",
1206 "//third_party/libpng",
1207 ]
1208 testonly = true
1209 }
mtkleinecbc5262016-09-22 11:51:24 -07001210 }
kjlubick14f984b2016-10-03 11:49:45 -07001211
1212 executable("fuzz") {
1213 sources = [
1214 "fuzz/FilterFuzz.cpp",
1215 "fuzz/FuzzGradients.cpp",
1216 "fuzz/FuzzParsePath.cpp",
1217 "fuzz/FuzzPathop.cpp",
1218 "fuzz/FuzzScaleToSides.cpp",
1219 "fuzz/fuzz.cpp",
1220 ]
1221 deps = [
1222 ":flags",
1223 ":skia",
1224 ]
1225 testonly = true
1226 }
Mike Klein38312422016-10-05 15:41:01 -04001227
caryclark9feb6322016-10-25 08:58:26 -07001228 executable("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001229 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001230 rebase_path("tests/skia_test.cpp"),
1231 rebase_path("tests/Test.cpp"),
1232 ]
caryclark9feb6322016-10-25 08:58:26 -07001233 deps = [
1234 ":flags",
1235 ":gpu_tool_utils",
1236 ":skia",
1237 ":tool_utils",
1238 ]
1239 testonly = true
1240 }
1241
Mike Klein38312422016-10-05 15:41:01 -04001242 executable("dump_record") {
1243 sources = [
1244 "tools/DumpRecord.cpp",
1245 "tools/dump_record.cpp",
1246 ]
1247 deps = [
1248 ":flags",
1249 ":skia",
1250 ]
1251 testonly = true
1252 }
bungemanfe917272016-10-13 17:36:40 -04001253
1254 executable("skdiff") {
1255 sources = [
1256 "tools/skdiff/skdiff.cpp",
1257 "tools/skdiff/skdiff_html.cpp",
1258 "tools/skdiff/skdiff_main.cpp",
1259 "tools/skdiff/skdiff_utils.cpp",
1260 ]
1261 deps = [
1262 ":skia",
1263 ":tool_utils",
1264 ]
1265 testonly = true
1266 }
halcanarya73d76a2016-10-17 13:19:02 -07001267
1268 executable("skp_parser") {
1269 sources = [
1270 "tools/skp_parser.cpp",
1271 ]
1272 deps = [
1273 ":skia",
1274 ":tool_utils",
1275 "//third_party/jsoncpp",
1276 ]
1277 testonly = true
1278 }
Brian Osman16adfa32016-10-18 14:42:44 -04001279
Mike Klein43c25262016-10-20 10:17:47 -04001280 if (skia_enable_gpu && (is_linux || is_win || is_mac)) {
Brian Osman16adfa32016-10-18 14:42:44 -04001281 executable("viewer") {
1282 sources = [
1283 "tools/viewer/GMSlide.cpp",
1284 "tools/viewer/ImageSlide.cpp",
1285 "tools/viewer/SKPSlide.cpp",
1286 "tools/viewer/SampleSlide.cpp",
1287 "tools/viewer/Viewer.cpp",
1288 "tools/viewer/sk_app/CommandSet.cpp",
1289 "tools/viewer/sk_app/GLWindowContext.cpp",
1290 "tools/viewer/sk_app/Window.cpp",
1291 "tools/viewer/sk_app/WindowContext.cpp",
1292 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001293 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001294
Jim Van Verth4e56a912016-10-21 10:58:52 -04001295 if (is_android) {
1296 sources += [
1297 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1298 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1299 "tools/viewer/sk_app/android/Window_android.cpp",
1300 "tools/viewer/sk_app/android/main_android.cpp",
1301 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1302 ]
1303 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001304 sources += [
1305 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1306 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1307 "tools/viewer/sk_app/unix/Window_unix.cpp",
1308 "tools/viewer/sk_app/unix/main_unix.cpp",
1309 ]
1310 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001311 sources += [
1312 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1313 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1314 "tools/viewer/sk_app/win/Window_win.cpp",
1315 "tools/viewer/sk_app/win/main_win.cpp",
1316 ]
Mike Klein43c25262016-10-20 10:17:47 -04001317 } else if (is_mac) {
1318 sources += [
1319 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1320 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1321 "tools/viewer/sk_app/mac/Window_mac.cpp",
1322 "tools/viewer/sk_app/mac/main_mac.cpp",
1323 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001324 }
1325
1326 if (skia_use_vulkan) {
1327 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001328 if (is_android) {
1329 sources +=
1330 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
1331 libs += [ "android" ]
1332 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001333 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1334 libs += [ "X11-xcb" ]
1335 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001336 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1337 }
1338 }
1339
1340 include_dirs = []
1341 deps = [
1342 ":flags",
1343 ":gm",
1344 ":gpu_tool_utils",
1345 ":samples",
1346 ":skia",
1347 ":tool_utils",
1348 ":views",
1349 "//third_party/jsoncpp",
1350 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001351 if (is_android) {
1352 deps += [ "//third_party/native_app_glue" ]
1353 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001354 deps += [ "//third_party/libsdl" ]
1355 }
Brian Osman16adfa32016-10-18 14:42:44 -04001356 testonly = true
1357 }
1358 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001359
1360 if (skia_enable_gpu) {
1361 executable("skslc") {
1362 sources = [
1363 "src/sksl/SkSLMain.cpp",
1364 ]
1365 deps = [
1366 ":flags",
1367 ":skia",
1368 ]
1369 testonly = true
1370 }
1371 }
mtklein25c81d42016-07-27 13:55:26 -07001372}