blob: e41166b14c6115feb20ed3916e764270a1c02029 [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
mtkleinc095df52016-08-24 12:23:52 -0700812 gm_sources = exec_script("gyp/find.py",
813 [
814 "*.c*",
815 rebase_path("gm"),
816 ],
817 "list lines",
818 [])
819 test_lib("gm") {
820 public_include_dirs = [ "gm" ]
821 sources = gm_sources
822 deps = [
scroggo19b91532016-10-24 09:03:26 -0700823 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700824 ":gpu_tool_utils",
825 ":skia",
826 ":tool_utils",
827 ]
828 }
mtklein25c81d42016-07-27 13:55:26 -0700829
mtkleinc095df52016-08-24 12:23:52 -0700830 tests_sources = exec_script("gyp/find.py",
831 [
832 "*.c*",
833 rebase_path("tests"),
834 ],
835 "list lines",
836 [])
mtklein2f3416d2016-08-02 16:02:05 -0700837
mtkleinc095df52016-08-24 12:23:52 -0700838 test_lib("tests") {
839 public_include_dirs = [ "tests" ]
mtkleina45be612016-08-29 15:22:10 -0700840 sources = tests_sources - [
841 rebase_path("tests/PathOpsSkpClipTest.cpp"), # alternate main
mtkleina45be612016-08-29 15:22:10 -0700842 rebase_path("tests/SkpSkGrTest.cpp"), # doesn't compile
843 rebase_path("tests/skia_test.cpp"), # alternate main
844 ]
845 if (!fontmgr_android_enabled) {
846 sources -= [ rebase_path("tests/FontMgrAndroidParserTest.cpp") ]
847 }
mtkleinc095df52016-08-24 12:23:52 -0700848 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700849 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700850 ":flags",
851 ":gpu_tool_utils",
852 ":skia",
853 ":tool_utils",
854 "//third_party/libpng",
855 "//third_party/zlib",
856 ]
857 }
mtklein2f3416d2016-08-02 16:02:05 -0700858
mtkleinc095df52016-08-24 12:23:52 -0700859 bench_sources = exec_script("gyp/find.py",
860 [
861 "*.c*",
862 rebase_path("bench"),
863 ],
864 "list lines",
865 [])
mtklein25c81d42016-07-27 13:55:26 -0700866
mtkleinc095df52016-08-24 12:23:52 -0700867 test_lib("bench") {
868 public_include_dirs = [ "bench" ]
869 sources = bench_sources
870 sources -= [
871 rebase_path("bench/nanobench.cpp"),
872 rebase_path("bench/nanobenchAndroid.cpp"),
873 ]
874 deps = [
875 ":flags",
876 ":gm",
877 ":gpu_tool_utils",
878 ":skia",
879 ":tool_utils",
880 ]
881 }
mtklein2b6870c2016-07-28 14:17:33 -0700882
mtkleinc095df52016-08-24 12:23:52 -0700883 test_lib("experimental_svg_model") {
884 public_include_dirs = [ "experimental/svg/model" ]
885 sources = [
886 "experimental/svg/model/SkSVGAttribute.cpp",
887 "experimental/svg/model/SkSVGAttributeParser.cpp",
888 "experimental/svg/model/SkSVGCircle.cpp",
889 "experimental/svg/model/SkSVGContainer.cpp",
890 "experimental/svg/model/SkSVGDOM.cpp",
891 "experimental/svg/model/SkSVGEllipse.cpp",
892 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700893 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700894 "experimental/svg/model/SkSVGNode.cpp",
895 "experimental/svg/model/SkSVGPath.cpp",
896 "experimental/svg/model/SkSVGPoly.cpp",
897 "experimental/svg/model/SkSVGRect.cpp",
898 "experimental/svg/model/SkSVGRenderContext.cpp",
899 "experimental/svg/model/SkSVGSVG.cpp",
900 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700901 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700902 "experimental/svg/model/SkSVGTransformableNode.cpp",
903 "experimental/svg/model/SkSVGValue.cpp",
904 ]
905 deps = [
906 ":skia",
907 ]
908 }
fmalitaa2b9fdf2016-08-03 19:53:36 -0700909
Brian Osman16adfa32016-10-18 14:42:44 -0400910 test_lib("views") {
911 public_include_dirs = [ "include/views" ]
912 sources = [
913 "src/views/SkEvent.cpp",
914 "src/views/SkEventSink.cpp",
915 "src/views/SkOSMenu.cpp",
916 "src/views/SkTagList.cpp",
917 "src/views/SkTouchGesture.cpp",
918 "src/views/SkView.cpp",
919 "src/views/SkViewPriv.cpp",
920 ]
921 libs = []
922 if (!is_android) {
923 sources += [ "src/views/SkWindow.cpp" ]
924 }
Jim Van Verth4e56a912016-10-21 10:58:52 -0400925 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -0400926 public_include_dirs += [ "src/views/unix" ]
927 sources += [
928 "src/views/unix/SkOSWindow_Unix.cpp",
929 "src/views/unix/keysym2ucs.c",
930 ]
Brian Osman16adfa32016-10-18 14:42:44 -0400931 } else if (is_mac) {
932 sources += [
933 "src/views/mac/SkEventNotifier.mm",
934 "src/views/mac/SkNSView.mm",
935 "src/views/mac/SkOSWindow_Mac.mm",
936 "src/views/mac/SkTextFieldCell.m",
937 ]
938 libs += [
939 "QuartzCore.framework",
940 "Cocoa.framework",
941 "Foundation.framework",
942 ]
943 } else if (is_win) {
944 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
945 }
946 }
947
948 sample_sources = exec_script("gyp/find.py",
949 [
950 "*.c*",
951 rebase_path("samplecode"),
952 ],
953 "list lines",
954 [])
955
956 test_lib("samples") {
957 include_dirs = [ "experimental" ]
958 public_include_dirs = [ "samplecode" ]
959 sources = sample_sources
960 sources -= [
961 rebase_path("samplecode/SampleAnimator.cpp"), # relies on animator
962 rebase_path("samplecode/SampleApp.cpp"), # part of SampleApp exe, not samples lib
963 rebase_path("samplecode/SampleClamp.cpp"),
964 rebase_path("samplecode/SampleDash.cpp"),
965 rebase_path("samplecode/SampleLua.cpp"), # no Lua yet in GN
966 rebase_path("samplecode/SamplePathFill.cpp"),
967 rebase_path("samplecode/SamplePictFile.cpp"), # relies on SK_SUPPORT_LEGACY_DRAWFILTER
968 rebase_path("samplecode/SampleSkLayer.cpp"), # relies on SkMatrix44 which doesn't compile?
969 rebase_path("samplecode/SampleFontCache.cpp"), # relies on pthread.h
970 ]
971 sources += [
972 "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp",
973 "experimental/SkSetPoly3To3.cpp",
974 "experimental/SkSetPoly3To3_A.cpp",
975 "experimental/SkSetPoly3To3_D.cpp",
976 ]
977 deps = [
978 ":experimental_svg_model",
979 ":gm", # Why does SampleFilterQuality.cpp include gm.h ???
980 ":tool_utils",
981 ":views",
982 ":xml",
983 ]
984 }
985
mtklein2b6870c2016-07-28 14:17:33 -0700986 executable("dm") {
987 sources = [
988 "dm/DM.cpp",
989 "dm/DMJsonWriter.cpp",
990 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700991 ]
992 include_dirs = [ "tests" ]
993 deps = [
mtklein046cb562016-09-16 10:23:12 -0700994 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -0700995 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -0700996 ":flags",
997 ":gm",
998 ":gpu_tool_utils",
999 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -07001000 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -07001001 ":tool_utils",
1002 "//third_party/jsoncpp",
1003 "//third_party/libpng",
1004 ]
1005 testonly = true
1006 }
1007
Mike Kleina3430172016-09-27 16:46:29 -04001008 if (!is_debug) { # I've benchmarked debug code once too many times...
1009 executable("monobench") {
1010 sources = [
1011 "tools/monobench.cpp",
1012 ]
1013 deps = [
1014 ":bench",
1015 ":skia",
1016 ]
1017 testonly = true
1018 }
mtklein2b6870c2016-07-28 14:17:33 -07001019 }
1020
1021 executable("nanobench") {
1022 sources = [
1023 "bench/nanobench.cpp",
1024 ]
1025 deps = [
1026 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001027 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001028 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001029 ":flags",
1030 ":gm",
1031 ":gpu_tool_utils",
1032 ":skia",
1033 ":tool_utils",
1034 "//third_party/jsoncpp",
1035 ]
1036 testonly = true
1037 }
halcanary19a97202016-08-03 15:08:04 -07001038
mtklein38925aa2016-09-21 10:11:25 -07001039 if (skia_enable_gpu) {
1040 executable("skpbench") {
1041 sources = [
1042 "tools/skpbench/skpbench.cpp",
1043 ]
1044 deps = [
1045 ":flags",
1046 ":gpu_tool_utils",
1047 ":skia",
1048 ":tool_utils",
1049 ]
1050 testonly = true
1051 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001052 }
1053
Mike Klein4b167fc2016-10-11 18:13:53 -04001054 # We can't yet build ICU on Windows.
Mike Klein768bdfc2016-10-11 19:59:22 -04001055 if (!is_win) {
halcanary3eee9d92016-09-10 07:01:53 -07001056 executable("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001057 sources = [
1058 "tools/SkShaper_harfbuzz.cpp",
1059 "tools/using_skia_and_harfbuzz.cpp",
1060 ]
1061 deps = [
1062 ":skia",
1063 "//third_party/harfbuzz",
1064 ]
1065 testonly = true
1066 }
halcanary19a97202016-08-03 15:08:04 -07001067 }
halcanary3eee9d92016-09-10 07:01:53 -07001068 executable("sktexttopdf") {
1069 sources = [
1070 "tools/SkShaper_primitive.cpp",
1071 "tools/using_skia_and_harfbuzz.cpp",
1072 ]
1073 deps = [
1074 ":skia",
1075 ]
1076 testonly = true
1077 }
mtklein046cb562016-09-16 10:23:12 -07001078
1079 executable("get_images_from_skps") {
1080 sources = [
1081 "tools/get_images_from_skps.cpp",
1082 ]
1083 deps = [
1084 ":flags",
1085 ":skia",
1086 "//third_party/jsoncpp",
1087 ]
1088 testonly = true
1089 }
mtkleinecbc5262016-09-22 11:51:24 -07001090
1091 executable("skiaserve") {
1092 sources = [
1093 "tools/skiaserve/Request.cpp",
1094 "tools/skiaserve/Response.cpp",
1095 "tools/skiaserve/skiaserve.cpp",
1096 "tools/skiaserve/urlhandlers/BatchBoundsHandler.cpp",
1097 "tools/skiaserve/urlhandlers/BatchesHandler.cpp",
1098 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1099 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1100 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1101 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1102 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1103 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1104 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1105 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1106 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Ben Wagnerc03e1c52016-10-17 15:20:02 -04001107 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
mtkleinecbc5262016-09-22 11:51:24 -07001108 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1109 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1110 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1111 ]
1112 deps = [
1113 ":flags",
1114 ":gpu_tool_utils",
1115 ":skia",
1116 ":tool_utils",
1117 "//third_party/jsoncpp",
1118 "//third_party/libmicrohttpd",
1119 "//third_party/libpng",
1120 ]
1121 testonly = true
1122 }
kjlubick14f984b2016-10-03 11:49:45 -07001123
1124 executable("fuzz") {
Mike Klein6e55fef2016-10-26 11:41:47 -04001125 if (is_skia_standalone) {
1126 configs -= [ "//gn:no_exceptions" ]
1127 }
kjlubick14f984b2016-10-03 11:49:45 -07001128 sources = [
1129 "fuzz/FilterFuzz.cpp",
1130 "fuzz/FuzzGradients.cpp",
1131 "fuzz/FuzzParsePath.cpp",
1132 "fuzz/FuzzPathop.cpp",
1133 "fuzz/FuzzScaleToSides.cpp",
1134 "fuzz/fuzz.cpp",
1135 ]
1136 deps = [
1137 ":flags",
1138 ":skia",
1139 ]
1140 testonly = true
1141 }
Mike Klein38312422016-10-05 15:41:01 -04001142
caryclark9feb6322016-10-25 08:58:26 -07001143 pathops_tests_sources = exec_script("gyp/find.py",
1144 [
1145 "PathOps*.cpp",
1146 rebase_path("tests"),
1147 ],
1148 "list lines",
1149 [])
1150
1151 executable("pathops_unittest") {
Mike Klein6e55fef2016-10-26 11:41:47 -04001152 sources = pathops_tests_sources -
1153 [ rebase_path("tests/PathOpsSkpClipTest.cpp") ] +
1154 [
1155 rebase_path("tests/skia_test.cpp"),
1156 rebase_path("tests/Test.cpp"),
1157 ]
caryclark9feb6322016-10-25 08:58:26 -07001158 deps = [
1159 ":flags",
1160 ":gpu_tool_utils",
1161 ":skia",
1162 ":tool_utils",
1163 ]
1164 testonly = true
1165 }
1166
Mike Klein38312422016-10-05 15:41:01 -04001167 executable("dump_record") {
1168 sources = [
1169 "tools/DumpRecord.cpp",
1170 "tools/dump_record.cpp",
1171 ]
1172 deps = [
1173 ":flags",
1174 ":skia",
1175 ]
1176 testonly = true
1177 }
bungemanfe917272016-10-13 17:36:40 -04001178
1179 executable("skdiff") {
1180 sources = [
1181 "tools/skdiff/skdiff.cpp",
1182 "tools/skdiff/skdiff_html.cpp",
1183 "tools/skdiff/skdiff_main.cpp",
1184 "tools/skdiff/skdiff_utils.cpp",
1185 ]
1186 deps = [
1187 ":skia",
1188 ":tool_utils",
1189 ]
1190 testonly = true
1191 }
halcanarya73d76a2016-10-17 13:19:02 -07001192
1193 executable("skp_parser") {
1194 sources = [
1195 "tools/skp_parser.cpp",
1196 ]
1197 deps = [
1198 ":skia",
1199 ":tool_utils",
1200 "//third_party/jsoncpp",
1201 ]
1202 testonly = true
1203 }
Brian Osman16adfa32016-10-18 14:42:44 -04001204
Mike Klein43c25262016-10-20 10:17:47 -04001205 if (skia_enable_gpu && (is_linux || is_win || is_mac)) {
Brian Osman16adfa32016-10-18 14:42:44 -04001206 executable("viewer") {
1207 sources = [
1208 "tools/viewer/GMSlide.cpp",
1209 "tools/viewer/ImageSlide.cpp",
1210 "tools/viewer/SKPSlide.cpp",
1211 "tools/viewer/SampleSlide.cpp",
1212 "tools/viewer/Viewer.cpp",
1213 "tools/viewer/sk_app/CommandSet.cpp",
1214 "tools/viewer/sk_app/GLWindowContext.cpp",
1215 "tools/viewer/sk_app/Window.cpp",
1216 "tools/viewer/sk_app/WindowContext.cpp",
1217 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001218 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001219
Jim Van Verth4e56a912016-10-21 10:58:52 -04001220 if (is_android) {
1221 sources += [
1222 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1223 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1224 "tools/viewer/sk_app/android/Window_android.cpp",
1225 "tools/viewer/sk_app/android/main_android.cpp",
1226 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1227 ]
1228 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001229 sources += [
1230 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1231 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1232 "tools/viewer/sk_app/unix/Window_unix.cpp",
1233 "tools/viewer/sk_app/unix/main_unix.cpp",
1234 ]
1235 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001236 sources += [
1237 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1238 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1239 "tools/viewer/sk_app/win/Window_win.cpp",
1240 "tools/viewer/sk_app/win/main_win.cpp",
1241 ]
Mike Klein43c25262016-10-20 10:17:47 -04001242 } else if (is_mac) {
1243 sources += [
1244 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1245 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1246 "tools/viewer/sk_app/mac/Window_mac.cpp",
1247 "tools/viewer/sk_app/mac/main_mac.cpp",
1248 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001249 }
1250
1251 if (skia_use_vulkan) {
1252 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001253 if (is_android) {
1254 sources +=
1255 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
1256 libs += [ "android" ]
1257 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001258 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1259 libs += [ "X11-xcb" ]
1260 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001261 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1262 }
1263 }
1264
1265 include_dirs = []
1266 deps = [
1267 ":flags",
1268 ":gm",
1269 ":gpu_tool_utils",
1270 ":samples",
1271 ":skia",
1272 ":tool_utils",
1273 ":views",
1274 "//third_party/jsoncpp",
1275 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001276 if (is_android) {
1277 deps += [ "//third_party/native_app_glue" ]
1278 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001279 deps += [ "//third_party/libsdl" ]
1280 }
Brian Osman16adfa32016-10-18 14:42:44 -04001281 testonly = true
1282 }
1283 }
mtklein25c81d42016-07-27 13:55:26 -07001284}