blob: 64e69e73e5fe1e984c59229bea0e15414e3f0581 [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() {
mtklein63213812016-08-24 09:55:56 -070014 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070015 skia_use_fontconfig = is_linux
mtkleincdedd0e2016-09-12 15:15:44 -070016 skia_use_freetype = is_android || is_fuchsia || is_linux
Mike Klein69f6ed42016-10-13 15:45:07 -040017 skia_use_gdi = false
Mike Klein7d302882016-11-03 14:06:31 -040018 skia_use_icu = !is_fuchsia && !is_ios && !is_win # TODO: Windows
mtklein63213812016-08-24 09:55:56 -070019 skia_use_libjpeg_turbo = true
20 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070021 skia_use_libwebp = !is_fuchsia
Mike Klein38af9432016-11-11 11:39:44 -050022 skia_use_lua = false
mtkleina627b5c2016-09-20 13:36:47 -070023 skia_use_mesa = false
Mike Klein10d665d2016-11-01 11:46:10 -040024 skia_use_piex = !is_win
mtklein63213812016-08-24 09:55:56 -070025 skia_use_zlib = true
mtklein1bd72ba2016-09-16 07:45:52 -070026
27 skia_enable_android_framework_defines = false
mtklein06c35c02016-09-20 12:28:12 -070028 skia_enable_gpu = true
mtklein3e8012e2016-09-21 09:14:19 -070029 skia_enable_tools = is_skia_standalone
30 skia_enable_vulkan_debug_layers = is_skia_standalone && is_debug
Greg Daniel686bb212016-10-27 10:48:48 -040031 skia_vulkan_sdk = getenv("VULKAN_SDK")
mtkleinc04ff472016-06-23 10:29:30 -070032}
Brian Salomon23d73ea2016-10-27 13:31:37 -040033declare_args() {
James Robinson14b748d2016-11-12 18:29:39 -080034 skia_use_dng_sdk =
35 !is_fuchsia && !is_win && skia_use_libjpeg_turbo && skia_use_zlib
Mike Klein10d665d2016-11-01 11:46:10 -040036 skia_use_sfntly = skia_use_icu
37
Mike Klein4d598a32016-10-31 13:44:49 -040038 if (is_android) {
39 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
40 } else {
41 skia_use_vulkan = skia_vulkan_sdk != ""
42 }
Brian Salomon23d73ea2016-10-27 13:31:37 -040043}
Brian Salomon789e25e2016-09-30 13:41:03 -040044
mtklein38925aa2016-09-21 10:11:25 -070045# Our tools require static linking (they use non-exported symbols).
46skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070047
mtkleina45be612016-08-29 15:22:10 -070048fontmgr_android_enabled = skia_use_expat && skia_use_freetype
49
mtklein1211e0c2016-07-26 13:55:45 -070050skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070051 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070052 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070053 "include/codec",
54 "include/config",
55 "include/core",
56 "include/effects",
57 "include/gpu",
58 "include/gpu/gl",
59 "include/images",
60 "include/pathops",
61 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070062 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -070063 "include/utils",
64 "include/utils/mac",
mtklein25c81d42016-07-27 13:55:26 -070065 "include/xml",
mtklein1211e0c2016-07-26 13:55:45 -070066]
67
mtkleinc04ff472016-06-23 10:29:30 -070068# Skia public API, generally provided by :skia.
69config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -070070 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -040071 defines = []
72 if (is_component_build) {
73 defines += [ "SKIA_DLL" ]
74 }
Mike Kleinc4cbd742016-09-26 21:37:09 -040075 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -070076 defines += [ "SK_SAMPLES_FOR_X" ]
77 }
mtkleincae1be52016-09-20 08:24:34 -070078 if (skia_enable_android_framework_defines) {
Mike Kleincfc4f442016-10-26 17:19:03 -040079 defines += android_framework_defines
mtkleincae1be52016-09-20 08:24:34 -070080 }
mtklein06c35c02016-09-20 12:28:12 -070081 if (!skia_enable_gpu) {
82 defines += [ "SK_SUPPORT_GPU=0" ]
83 }
mtkleinc04ff472016-06-23 10:29:30 -070084}
85
86# Skia internal APIs, used by Skia itself and a few test tools.
87config("skia_private") {
88 visibility = [ ":*" ]
89
90 include_dirs = [
91 "include/private",
92 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -070093 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -070094 "src/config",
95 "src/core",
96 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -070097 "src/effects/gradients",
98 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -070099 "src/gpu",
100 "src/image",
101 "src/images",
102 "src/lazy",
103 "src/opts",
104 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -0700105 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -0700106 "src/ports",
107 "src/sfnt",
mtklein9e0d9dd2016-08-30 10:37:19 -0700108 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700109 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700110 "src/utils/win",
mtkleinc04ff472016-06-23 10:29:30 -0700111 "third_party/etc1",
scroggo19b91532016-10-24 09:03:26 -0700112 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700113 "third_party/ktx",
114 ]
mtklein150d1132016-08-01 06:56:40 -0700115
Jim Van Verthb6c5e532016-10-28 10:38:08 -0400116 defines = [
117 "SK_GAMMA_APPLY_TO_A8",
118 "SK_INTERNAL",
119 ]
mtkleinb37c0342016-09-09 11:07:45 -0700120 if (is_android) {
121 defines += [
122 "SK_GAMMA_EXPONENT=1.4",
123 "SK_GAMMA_CONTRAST=0.0",
124 ]
125 }
mtklein88a7ac02016-09-14 11:16:49 -0700126 if (is_official_build || is_android) {
127 # TODO(bsalomon): it'd be nice to make Android normal.
128 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
129 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400130 libs = []
131 lib_dirs = []
132 if (skia_use_vulkan) {
Greg Danielab563d42016-10-31 11:19:59 -0400133 if (skia_vulkan_sdk != "" && !is_android) {
Mike Klein487bfc22016-10-14 14:04:56 -0400134 if (is_win) {
135 include_dirs += [ "$skia_vulkan_sdk/Include/" ]
136 lib_dirs += [ "$skia_vulkan_sdk/Bin" ]
137 } else {
Greg Daniel686bb212016-10-27 10:48:48 -0400138 include_dirs += [ "$skia_vulkan_sdk/include/" ]
139 lib_dirs += [ "$skia_vulkan_sdk/lib/" ]
Mike Klein487bfc22016-10-14 14:04:56 -0400140 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400141 }
Mike Klein487bfc22016-10-14 14:04:56 -0400142 if (is_win) {
143 libs += [ "vulkan-1.lib" ]
144 } else {
145 libs += [ "vulkan" ]
146 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400147 }
mtkleinc04ff472016-06-23 10:29:30 -0700148}
149
150# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
151config("skia_library") {
152 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700153 defines = [ "SKIA_IMPLEMENTATION=1" ]
154}
155
156skia_library_configs = [
157 ":skia_public",
158 ":skia_private",
159 ":skia_library",
160]
161
mtklein9b8583d2016-08-24 17:32:30 -0700162# Use for CPU-specific Skia code that needs particular compiler flags.
163template("opts") {
164 if (invoker.enabled) {
165 source_set(target_name) {
166 forward_variables_from(invoker, "*")
167 configs += skia_library_configs
168 }
169 } else {
170 # If not enabled, a phony empty target that swallows all otherwise unused variables.
171 source_set(target_name) {
172 forward_variables_from(invoker,
173 "*",
174 [
175 "sources",
176 "cflags",
177 ])
178 }
179 }
anmittala7eaf2e2016-08-17 13:57:26 -0700180}
181
mtklein422310d2016-08-16 18:28:43 -0700182is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700183
mtklein7d6fb2c2016-08-25 14:50:44 -0700184opts("none") {
185 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700186 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700187 cflags = []
188}
189
mtklein7d6fb2c2016-08-25 14:50:44 -0700190opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700191 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700192 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700193 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700194}
195
196opts("arm64") {
197 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700198 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700199 cflags = []
200}
201
202opts("crc32") {
203 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700204 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700205 cflags = [ "-march=armv8-a+crc" ]
206}
207
mtklein9b8583d2016-08-24 17:32:30 -0700208opts("sse2") {
209 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700210 sources = skia_opts.sse2_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400211 if (is_win) {
212 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
213 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400214 cflags = [ "-msse2" ]
215 }
mtklein9b8583d2016-08-24 17:32:30 -0700216}
mtkleinc04ff472016-06-23 10:29:30 -0700217
mtklein9b8583d2016-08-24 17:32:30 -0700218opts("ssse3") {
219 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700220 sources = skia_opts.ssse3_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400221 if (is_win) {
222 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
223 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400224 cflags = [ "-mssse3" ]
225 }
mtklein9b8583d2016-08-24 17:32:30 -0700226}
mtkleinc04ff472016-06-23 10:29:30 -0700227
mtklein9b8583d2016-08-24 17:32:30 -0700228opts("sse41") {
229 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700230 sources = skia_opts.sse41_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400231 if (is_win) {
232 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
233 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400234 cflags = [ "-msse4.1" ]
235 }
mtklein9b8583d2016-08-24 17:32:30 -0700236}
mtklein4e976072016-08-08 09:06:27 -0700237
mtklein9b8583d2016-08-24 17:32:30 -0700238opts("sse42") {
239 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700240 sources = skia_opts.sse42_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400241 if (is_win) {
242 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
243 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400244 cflags = [ "-msse4.2" ]
245 }
mtklein9b8583d2016-08-24 17:32:30 -0700246}
247
248opts("avx") {
249 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700250 sources = skia_opts.avx_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400251 if (is_win) {
252 cflags = [ "/arch:AVX" ]
253 } else {
254 cflags = [ "-mavx" ]
255 }
mtkleinc04ff472016-06-23 10:29:30 -0700256}
257
Mike Klein78d5a3b2016-09-30 10:48:01 -0400258opts("hsw") {
259 enabled = is_x86
260 sources = skia_opts.hsw_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400261 if (is_win) {
262 cflags = [ "/arch:AVX2" ]
263 } else {
264 cflags = [
265 "-mavx2",
266 "-mbmi",
267 "-mbmi2",
268 "-mf16c",
269 "-mfma",
270 ]
271 }
Mike Klein78d5a3b2016-09-30 10:48:01 -0400272}
273
mtklein349cece2016-08-26 08:13:04 -0700274opts("dsp") {
275 enabled = current_cpu == "mipsel"
brettwb9447282016-09-01 14:24:39 -0700276 sources = skia_opts.mips_dsp_sources
mtkleinb6064ef2016-08-30 11:49:24 -0700277 cflags = []
mtklein349cece2016-08-26 08:13:04 -0700278}
279
mtkleinc095df52016-08-24 12:23:52 -0700280# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700281template("optional") {
282 if (invoker.enabled) {
283 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700284 if (defined(invoker.public_defines)) {
285 defines = invoker.public_defines
286 }
mtklein457b42a2016-08-23 13:56:37 -0700287 }
288 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700289 forward_variables_from(invoker,
290 "*",
291 [
292 "public_defines",
293 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700294 "configs_to_remove",
mtkleincd01b032016-08-31 04:58:19 -0700295 ])
mtklein457b42a2016-08-23 13:56:37 -0700296 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700297 configs += skia_library_configs
scroggof84ad642016-10-31 09:02:57 -0700298 if (defined(invoker.configs_to_remove)) {
299 configs -= invoker.configs_to_remove
300 }
mtklein457b42a2016-08-23 13:56:37 -0700301 }
302 } else {
mtklein457b42a2016-08-23 13:56:37 -0700303 source_set(target_name) {
304 forward_variables_from(invoker,
305 "*",
306 [
307 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700308 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700309 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700310 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700311 "sources_when_disabled",
scroggof84ad642016-10-31 09:02:57 -0700312 "configs_to_remove",
mtklein457b42a2016-08-23 13:56:37 -0700313 ])
mtkleincd01b032016-08-31 04:58:19 -0700314 if (defined(invoker.sources_when_disabled)) {
315 sources = invoker.sources_when_disabled
316 }
317 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700318 }
mtkleineb3c4252016-08-23 07:38:09 -0700319 }
mtklein457b42a2016-08-23 13:56:37 -0700320}
mtklein457b42a2016-08-23 13:56:37 -0700321
mtkleina45be612016-08-29 15:22:10 -0700322optional("fontmgr_android") {
323 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700324
325 deps = [
326 "//third_party/expat",
327 "//third_party/freetype2",
328 ]
329 sources = [
330 "src/ports/SkFontMgr_android.cpp",
331 "src/ports/SkFontMgr_android_factory.cpp",
332 "src/ports/SkFontMgr_android_parser.cpp",
333 ]
334}
335
mtkleind2e39db2016-09-07 07:52:55 -0700336optional("fontmgr_custom") {
337 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
338
339 deps = [
340 "//third_party/freetype2",
341 ]
342 sources = [
343 "src/ports/SkFontMgr_custom.cpp",
344 "src/ports/SkFontMgr_custom_directory_factory.cpp",
345 ]
346}
347
mtklein3cc22182016-08-29 13:26:14 -0700348optional("fontmgr_fontconfig") {
349 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700350
351 deps = [
352 "//third_party:fontconfig",
353 "//third_party/freetype2",
354 ]
355 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700356 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700357 "src/ports/SkFontConfigInterface_direct.cpp",
358 "src/ports/SkFontConfigInterface_direct_factory.cpp",
359 "src/ports/SkFontMgr_FontConfigInterface.cpp",
360 "src/ports/SkFontMgr_fontconfig.cpp",
361 "src/ports/SkFontMgr_fontconfig_factory.cpp",
362 ]
363}
364
mtkleincdedd0e2016-09-12 15:15:44 -0700365optional("fontmgr_fuchsia") {
366 enabled = is_fuchsia && skia_use_freetype
367
368 deps = [
369 "//third_party/freetype2",
370 ]
371 sources = [
372 "src/ports/SkFontMgr_custom.cpp",
373 "src/ports/SkFontMgr_custom_empty_factory.cpp",
374 ]
375}
376
mtklein06c35c02016-09-20 12:28:12 -0700377optional("gpu") {
378 enabled = skia_enable_gpu
mtkleine9fb3d52016-09-20 15:11:46 -0700379 public_defines = []
380
mtklein06c35c02016-09-20 12:28:12 -0700381 sources = skia_gpu_sources + [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ]
382
383 # These paths need to be absolute to match the ones produced by shared_sources.gni.
384 sources -= get_path_info([
385 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
386 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
387 ],
388 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400389 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700390 if (is_android) {
391 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
392 } else if (is_linux) {
393 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
394 } else if (is_mac) {
395 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400396 } else if (is_win) {
397 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
398 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700399 } else {
400 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
401 }
mtkleine9fb3d52016-09-20 15:11:46 -0700402
403 if (skia_use_vulkan) {
404 public_defines += [ "SK_VULKAN" ]
405 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700406 if (skia_enable_vulkan_debug_layers) {
407 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
408 }
mtkleine9fb3d52016-09-20 15:11:46 -0700409 }
mtklein06c35c02016-09-20 12:28:12 -0700410}
411
mtklein63213812016-08-24 09:55:56 -0700412optional("jpeg") {
413 enabled = skia_use_libjpeg_turbo
414 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
415
mtklein63213812016-08-24 09:55:56 -0700416 deps = [
417 "//third_party/libjpeg-turbo:libjpeg",
418 ]
419 sources = [
420 "src/codec/SkJpegCodec.cpp",
421 "src/codec/SkJpegDecoderMgr.cpp",
422 "src/codec/SkJpegUtility.cpp",
423 "src/images/SkJPEGImageEncoder.cpp",
424 "src/images/SkJPEGWriteUtility.cpp",
425 ]
426}
427
428optional("pdf") {
429 enabled = skia_use_zlib
mtklein63213812016-08-24 09:55:56 -0700430
mtklein63213812016-08-24 09:55:56 -0700431 deps = [
432 "//third_party/zlib",
433 ]
brettwb9447282016-09-01 14:24:39 -0700434 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700435 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700436
437 if (skia_use_sfntly) {
438 deps += [ "//third_party/sfntly" ]
mtkleincd01b032016-08-31 04:58:19 -0700439 public_defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700440 }
441}
442
443optional("png") {
444 enabled = skia_use_libpng
445 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
446
mtklein63213812016-08-24 09:55:56 -0700447 deps = [
448 "//third_party/libpng",
449 ]
450 sources = [
451 "src/codec/SkIcoCodec.cpp",
452 "src/codec/SkPngCodec.cpp",
453 "src/images/SkPNGImageEncoder.cpp",
454 ]
455}
456
scroggof84ad642016-10-31 09:02:57 -0700457optional("raw") {
Mike Klein10d665d2016-11-01 11:46:10 -0400458 enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo && skia_use_piex
scroggof84ad642016-10-31 09:02:57 -0700459 public_defines = [ "SK_CODEC_DECODES_RAW" ]
460
461 deps = [
462 "//third_party/dng_sdk",
463 "//third_party/libjpeg-turbo:libjpeg",
464 "//third_party/piex",
465 ]
466
467 # SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
468 # Skia.
469 configs_to_remove = [ "//gn:no_exceptions" ]
470
471 sources = [
472 "src/codec/SkRawAdapterCodec.cpp",
473 "src/codec/SkRawCodec.cpp",
474 ]
475}
476
mtklein3cc22182016-08-29 13:26:14 -0700477optional("typeface_freetype") {
478 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700479
480 deps = [
481 "//third_party/freetype2",
482 ]
483 sources = [
484 "src/ports/SkFontHost_FreeType.cpp",
485 "src/ports/SkFontHost_FreeType_common.cpp",
486 ]
487}
488
mtklein457b42a2016-08-23 13:56:37 -0700489optional("webp") {
490 enabled = skia_use_libwebp
491 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
492
mtklein457b42a2016-08-23 13:56:37 -0700493 deps = [
494 "//third_party/libwebp",
495 ]
496 sources = [
497 "src/codec/SkWebpAdapterCodec.cpp",
498 "src/codec/SkWebpCodec.cpp",
499 "src/images/SkWEBPImageEncoder.cpp",
500 ]
mtkleineb3c4252016-08-23 07:38:09 -0700501}
502
mtklein63213812016-08-24 09:55:56 -0700503optional("xml") {
504 enabled = skia_use_expat
Florin Malita442fff92016-11-08 16:07:52 +0000505 public_defines = [ "SK_XML" ]
mtklein63213812016-08-24 09:55:56 -0700506
mtklein63213812016-08-24 09:55:56 -0700507 deps = [
508 "//third_party/expat",
509 ]
510 sources = [
511 "src/xml/SkDOM.cpp",
512 "src/xml/SkXMLParser.cpp",
513 "src/xml/SkXMLWriter.cpp",
514 ]
515}
516
mtkleinc04ff472016-06-23 10:29:30 -0700517component("skia") {
518 public_configs = [ ":skia_public" ]
519 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700520
521 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700522 ":arm64",
523 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700524 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700525 ":crc32",
mtklein349cece2016-08-26 08:13:04 -0700526 ":dsp",
mtkleina45be612016-08-29 15:22:10 -0700527 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700528 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700529 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700530 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700531 ":gpu",
Mike Klein78d5a3b2016-09-30 10:48:01 -0400532 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700533 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700534 ":none",
mtklein63213812016-08-24 09:55:56 -0700535 ":pdf",
536 ":png",
scroggof84ad642016-10-31 09:02:57 -0700537 ":raw",
mtklein9b8583d2016-08-24 17:32:30 -0700538 ":sse2",
539 ":sse41",
540 ":sse42",
541 ":ssse3",
mtklein3cc22182016-08-29 13:26:14 -0700542 ":typeface_freetype",
mtkleineb3c4252016-08-23 07:38:09 -0700543 ":webp",
mtklein63213812016-08-24 09:55:56 -0700544 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700545 ]
546
mtkleinc04ff472016-06-23 10:29:30 -0700547 sources = []
brettwb9447282016-09-01 14:24:39 -0700548 sources += skia_core_sources
549 sources += skia_effects_sources
brettwb9447282016-09-01 14:24:39 -0700550 sources += skia_sksl_sources
551 sources += skia_utils_sources
mtkleinc04ff472016-06-23 10:29:30 -0700552 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700553 "src/android/SkBitmapRegionCodec.cpp",
554 "src/android/SkBitmapRegionDecoder.cpp",
555 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700556 "src/codec/SkBmpCodec.cpp",
557 "src/codec/SkBmpMaskCodec.cpp",
558 "src/codec/SkBmpRLECodec.cpp",
559 "src/codec/SkBmpStandardCodec.cpp",
560 "src/codec/SkCodec.cpp",
561 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700562 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700563 "src/codec/SkMaskSwizzler.cpp",
564 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700565 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700566 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700567 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700568 "src/codec/SkSwizzler.cpp",
569 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700570 "src/images/SkImageEncoder.cpp",
571 "src/images/SkImageEncoder_Factory.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700572 "src/images/SkKTXImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700573 "src/ports/SkDiscardableMemory_none.cpp",
574 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700575 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700576 "src/ports/SkMemory_malloc.cpp",
577 "src/ports/SkOSFile_stdio.cpp",
578 "src/sfnt/SkOTTable_name.cpp",
579 "src/sfnt/SkOTUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700580 "src/svg/SkSVGCanvas.cpp",
581 "src/svg/SkSVGDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700582 "src/utils/mac/SkStream_mac.cpp",
583 "third_party/etc1/etc1.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700584 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700585 "third_party/ktx/ktx.cpp",
586 ]
brettwb9447282016-09-01 14:24:39 -0700587
mtklein7d6fb2c2016-08-25 14:50:44 -0700588 libs = []
589
mtkleinc04ff472016-06-23 10:29:30 -0700590 if (is_win) {
591 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400592 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700593 "src/ports/SkDebug_win.cpp",
594 "src/ports/SkFontHost_win.cpp",
595 "src/ports/SkFontMgr_win_dw.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700596 "src/ports/SkImageEncoder_WIC.cpp",
597 "src/ports/SkImageGeneratorWIC.cpp",
598 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700599 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700600 "src/ports/SkScalerContext_win_dw.cpp",
601 "src/ports/SkTLS_win.cpp",
602 "src/ports/SkTypeface_win_dw.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700603 "src/xps/SkDocument_XPS.cpp",
Mike Klein4b167fc2016-10-11 18:13:53 -0400604 "src/xps/SkXPSDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700605 ]
Mike Klein69f6ed42016-10-13 15:45:07 -0400606 if (skia_use_gdi) {
607 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
608 libs += [
609 "Gdi32.lib",
610 "Usp10.lib",
611 ]
612 } else {
613 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
614 }
mtkleinb9be9792016-09-16 14:44:18 -0700615 sources -=
616 [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400617 libs += [
618 "FontSub.lib",
619 "Ole32.lib",
620 "OleAut32.lib",
621 "User32.lib",
622 ]
mtkleinc04ff472016-06-23 10:29:30 -0700623 } else {
624 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700625 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700626 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700627 "src/ports/SkTLS_pthread.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700628 "src/xps/SkDocument_XPS_None.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700629 ]
630 }
631
mtklein7d6fb2c2016-08-25 14:50:44 -0700632 if (is_android) {
633 deps += [
634 "//third_party/cpu-features",
635 "//third_party/expat",
mtklein7d6fb2c2016-08-25 14:50:44 -0700636 ]
mtklein06c35c02016-09-20 12:28:12 -0700637 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700638 libs += [
639 "EGL",
640 "GLESv2",
641 "log",
642 ]
643 }
644
mtkleinc04ff472016-06-23 10:29:30 -0700645 if (is_linux) {
mtklein09e61f72016-08-23 13:35:28 -0700646 libs += [
647 "GL",
648 "GLU",
649 "X11",
650 ]
mtklein06c35c02016-09-20 12:28:12 -0700651 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700652 }
653
654 if (is_mac) {
655 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700656 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700657 "src/ports/SkFontHost_mac.cpp",
658 "src/ports/SkImageEncoder_CG.cpp",
659 "src/ports/SkImageGeneratorCG.cpp",
660 ]
mtklein09e61f72016-08-23 13:35:28 -0700661 libs += [
662 "ApplicationServices.framework",
663 "OpenGL.framework",
664 ]
mtkleinc04ff472016-06-23 10:29:30 -0700665 }
abarth6fc8ff02016-07-15 15:15:15 -0700666
Mike Klein7d302882016-11-03 14:06:31 -0400667 if (is_ios) {
668 sources += [
669 "src/ports/SkDebug_stdio.cpp",
670 "src/ports/SkFontHost_mac.cpp",
671 "src/ports/SkImageEncoder_CG.cpp",
672 "src/ports/SkImageGeneratorCG.cpp",
673 ]
674 libs += [
675 "CoreFoundation.framework",
676 "CoreGraphics.framework",
677 "CoreText.framework",
678 "ImageIO.framework",
679 "MobileCoreServices.framework",
680 ]
681 }
682
abarth6fc8ff02016-07-15 15:15:15 -0700683 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700684 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700685 }
mtkleinc04ff472016-06-23 10:29:30 -0700686}
687
mtklein1211e0c2016-07-26 13:55:45 -0700688action("skia.h") {
Mike Klein89eda8a2016-11-02 09:14:55 -0400689 skia_h = "$target_gen_dir/skia.h"
690 script = "gn/find_headers.py"
691 args = [ rebase_path(skia_h, root_build_dir) ] +
692 rebase_path(skia_public_includes)
693 depfile = "$skia_h.deps"
mtklein1211e0c2016-07-26 13:55:45 -0700694 outputs = [
Mike Klein89eda8a2016-11-02 09:14:55 -0400695 skia_h,
mtklein1211e0c2016-07-26 13:55:45 -0700696 ]
697}
698
mtklein06c35c02016-09-20 12:28:12 -0700699if (skia_enable_gpu && target_cpu == "x64") {
mtklein1fbdf982016-09-15 12:07:48 -0700700 # Our bots only have 64-bit libOSMesa installed.
701 # TODO: worth fixing?
702 executable("fiddle") {
703 include_dirs = [ "$target_gen_dir" ]
704 libs = []
705 if (is_linux) {
706 libs += [ "OSMesa" ]
707 }
mtklein56d56692016-09-15 11:18:55 -0700708
mtklein1fbdf982016-09-15 12:07:48 -0700709 sources = [
710 "src/images/SkForceLinking.cpp",
711 "tools/fiddle/draw.cpp",
712 "tools/fiddle/fiddle_main.cpp",
713 ]
714 deps = [
715 ":skia",
716 ":skia.h",
717 ]
718 }
mtkleinc04ff472016-06-23 10:29:30 -0700719}
mtklein25c81d42016-07-27 13:55:26 -0700720
mtkleinc095df52016-08-24 12:23:52 -0700721# Targets guarded by skia_enable_tools may use //third_party freely.
722if (skia_enable_tools) {
723 template("test_lib") {
724 config(target_name + "_config") {
725 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700726 if (defined(invoker.public_defines)) {
727 defines = invoker.public_defines
728 }
mtklein25c81d42016-07-27 13:55:26 -0700729 }
mtkleinc095df52016-08-24 12:23:52 -0700730 source_set(target_name) {
731 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
732 public_configs = [
733 ":" + target_name + "_config",
734 ":skia_private",
735 ]
736
737 if (!defined(deps)) {
738 deps = []
739 }
740 deps += [ ":skia" ]
741 testonly = true
742 }
mtklein25c81d42016-07-27 13:55:26 -0700743 }
mtklein25c81d42016-07-27 13:55:26 -0700744
mtkleinc095df52016-08-24 12:23:52 -0700745 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700746 public_include_dirs = []
747 if (skia_enable_gpu) {
748 public_defines = []
749 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700750
751 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700752 sources = [
753 "tools/gpu/GrContextFactory.cpp",
754 "tools/gpu/GrTest.cpp",
755 "tools/gpu/TestContext.cpp",
756 "tools/gpu/gl/GLTestContext.cpp",
Brian Salomon238b8202016-11-11 15:35:34 -0500757 "tools/gpu/gl/angle/GLTestContext_angle.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" ]
Brian Salomon238b8202016-11-11 15:35:34 -0500777 deps += [ "//third_party/angle2" ]
mtklein38925aa2016-09-21 10:11:25 -0700778 } else if (is_mac) {
779 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400780 } else if (is_win) {
781 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
782 libs += [
783 "Gdi32.lib",
784 "OpenGL32.lib",
785 ]
Brian Salomon238b8202016-11-11 15:35:34 -0500786 deps += [ "//third_party/angle2" ]
mtklein38925aa2016-09-21 10:11:25 -0700787 }
mtklein6ef69992016-09-14 06:12:09 -0700788
mtklein38925aa2016-09-21 10:11:25 -0700789 if (skia_use_mesa) {
790 public_defines += [ "SK_MESA" ]
791 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
792 libs += [ "OSMesa" ]
793 }
mtkleind68f9b02016-09-23 13:18:41 -0700794 if (skia_use_vulkan) {
795 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
796 }
mtkleina627b5c2016-09-20 13:36:47 -0700797 }
mtklein25c81d42016-07-27 13:55:26 -0700798 }
mtklein25c81d42016-07-27 13:55:26 -0700799
mtkleinc095df52016-08-24 12:23:52 -0700800 test_lib("flags") {
801 public_include_dirs = [ "tools/flags" ]
802 sources = [
803 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -0700804 ]
805 }
806 test_lib("common_flags") {
807 public_include_dirs = [ "tools/flags" ]
808 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700809 "tools/flags/SkCommonFlags.cpp",
810 "tools/flags/SkCommonFlagsConfig.cpp",
811 ]
812 deps = [
mtklein046cb562016-09-16 10:23:12 -0700813 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700814 ":gpu_tool_utils",
815 ]
816 }
mtklein25c81d42016-07-27 13:55:26 -0700817
mtkleinc095df52016-08-24 12:23:52 -0700818 test_lib("tool_utils") {
819 public_include_dirs = [
820 "tools",
821 "tools/debugger",
822 "tools/timer",
823 ]
824 sources = [
825 "src/images/SkForceLinking.cpp",
826 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
mtkleinb37c0342016-09-09 11:07:45 -0700827 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700828 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700829 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700830 "tools/ProcStats.cpp",
831 "tools/Resources.cpp",
832 "tools/ThermalManager.cpp",
833 "tools/UrlDataManager.cpp",
834 "tools/debugger/SkDebugCanvas.cpp",
835 "tools/debugger/SkDrawCommand.cpp",
836 "tools/debugger/SkJsonWriteBuffer.cpp",
837 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700838 "tools/picture_utils.cpp",
839 "tools/random_parse_path.cpp",
840 "tools/sk_tool_utils.cpp",
841 "tools/sk_tool_utils_font.cpp",
842 "tools/timer/Timer.cpp",
843 ]
844 deps = [
mtklein046cb562016-09-16 10:23:12 -0700845 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -0700846 ":flags",
847 "//third_party/libpng",
848 ]
849 public_deps = [
850 "//third_party/jsoncpp",
851 ]
852 }
mtklein25c81d42016-07-27 13:55:26 -0700853
Mike Klein6e744122016-10-27 12:21:40 -0400854 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -0700855 test_lib("gm") {
856 public_include_dirs = [ "gm" ]
857 sources = gm_sources
858 deps = [
scroggo19b91532016-10-24 09:03:26 -0700859 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700860 ":gpu_tool_utils",
861 ":skia",
862 ":tool_utils",
863 ]
864 }
mtklein25c81d42016-07-27 13:55:26 -0700865
Mike Klein6e744122016-10-27 12:21:40 -0400866 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -0700867 test_lib("tests") {
868 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -0400869 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -0700870 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -0400871 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700872 }
mtkleinc095df52016-08-24 12:23:52 -0700873 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700874 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700875 ":flags",
876 ":gpu_tool_utils",
877 ":skia",
878 ":tool_utils",
879 "//third_party/libpng",
880 "//third_party/zlib",
881 ]
882 }
mtklein2f3416d2016-08-02 16:02:05 -0700883
Mike Klein6e744122016-10-27 12:21:40 -0400884 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -0700885 test_lib("bench") {
886 public_include_dirs = [ "bench" ]
887 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -0700888 deps = [
889 ":flags",
890 ":gm",
891 ":gpu_tool_utils",
892 ":skia",
893 ":tool_utils",
894 ]
895 }
mtklein2b6870c2016-07-28 14:17:33 -0700896
mtkleinc095df52016-08-24 12:23:52 -0700897 test_lib("experimental_svg_model") {
898 public_include_dirs = [ "experimental/svg/model" ]
899 sources = [
900 "experimental/svg/model/SkSVGAttribute.cpp",
901 "experimental/svg/model/SkSVGAttributeParser.cpp",
902 "experimental/svg/model/SkSVGCircle.cpp",
903 "experimental/svg/model/SkSVGContainer.cpp",
904 "experimental/svg/model/SkSVGDOM.cpp",
905 "experimental/svg/model/SkSVGEllipse.cpp",
906 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700907 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700908 "experimental/svg/model/SkSVGNode.cpp",
909 "experimental/svg/model/SkSVGPath.cpp",
910 "experimental/svg/model/SkSVGPoly.cpp",
911 "experimental/svg/model/SkSVGRect.cpp",
912 "experimental/svg/model/SkSVGRenderContext.cpp",
913 "experimental/svg/model/SkSVGSVG.cpp",
914 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700915 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700916 "experimental/svg/model/SkSVGTransformableNode.cpp",
917 "experimental/svg/model/SkSVGValue.cpp",
918 ]
919 deps = [
920 ":skia",
921 ]
922 }
fmalitaa2b9fdf2016-08-03 19:53:36 -0700923
Brian Osman16adfa32016-10-18 14:42:44 -0400924 test_lib("views") {
925 public_include_dirs = [ "include/views" ]
926 sources = [
927 "src/views/SkEvent.cpp",
928 "src/views/SkEventSink.cpp",
929 "src/views/SkOSMenu.cpp",
930 "src/views/SkTagList.cpp",
931 "src/views/SkTouchGesture.cpp",
932 "src/views/SkView.cpp",
933 "src/views/SkViewPriv.cpp",
934 ]
935 libs = []
936 if (!is_android) {
937 sources += [ "src/views/SkWindow.cpp" ]
938 }
Jim Van Verth4e56a912016-10-21 10:58:52 -0400939 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -0400940 public_include_dirs += [ "src/views/unix" ]
941 sources += [
942 "src/views/unix/SkOSWindow_Unix.cpp",
943 "src/views/unix/keysym2ucs.c",
944 ]
Brian Osman16adfa32016-10-18 14:42:44 -0400945 } else if (is_mac) {
946 sources += [
947 "src/views/mac/SkEventNotifier.mm",
948 "src/views/mac/SkNSView.mm",
949 "src/views/mac/SkOSWindow_Mac.mm",
950 "src/views/mac/SkTextFieldCell.m",
951 ]
952 libs += [
953 "QuartzCore.framework",
954 "Cocoa.framework",
955 "Foundation.framework",
956 ]
957 } else if (is_win) {
958 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
959 }
960 }
961
Mike Klein38af9432016-11-11 11:39:44 -0500962 if (skia_use_lua) {
963 test_lib("lua") {
964 public_include_dirs = []
965 sources = [
966 "src/utils/SkLua.cpp",
967 "src/utils/SkLuaCanvas.cpp",
968 ]
969 deps = [
970 "//third_party/lua",
971 ]
972 }
973
974 executable("lua_app") {
975 sources = [
976 "tools/lua/lua_app.cpp",
977 ]
978 deps = [
979 ":lua",
980 ":skia",
981 "//third_party/lua",
982 ]
983 testonly = true
984 }
985
986 executable("lua_pictures") {
987 sources = [
988 "tools/lua/lua_pictures.cpp",
989 ]
990 deps = [
991 ":flags",
992 ":lua",
993 ":skia",
994 ":tool_utils",
995 "//third_party/lua",
996 ]
997 testonly = true
998 }
999 }
1000
Mike Klein6e744122016-10-27 12:21:40 -04001001 import("gn/samples.gni")
Brian Osman16adfa32016-10-18 14:42:44 -04001002 test_lib("samples") {
Brian Osman16adfa32016-10-18 14:42:44 -04001003 public_include_dirs = [ "samplecode" ]
Mike Klein6e744122016-10-27 12:21:40 -04001004 include_dirs = [ "experimental" ]
1005 sources = samples_sources + [
1006 "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp",
1007 "experimental/SkSetPoly3To3.cpp",
1008 "experimental/SkSetPoly3To3_A.cpp",
1009 "experimental/SkSetPoly3To3_D.cpp",
1010 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001011 deps = [
1012 ":experimental_svg_model",
Mike Klein6e744122016-10-27 12:21:40 -04001013 ":gm",
Brian Osman16adfa32016-10-18 14:42:44 -04001014 ":tool_utils",
1015 ":views",
1016 ":xml",
1017 ]
Mike Klein38af9432016-11-11 11:39:44 -05001018
1019 if (skia_use_lua) {
1020 sources += [ "samplecode/SampleLua.cpp" ]
1021 deps += [
1022 ":lua",
1023 "//third_party/lua",
1024 ]
1025 }
Brian Osman16adfa32016-10-18 14:42:44 -04001026 }
1027
mtklein2b6870c2016-07-28 14:17:33 -07001028 executable("dm") {
1029 sources = [
1030 "dm/DM.cpp",
1031 "dm/DMJsonWriter.cpp",
1032 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -07001033 ]
1034 include_dirs = [ "tests" ]
1035 deps = [
mtklein046cb562016-09-16 10:23:12 -07001036 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -07001037 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001038 ":flags",
1039 ":gm",
1040 ":gpu_tool_utils",
1041 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -07001042 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -07001043 ":tool_utils",
1044 "//third_party/jsoncpp",
1045 "//third_party/libpng",
1046 ]
1047 testonly = true
1048 }
1049
Mike Kleina3430172016-09-27 16:46:29 -04001050 if (!is_debug) { # I've benchmarked debug code once too many times...
1051 executable("monobench") {
1052 sources = [
1053 "tools/monobench.cpp",
1054 ]
1055 deps = [
1056 ":bench",
1057 ":skia",
1058 ]
1059 testonly = true
1060 }
mtklein2b6870c2016-07-28 14:17:33 -07001061 }
1062
1063 executable("nanobench") {
1064 sources = [
1065 "bench/nanobench.cpp",
1066 ]
1067 deps = [
1068 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001069 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001070 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001071 ":flags",
1072 ":gm",
1073 ":gpu_tool_utils",
1074 ":skia",
1075 ":tool_utils",
1076 "//third_party/jsoncpp",
1077 ]
1078 testonly = true
1079 }
halcanary19a97202016-08-03 15:08:04 -07001080
Jim Van Verth57a98fc2016-10-28 13:35:50 -04001081 if (is_linux || is_win || is_mac) {
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001082 executable("SampleApp") {
mtklein38925aa2016-09-21 10:11:25 -07001083 sources = [
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001084 "samplecode/SampleApp.cpp",
1085 "samplecode/SamplePictFile.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001086 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001087 if (is_mac) {
1088 sources += [ "src/views/mac/skia_mac.mm" ]
1089 } else if (is_win) {
1090 sources += [ "src/views/win/skia_win.cpp" ]
1091 } else if (is_linux) {
1092 sources += [ "src/views/unix/skia_unix.cpp" ]
1093 }
mtklein38925aa2016-09-21 10:11:25 -07001094 deps = [
1095 ":flags",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001096 ":gm",
mtklein38925aa2016-09-21 10:11:25 -07001097 ":gpu_tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001098 ":samples",
mtklein38925aa2016-09-21 10:11:25 -07001099 ":skia",
1100 ":tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001101 ":views",
mtklein38925aa2016-09-21 10:11:25 -07001102 ]
1103 testonly = true
1104 }
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001105 }
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001106
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001107 if (skia_enable_gpu) {
1108 executable("skpbench") {
1109 sources = [
1110 "tools/skpbench/skpbench.cpp",
1111 ]
1112 deps = [
1113 ":flags",
1114 ":gpu_tool_utils",
1115 ":skia",
1116 ":tool_utils",
1117 ]
1118 testonly = true
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001119 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001120 }
1121
Mike Klein7d302882016-11-03 14:06:31 -04001122 # We can't yet build ICU on iOS or Windows.
1123 if (!is_ios && !is_win) {
halcanary3eee9d92016-09-10 07:01:53 -07001124 executable("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001125 sources = [
1126 "tools/SkShaper_harfbuzz.cpp",
1127 "tools/using_skia_and_harfbuzz.cpp",
1128 ]
1129 deps = [
1130 ":skia",
1131 "//third_party/harfbuzz",
1132 ]
1133 testonly = true
1134 }
halcanary19a97202016-08-03 15:08:04 -07001135 }
halcanary3eee9d92016-09-10 07:01:53 -07001136 executable("sktexttopdf") {
1137 sources = [
1138 "tools/SkShaper_primitive.cpp",
1139 "tools/using_skia_and_harfbuzz.cpp",
1140 ]
1141 deps = [
1142 ":skia",
1143 ]
1144 testonly = true
1145 }
mtklein046cb562016-09-16 10:23:12 -07001146
1147 executable("get_images_from_skps") {
1148 sources = [
1149 "tools/get_images_from_skps.cpp",
1150 ]
1151 deps = [
1152 ":flags",
1153 ":skia",
1154 "//third_party/jsoncpp",
1155 ]
1156 testonly = true
1157 }
mtkleinecbc5262016-09-22 11:51:24 -07001158
Matt Sarett8740d582016-11-11 13:59:14 -05001159 executable("colorspaceinfo") {
1160 sources = [
1161 "tools/colorspaceinfo.cpp",
1162 ]
1163 deps = [
1164 ":flags",
1165 ":skia",
1166 ":tool_utils",
1167 ]
1168 testonly = true
1169 }
1170
Mike Klein7d302882016-11-03 14:06:31 -04001171 if (!is_ios) {
1172 executable("skiaserve") {
1173 sources = [
1174 "tools/skiaserve/Request.cpp",
1175 "tools/skiaserve/Response.cpp",
1176 "tools/skiaserve/skiaserve.cpp",
1177 "tools/skiaserve/urlhandlers/BatchBoundsHandler.cpp",
1178 "tools/skiaserve/urlhandlers/BatchesHandler.cpp",
1179 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1180 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1181 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1182 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1183 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1184 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1185 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1186 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1187 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
1188 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1189 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1190 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1191 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1192 ]
1193 deps = [
1194 ":flags",
1195 ":gpu_tool_utils",
1196 ":skia",
1197 ":tool_utils",
1198 "//third_party/jsoncpp",
1199 "//third_party/libmicrohttpd",
1200 "//third_party/libpng",
1201 ]
1202 testonly = true
1203 }
mtkleinecbc5262016-09-22 11:51:24 -07001204 }
kjlubick14f984b2016-10-03 11:49:45 -07001205
1206 executable("fuzz") {
1207 sources = [
1208 "fuzz/FilterFuzz.cpp",
1209 "fuzz/FuzzGradients.cpp",
1210 "fuzz/FuzzParsePath.cpp",
1211 "fuzz/FuzzPathop.cpp",
1212 "fuzz/FuzzScaleToSides.cpp",
1213 "fuzz/fuzz.cpp",
1214 ]
1215 deps = [
1216 ":flags",
1217 ":skia",
1218 ]
1219 testonly = true
1220 }
Mike Klein38312422016-10-05 15:41:01 -04001221
caryclark9feb6322016-10-25 08:58:26 -07001222 executable("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001223 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001224 rebase_path("tests/skia_test.cpp"),
1225 rebase_path("tests/Test.cpp"),
1226 ]
caryclark9feb6322016-10-25 08:58:26 -07001227 deps = [
1228 ":flags",
1229 ":gpu_tool_utils",
1230 ":skia",
1231 ":tool_utils",
1232 ]
1233 testonly = true
1234 }
1235
Mike Klein38312422016-10-05 15:41:01 -04001236 executable("dump_record") {
1237 sources = [
1238 "tools/DumpRecord.cpp",
1239 "tools/dump_record.cpp",
1240 ]
1241 deps = [
1242 ":flags",
1243 ":skia",
1244 ]
1245 testonly = true
1246 }
bungemanfe917272016-10-13 17:36:40 -04001247
1248 executable("skdiff") {
1249 sources = [
1250 "tools/skdiff/skdiff.cpp",
1251 "tools/skdiff/skdiff_html.cpp",
1252 "tools/skdiff/skdiff_main.cpp",
1253 "tools/skdiff/skdiff_utils.cpp",
1254 ]
1255 deps = [
1256 ":skia",
1257 ":tool_utils",
1258 ]
1259 testonly = true
1260 }
halcanarya73d76a2016-10-17 13:19:02 -07001261
1262 executable("skp_parser") {
1263 sources = [
1264 "tools/skp_parser.cpp",
1265 ]
1266 deps = [
1267 ":skia",
1268 ":tool_utils",
1269 "//third_party/jsoncpp",
1270 ]
1271 testonly = true
1272 }
Brian Osman16adfa32016-10-18 14:42:44 -04001273
Mike Klein43c25262016-10-20 10:17:47 -04001274 if (skia_enable_gpu && (is_linux || is_win || is_mac)) {
Brian Osman16adfa32016-10-18 14:42:44 -04001275 executable("viewer") {
1276 sources = [
1277 "tools/viewer/GMSlide.cpp",
1278 "tools/viewer/ImageSlide.cpp",
1279 "tools/viewer/SKPSlide.cpp",
1280 "tools/viewer/SampleSlide.cpp",
1281 "tools/viewer/Viewer.cpp",
1282 "tools/viewer/sk_app/CommandSet.cpp",
1283 "tools/viewer/sk_app/GLWindowContext.cpp",
1284 "tools/viewer/sk_app/Window.cpp",
1285 "tools/viewer/sk_app/WindowContext.cpp",
1286 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001287 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001288
Jim Van Verth4e56a912016-10-21 10:58:52 -04001289 if (is_android) {
1290 sources += [
1291 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1292 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1293 "tools/viewer/sk_app/android/Window_android.cpp",
1294 "tools/viewer/sk_app/android/main_android.cpp",
1295 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1296 ]
1297 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001298 sources += [
1299 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1300 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1301 "tools/viewer/sk_app/unix/Window_unix.cpp",
1302 "tools/viewer/sk_app/unix/main_unix.cpp",
1303 ]
1304 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001305 sources += [
1306 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1307 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1308 "tools/viewer/sk_app/win/Window_win.cpp",
1309 "tools/viewer/sk_app/win/main_win.cpp",
1310 ]
Mike Klein43c25262016-10-20 10:17:47 -04001311 } else if (is_mac) {
1312 sources += [
1313 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1314 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1315 "tools/viewer/sk_app/mac/Window_mac.cpp",
1316 "tools/viewer/sk_app/mac/main_mac.cpp",
1317 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001318 }
1319
1320 if (skia_use_vulkan) {
1321 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001322 if (is_android) {
1323 sources +=
1324 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
1325 libs += [ "android" ]
1326 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001327 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1328 libs += [ "X11-xcb" ]
1329 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001330 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1331 }
1332 }
1333
1334 include_dirs = []
1335 deps = [
1336 ":flags",
1337 ":gm",
1338 ":gpu_tool_utils",
1339 ":samples",
1340 ":skia",
1341 ":tool_utils",
1342 ":views",
1343 "//third_party/jsoncpp",
1344 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001345 if (is_android) {
1346 deps += [ "//third_party/native_app_glue" ]
1347 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001348 deps += [ "//third_party/libsdl" ]
1349 }
Brian Osman16adfa32016-10-18 14:42:44 -04001350 testonly = true
1351 }
1352 }
mtklein25c81d42016-07-27 13:55:26 -07001353}