blob: e3954d7f27507609859f358819cdc08f62483b9b [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() {
mtkleind68f9b02016-09-23 13:18:41 -070014 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() {
Mike Klein10d665d2016-11-01 11:46:10 -040035 skia_use_dng_sdk = !is_win && skia_use_libjpeg_turbo && skia_use_zlib
36 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",
mtklein605d9522016-09-21 14:01:32 -0700757 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700758 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
759 "tools/gpu/gl/debug/GrBufferObj.cpp",
760 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
761 "tools/gpu/gl/debug/GrProgramObj.cpp",
762 "tools/gpu/gl/debug/GrShaderObj.cpp",
763 "tools/gpu/gl/debug/GrTextureObj.cpp",
764 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
765 "tools/gpu/gl/null/NullGLTestContext.cpp",
766 ]
767 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700768
mtklein38925aa2016-09-21 10:11:25 -0700769 if (is_android) {
770 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
Mike Klein7d302882016-11-03 14:06:31 -0400771 } else if (is_ios) {
772 sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
773 libs += [ "OpenGLES.framework" ]
mtklein38925aa2016-09-21 10:11:25 -0700774 } else if (is_linux) {
775 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
776 } else if (is_mac) {
777 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400778 } else if (is_win) {
779 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
780 libs += [
781 "Gdi32.lib",
782 "OpenGL32.lib",
783 ]
mtklein38925aa2016-09-21 10:11:25 -0700784 }
mtklein6ef69992016-09-14 06:12:09 -0700785
mtkleind68f9b02016-09-23 13:18:41 -0700786 if (skia_use_angle) {
787 public_defines += [ "SK_ANGLE" ]
788 deps += [ "//third_party/angle2" ]
789 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
mtklein38925aa2016-09-21 10:11:25 -0700790 }
791 if (skia_use_mesa) {
792 public_defines += [ "SK_MESA" ]
793 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
794 libs += [ "OSMesa" ]
795 }
mtkleind68f9b02016-09-23 13:18:41 -0700796 if (skia_use_vulkan) {
797 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
798 }
mtkleina627b5c2016-09-20 13:36:47 -0700799 }
mtklein25c81d42016-07-27 13:55:26 -0700800 }
mtklein25c81d42016-07-27 13:55:26 -0700801
mtkleinc095df52016-08-24 12:23:52 -0700802 test_lib("flags") {
803 public_include_dirs = [ "tools/flags" ]
804 sources = [
805 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -0700806 ]
807 }
808 test_lib("common_flags") {
809 public_include_dirs = [ "tools/flags" ]
810 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700811 "tools/flags/SkCommonFlags.cpp",
812 "tools/flags/SkCommonFlagsConfig.cpp",
813 ]
814 deps = [
mtklein046cb562016-09-16 10:23:12 -0700815 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700816 ":gpu_tool_utils",
817 ]
818 }
mtklein25c81d42016-07-27 13:55:26 -0700819
mtkleinc095df52016-08-24 12:23:52 -0700820 test_lib("tool_utils") {
821 public_include_dirs = [
822 "tools",
823 "tools/debugger",
824 "tools/timer",
825 ]
826 sources = [
827 "src/images/SkForceLinking.cpp",
828 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
mtkleinb37c0342016-09-09 11:07:45 -0700829 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700830 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700831 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700832 "tools/ProcStats.cpp",
833 "tools/Resources.cpp",
834 "tools/ThermalManager.cpp",
835 "tools/UrlDataManager.cpp",
836 "tools/debugger/SkDebugCanvas.cpp",
837 "tools/debugger/SkDrawCommand.cpp",
838 "tools/debugger/SkJsonWriteBuffer.cpp",
839 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700840 "tools/picture_utils.cpp",
841 "tools/random_parse_path.cpp",
842 "tools/sk_tool_utils.cpp",
843 "tools/sk_tool_utils_font.cpp",
844 "tools/timer/Timer.cpp",
845 ]
846 deps = [
mtklein046cb562016-09-16 10:23:12 -0700847 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -0700848 ":flags",
849 "//third_party/libpng",
850 ]
851 public_deps = [
852 "//third_party/jsoncpp",
853 ]
854 }
mtklein25c81d42016-07-27 13:55:26 -0700855
Mike Klein6e744122016-10-27 12:21:40 -0400856 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -0700857 test_lib("gm") {
858 public_include_dirs = [ "gm" ]
859 sources = gm_sources
860 deps = [
scroggo19b91532016-10-24 09:03:26 -0700861 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700862 ":gpu_tool_utils",
863 ":skia",
864 ":tool_utils",
865 ]
866 }
mtklein25c81d42016-07-27 13:55:26 -0700867
Mike Klein6e744122016-10-27 12:21:40 -0400868 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -0700869 test_lib("tests") {
870 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -0400871 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -0700872 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -0400873 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700874 }
mtkleinc095df52016-08-24 12:23:52 -0700875 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700876 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700877 ":flags",
878 ":gpu_tool_utils",
879 ":skia",
880 ":tool_utils",
881 "//third_party/libpng",
882 "//third_party/zlib",
883 ]
884 }
mtklein2f3416d2016-08-02 16:02:05 -0700885
Mike Klein6e744122016-10-27 12:21:40 -0400886 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -0700887 test_lib("bench") {
888 public_include_dirs = [ "bench" ]
889 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -0700890 deps = [
891 ":flags",
892 ":gm",
893 ":gpu_tool_utils",
894 ":skia",
895 ":tool_utils",
896 ]
897 }
mtklein2b6870c2016-07-28 14:17:33 -0700898
mtkleinc095df52016-08-24 12:23:52 -0700899 test_lib("experimental_svg_model") {
900 public_include_dirs = [ "experimental/svg/model" ]
901 sources = [
902 "experimental/svg/model/SkSVGAttribute.cpp",
903 "experimental/svg/model/SkSVGAttributeParser.cpp",
904 "experimental/svg/model/SkSVGCircle.cpp",
905 "experimental/svg/model/SkSVGContainer.cpp",
906 "experimental/svg/model/SkSVGDOM.cpp",
907 "experimental/svg/model/SkSVGEllipse.cpp",
908 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700909 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700910 "experimental/svg/model/SkSVGNode.cpp",
911 "experimental/svg/model/SkSVGPath.cpp",
912 "experimental/svg/model/SkSVGPoly.cpp",
913 "experimental/svg/model/SkSVGRect.cpp",
914 "experimental/svg/model/SkSVGRenderContext.cpp",
915 "experimental/svg/model/SkSVGSVG.cpp",
916 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700917 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700918 "experimental/svg/model/SkSVGTransformableNode.cpp",
919 "experimental/svg/model/SkSVGValue.cpp",
920 ]
921 deps = [
922 ":skia",
923 ]
924 }
fmalitaa2b9fdf2016-08-03 19:53:36 -0700925
Brian Osman16adfa32016-10-18 14:42:44 -0400926 test_lib("views") {
927 public_include_dirs = [ "include/views" ]
928 sources = [
929 "src/views/SkEvent.cpp",
930 "src/views/SkEventSink.cpp",
931 "src/views/SkOSMenu.cpp",
932 "src/views/SkTagList.cpp",
933 "src/views/SkTouchGesture.cpp",
934 "src/views/SkView.cpp",
935 "src/views/SkViewPriv.cpp",
936 ]
937 libs = []
938 if (!is_android) {
939 sources += [ "src/views/SkWindow.cpp" ]
940 }
Jim Van Verth4e56a912016-10-21 10:58:52 -0400941 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -0400942 public_include_dirs += [ "src/views/unix" ]
943 sources += [
944 "src/views/unix/SkOSWindow_Unix.cpp",
945 "src/views/unix/keysym2ucs.c",
946 ]
Brian Osman16adfa32016-10-18 14:42:44 -0400947 } else if (is_mac) {
948 sources += [
949 "src/views/mac/SkEventNotifier.mm",
950 "src/views/mac/SkNSView.mm",
951 "src/views/mac/SkOSWindow_Mac.mm",
952 "src/views/mac/SkTextFieldCell.m",
953 ]
954 libs += [
955 "QuartzCore.framework",
956 "Cocoa.framework",
957 "Foundation.framework",
958 ]
959 } else if (is_win) {
960 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
961 }
962 }
963
Mike Klein38af9432016-11-11 11:39:44 -0500964 if (skia_use_lua) {
965 test_lib("lua") {
966 public_include_dirs = []
967 sources = [
968 "src/utils/SkLua.cpp",
969 "src/utils/SkLuaCanvas.cpp",
970 ]
971 deps = [
972 "//third_party/lua",
973 ]
974 }
975
976 executable("lua_app") {
977 sources = [
978 "tools/lua/lua_app.cpp",
979 ]
980 deps = [
981 ":lua",
982 ":skia",
983 "//third_party/lua",
984 ]
985 testonly = true
986 }
987
988 executable("lua_pictures") {
989 sources = [
990 "tools/lua/lua_pictures.cpp",
991 ]
992 deps = [
993 ":flags",
994 ":lua",
995 ":skia",
996 ":tool_utils",
997 "//third_party/lua",
998 ]
999 testonly = true
1000 }
1001 }
1002
Mike Klein6e744122016-10-27 12:21:40 -04001003 import("gn/samples.gni")
Brian Osman16adfa32016-10-18 14:42:44 -04001004 test_lib("samples") {
Brian Osman16adfa32016-10-18 14:42:44 -04001005 public_include_dirs = [ "samplecode" ]
Mike Klein6e744122016-10-27 12:21:40 -04001006 include_dirs = [ "experimental" ]
1007 sources = samples_sources + [
1008 "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp",
1009 "experimental/SkSetPoly3To3.cpp",
1010 "experimental/SkSetPoly3To3_A.cpp",
1011 "experimental/SkSetPoly3To3_D.cpp",
1012 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001013 deps = [
1014 ":experimental_svg_model",
Mike Klein6e744122016-10-27 12:21:40 -04001015 ":gm",
Brian Osman16adfa32016-10-18 14:42:44 -04001016 ":tool_utils",
1017 ":views",
1018 ":xml",
1019 ]
Mike Klein38af9432016-11-11 11:39:44 -05001020
1021 if (skia_use_lua) {
1022 sources += [ "samplecode/SampleLua.cpp" ]
1023 deps += [
1024 ":lua",
1025 "//third_party/lua",
1026 ]
1027 }
Brian Osman16adfa32016-10-18 14:42:44 -04001028 }
1029
mtklein2b6870c2016-07-28 14:17:33 -07001030 executable("dm") {
1031 sources = [
1032 "dm/DM.cpp",
1033 "dm/DMJsonWriter.cpp",
1034 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -07001035 ]
1036 include_dirs = [ "tests" ]
1037 deps = [
mtklein046cb562016-09-16 10:23:12 -07001038 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -07001039 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001040 ":flags",
1041 ":gm",
1042 ":gpu_tool_utils",
1043 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -07001044 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -07001045 ":tool_utils",
1046 "//third_party/jsoncpp",
1047 "//third_party/libpng",
1048 ]
1049 testonly = true
1050 }
1051
Mike Kleina3430172016-09-27 16:46:29 -04001052 if (!is_debug) { # I've benchmarked debug code once too many times...
1053 executable("monobench") {
1054 sources = [
1055 "tools/monobench.cpp",
1056 ]
1057 deps = [
1058 ":bench",
1059 ":skia",
1060 ]
1061 testonly = true
1062 }
mtklein2b6870c2016-07-28 14:17:33 -07001063 }
1064
1065 executable("nanobench") {
1066 sources = [
1067 "bench/nanobench.cpp",
1068 ]
1069 deps = [
1070 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001071 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001072 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001073 ":flags",
1074 ":gm",
1075 ":gpu_tool_utils",
1076 ":skia",
1077 ":tool_utils",
1078 "//third_party/jsoncpp",
1079 ]
1080 testonly = true
1081 }
halcanary19a97202016-08-03 15:08:04 -07001082
Jim Van Verth57a98fc2016-10-28 13:35:50 -04001083 if (is_linux || is_win || is_mac) {
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001084 executable("SampleApp") {
mtklein38925aa2016-09-21 10:11:25 -07001085 sources = [
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001086 "samplecode/SampleApp.cpp",
1087 "samplecode/SamplePictFile.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001088 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001089 if (is_mac) {
1090 sources += [ "src/views/mac/skia_mac.mm" ]
1091 } else if (is_win) {
1092 sources += [ "src/views/win/skia_win.cpp" ]
1093 } else if (is_linux) {
1094 sources += [ "src/views/unix/skia_unix.cpp" ]
1095 }
mtklein38925aa2016-09-21 10:11:25 -07001096 deps = [
1097 ":flags",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001098 ":gm",
mtklein38925aa2016-09-21 10:11:25 -07001099 ":gpu_tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001100 ":samples",
mtklein38925aa2016-09-21 10:11:25 -07001101 ":skia",
1102 ":tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001103 ":views",
mtklein38925aa2016-09-21 10:11:25 -07001104 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001105 if (skia_use_angle) {
1106 deps += [ "//third_party/angle2" ]
1107 }
mtklein38925aa2016-09-21 10:11:25 -07001108 testonly = true
1109 }
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001110 }
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001111
Jim Van Verth8f5468f2016-10-31 09:52:33 -04001112 if (skia_enable_gpu) {
1113 executable("skpbench") {
1114 sources = [
1115 "tools/skpbench/skpbench.cpp",
1116 ]
1117 deps = [
1118 ":flags",
1119 ":gpu_tool_utils",
1120 ":skia",
1121 ":tool_utils",
1122 ]
1123 testonly = true
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001124 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001125 }
1126
Mike Klein7d302882016-11-03 14:06:31 -04001127 # We can't yet build ICU on iOS or Windows.
1128 if (!is_ios && !is_win) {
halcanary3eee9d92016-09-10 07:01:53 -07001129 executable("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001130 sources = [
1131 "tools/SkShaper_harfbuzz.cpp",
1132 "tools/using_skia_and_harfbuzz.cpp",
1133 ]
1134 deps = [
1135 ":skia",
1136 "//third_party/harfbuzz",
1137 ]
1138 testonly = true
1139 }
halcanary19a97202016-08-03 15:08:04 -07001140 }
halcanary3eee9d92016-09-10 07:01:53 -07001141 executable("sktexttopdf") {
1142 sources = [
1143 "tools/SkShaper_primitive.cpp",
1144 "tools/using_skia_and_harfbuzz.cpp",
1145 ]
1146 deps = [
1147 ":skia",
1148 ]
1149 testonly = true
1150 }
mtklein046cb562016-09-16 10:23:12 -07001151
1152 executable("get_images_from_skps") {
1153 sources = [
1154 "tools/get_images_from_skps.cpp",
1155 ]
1156 deps = [
1157 ":flags",
1158 ":skia",
1159 "//third_party/jsoncpp",
1160 ]
1161 testonly = true
1162 }
mtkleinecbc5262016-09-22 11:51:24 -07001163
Mike Klein7d302882016-11-03 14:06:31 -04001164 if (!is_ios) {
1165 executable("skiaserve") {
1166 sources = [
1167 "tools/skiaserve/Request.cpp",
1168 "tools/skiaserve/Response.cpp",
1169 "tools/skiaserve/skiaserve.cpp",
1170 "tools/skiaserve/urlhandlers/BatchBoundsHandler.cpp",
1171 "tools/skiaserve/urlhandlers/BatchesHandler.cpp",
1172 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1173 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1174 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1175 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1176 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1177 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1178 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1179 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1180 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
1181 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
1182 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1183 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1184 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1185 ]
1186 deps = [
1187 ":flags",
1188 ":gpu_tool_utils",
1189 ":skia",
1190 ":tool_utils",
1191 "//third_party/jsoncpp",
1192 "//third_party/libmicrohttpd",
1193 "//third_party/libpng",
1194 ]
1195 testonly = true
1196 }
mtkleinecbc5262016-09-22 11:51:24 -07001197 }
kjlubick14f984b2016-10-03 11:49:45 -07001198
1199 executable("fuzz") {
1200 sources = [
1201 "fuzz/FilterFuzz.cpp",
1202 "fuzz/FuzzGradients.cpp",
1203 "fuzz/FuzzParsePath.cpp",
1204 "fuzz/FuzzPathop.cpp",
1205 "fuzz/FuzzScaleToSides.cpp",
1206 "fuzz/fuzz.cpp",
1207 ]
1208 deps = [
1209 ":flags",
1210 ":skia",
1211 ]
1212 testonly = true
1213 }
Mike Klein38312422016-10-05 15:41:01 -04001214
caryclark9feb6322016-10-25 08:58:26 -07001215 executable("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001216 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001217 rebase_path("tests/skia_test.cpp"),
1218 rebase_path("tests/Test.cpp"),
1219 ]
caryclark9feb6322016-10-25 08:58:26 -07001220 deps = [
1221 ":flags",
1222 ":gpu_tool_utils",
1223 ":skia",
1224 ":tool_utils",
1225 ]
1226 testonly = true
1227 }
1228
Mike Klein38312422016-10-05 15:41:01 -04001229 executable("dump_record") {
1230 sources = [
1231 "tools/DumpRecord.cpp",
1232 "tools/dump_record.cpp",
1233 ]
1234 deps = [
1235 ":flags",
1236 ":skia",
1237 ]
1238 testonly = true
1239 }
bungemanfe917272016-10-13 17:36:40 -04001240
1241 executable("skdiff") {
1242 sources = [
1243 "tools/skdiff/skdiff.cpp",
1244 "tools/skdiff/skdiff_html.cpp",
1245 "tools/skdiff/skdiff_main.cpp",
1246 "tools/skdiff/skdiff_utils.cpp",
1247 ]
1248 deps = [
1249 ":skia",
1250 ":tool_utils",
1251 ]
1252 testonly = true
1253 }
halcanarya73d76a2016-10-17 13:19:02 -07001254
1255 executable("skp_parser") {
1256 sources = [
1257 "tools/skp_parser.cpp",
1258 ]
1259 deps = [
1260 ":skia",
1261 ":tool_utils",
1262 "//third_party/jsoncpp",
1263 ]
1264 testonly = true
1265 }
Brian Osman16adfa32016-10-18 14:42:44 -04001266
Mike Klein43c25262016-10-20 10:17:47 -04001267 if (skia_enable_gpu && (is_linux || is_win || is_mac)) {
Brian Osman16adfa32016-10-18 14:42:44 -04001268 executable("viewer") {
1269 sources = [
1270 "tools/viewer/GMSlide.cpp",
1271 "tools/viewer/ImageSlide.cpp",
1272 "tools/viewer/SKPSlide.cpp",
1273 "tools/viewer/SampleSlide.cpp",
1274 "tools/viewer/Viewer.cpp",
1275 "tools/viewer/sk_app/CommandSet.cpp",
1276 "tools/viewer/sk_app/GLWindowContext.cpp",
1277 "tools/viewer/sk_app/Window.cpp",
1278 "tools/viewer/sk_app/WindowContext.cpp",
1279 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001280 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001281
Jim Van Verth4e56a912016-10-21 10:58:52 -04001282 if (is_android) {
1283 sources += [
1284 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1285 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1286 "tools/viewer/sk_app/android/Window_android.cpp",
1287 "tools/viewer/sk_app/android/main_android.cpp",
1288 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1289 ]
1290 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001291 sources += [
1292 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1293 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1294 "tools/viewer/sk_app/unix/Window_unix.cpp",
1295 "tools/viewer/sk_app/unix/main_unix.cpp",
1296 ]
1297 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001298 sources += [
1299 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1300 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1301 "tools/viewer/sk_app/win/Window_win.cpp",
1302 "tools/viewer/sk_app/win/main_win.cpp",
1303 ]
Mike Klein43c25262016-10-20 10:17:47 -04001304 } else if (is_mac) {
1305 sources += [
1306 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1307 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1308 "tools/viewer/sk_app/mac/Window_mac.cpp",
1309 "tools/viewer/sk_app/mac/main_mac.cpp",
1310 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001311 }
1312
1313 if (skia_use_vulkan) {
1314 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001315 if (is_android) {
1316 sources +=
1317 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
1318 libs += [ "android" ]
1319 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001320 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1321 libs += [ "X11-xcb" ]
1322 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001323 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1324 }
1325 }
1326
1327 include_dirs = []
1328 deps = [
1329 ":flags",
1330 ":gm",
1331 ":gpu_tool_utils",
1332 ":samples",
1333 ":skia",
1334 ":tool_utils",
1335 ":views",
1336 "//third_party/jsoncpp",
1337 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001338 if (is_android) {
1339 deps += [ "//third_party/native_app_glue" ]
1340 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001341 deps += [ "//third_party/libsdl" ]
1342 }
Brian Osman16adfa32016-10-18 14:42:44 -04001343 testonly = true
1344 }
1345 }
mtklein25c81d42016-07-27 13:55:26 -07001346}