blob: 6a559227a3bae8a5de62aa9e88424b918faaa674 [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
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
mtkleina627b5c2016-09-20 13:36:47 -070022 skia_use_mesa = false
Mike Kleinae7e6712016-10-11 17:49:33 -040023 skia_use_sfntly = !is_fuchsia && !is_win # TODO: icu on Windows, re-enable this.
mtklein63213812016-08-24 09:55:56 -070024 skia_use_zlib = true
mtklein1bd72ba2016-09-16 07:45:52 -070025
26 skia_enable_android_framework_defines = false
mtklein06c35c02016-09-20 12:28:12 -070027 skia_enable_gpu = true
mtklein3e8012e2016-09-21 09:14:19 -070028 skia_enable_tools = is_skia_standalone
29 skia_enable_vulkan_debug_layers = is_skia_standalone && is_debug
Greg Daniel686bb212016-10-27 10:48:48 -040030 skia_vulkan_sdk = getenv("VULKAN_SDK")
mtkleinc04ff472016-06-23 10:29:30 -070031}
32
Brian Salomon23d73ea2016-10-27 13:31:37 -040033declare_args() {
34 skia_use_vulkan =
35 skia_vulkan_sdk != "" || (is_android && defined(ndk_api) && ndk_api >= 24)
36}
Brian Salomon789e25e2016-09-30 13:41:03 -040037
mtklein38925aa2016-09-21 10:11:25 -070038# Our tools require static linking (they use non-exported symbols).
39skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070040
mtkleina45be612016-08-29 15:22:10 -070041fontmgr_android_enabled = skia_use_expat && skia_use_freetype
42
mtklein1211e0c2016-07-26 13:55:45 -070043skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070044 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070045 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070046 "include/codec",
47 "include/config",
48 "include/core",
49 "include/effects",
50 "include/gpu",
51 "include/gpu/gl",
52 "include/images",
53 "include/pathops",
54 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070055 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -070056 "include/utils",
57 "include/utils/mac",
mtklein25c81d42016-07-27 13:55:26 -070058 "include/xml",
mtklein1211e0c2016-07-26 13:55:45 -070059]
60
mtkleinc04ff472016-06-23 10:29:30 -070061# Skia public API, generally provided by :skia.
62config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -070063 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -040064 defines = []
65 if (is_component_build) {
66 defines += [ "SKIA_DLL" ]
67 }
Mike Kleinc4cbd742016-09-26 21:37:09 -040068 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -070069 defines += [ "SK_SAMPLES_FOR_X" ]
70 }
mtkleincae1be52016-09-20 08:24:34 -070071 if (skia_enable_android_framework_defines) {
Mike Kleincfc4f442016-10-26 17:19:03 -040072 defines += android_framework_defines
mtkleincae1be52016-09-20 08:24:34 -070073 }
mtklein06c35c02016-09-20 12:28:12 -070074 if (!skia_enable_gpu) {
75 defines += [ "SK_SUPPORT_GPU=0" ]
76 }
mtkleinc04ff472016-06-23 10:29:30 -070077}
78
79# Skia internal APIs, used by Skia itself and a few test tools.
80config("skia_private") {
81 visibility = [ ":*" ]
82
83 include_dirs = [
84 "include/private",
85 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -070086 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -070087 "src/config",
88 "src/core",
89 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -070090 "src/effects/gradients",
91 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -070092 "src/gpu",
93 "src/image",
94 "src/images",
95 "src/lazy",
96 "src/opts",
97 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -070098 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -070099 "src/ports",
100 "src/sfnt",
mtklein9e0d9dd2016-08-30 10:37:19 -0700101 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -0700102 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700103 "src/utils/win",
mtkleinc04ff472016-06-23 10:29:30 -0700104 "third_party/etc1",
scroggo19b91532016-10-24 09:03:26 -0700105 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700106 "third_party/ktx",
107 ]
mtklein150d1132016-08-01 06:56:40 -0700108
mtklein63213812016-08-24 09:55:56 -0700109 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700110 if (is_android) {
111 defines += [
112 "SK_GAMMA_EXPONENT=1.4",
113 "SK_GAMMA_CONTRAST=0.0",
114 ]
115 }
mtklein88a7ac02016-09-14 11:16:49 -0700116 if (is_official_build || is_android) {
117 # TODO(bsalomon): it'd be nice to make Android normal.
118 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
119 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400120 libs = []
121 lib_dirs = []
122 if (skia_use_vulkan) {
123 if (skia_vulkan_sdk != "") {
Mike Klein487bfc22016-10-14 14:04:56 -0400124 if (is_win) {
125 include_dirs += [ "$skia_vulkan_sdk/Include/" ]
126 lib_dirs += [ "$skia_vulkan_sdk/Bin" ]
127 } else {
Greg Daniel686bb212016-10-27 10:48:48 -0400128 include_dirs += [ "$skia_vulkan_sdk/include/" ]
129 lib_dirs += [ "$skia_vulkan_sdk/lib/" ]
Mike Klein487bfc22016-10-14 14:04:56 -0400130 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400131 }
Mike Klein487bfc22016-10-14 14:04:56 -0400132 if (is_win) {
133 libs += [ "vulkan-1.lib" ]
134 } else {
135 libs += [ "vulkan" ]
136 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400137 }
mtkleinc04ff472016-06-23 10:29:30 -0700138}
139
140# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
141config("skia_library") {
142 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700143 defines = [ "SKIA_IMPLEMENTATION=1" ]
144}
145
146skia_library_configs = [
147 ":skia_public",
148 ":skia_private",
149 ":skia_library",
150]
151
mtklein9b8583d2016-08-24 17:32:30 -0700152# Use for CPU-specific Skia code that needs particular compiler flags.
153template("opts") {
154 if (invoker.enabled) {
155 source_set(target_name) {
156 forward_variables_from(invoker, "*")
157 configs += skia_library_configs
158 }
159 } else {
160 # If not enabled, a phony empty target that swallows all otherwise unused variables.
161 source_set(target_name) {
162 forward_variables_from(invoker,
163 "*",
164 [
165 "sources",
166 "cflags",
167 ])
168 }
169 }
anmittala7eaf2e2016-08-17 13:57:26 -0700170}
171
mtklein422310d2016-08-16 18:28:43 -0700172is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700173
mtklein7d6fb2c2016-08-25 14:50:44 -0700174opts("none") {
175 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700176 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700177 cflags = []
178}
179
mtklein7d6fb2c2016-08-25 14:50:44 -0700180opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700181 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700182 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700183 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700184}
185
186opts("arm64") {
187 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700188 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700189 cflags = []
190}
191
192opts("crc32") {
193 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700194 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700195 cflags = [ "-march=armv8-a+crc" ]
196}
197
mtklein9b8583d2016-08-24 17:32:30 -0700198opts("sse2") {
199 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700200 sources = skia_opts.sse2_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400201 if (is_win) {
202 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
203 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400204 cflags = [ "-msse2" ]
205 }
mtklein9b8583d2016-08-24 17:32:30 -0700206}
mtkleinc04ff472016-06-23 10:29:30 -0700207
mtklein9b8583d2016-08-24 17:32:30 -0700208opts("ssse3") {
209 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700210 sources = skia_opts.ssse3_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400211 if (is_win) {
212 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
213 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400214 cflags = [ "-mssse3" ]
215 }
mtklein9b8583d2016-08-24 17:32:30 -0700216}
mtkleinc04ff472016-06-23 10:29:30 -0700217
mtklein9b8583d2016-08-24 17:32:30 -0700218opts("sse41") {
219 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700220 sources = skia_opts.sse41_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400221 if (is_win) {
222 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
223 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400224 cflags = [ "-msse4.1" ]
225 }
mtklein9b8583d2016-08-24 17:32:30 -0700226}
mtklein4e976072016-08-08 09:06:27 -0700227
mtklein9b8583d2016-08-24 17:32:30 -0700228opts("sse42") {
229 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700230 sources = skia_opts.sse42_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400231 if (is_win) {
232 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
233 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400234 cflags = [ "-msse4.2" ]
235 }
mtklein9b8583d2016-08-24 17:32:30 -0700236}
237
238opts("avx") {
239 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700240 sources = skia_opts.avx_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400241 if (is_win) {
242 cflags = [ "/arch:AVX" ]
243 } else {
244 cflags = [ "-mavx" ]
245 }
mtkleinc04ff472016-06-23 10:29:30 -0700246}
247
Mike Klein78d5a3b2016-09-30 10:48:01 -0400248opts("hsw") {
249 enabled = is_x86
250 sources = skia_opts.hsw_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400251 if (is_win) {
252 cflags = [ "/arch:AVX2" ]
253 } else {
254 cflags = [
255 "-mavx2",
256 "-mbmi",
257 "-mbmi2",
258 "-mf16c",
259 "-mfma",
260 ]
261 }
Mike Klein78d5a3b2016-09-30 10:48:01 -0400262}
263
mtklein349cece2016-08-26 08:13:04 -0700264opts("dsp") {
265 enabled = current_cpu == "mipsel"
brettwb9447282016-09-01 14:24:39 -0700266 sources = skia_opts.mips_dsp_sources
mtkleinb6064ef2016-08-30 11:49:24 -0700267 cflags = []
mtklein349cece2016-08-26 08:13:04 -0700268}
269
mtkleinc095df52016-08-24 12:23:52 -0700270# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700271template("optional") {
272 if (invoker.enabled) {
273 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700274 if (defined(invoker.public_defines)) {
275 defines = invoker.public_defines
276 }
mtklein457b42a2016-08-23 13:56:37 -0700277 }
278 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700279 forward_variables_from(invoker,
280 "*",
281 [
282 "public_defines",
283 "sources_when_disabled",
284 ])
mtklein457b42a2016-08-23 13:56:37 -0700285 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700286 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700287 }
288 } else {
mtklein457b42a2016-08-23 13:56:37 -0700289 source_set(target_name) {
290 forward_variables_from(invoker,
291 "*",
292 [
293 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700294 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700295 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700296 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700297 "sources_when_disabled",
mtklein457b42a2016-08-23 13:56:37 -0700298 ])
mtkleincd01b032016-08-31 04:58:19 -0700299 if (defined(invoker.sources_when_disabled)) {
300 sources = invoker.sources_when_disabled
301 }
302 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700303 }
mtkleineb3c4252016-08-23 07:38:09 -0700304 }
mtklein457b42a2016-08-23 13:56:37 -0700305}
mtklein457b42a2016-08-23 13:56:37 -0700306
mtkleina45be612016-08-29 15:22:10 -0700307optional("fontmgr_android") {
308 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700309
310 deps = [
311 "//third_party/expat",
312 "//third_party/freetype2",
313 ]
314 sources = [
315 "src/ports/SkFontMgr_android.cpp",
316 "src/ports/SkFontMgr_android_factory.cpp",
317 "src/ports/SkFontMgr_android_parser.cpp",
318 ]
319}
320
mtkleind2e39db2016-09-07 07:52:55 -0700321optional("fontmgr_custom") {
322 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
323
324 deps = [
325 "//third_party/freetype2",
326 ]
327 sources = [
328 "src/ports/SkFontMgr_custom.cpp",
329 "src/ports/SkFontMgr_custom_directory_factory.cpp",
330 ]
331}
332
mtklein3cc22182016-08-29 13:26:14 -0700333optional("fontmgr_fontconfig") {
334 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700335
336 deps = [
337 "//third_party:fontconfig",
338 "//third_party/freetype2",
339 ]
340 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700341 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700342 "src/ports/SkFontConfigInterface_direct.cpp",
343 "src/ports/SkFontConfigInterface_direct_factory.cpp",
344 "src/ports/SkFontMgr_FontConfigInterface.cpp",
345 "src/ports/SkFontMgr_fontconfig.cpp",
346 "src/ports/SkFontMgr_fontconfig_factory.cpp",
347 ]
348}
349
mtkleincdedd0e2016-09-12 15:15:44 -0700350optional("fontmgr_fuchsia") {
351 enabled = is_fuchsia && skia_use_freetype
352
353 deps = [
354 "//third_party/freetype2",
355 ]
356 sources = [
357 "src/ports/SkFontMgr_custom.cpp",
358 "src/ports/SkFontMgr_custom_empty_factory.cpp",
359 ]
360}
361
mtklein06c35c02016-09-20 12:28:12 -0700362optional("gpu") {
363 enabled = skia_enable_gpu
mtkleine9fb3d52016-09-20 15:11:46 -0700364 public_defines = []
365
mtklein06c35c02016-09-20 12:28:12 -0700366 sources = skia_gpu_sources + [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ]
367
368 # These paths need to be absolute to match the ones produced by shared_sources.gni.
369 sources -= get_path_info([
370 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
371 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
372 ],
373 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400374 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700375 if (is_android) {
376 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
377 } else if (is_linux) {
378 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
379 } else if (is_mac) {
380 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400381 } else if (is_win) {
382 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
383 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700384 } else {
385 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
386 }
mtkleine9fb3d52016-09-20 15:11:46 -0700387
388 if (skia_use_vulkan) {
389 public_defines += [ "SK_VULKAN" ]
390 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700391 if (skia_enable_vulkan_debug_layers) {
392 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
393 }
mtkleine9fb3d52016-09-20 15:11:46 -0700394 }
mtklein06c35c02016-09-20 12:28:12 -0700395}
396
mtklein63213812016-08-24 09:55:56 -0700397optional("jpeg") {
398 enabled = skia_use_libjpeg_turbo
399 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
400
mtklein63213812016-08-24 09:55:56 -0700401 deps = [
402 "//third_party/libjpeg-turbo:libjpeg",
403 ]
404 sources = [
405 "src/codec/SkJpegCodec.cpp",
406 "src/codec/SkJpegDecoderMgr.cpp",
407 "src/codec/SkJpegUtility.cpp",
408 "src/images/SkJPEGImageEncoder.cpp",
409 "src/images/SkJPEGWriteUtility.cpp",
410 ]
411}
412
413optional("pdf") {
414 enabled = skia_use_zlib
mtklein63213812016-08-24 09:55:56 -0700415
mtklein63213812016-08-24 09:55:56 -0700416 deps = [
417 "//third_party/zlib",
418 ]
brettwb9447282016-09-01 14:24:39 -0700419 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700420 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700421
422 if (skia_use_sfntly) {
423 deps += [ "//third_party/sfntly" ]
mtkleincd01b032016-08-31 04:58:19 -0700424 public_defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700425 }
426}
427
428optional("png") {
429 enabled = skia_use_libpng
430 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
431
mtklein63213812016-08-24 09:55:56 -0700432 deps = [
433 "//third_party/libpng",
434 ]
435 sources = [
436 "src/codec/SkIcoCodec.cpp",
437 "src/codec/SkPngCodec.cpp",
438 "src/images/SkPNGImageEncoder.cpp",
439 ]
440}
441
mtklein3cc22182016-08-29 13:26:14 -0700442optional("typeface_freetype") {
443 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700444
445 deps = [
446 "//third_party/freetype2",
447 ]
448 sources = [
449 "src/ports/SkFontHost_FreeType.cpp",
450 "src/ports/SkFontHost_FreeType_common.cpp",
451 ]
452}
453
mtklein457b42a2016-08-23 13:56:37 -0700454optional("webp") {
455 enabled = skia_use_libwebp
456 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
457
mtklein457b42a2016-08-23 13:56:37 -0700458 deps = [
459 "//third_party/libwebp",
460 ]
461 sources = [
462 "src/codec/SkWebpAdapterCodec.cpp",
463 "src/codec/SkWebpCodec.cpp",
464 "src/images/SkWEBPImageEncoder.cpp",
465 ]
mtkleineb3c4252016-08-23 07:38:09 -0700466}
467
mtklein63213812016-08-24 09:55:56 -0700468optional("xml") {
469 enabled = skia_use_expat
mtklein63213812016-08-24 09:55:56 -0700470
mtklein63213812016-08-24 09:55:56 -0700471 deps = [
472 "//third_party/expat",
473 ]
474 sources = [
475 "src/xml/SkDOM.cpp",
476 "src/xml/SkXMLParser.cpp",
477 "src/xml/SkXMLWriter.cpp",
478 ]
479}
480
mtkleinc04ff472016-06-23 10:29:30 -0700481component("skia") {
482 public_configs = [ ":skia_public" ]
483 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700484
485 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700486 ":arm64",
487 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700488 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700489 ":crc32",
mtklein349cece2016-08-26 08:13:04 -0700490 ":dsp",
mtkleina45be612016-08-29 15:22:10 -0700491 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700492 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700493 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700494 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700495 ":gpu",
Mike Klein78d5a3b2016-09-30 10:48:01 -0400496 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700497 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700498 ":none",
mtklein63213812016-08-24 09:55:56 -0700499 ":pdf",
500 ":png",
mtklein9b8583d2016-08-24 17:32:30 -0700501 ":sse2",
502 ":sse41",
503 ":sse42",
504 ":ssse3",
mtklein3cc22182016-08-29 13:26:14 -0700505 ":typeface_freetype",
mtkleineb3c4252016-08-23 07:38:09 -0700506 ":webp",
mtklein63213812016-08-24 09:55:56 -0700507 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700508 ]
509
mtkleinc04ff472016-06-23 10:29:30 -0700510 sources = []
brettwb9447282016-09-01 14:24:39 -0700511 sources += skia_core_sources
512 sources += skia_effects_sources
brettwb9447282016-09-01 14:24:39 -0700513 sources += skia_sksl_sources
514 sources += skia_utils_sources
mtkleinc04ff472016-06-23 10:29:30 -0700515 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700516 "src/android/SkBitmapRegionCodec.cpp",
517 "src/android/SkBitmapRegionDecoder.cpp",
518 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700519 "src/codec/SkBmpCodec.cpp",
520 "src/codec/SkBmpMaskCodec.cpp",
521 "src/codec/SkBmpRLECodec.cpp",
522 "src/codec/SkBmpStandardCodec.cpp",
523 "src/codec/SkCodec.cpp",
524 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700525 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700526 "src/codec/SkMaskSwizzler.cpp",
527 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700528 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700529 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700530 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700531 "src/codec/SkSwizzler.cpp",
532 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700533 "src/images/SkImageEncoder.cpp",
534 "src/images/SkImageEncoder_Factory.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700535 "src/images/SkKTXImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700536 "src/ports/SkDiscardableMemory_none.cpp",
537 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700538 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700539 "src/ports/SkMemory_malloc.cpp",
540 "src/ports/SkOSFile_stdio.cpp",
541 "src/sfnt/SkOTTable_name.cpp",
542 "src/sfnt/SkOTUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700543 "src/svg/SkSVGCanvas.cpp",
544 "src/svg/SkSVGDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700545 "src/utils/mac/SkStream_mac.cpp",
546 "third_party/etc1/etc1.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700547 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700548 "third_party/ktx/ktx.cpp",
549 ]
brettwb9447282016-09-01 14:24:39 -0700550
mtklein7d6fb2c2016-08-25 14:50:44 -0700551 libs = []
552
mtkleinc04ff472016-06-23 10:29:30 -0700553 if (is_win) {
554 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400555 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700556 "src/ports/SkDebug_win.cpp",
557 "src/ports/SkFontHost_win.cpp",
558 "src/ports/SkFontMgr_win_dw.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700559 "src/ports/SkImageEncoder_WIC.cpp",
560 "src/ports/SkImageGeneratorWIC.cpp",
561 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700562 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700563 "src/ports/SkScalerContext_win_dw.cpp",
564 "src/ports/SkTLS_win.cpp",
565 "src/ports/SkTypeface_win_dw.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700566 "src/xps/SkDocument_XPS.cpp",
Mike Klein4b167fc2016-10-11 18:13:53 -0400567 "src/xps/SkXPSDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700568 ]
Mike Klein69f6ed42016-10-13 15:45:07 -0400569 if (skia_use_gdi) {
570 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
571 libs += [
572 "Gdi32.lib",
573 "Usp10.lib",
574 ]
575 } else {
576 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
577 }
mtkleinb9be9792016-09-16 14:44:18 -0700578 sources -=
579 [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400580 libs += [
581 "FontSub.lib",
582 "Ole32.lib",
583 "OleAut32.lib",
584 "User32.lib",
585 ]
mtkleinc04ff472016-06-23 10:29:30 -0700586 } else {
587 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700588 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700589 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700590 "src/ports/SkTLS_pthread.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700591 "src/xps/SkDocument_XPS_None.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700592 ]
593 }
594
mtklein7d6fb2c2016-08-25 14:50:44 -0700595 if (is_android) {
596 deps += [
597 "//third_party/cpu-features",
598 "//third_party/expat",
mtklein7d6fb2c2016-08-25 14:50:44 -0700599 ]
mtklein06c35c02016-09-20 12:28:12 -0700600 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700601 libs += [
602 "EGL",
603 "GLESv2",
604 "log",
605 ]
606 }
607
mtkleinc04ff472016-06-23 10:29:30 -0700608 if (is_linux) {
mtklein09e61f72016-08-23 13:35:28 -0700609 libs += [
610 "GL",
611 "GLU",
612 "X11",
613 ]
mtklein06c35c02016-09-20 12:28:12 -0700614 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700615 }
616
617 if (is_mac) {
618 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700619 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700620 "src/ports/SkFontHost_mac.cpp",
621 "src/ports/SkImageEncoder_CG.cpp",
622 "src/ports/SkImageGeneratorCG.cpp",
623 ]
mtklein09e61f72016-08-23 13:35:28 -0700624 libs += [
625 "ApplicationServices.framework",
626 "OpenGL.framework",
627 ]
mtkleinc04ff472016-06-23 10:29:30 -0700628 }
abarth6fc8ff02016-07-15 15:15:15 -0700629
630 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700631 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700632 }
mtkleinc04ff472016-06-23 10:29:30 -0700633}
634
mtkleinada5a442016-08-02 14:28:26 -0700635skia_h_headers = exec_script("gyp/find.py",
636 [ "*.h" ] + rebase_path(skia_public_includes),
637 "list lines",
638 []) -
639 [
640 rebase_path("include/gpu/gl/GrGLConfig_chrome.h"),
641 rebase_path("include/gpu/vk/GrVkBackendContext.h"),
642 rebase_path("include/gpu/vk/GrVkDefines.h"),
643 rebase_path("include/gpu/vk/GrVkInterface.h"),
644 rebase_path("include/gpu/vk/GrVkTypes.h"),
645 rebase_path("include/ports/SkFontMgr_fontconfig.h"),
646 ]
647
mtklein1211e0c2016-07-26 13:55:45 -0700648action("skia.h") {
649 script = "gn/echo_headers.py"
650 args = [ rebase_path("$target_gen_dir/skia.h", root_build_dir) ] +
mtkleinc095df52016-08-24 12:23:52 -0700651 rebase_path(skia_h_headers, target_gen_dir)
Ben Wagnerbc344042016-09-29 15:41:53 -0400652 inputs = skia_h_headers
mtklein1211e0c2016-07-26 13:55:45 -0700653 outputs = [
654 "$target_gen_dir/skia.h",
655 ]
656}
657
mtklein06c35c02016-09-20 12:28:12 -0700658if (skia_enable_gpu && target_cpu == "x64") {
mtklein1fbdf982016-09-15 12:07:48 -0700659 # Our bots only have 64-bit libOSMesa installed.
660 # TODO: worth fixing?
661 executable("fiddle") {
662 include_dirs = [ "$target_gen_dir" ]
663 libs = []
664 if (is_linux) {
665 libs += [ "OSMesa" ]
666 }
mtklein56d56692016-09-15 11:18:55 -0700667
mtklein1fbdf982016-09-15 12:07:48 -0700668 sources = [
669 "src/images/SkForceLinking.cpp",
670 "tools/fiddle/draw.cpp",
671 "tools/fiddle/fiddle_main.cpp",
672 ]
673 deps = [
674 ":skia",
675 ":skia.h",
676 ]
677 }
mtkleinc04ff472016-06-23 10:29:30 -0700678}
mtklein25c81d42016-07-27 13:55:26 -0700679
mtkleinc095df52016-08-24 12:23:52 -0700680# Targets guarded by skia_enable_tools may use //third_party freely.
681if (skia_enable_tools) {
682 template("test_lib") {
683 config(target_name + "_config") {
684 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700685 if (defined(invoker.public_defines)) {
686 defines = invoker.public_defines
687 }
mtklein25c81d42016-07-27 13:55:26 -0700688 }
mtkleinc095df52016-08-24 12:23:52 -0700689 source_set(target_name) {
690 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
691 public_configs = [
692 ":" + target_name + "_config",
693 ":skia_private",
694 ]
695
696 if (!defined(deps)) {
697 deps = []
698 }
699 deps += [ ":skia" ]
700 testonly = true
701 }
mtklein25c81d42016-07-27 13:55:26 -0700702 }
mtklein25c81d42016-07-27 13:55:26 -0700703
mtkleinc095df52016-08-24 12:23:52 -0700704 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700705 public_include_dirs = []
706 if (skia_enable_gpu) {
707 public_defines = []
708 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700709
710 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700711 sources = [
712 "tools/gpu/GrContextFactory.cpp",
713 "tools/gpu/GrTest.cpp",
714 "tools/gpu/TestContext.cpp",
715 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -0700716 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700717 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
718 "tools/gpu/gl/debug/GrBufferObj.cpp",
719 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
720 "tools/gpu/gl/debug/GrProgramObj.cpp",
721 "tools/gpu/gl/debug/GrShaderObj.cpp",
722 "tools/gpu/gl/debug/GrTextureObj.cpp",
723 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
724 "tools/gpu/gl/null/NullGLTestContext.cpp",
725 ]
726 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700727
mtklein38925aa2016-09-21 10:11:25 -0700728 if (is_android) {
729 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
730 } else if (is_linux) {
731 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
732 } else if (is_mac) {
733 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400734 } else if (is_win) {
735 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
736 libs += [
737 "Gdi32.lib",
738 "OpenGL32.lib",
739 ]
mtklein38925aa2016-09-21 10:11:25 -0700740 }
mtklein6ef69992016-09-14 06:12:09 -0700741
mtkleind68f9b02016-09-23 13:18:41 -0700742 if (skia_use_angle) {
743 public_defines += [ "SK_ANGLE" ]
744 deps += [ "//third_party/angle2" ]
745 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
mtklein38925aa2016-09-21 10:11:25 -0700746 }
747 if (skia_use_mesa) {
748 public_defines += [ "SK_MESA" ]
749 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
750 libs += [ "OSMesa" ]
751 }
mtkleind68f9b02016-09-23 13:18:41 -0700752 if (skia_use_vulkan) {
753 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
754 }
mtkleina627b5c2016-09-20 13:36:47 -0700755 }
mtklein25c81d42016-07-27 13:55:26 -0700756 }
mtklein25c81d42016-07-27 13:55:26 -0700757
mtkleinc095df52016-08-24 12:23:52 -0700758 test_lib("flags") {
759 public_include_dirs = [ "tools/flags" ]
760 sources = [
761 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -0700762 ]
763 }
764 test_lib("common_flags") {
765 public_include_dirs = [ "tools/flags" ]
766 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700767 "tools/flags/SkCommonFlags.cpp",
768 "tools/flags/SkCommonFlagsConfig.cpp",
769 ]
770 deps = [
mtklein046cb562016-09-16 10:23:12 -0700771 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700772 ":gpu_tool_utils",
773 ]
774 }
mtklein25c81d42016-07-27 13:55:26 -0700775
mtkleinc095df52016-08-24 12:23:52 -0700776 test_lib("tool_utils") {
777 public_include_dirs = [
778 "tools",
779 "tools/debugger",
780 "tools/timer",
781 ]
782 sources = [
783 "src/images/SkForceLinking.cpp",
784 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
mtkleinb37c0342016-09-09 11:07:45 -0700785 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700786 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700787 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700788 "tools/ProcStats.cpp",
789 "tools/Resources.cpp",
790 "tools/ThermalManager.cpp",
791 "tools/UrlDataManager.cpp",
792 "tools/debugger/SkDebugCanvas.cpp",
793 "tools/debugger/SkDrawCommand.cpp",
794 "tools/debugger/SkJsonWriteBuffer.cpp",
795 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700796 "tools/picture_utils.cpp",
797 "tools/random_parse_path.cpp",
798 "tools/sk_tool_utils.cpp",
799 "tools/sk_tool_utils_font.cpp",
800 "tools/timer/Timer.cpp",
801 ]
802 deps = [
mtklein046cb562016-09-16 10:23:12 -0700803 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -0700804 ":flags",
805 "//third_party/libpng",
806 ]
807 public_deps = [
808 "//third_party/jsoncpp",
809 ]
810 }
mtklein25c81d42016-07-27 13:55:26 -0700811
Mike Klein6e744122016-10-27 12:21:40 -0400812 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -0700813 test_lib("gm") {
814 public_include_dirs = [ "gm" ]
815 sources = gm_sources
816 deps = [
scroggo19b91532016-10-24 09:03:26 -0700817 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700818 ":gpu_tool_utils",
819 ":skia",
820 ":tool_utils",
821 ]
822 }
mtklein25c81d42016-07-27 13:55:26 -0700823
Mike Klein6e744122016-10-27 12:21:40 -0400824 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -0700825 test_lib("tests") {
826 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -0400827 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -0700828 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -0400829 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700830 }
mtkleinc095df52016-08-24 12:23:52 -0700831 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700832 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700833 ":flags",
834 ":gpu_tool_utils",
835 ":skia",
836 ":tool_utils",
837 "//third_party/libpng",
838 "//third_party/zlib",
839 ]
840 }
mtklein2f3416d2016-08-02 16:02:05 -0700841
Mike Klein6e744122016-10-27 12:21:40 -0400842 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -0700843 test_lib("bench") {
844 public_include_dirs = [ "bench" ]
845 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -0700846 deps = [
847 ":flags",
848 ":gm",
849 ":gpu_tool_utils",
850 ":skia",
851 ":tool_utils",
852 ]
853 }
mtklein2b6870c2016-07-28 14:17:33 -0700854
mtkleinc095df52016-08-24 12:23:52 -0700855 test_lib("experimental_svg_model") {
856 public_include_dirs = [ "experimental/svg/model" ]
857 sources = [
858 "experimental/svg/model/SkSVGAttribute.cpp",
859 "experimental/svg/model/SkSVGAttributeParser.cpp",
860 "experimental/svg/model/SkSVGCircle.cpp",
861 "experimental/svg/model/SkSVGContainer.cpp",
862 "experimental/svg/model/SkSVGDOM.cpp",
863 "experimental/svg/model/SkSVGEllipse.cpp",
864 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700865 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700866 "experimental/svg/model/SkSVGNode.cpp",
867 "experimental/svg/model/SkSVGPath.cpp",
868 "experimental/svg/model/SkSVGPoly.cpp",
869 "experimental/svg/model/SkSVGRect.cpp",
870 "experimental/svg/model/SkSVGRenderContext.cpp",
871 "experimental/svg/model/SkSVGSVG.cpp",
872 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700873 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700874 "experimental/svg/model/SkSVGTransformableNode.cpp",
875 "experimental/svg/model/SkSVGValue.cpp",
876 ]
877 deps = [
878 ":skia",
879 ]
880 }
fmalitaa2b9fdf2016-08-03 19:53:36 -0700881
Brian Osman16adfa32016-10-18 14:42:44 -0400882 test_lib("views") {
883 public_include_dirs = [ "include/views" ]
884 sources = [
885 "src/views/SkEvent.cpp",
886 "src/views/SkEventSink.cpp",
887 "src/views/SkOSMenu.cpp",
888 "src/views/SkTagList.cpp",
889 "src/views/SkTouchGesture.cpp",
890 "src/views/SkView.cpp",
891 "src/views/SkViewPriv.cpp",
892 ]
893 libs = []
894 if (!is_android) {
895 sources += [ "src/views/SkWindow.cpp" ]
896 }
Jim Van Verth4e56a912016-10-21 10:58:52 -0400897 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -0400898 public_include_dirs += [ "src/views/unix" ]
899 sources += [
900 "src/views/unix/SkOSWindow_Unix.cpp",
901 "src/views/unix/keysym2ucs.c",
902 ]
Brian Osman16adfa32016-10-18 14:42:44 -0400903 } else if (is_mac) {
904 sources += [
905 "src/views/mac/SkEventNotifier.mm",
906 "src/views/mac/SkNSView.mm",
907 "src/views/mac/SkOSWindow_Mac.mm",
908 "src/views/mac/SkTextFieldCell.m",
909 ]
910 libs += [
911 "QuartzCore.framework",
912 "Cocoa.framework",
913 "Foundation.framework",
914 ]
915 } else if (is_win) {
916 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
917 }
918 }
919
Mike Klein6e744122016-10-27 12:21:40 -0400920 import("gn/samples.gni")
Brian Osman16adfa32016-10-18 14:42:44 -0400921 test_lib("samples") {
Brian Osman16adfa32016-10-18 14:42:44 -0400922 public_include_dirs = [ "samplecode" ]
Mike Klein6e744122016-10-27 12:21:40 -0400923 include_dirs = [ "experimental" ]
924 sources = samples_sources + [
925 "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp",
926 "experimental/SkSetPoly3To3.cpp",
927 "experimental/SkSetPoly3To3_A.cpp",
928 "experimental/SkSetPoly3To3_D.cpp",
929 ]
Brian Osman16adfa32016-10-18 14:42:44 -0400930 deps = [
931 ":experimental_svg_model",
Mike Klein6e744122016-10-27 12:21:40 -0400932 ":gm",
Brian Osman16adfa32016-10-18 14:42:44 -0400933 ":tool_utils",
934 ":views",
935 ":xml",
936 ]
937 }
938
mtklein2b6870c2016-07-28 14:17:33 -0700939 executable("dm") {
940 sources = [
941 "dm/DM.cpp",
942 "dm/DMJsonWriter.cpp",
943 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700944 ]
945 include_dirs = [ "tests" ]
946 deps = [
mtklein046cb562016-09-16 10:23:12 -0700947 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -0700948 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -0700949 ":flags",
950 ":gm",
951 ":gpu_tool_utils",
952 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -0700953 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -0700954 ":tool_utils",
955 "//third_party/jsoncpp",
956 "//third_party/libpng",
957 ]
958 testonly = true
959 }
960
Mike Kleina3430172016-09-27 16:46:29 -0400961 if (!is_debug) { # I've benchmarked debug code once too many times...
962 executable("monobench") {
963 sources = [
964 "tools/monobench.cpp",
965 ]
966 deps = [
967 ":bench",
968 ":skia",
969 ]
970 testonly = true
971 }
mtklein2b6870c2016-07-28 14:17:33 -0700972 }
973
974 executable("nanobench") {
975 sources = [
976 "bench/nanobench.cpp",
977 ]
978 deps = [
979 ":bench",
mtklein046cb562016-09-16 10:23:12 -0700980 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -0700981 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -0700982 ":flags",
983 ":gm",
984 ":gpu_tool_utils",
985 ":skia",
986 ":tool_utils",
987 "//third_party/jsoncpp",
988 ]
989 testonly = true
990 }
halcanary19a97202016-08-03 15:08:04 -0700991
mtklein38925aa2016-09-21 10:11:25 -0700992 if (skia_enable_gpu) {
993 executable("skpbench") {
994 sources = [
995 "tools/skpbench/skpbench.cpp",
996 ]
997 deps = [
998 ":flags",
999 ":gpu_tool_utils",
1000 ":skia",
1001 ":tool_utils",
1002 ]
1003 testonly = true
1004 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001005 }
1006
Mike Klein4b167fc2016-10-11 18:13:53 -04001007 # We can't yet build ICU on Windows.
Mike Klein768bdfc2016-10-11 19:59:22 -04001008 if (!is_win) {
halcanary3eee9d92016-09-10 07:01:53 -07001009 executable("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001010 sources = [
1011 "tools/SkShaper_harfbuzz.cpp",
1012 "tools/using_skia_and_harfbuzz.cpp",
1013 ]
1014 deps = [
1015 ":skia",
1016 "//third_party/harfbuzz",
1017 ]
1018 testonly = true
1019 }
halcanary19a97202016-08-03 15:08:04 -07001020 }
halcanary3eee9d92016-09-10 07:01:53 -07001021 executable("sktexttopdf") {
1022 sources = [
1023 "tools/SkShaper_primitive.cpp",
1024 "tools/using_skia_and_harfbuzz.cpp",
1025 ]
1026 deps = [
1027 ":skia",
1028 ]
1029 testonly = true
1030 }
mtklein046cb562016-09-16 10:23:12 -07001031
1032 executable("get_images_from_skps") {
1033 sources = [
1034 "tools/get_images_from_skps.cpp",
1035 ]
1036 deps = [
1037 ":flags",
1038 ":skia",
1039 "//third_party/jsoncpp",
1040 ]
1041 testonly = true
1042 }
mtkleinecbc5262016-09-22 11:51:24 -07001043
1044 executable("skiaserve") {
1045 sources = [
1046 "tools/skiaserve/Request.cpp",
1047 "tools/skiaserve/Response.cpp",
1048 "tools/skiaserve/skiaserve.cpp",
1049 "tools/skiaserve/urlhandlers/BatchBoundsHandler.cpp",
1050 "tools/skiaserve/urlhandlers/BatchesHandler.cpp",
1051 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1052 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1053 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1054 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1055 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1056 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1057 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1058 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1059 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Ben Wagnerc03e1c52016-10-17 15:20:02 -04001060 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
mtkleinecbc5262016-09-22 11:51:24 -07001061 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1062 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1063 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1064 ]
1065 deps = [
1066 ":flags",
1067 ":gpu_tool_utils",
1068 ":skia",
1069 ":tool_utils",
1070 "//third_party/jsoncpp",
1071 "//third_party/libmicrohttpd",
1072 "//third_party/libpng",
1073 ]
1074 testonly = true
1075 }
kjlubick14f984b2016-10-03 11:49:45 -07001076
1077 executable("fuzz") {
Mike Klein6e55fef2016-10-26 11:41:47 -04001078 if (is_skia_standalone) {
1079 configs -= [ "//gn:no_exceptions" ]
1080 }
kjlubick14f984b2016-10-03 11:49:45 -07001081 sources = [
1082 "fuzz/FilterFuzz.cpp",
1083 "fuzz/FuzzGradients.cpp",
1084 "fuzz/FuzzParsePath.cpp",
1085 "fuzz/FuzzPathop.cpp",
1086 "fuzz/FuzzScaleToSides.cpp",
1087 "fuzz/fuzz.cpp",
1088 ]
1089 deps = [
1090 ":flags",
1091 ":skia",
1092 ]
1093 testonly = true
1094 }
Mike Klein38312422016-10-05 15:41:01 -04001095
caryclark9feb6322016-10-25 08:58:26 -07001096 executable("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001097 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001098 rebase_path("tests/skia_test.cpp"),
1099 rebase_path("tests/Test.cpp"),
1100 ]
caryclark9feb6322016-10-25 08:58:26 -07001101 deps = [
1102 ":flags",
1103 ":gpu_tool_utils",
1104 ":skia",
1105 ":tool_utils",
1106 ]
1107 testonly = true
1108 }
1109
Mike Klein38312422016-10-05 15:41:01 -04001110 executable("dump_record") {
1111 sources = [
1112 "tools/DumpRecord.cpp",
1113 "tools/dump_record.cpp",
1114 ]
1115 deps = [
1116 ":flags",
1117 ":skia",
1118 ]
1119 testonly = true
1120 }
bungemanfe917272016-10-13 17:36:40 -04001121
1122 executable("skdiff") {
1123 sources = [
1124 "tools/skdiff/skdiff.cpp",
1125 "tools/skdiff/skdiff_html.cpp",
1126 "tools/skdiff/skdiff_main.cpp",
1127 "tools/skdiff/skdiff_utils.cpp",
1128 ]
1129 deps = [
1130 ":skia",
1131 ":tool_utils",
1132 ]
1133 testonly = true
1134 }
halcanarya73d76a2016-10-17 13:19:02 -07001135
1136 executable("skp_parser") {
1137 sources = [
1138 "tools/skp_parser.cpp",
1139 ]
1140 deps = [
1141 ":skia",
1142 ":tool_utils",
1143 "//third_party/jsoncpp",
1144 ]
1145 testonly = true
1146 }
Brian Osman16adfa32016-10-18 14:42:44 -04001147
Mike Klein43c25262016-10-20 10:17:47 -04001148 if (skia_enable_gpu && (is_linux || is_win || is_mac)) {
Brian Osman16adfa32016-10-18 14:42:44 -04001149 executable("viewer") {
1150 sources = [
1151 "tools/viewer/GMSlide.cpp",
1152 "tools/viewer/ImageSlide.cpp",
1153 "tools/viewer/SKPSlide.cpp",
1154 "tools/viewer/SampleSlide.cpp",
1155 "tools/viewer/Viewer.cpp",
1156 "tools/viewer/sk_app/CommandSet.cpp",
1157 "tools/viewer/sk_app/GLWindowContext.cpp",
1158 "tools/viewer/sk_app/Window.cpp",
1159 "tools/viewer/sk_app/WindowContext.cpp",
1160 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001161 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001162
Jim Van Verth4e56a912016-10-21 10:58:52 -04001163 if (is_android) {
1164 sources += [
1165 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1166 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1167 "tools/viewer/sk_app/android/Window_android.cpp",
1168 "tools/viewer/sk_app/android/main_android.cpp",
1169 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1170 ]
1171 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001172 sources += [
1173 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1174 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1175 "tools/viewer/sk_app/unix/Window_unix.cpp",
1176 "tools/viewer/sk_app/unix/main_unix.cpp",
1177 ]
1178 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001179 sources += [
1180 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1181 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1182 "tools/viewer/sk_app/win/Window_win.cpp",
1183 "tools/viewer/sk_app/win/main_win.cpp",
1184 ]
Mike Klein43c25262016-10-20 10:17:47 -04001185 } else if (is_mac) {
1186 sources += [
1187 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1188 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1189 "tools/viewer/sk_app/mac/Window_mac.cpp",
1190 "tools/viewer/sk_app/mac/main_mac.cpp",
1191 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001192 }
1193
1194 if (skia_use_vulkan) {
1195 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001196 if (is_android) {
1197 sources +=
1198 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
1199 libs += [ "android" ]
1200 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001201 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1202 libs += [ "X11-xcb" ]
1203 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001204 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1205 }
1206 }
1207
1208 include_dirs = []
1209 deps = [
1210 ":flags",
1211 ":gm",
1212 ":gpu_tool_utils",
1213 ":samples",
1214 ":skia",
1215 ":tool_utils",
1216 ":views",
1217 "//third_party/jsoncpp",
1218 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001219 if (is_android) {
1220 deps += [ "//third_party/native_app_glue" ]
1221 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001222 deps += [ "//third_party/libsdl" ]
1223 }
Brian Osman16adfa32016-10-18 14:42:44 -04001224 testonly = true
1225 }
1226 }
mtklein25c81d42016-07-27 13:55:26 -07001227}