blob: 078b205191631c0f7fa1b18c71d0445093b719e5 [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) {
Mike Klein17b6e482016-11-18 22:11:41 +0000253 cflags = [ "/arch:AVX" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400254 } 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) {
Mike Klein17b6e482016-11-18 22:11:41 +0000263 cflags = [ "/arch:AVX2" ]
Mike Klein3eb71212016-10-11 17:08:53 -0400264 } 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" ]
Chinmay Garde130a1182016-11-23 11:43:56 -0800397 } else if (is_ios) {
398 sources += [ "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400399 } else if (is_win) {
400 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
401 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700402 } else {
403 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
404 }
mtkleine9fb3d52016-09-20 15:11:46 -0700405
406 if (skia_use_vulkan) {
407 public_defines += [ "SK_VULKAN" ]
408 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700409 if (skia_enable_vulkan_debug_layers) {
410 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
411 }
mtkleine9fb3d52016-09-20 15:11:46 -0700412 }
mtklein06c35c02016-09-20 12:28:12 -0700413}
414
mtklein63213812016-08-24 09:55:56 -0700415optional("jpeg") {
416 enabled = skia_use_libjpeg_turbo
417 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
418
mtklein63213812016-08-24 09:55:56 -0700419 deps = [
420 "//third_party/libjpeg-turbo:libjpeg",
421 ]
422 sources = [
423 "src/codec/SkJpegCodec.cpp",
424 "src/codec/SkJpegDecoderMgr.cpp",
425 "src/codec/SkJpegUtility.cpp",
426 "src/images/SkJPEGImageEncoder.cpp",
427 "src/images/SkJPEGWriteUtility.cpp",
428 ]
429}
430
431optional("pdf") {
432 enabled = skia_use_zlib
mtklein63213812016-08-24 09:55:56 -0700433
mtklein63213812016-08-24 09:55:56 -0700434 deps = [
435 "//third_party/zlib",
436 ]
brettwb9447282016-09-01 14:24:39 -0700437 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700438 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700439
440 if (skia_use_sfntly) {
441 deps += [ "//third_party/sfntly" ]
mtkleincd01b032016-08-31 04:58:19 -0700442 public_defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700443 }
444}
445
446optional("png") {
447 enabled = skia_use_libpng
448 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
449
mtklein63213812016-08-24 09:55:56 -0700450 deps = [
451 "//third_party/libpng",
452 ]
453 sources = [
454 "src/codec/SkIcoCodec.cpp",
455 "src/codec/SkPngCodec.cpp",
456 "src/images/SkPNGImageEncoder.cpp",
457 ]
458}
459
scroggof84ad642016-10-31 09:02:57 -0700460optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400461 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700462 public_defines = [ "SK_CODEC_DECODES_RAW" ]
463
464 deps = [
465 "//third_party/dng_sdk",
466 "//third_party/libjpeg-turbo:libjpeg",
467 "//third_party/piex",
468 ]
469
470 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
471 # Skia.
472 configs_to_remove = [ "//gn:no_exceptions" ]
473
474 sources = [
475 "src/codec/SkRawAdapterCodec.cpp",
476 "src/codec/SkRawCodec.cpp",
477 ]
478}
479
mtklein3cc22182016-08-29 13:26:14 -0700480optional("typeface_freetype") {
481 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700482
483 deps = [
484 "//third_party/freetype2",
485 ]
486 sources = [
487 "src/ports/SkFontHost_FreeType.cpp",
488 "src/ports/SkFontHost_FreeType_common.cpp",
489 ]
490}
491
mtklein457b42a2016-08-23 13:56:37 -0700492optional("webp") {
493 enabled = skia_use_libwebp
494 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
495
mtklein457b42a2016-08-23 13:56:37 -0700496 deps = [
497 "//third_party/libwebp",
498 ]
499 sources = [
500 "src/codec/SkWebpAdapterCodec.cpp",
501 "src/codec/SkWebpCodec.cpp",
502 "src/images/SkWEBPImageEncoder.cpp",
503 ]
mtkleineb3c4252016-08-23 07:38:09 -0700504}
505
mtklein63213812016-08-24 09:55:56 -0700506optional("xml") {
507 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000508 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700509
mtklein63213812016-08-24 09:55:56 -0700510 deps = [
511 "//third_party/expat",
512 ]
513 sources = [
514 "src/xml/SkDOM.cpp",
515 "src/xml/SkXMLParser.cpp",
516 "src/xml/SkXMLWriter.cpp",
517 ]
518}
519
mtkleinc04ff472016-06-23 10:29:30 -0700520component("skia") {
521 public_configs = [ ":skia_public" ]
522 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700523
524 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700525 ":arm64",
526 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700527 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700528 ":crc32",
mtklein349cece2016-08-26 08:13:04 -0700529 ":dsp",
mtkleina45be612016-08-29 15:22:10 -0700530 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700531 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700532 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700533 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700534 ":gpu",
Mike Klein78d5a3b2016-09-30 10:48:01 -0400535 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700536 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700537 ":none",
mtklein63213812016-08-24 09:55:56 -0700538 ":pdf",
539 ":png",
scroggof84ad642016-10-31 09:02:57 -0700540 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700541 ":sse2",
542 ":sse41",
543 ":sse42",
544 ":ssse3",
mtklein3cc22182016-08-29 13:26:14 -0700545 ":typeface_freetype",
mtkleineb3c4252016-08-23 07:38:09 -0700546 ":webp",
mtklein63213812016-08-24 09:55:56 -0700547 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700548 ]
549
Chinmay Garde43f115c2016-11-16 15:04:12 -0800550 # This file (and all GN files in Skia) are designed to work with an
551 # empty sources assignment filter; we handle all that explicitly.
552 # We clear the filter here for clients who may have set up a global filter.
553 set_sources_assignment_filter([])
554
mtkleinc04ff472016-06-23 10:29:30 -0700555 sources = []
brettwb9447282016-09-01 14:24:39 -0700556 sources += skia_core_sources
557 sources += skia_effects_sources
brettwb9447282016-09-01 14:24:39 -0700558 sources += skia_sksl_sources
559 sources += skia_utils_sources
mtkleinc04ff472016-06-23 10:29:30 -0700560 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700561 "src/android/SkBitmapRegionCodec.cpp",
562 "src/android/SkBitmapRegionDecoder.cpp",
563 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700564 "src/codec/SkBmpCodec.cpp",
565 "src/codec/SkBmpMaskCodec.cpp",
566 "src/codec/SkBmpRLECodec.cpp",
567 "src/codec/SkBmpStandardCodec.cpp",
568 "src/codec/SkCodec.cpp",
569 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700570 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700571 "src/codec/SkMaskSwizzler.cpp",
572 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700573 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700574 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700575 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700576 "src/codec/SkSwizzler.cpp",
577 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700578 "src/images/SkImageEncoder.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700579 "src/images/SkKTXImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700580 "src/ports/SkDiscardableMemory_none.cpp",
581 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700582 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700583 "src/ports/SkMemory_malloc.cpp",
584 "src/ports/SkOSFile_stdio.cpp",
585 "src/sfnt/SkOTTable_name.cpp",
586 "src/sfnt/SkOTUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700587 "src/svg/SkSVGCanvas.cpp",
588 "src/svg/SkSVGDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700589 "src/utils/mac/SkStream_mac.cpp",
590 "third_party/etc1/etc1.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700591 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700592 "third_party/ktx/ktx.cpp",
593 ]
brettwb9447282016-09-01 14:24:39 -0700594
mtklein7d6fb2c2016-08-25 14:50:44 -0700595 libs = []
596
mtkleinc04ff472016-06-23 10:29:30 -0700597 if (is_win) {
598 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400599 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700600 "src/ports/SkDebug_win.cpp",
601 "src/ports/SkFontHost_win.cpp",
602 "src/ports/SkFontMgr_win_dw.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700603 "src/ports/SkImageEncoder_WIC.cpp",
604 "src/ports/SkImageGeneratorWIC.cpp",
605 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700606 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700607 "src/ports/SkScalerContext_win_dw.cpp",
608 "src/ports/SkTLS_win.cpp",
609 "src/ports/SkTypeface_win_dw.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700610 "src/xps/SkDocument_XPS.cpp",
Mike Klein4b167fc2016-10-11 18:13:53 -0400611 "src/xps/SkXPSDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700612 ]
Mike Klein69f6ed42016-10-13 15:45:07 -0400613 if (skia_use_gdi) {
614 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
615 libs += [
616 "Gdi32.lib",
617 "Usp10.lib",
618 ]
619 } else {
620 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
621 }
mtkleinb9be9792016-09-16 14:44:18 -0700622 sources -=
623 [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400624 libs += [
625 "FontSub.lib",
626 "Ole32.lib",
627 "OleAut32.lib",
628 "User32.lib",
629 ]
mtkleinc04ff472016-06-23 10:29:30 -0700630 } else {
631 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700632 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700633 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700634 "src/ports/SkTLS_pthread.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700635 "src/xps/SkDocument_XPS_None.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700636 ]
637 }
638
mtklein7d6fb2c2016-08-25 14:50:44 -0700639 if (is_android) {
640 deps += [
641 "//third_party/cpu-features",
642 "//third_party/expat",
mtklein7d6fb2c2016-08-25 14:50:44 -0700643 ]
mtklein06c35c02016-09-20 12:28:12 -0700644 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700645 libs += [
646 "EGL",
647 "GLESv2",
648 "log",
649 ]
650 }
651
mtkleinc04ff472016-06-23 10:29:30 -0700652 if (is_linux) {
mtklein09e61f72016-08-23 13:35:28 -0700653 libs += [
654 "GL",
655 "GLU",
656 "X11",
657 ]
mtklein06c35c02016-09-20 12:28:12 -0700658 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700659 }
660
661 if (is_mac) {
662 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700663 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700664 "src/ports/SkFontHost_mac.cpp",
665 "src/ports/SkImageEncoder_CG.cpp",
666 "src/ports/SkImageGeneratorCG.cpp",
667 ]
mtklein09e61f72016-08-23 13:35:28 -0700668 libs += [
669 "ApplicationServices.framework",
670 "OpenGL.framework",
671 ]
mtkleinc04ff472016-06-23 10:29:30 -0700672 }
abarth6fc8ff02016-07-15 15:15:15 -0700673
Mike Klein7d302882016-11-03 14:06:31 -0400674 if (is_ios) {
675 sources += [
676 "src/ports/SkDebug_stdio.cpp",
677 "src/ports/SkFontHost_mac.cpp",
678 "src/ports/SkImageEncoder_CG.cpp",
679 "src/ports/SkImageGeneratorCG.cpp",
680 ]
681 libs += [
682 "CoreFoundation.framework",
683 "CoreGraphics.framework",
684 "CoreText.framework",
685 "ImageIO.framework",
686 "MobileCoreServices.framework",
687 ]
688 }
689
abarth6fc8ff02016-07-15 15:15:15 -0700690 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700691 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700692 }
mtkleinc04ff472016-06-23 10:29:30 -0700693}
694
mtkleinc095df52016-08-24 12:23:52 -0700695# Targets guarded by skia_enable_tools may use //third_party freely.
696if (skia_enable_tools) {
Mike Kleinc36dedf2016-11-18 09:35:28 -0500697 config("skia.h_config") {
698 include_dirs = [ "$target_gen_dir" ]
699 }
700 action("skia.h") {
701 public_configs = [ ":skia.h_config" ]
702 skia_h = "$target_gen_dir/skia.h"
703 script = "gn/find_headers.py"
704 args = [ rebase_path(skia_h, root_build_dir) ] +
705 rebase_path(skia_public_includes)
706 depfile = "$skia_h.deps"
707 outputs = [
708 skia_h,
709 ]
710 }
711
712 if (skia_enable_gpu && target_cpu == "x64") {
713 # Our bots only have 64-bit libOSMesa installed.
714 # TODO: worth fixing?
715 executable("fiddle") {
716 libs = []
717 if (is_linux) {
718 libs += [ "OSMesa" ]
719 }
720
721 sources = [
Mike Kleinc36dedf2016-11-18 09:35:28 -0500722 "tools/fiddle/draw.cpp",
723 "tools/fiddle/fiddle_main.cpp",
724 ]
725 deps = [
726 ":skia",
727 ":skia.h",
728 ]
729 }
730 }
731
732 if (skia_enable_gpu) {
733 source_set("public_headers_warnings_check") {
734 sources = [
735 "tools/public_headers_warnings_check.cpp",
736 ]
737 configs -= [ "//gn:warnings_except_public_headers" ]
738 deps = [
739 ":skia",
740 ":skia.h",
741 ]
742 }
743 }
744
mtkleinc095df52016-08-24 12:23:52 -0700745 template("test_lib") {
746 config(target_name + "_config") {
747 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700748 if (defined(invoker.public_defines)) {
749 defines = invoker.public_defines
750 }
mtklein25c81d42016-07-27 13:55:26 -0700751 }
mtkleinc095df52016-08-24 12:23:52 -0700752 source_set(target_name) {
753 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
754 public_configs = [
755 ":" + target_name + "_config",
756 ":skia_private",
757 ]
758
759 if (!defined(deps)) {
760 deps = []
761 }
762 deps += [ ":skia" ]
763 testonly = true
764 }
mtklein25c81d42016-07-27 13:55:26 -0700765 }
mtklein25c81d42016-07-27 13:55:26 -0700766
mtkleinc095df52016-08-24 12:23:52 -0700767 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700768 public_include_dirs = []
769 if (skia_enable_gpu) {
770 public_defines = []
771 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700772
773 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700774 sources = [
775 "tools/gpu/GrContextFactory.cpp",
776 "tools/gpu/GrTest.cpp",
777 "tools/gpu/TestContext.cpp",
778 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -0700779 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700780 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
781 "tools/gpu/gl/debug/GrBufferObj.cpp",
782 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
783 "tools/gpu/gl/debug/GrProgramObj.cpp",
784 "tools/gpu/gl/debug/GrShaderObj.cpp",
785 "tools/gpu/gl/debug/GrTextureObj.cpp",
786 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
787 "tools/gpu/gl/null/NullGLTestContext.cpp",
788 ]
789 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700790
mtklein38925aa2016-09-21 10:11:25 -0700791 if (is_android) {
792 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -0400793 } else if (is_ios) {
794 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
795 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -0700796 } else if (is_linux) {
797 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
798 } else if (is_mac) {
799 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400800 } else if (is_win) {
801 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
802 libs += [
803 "Gdi32.lib",
804 "OpenGL32.lib",
805 ]
mtklein38925aa2016-09-21 10:11:25 -0700806 }
mtklein6ef69992016-09-14 06:12:09 -0700807
Mike Kleinc168a3a2016-11-14 14:53:13 +0000808 if (skia_use_angle) {
809 public_defines += [ "SK_ANGLE" ]
810 deps += [ "//third_party/angle2" ]
811 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
812 }
mtklein38925aa2016-09-21 10:11:25 -0700813 if (skia_use_mesa) {
814 public_defines += [ "SK_MESA" ]
815 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
816 libs += [ "OSMesa" ]
817 }
mtkleind68f9b02016-09-23 13:18:41 -0700818 if (skia_use_vulkan) {
819 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
820 }
mtkleina627b5c2016-09-20 13:36:47 -0700821 }
mtklein25c81d42016-07-27 13:55:26 -0700822 }
mtklein25c81d42016-07-27 13:55:26 -0700823
mtkleinc095df52016-08-24 12:23:52 -0700824 test_lib("flags") {
825 public_include_dirs = [ "tools/flags" ]
826 sources = [
827 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -0700828 ]
829 }
830 test_lib("common_flags") {
831 public_include_dirs = [ "tools/flags" ]
832 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700833 "tools/flags/SkCommonFlags.cpp",
834 "tools/flags/SkCommonFlagsConfig.cpp",
835 ]
836 deps = [
mtklein046cb562016-09-16 10:23:12 -0700837 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700838 ":gpu_tool_utils",
839 ]
840 }
mtklein25c81d42016-07-27 13:55:26 -0700841
mtkleinc095df52016-08-24 12:23:52 -0700842 test_lib("tool_utils") {
843 public_include_dirs = [
844 "tools",
845 "tools/debugger",
846 "tools/timer",
847 ]
848 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700849 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
mtkleinb37c0342016-09-09 11:07:45 -0700850 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700851 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700852 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700853 "tools/ProcStats.cpp",
854 "tools/Resources.cpp",
855 "tools/ThermalManager.cpp",
856 "tools/UrlDataManager.cpp",
857 "tools/debugger/SkDebugCanvas.cpp",
858 "tools/debugger/SkDrawCommand.cpp",
859 "tools/debugger/SkJsonWriteBuffer.cpp",
860 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700861 "tools/picture_utils.cpp",
862 "tools/random_parse_path.cpp",
863 "tools/sk_tool_utils.cpp",
864 "tools/sk_tool_utils_font.cpp",
865 "tools/timer/Timer.cpp",
866 ]
867 deps = [
mtklein046cb562016-09-16 10:23:12 -0700868 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -0700869 ":flags",
870 "//third_party/libpng",
871 ]
872 public_deps = [
873 "//third_party/jsoncpp",
874 ]
875 }
mtklein25c81d42016-07-27 13:55:26 -0700876
Mike Klein6e744122016-10-27 12:21:40 -0400877 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -0700878 test_lib("gm") {
879 public_include_dirs = [ "gm" ]
880 sources = gm_sources
881 deps = [
scroggo19b91532016-10-24 09:03:26 -0700882 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700883 ":gpu_tool_utils",
884 ":skia",
885 ":tool_utils",
886 ]
887 }
mtklein25c81d42016-07-27 13:55:26 -0700888
Mike Klein6e744122016-10-27 12:21:40 -0400889 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -0700890 test_lib("tests") {
891 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -0400892 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -0700893 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -0400894 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700895 }
mtkleinc095df52016-08-24 12:23:52 -0700896 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700897 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700898 ":flags",
899 ":gpu_tool_utils",
900 ":skia",
901 ":tool_utils",
902 "//third_party/libpng",
903 "//third_party/zlib",
904 ]
905 }
mtklein2f3416d2016-08-02 16:02:05 -0700906
Mike Klein6e744122016-10-27 12:21:40 -0400907 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -0700908 test_lib("bench") {
909 public_include_dirs = [ "bench" ]
910 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -0700911 deps = [
912 ":flags",
913 ":gm",
914 ":gpu_tool_utils",
915 ":skia",
916 ":tool_utils",
917 ]
918 }
mtklein2b6870c2016-07-28 14:17:33 -0700919
mtkleinc095df52016-08-24 12:23:52 -0700920 test_lib("experimental_svg_model") {
921 public_include_dirs = [ "experimental/svg/model" ]
922 sources = [
923 "experimental/svg/model/SkSVGAttribute.cpp",
924 "experimental/svg/model/SkSVGAttributeParser.cpp",
925 "experimental/svg/model/SkSVGCircle.cpp",
926 "experimental/svg/model/SkSVGContainer.cpp",
927 "experimental/svg/model/SkSVGDOM.cpp",
928 "experimental/svg/model/SkSVGEllipse.cpp",
929 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700930 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700931 "experimental/svg/model/SkSVGNode.cpp",
932 "experimental/svg/model/SkSVGPath.cpp",
933 "experimental/svg/model/SkSVGPoly.cpp",
934 "experimental/svg/model/SkSVGRect.cpp",
935 "experimental/svg/model/SkSVGRenderContext.cpp",
936 "experimental/svg/model/SkSVGSVG.cpp",
937 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700938 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700939 "experimental/svg/model/SkSVGTransformableNode.cpp",
940 "experimental/svg/model/SkSVGValue.cpp",
941 ]
942 deps = [
943 ":skia",
944 ]
945 }
fmalitaa2b9fdf2016-08-03 19:53:36 -0700946
Brian Osman16adfa32016-10-18 14:42:44 -0400947 test_lib("views") {
948 public_include_dirs = [ "include/views" ]
949 sources = [
950 "src/views/SkEvent.cpp",
951 "src/views/SkEventSink.cpp",
952 "src/views/SkOSMenu.cpp",
953 "src/views/SkTagList.cpp",
954 "src/views/SkTouchGesture.cpp",
955 "src/views/SkView.cpp",
956 "src/views/SkViewPriv.cpp",
957 ]
958 libs = []
959 if (!is_android) {
960 sources += [ "src/views/SkWindow.cpp" ]
961 }
Jim Van Verth4e56a912016-10-21 10:58:52 -0400962 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -0400963 public_include_dirs += [ "src/views/unix" ]
964 sources += [
965 "src/views/unix/SkOSWindow_Unix.cpp",
966 "src/views/unix/keysym2ucs.c",
967 ]
Brian Osman16adfa32016-10-18 14:42:44 -0400968 } else if (is_mac) {
969 sources += [
970 "src/views/mac/SkEventNotifier.mm",
971 "src/views/mac/SkNSView.mm",
972 "src/views/mac/SkOSWindow_Mac.mm",
973 "src/views/mac/SkTextFieldCell.m",
974 ]
975 libs += [
976 "QuartzCore.framework",
977 "Cocoa.framework",
978 "Foundation.framework",
979 ]
980 } else if (is_win) {
981 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
982 }
983 }
984
Mike Klein38af9432016-11-11 11:39:44 -0500985 if (skia_use_lua) {
986 test_lib("lua") {
987 public_include_dirs = []
988 sources = [
989 "src/utils/SkLua.cpp",
990 "src/utils/SkLuaCanvas.cpp",
991 ]
992 deps = [
993 "//third_party/lua",
994 ]
995 }
996
997 executable("lua_app") {
998 sources = [
999 "tools/lua/lua_app.cpp",
1000 ]
1001 deps = [
1002 ":lua",
1003 ":skia",
1004 "//third_party/lua",
1005 ]
1006 testonly = true
1007 }
1008
1009 executable("lua_pictures") {
1010 sources = [
1011 "tools/lua/lua_pictures.cpp",
1012 ]
1013 deps = [
1014 ":flags",
1015 ":lua",
1016 ":skia",
1017 ":tool_utils",
1018 "//third_party/lua",
1019 ]
1020 testonly = true
1021 }
1022 }
1023
Mike Klein6e744122016-10-27 12:21:40 -04001024 import("gn/samples.gni")
Brian Osman16adfa32016-10-18 14:42:44 -04001025 test_lib("samples") {
Brian Osman16adfa32016-10-18 14:42:44 -04001026 public_include_dirs = [ "samplecode" ]
Mike Klein6e744122016-10-27 12:21:40 -04001027 include_dirs = [ "experimental" ]
1028 sources = samples_sources + [
1029 "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp",
1030 "experimental/SkSetPoly3To3.cpp",
1031 "experimental/SkSetPoly3To3_A.cpp",
1032 "experimental/SkSetPoly3To3_D.cpp",
1033 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001034 deps = [
1035 ":experimental_svg_model",
Mike Klein6e744122016-10-27 12:21:40 -04001036 ":gm",
Brian Osman16adfa32016-10-18 14:42:44 -04001037 ":tool_utils",
1038 ":views",
1039 ":xml",
1040 ]
Mike Klein38af9432016-11-11 11:39:44 -05001041
1042 if (skia_use_lua) {
1043 sources += [ "samplecode/SampleLua.cpp" ]
1044 deps += [
1045 ":lua",
1046 "//third_party/lua",
1047 ]
1048 }
Brian Osman16adfa32016-10-18 14:42:44 -04001049 }
1050
mtklein2b6870c2016-07-28 14:17:33 -07001051 executable("dm") {
1052 sources = [
1053 "dm/DM.cpp",
1054 "dm/DMJsonWriter.cpp",
1055 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -07001056 ]
1057 include_dirs = [ "tests" ]
1058 deps = [
mtklein046cb562016-09-16 10:23:12 -07001059 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -07001060 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001061 ":flags",
1062 ":gm",
1063 ":gpu_tool_utils",
1064 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -07001065 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -07001066 ":tool_utils",
1067 "//third_party/jsoncpp",
1068 "//third_party/libpng",
1069 ]
1070 testonly = true
1071 }
1072
Mike Kleina3430172016-09-27 16:46:29 -04001073 if (!is_debug) { # I've benchmarked debug code once too many times...
1074 executable("monobench") {
1075 sources = [
1076 "tools/monobench.cpp",
1077 ]
1078 deps = [
1079 ":bench",
1080 ":skia",
1081 ]
1082 testonly = true
1083 }
mtklein2b6870c2016-07-28 14:17:33 -07001084 }
1085
1086 executable("nanobench") {
1087 sources = [
1088 "bench/nanobench.cpp",
1089 ]
1090 deps = [
1091 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001092 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001093 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001094 ":flags",
1095 ":gm",
1096 ":gpu_tool_utils",
1097 ":skia",
1098 ":tool_utils",
1099 "//third_party/jsoncpp",
1100 ]
1101 testonly = true
1102 }
halcanary19a97202016-08-03 15:08:04 -07001103
Jim Van Verth57a98fc2016-10-28 13:35:50 -04001104 if (is_linux || is_win || is_mac) {
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001105 executable("SampleApp") {
mtklein38925aa2016-09-21 10:11:25 -07001106 sources = [
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001107 "samplecode/SampleApp.cpp",
1108 "samplecode/SamplePictFile.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001109 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001110 if (is_mac) {
1111 sources += [ "src/views/mac/skia_mac.mm" ]
1112 } else if (is_win) {
1113 sources += [ "src/views/win/skia_win.cpp" ]
1114 } else if (is_linux) {
1115 sources += [ "src/views/unix/skia_unix.cpp" ]
1116 }
mtklein38925aa2016-09-21 10:11:25 -07001117 deps = [
1118 ":flags",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001119 ":gm",
mtklein38925aa2016-09-21 10:11:25 -07001120 ":gpu_tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001121 ":samples",
mtklein38925aa2016-09-21 10:11:25 -07001122 ":skia",
1123 ":tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001124 ":views",
mtklein38925aa2016-09-21 10:11:25 -07001125 ]
Mike Kleinc168a3a2016-11-14 14:53:13 +00001126 if (skia_use_angle) {
1127 deps += [ "//third_party/angle2" ]
1128 }
mtklein38925aa2016-09-21 10:11:25 -07001129 testonly = true
1130 }
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001131 }
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001132
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001133 if (skia_enable_gpu) {
1134 executable("skpbench") {
1135 sources = [
1136 "tools/skpbench/skpbench.cpp",
1137 ]
1138 deps = [
1139 ":flags",
1140 ":gpu_tool_utils",
1141 ":skia",
1142 ":tool_utils",
1143 ]
1144 testonly = true
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001145 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001146 }
1147
Mike Klein7d302882016-11-03 14:06:31 -04001148 # We can't yet build ICU on iOS or Windows.
1149 if (!is_ios && !is_win) {
halcanary3eee9d92016-09-10 07:01:53 -07001150 executable("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001151 sources = [
1152 "tools/SkShaper_harfbuzz.cpp",
1153 "tools/using_skia_and_harfbuzz.cpp",
1154 ]
1155 deps = [
1156 ":skia",
1157 "//third_party/harfbuzz",
1158 ]
1159 testonly = true
1160 }
halcanary19a97202016-08-03 15:08:04 -07001161 }
halcanary3eee9d92016-09-10 07:01:53 -07001162 executable("sktexttopdf") {
1163 sources = [
1164 "tools/SkShaper_primitive.cpp",
1165 "tools/using_skia_and_harfbuzz.cpp",
1166 ]
1167 deps = [
1168 ":skia",
1169 ]
1170 testonly = true
1171 }
mtklein046cb562016-09-16 10:23:12 -07001172
1173 executable("get_images_from_skps") {
1174 sources = [
1175 "tools/get_images_from_skps.cpp",
1176 ]
1177 deps = [
1178 ":flags",
1179 ":skia",
1180 "//third_party/jsoncpp",
1181 ]
1182 testonly = true
1183 }
mtkleinecbc5262016-09-22 11:51:24 -07001184
Matt Sarett8740d582016-11-11 13:59:14 -05001185 executable("colorspaceinfo") {
1186 sources = [
1187 "tools/colorspaceinfo.cpp",
1188 ]
1189 deps = [
1190 ":flags",
1191 ":skia",
1192 ":tool_utils",
1193 ]
1194 testonly = true
1195 }
1196
Mike Klein7d302882016-11-03 14:06:31 -04001197 if (!is_ios) {
1198 executable("skiaserve") {
1199 sources = [
1200 "tools/skiaserve/Request.cpp",
1201 "tools/skiaserve/Response.cpp",
1202 "tools/skiaserve/skiaserve.cpp",
1203 "tools/skiaserve/urlhandlers/BatchBoundsHandler.cpp",
1204 "tools/skiaserve/urlhandlers/BatchesHandler.cpp",
1205 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1206 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1207 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1208 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1209 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1210 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1211 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1212 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1213 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
1214 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1215 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1216 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1217 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1218 ]
1219 deps = [
1220 ":flags",
1221 ":gpu_tool_utils",
1222 ":skia",
1223 ":tool_utils",
1224 "//third_party/jsoncpp",
1225 "//third_party/libmicrohttpd",
1226 "//third_party/libpng",
1227 ]
1228 testonly = true
1229 }
mtkleinecbc5262016-09-22 11:51:24 -07001230 }
kjlubick14f984b2016-10-03 11:49:45 -07001231
1232 executable("fuzz") {
1233 sources = [
1234 "fuzz/FilterFuzz.cpp",
Kevin Lubickfec1dea2016-11-22 13:57:18 -05001235 "fuzz/FuzzDrawFunctions.cpp",
kjlubick14f984b2016-10-03 11:49:45 -07001236 "fuzz/FuzzGradients.cpp",
1237 "fuzz/FuzzParsePath.cpp",
1238 "fuzz/FuzzPathop.cpp",
1239 "fuzz/FuzzScaleToSides.cpp",
1240 "fuzz/fuzz.cpp",
1241 ]
1242 deps = [
1243 ":flags",
1244 ":skia",
Hal Canarydb683012016-11-23 08:55:18 -07001245 ":tool_utils",
kjlubick14f984b2016-10-03 11:49:45 -07001246 ]
1247 testonly = true
1248 }
Mike Klein38312422016-10-05 15:41:01 -04001249
caryclark9feb6322016-10-25 08:58:26 -07001250 executable("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001251 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001252 rebase_path("tests/skia_test.cpp"),
1253 rebase_path("tests/Test.cpp"),
1254 ]
caryclark9feb6322016-10-25 08:58:26 -07001255 deps = [
1256 ":flags",
1257 ":gpu_tool_utils",
1258 ":skia",
1259 ":tool_utils",
1260 ]
1261 testonly = true
1262 }
1263
Mike Klein38312422016-10-05 15:41:01 -04001264 executable("dump_record") {
1265 sources = [
1266 "tools/DumpRecord.cpp",
1267 "tools/dump_record.cpp",
1268 ]
1269 deps = [
1270 ":flags",
1271 ":skia",
1272 ]
1273 testonly = true
1274 }
bungemanfe917272016-10-13 17:36:40 -04001275
1276 executable("skdiff") {
1277 sources = [
1278 "tools/skdiff/skdiff.cpp",
1279 "tools/skdiff/skdiff_html.cpp",
1280 "tools/skdiff/skdiff_main.cpp",
1281 "tools/skdiff/skdiff_utils.cpp",
1282 ]
1283 deps = [
1284 ":skia",
1285 ":tool_utils",
1286 ]
1287 testonly = true
1288 }
halcanarya73d76a2016-10-17 13:19:02 -07001289
1290 executable("skp_parser") {
1291 sources = [
1292 "tools/skp_parser.cpp",
1293 ]
1294 deps = [
1295 ":skia",
1296 ":tool_utils",
1297 "//third_party/jsoncpp",
1298 ]
1299 testonly = true
1300 }
Brian Osman16adfa32016-10-18 14:42:44 -04001301
Mike Klein43c25262016-10-20 10:17:47 -04001302 if (skia_enable_gpu && (is_linux || is_win || is_mac)) {
Brian Osman16adfa32016-10-18 14:42:44 -04001303 executable("viewer") {
1304 sources = [
1305 "tools/viewer/GMSlide.cpp",
1306 "tools/viewer/ImageSlide.cpp",
1307 "tools/viewer/SKPSlide.cpp",
1308 "tools/viewer/SampleSlide.cpp",
1309 "tools/viewer/Viewer.cpp",
1310 "tools/viewer/sk_app/CommandSet.cpp",
1311 "tools/viewer/sk_app/GLWindowContext.cpp",
1312 "tools/viewer/sk_app/Window.cpp",
1313 "tools/viewer/sk_app/WindowContext.cpp",
1314 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001315 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001316
Jim Van Verth4e56a912016-10-21 10:58:52 -04001317 if (is_android) {
1318 sources += [
1319 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1320 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1321 "tools/viewer/sk_app/android/Window_android.cpp",
1322 "tools/viewer/sk_app/android/main_android.cpp",
1323 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1324 ]
1325 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001326 sources += [
1327 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1328 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1329 "tools/viewer/sk_app/unix/Window_unix.cpp",
1330 "tools/viewer/sk_app/unix/main_unix.cpp",
1331 ]
1332 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001333 sources += [
1334 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1335 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1336 "tools/viewer/sk_app/win/Window_win.cpp",
1337 "tools/viewer/sk_app/win/main_win.cpp",
1338 ]
Mike Klein43c25262016-10-20 10:17:47 -04001339 } else if (is_mac) {
1340 sources += [
1341 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1342 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1343 "tools/viewer/sk_app/mac/Window_mac.cpp",
1344 "tools/viewer/sk_app/mac/main_mac.cpp",
1345 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001346 }
1347
1348 if (skia_use_vulkan) {
1349 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001350 if (is_android) {
1351 sources +=
1352 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
1353 libs += [ "android" ]
1354 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001355 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1356 libs += [ "X11-xcb" ]
1357 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001358 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1359 }
1360 }
1361
1362 include_dirs = []
1363 deps = [
1364 ":flags",
1365 ":gm",
1366 ":gpu_tool_utils",
1367 ":samples",
1368 ":skia",
1369 ":tool_utils",
1370 ":views",
1371 "//third_party/jsoncpp",
1372 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001373 if (is_android) {
1374 deps += [ "//third_party/native_app_glue" ]
1375 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001376 deps += [ "//third_party/libsdl" ]
1377 }
Brian Osman16adfa32016-10-18 14:42:44 -04001378 testonly = true
1379 }
1380 }
Ethan Nicholas4f3985c2016-11-14 11:16:37 -05001381
1382 if (skia_enable_gpu) {
1383 executable("skslc") {
1384 sources = [
1385 "src/sksl/SkSLMain.cpp",
1386 ]
1387 deps = [
1388 ":flags",
1389 ":skia",
1390 ]
1391 testonly = true
1392 }
1393 }
mtklein25c81d42016-07-27 13:55:26 -07001394}