blob: 00f70d9c35c29257313bd3427f223721b1c6e875 [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
mikejurka8c24f4f2016-09-12 16:51:58 -07006import("gn/shared_sources.gni")
brettwb9447282016-09-01 14:24:39 -07007
mtklein3e8012e2016-09-21 09:14:19 -07008if (!defined(is_skia_standalone)) {
9 is_skia_standalone = false
10}
11
mtkleinc04ff472016-06-23 10:29:30 -070012declare_args() {
mtkleind68f9b02016-09-23 13:18:41 -070013 skia_use_angle = false
mtklein63213812016-08-24 09:55:56 -070014 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070015 skia_use_fontconfig = is_linux
mtkleincdedd0e2016-09-12 15:15:44 -070016 skia_use_freetype = is_android || is_fuchsia || is_linux
Mike Klein69f6ed42016-10-13 15:45:07 -040017 skia_use_gdi = false
mtklein63213812016-08-24 09:55:56 -070018 skia_use_libjpeg_turbo = true
19 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070020 skia_use_libwebp = !is_fuchsia
mtkleina627b5c2016-09-20 13:36:47 -070021 skia_use_mesa = false
Mike Kleinae7e6712016-10-11 17:49:33 -040022 skia_use_sfntly = !is_fuchsia && !is_win # TODO: icu on Windows, re-enable this.
mtkleinf29180e2016-09-16 07:01:17 -070023 skia_use_vulkan = is_android && defined(ndk_api) && ndk_api >= 24
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
Brian Salomon789e25e2016-09-30 13:41:03 -040030 skia_vulkan_sdk = ""
mtkleinc04ff472016-06-23 10:29:30 -070031}
32
Brian Salomon789e25e2016-09-30 13:41:03 -040033skia_use_vulkan = skia_use_vulkan || skia_vulkan_sdk != ""
34
mtklein38925aa2016-09-21 10:11:25 -070035# Our tools require static linking (they use non-exported symbols).
36skia_enable_tools = skia_enable_tools && !is_component_build
mtklein06c35c02016-09-20 12:28:12 -070037
mtkleina45be612016-08-29 15:22:10 -070038fontmgr_android_enabled = skia_use_expat && skia_use_freetype
39
mtklein1211e0c2016-07-26 13:55:45 -070040skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070041 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070042 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070043 "include/codec",
44 "include/config",
45 "include/core",
46 "include/effects",
47 "include/gpu",
48 "include/gpu/gl",
49 "include/images",
50 "include/pathops",
51 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070052 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -070053 "include/utils",
54 "include/utils/mac",
mtklein25c81d42016-07-27 13:55:26 -070055 "include/xml",
mtklein1211e0c2016-07-26 13:55:45 -070056]
57
mtkleinc04ff472016-06-23 10:29:30 -070058# Skia public API, generally provided by :skia.
59config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -070060 include_dirs = skia_public_includes
Mike Kleinae7e6712016-10-11 17:49:33 -040061 defines = []
62 if (is_component_build) {
63 defines += [ "SKIA_DLL" ]
64 }
Mike Kleinc4cbd742016-09-26 21:37:09 -040065 if (is_fuchsia || is_linux) {
jcgregorio5561e3d2016-08-25 09:25:11 -070066 defines += [ "SK_SAMPLES_FOR_X" ]
67 }
mtkleincae1be52016-09-20 08:24:34 -070068 if (skia_enable_android_framework_defines) {
69 defines += skia_android_framework_defines
70 }
mtklein06c35c02016-09-20 12:28:12 -070071 if (!skia_enable_gpu) {
72 defines += [ "SK_SUPPORT_GPU=0" ]
73 }
mtkleinc04ff472016-06-23 10:29:30 -070074}
75
76# Skia internal APIs, used by Skia itself and a few test tools.
77config("skia_private") {
78 visibility = [ ":*" ]
79
80 include_dirs = [
81 "include/private",
82 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -070083 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -070084 "src/config",
85 "src/core",
86 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -070087 "src/effects/gradients",
88 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -070089 "src/gpu",
90 "src/image",
91 "src/images",
92 "src/lazy",
93 "src/opts",
94 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -070095 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -070096 "src/ports",
97 "src/sfnt",
mtklein9e0d9dd2016-08-30 10:37:19 -070098 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -070099 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -0700100 "src/utils/win",
mtkleinc04ff472016-06-23 10:29:30 -0700101 "third_party/etc1",
scroggo19b91532016-10-24 09:03:26 -0700102 "third_party/gif",
mtkleinc04ff472016-06-23 10:29:30 -0700103 "third_party/ktx",
104 ]
mtklein150d1132016-08-01 06:56:40 -0700105
mtklein63213812016-08-24 09:55:56 -0700106 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -0700107 if (is_android) {
108 defines += [
109 "SK_GAMMA_EXPONENT=1.4",
110 "SK_GAMMA_CONTRAST=0.0",
111 ]
112 }
mtklein88a7ac02016-09-14 11:16:49 -0700113 if (is_official_build || is_android) {
114 # TODO(bsalomon): it'd be nice to make Android normal.
115 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
116 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400117 libs = []
118 lib_dirs = []
119 if (skia_use_vulkan) {
120 if (skia_vulkan_sdk != "") {
Mike Klein487bfc22016-10-14 14:04:56 -0400121 if (is_win) {
122 include_dirs += [ "$skia_vulkan_sdk/Include/" ]
123 lib_dirs += [ "$skia_vulkan_sdk/Bin" ]
124 } else {
125 include_dirs += [ "$skia_vulkan_sdk/x86_64/include/" ]
126 lib_dirs += [ "$skia_vulkan_sdk/x86_64/lib/" ]
127 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400128 }
Mike Klein487bfc22016-10-14 14:04:56 -0400129 if (is_win) {
130 libs += [ "vulkan-1.lib" ]
131 } else {
132 libs += [ "vulkan" ]
133 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400134 }
mtkleinc04ff472016-06-23 10:29:30 -0700135}
136
137# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
138config("skia_library") {
139 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700140 defines = [ "SKIA_IMPLEMENTATION=1" ]
141}
142
143skia_library_configs = [
144 ":skia_public",
145 ":skia_private",
146 ":skia_library",
147]
148
mtklein9b8583d2016-08-24 17:32:30 -0700149# Use for CPU-specific Skia code that needs particular compiler flags.
150template("opts") {
151 if (invoker.enabled) {
152 source_set(target_name) {
153 forward_variables_from(invoker, "*")
154 configs += skia_library_configs
155 }
156 } else {
157 # If not enabled, a phony empty target that swallows all otherwise unused variables.
158 source_set(target_name) {
159 forward_variables_from(invoker,
160 "*",
161 [
162 "sources",
163 "cflags",
164 ])
165 }
166 }
anmittala7eaf2e2016-08-17 13:57:26 -0700167}
168
mtklein422310d2016-08-16 18:28:43 -0700169is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700170
mtklein7d6fb2c2016-08-25 14:50:44 -0700171opts("none") {
172 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700173 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700174 cflags = []
175}
176
mtklein7d6fb2c2016-08-25 14:50:44 -0700177opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700178 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700179 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700180 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700181}
182
183opts("arm64") {
184 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700185 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700186 cflags = []
187}
188
189opts("crc32") {
190 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700191 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700192 cflags = [ "-march=armv8-a+crc" ]
193}
194
mtklein9b8583d2016-08-24 17:32:30 -0700195opts("sse2") {
196 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700197 sources = skia_opts.sse2_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400198 if (is_win) {
199 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
200 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400201 cflags = [ "-msse2" ]
202 }
mtklein9b8583d2016-08-24 17:32:30 -0700203}
mtkleinc04ff472016-06-23 10:29:30 -0700204
mtklein9b8583d2016-08-24 17:32:30 -0700205opts("ssse3") {
206 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700207 sources = skia_opts.ssse3_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400208 if (is_win) {
209 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
210 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400211 cflags = [ "-mssse3" ]
212 }
mtklein9b8583d2016-08-24 17:32:30 -0700213}
mtkleinc04ff472016-06-23 10:29:30 -0700214
mtklein9b8583d2016-08-24 17:32:30 -0700215opts("sse41") {
216 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700217 sources = skia_opts.sse41_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400218 if (is_win) {
219 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
220 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400221 cflags = [ "-msse4.1" ]
222 }
mtklein9b8583d2016-08-24 17:32:30 -0700223}
mtklein4e976072016-08-08 09:06:27 -0700224
mtklein9b8583d2016-08-24 17:32:30 -0700225opts("sse42") {
226 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700227 sources = skia_opts.sse42_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400228 if (is_win) {
229 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
230 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400231 cflags = [ "-msse4.2" ]
232 }
mtklein9b8583d2016-08-24 17:32:30 -0700233}
234
235opts("avx") {
236 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700237 sources = skia_opts.avx_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400238 if (is_win) {
239 cflags = [ "/arch:AVX" ]
240 } else {
241 cflags = [ "-mavx" ]
242 }
mtkleinc04ff472016-06-23 10:29:30 -0700243}
244
Mike Klein78d5a3b2016-09-30 10:48:01 -0400245opts("hsw") {
246 enabled = is_x86
247 sources = skia_opts.hsw_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400248 if (is_win) {
249 cflags = [ "/arch:AVX2" ]
250 } else {
251 cflags = [
252 "-mavx2",
253 "-mbmi",
254 "-mbmi2",
255 "-mf16c",
256 "-mfma",
257 ]
258 }
Mike Klein78d5a3b2016-09-30 10:48:01 -0400259}
260
mtklein349cece2016-08-26 08:13:04 -0700261opts("dsp") {
262 enabled = current_cpu == "mipsel"
brettwb9447282016-09-01 14:24:39 -0700263 sources = skia_opts.mips_dsp_sources
mtkleinb6064ef2016-08-30 11:49:24 -0700264 cflags = []
mtklein349cece2016-08-26 08:13:04 -0700265}
266
mtkleinc095df52016-08-24 12:23:52 -0700267# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700268template("optional") {
269 if (invoker.enabled) {
270 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700271 if (defined(invoker.public_defines)) {
272 defines = invoker.public_defines
273 }
mtklein457b42a2016-08-23 13:56:37 -0700274 }
275 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700276 forward_variables_from(invoker,
277 "*",
278 [
279 "public_defines",
280 "sources_when_disabled",
281 ])
mtklein457b42a2016-08-23 13:56:37 -0700282 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700283 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700284 }
285 } else {
mtklein457b42a2016-08-23 13:56:37 -0700286 source_set(target_name) {
287 forward_variables_from(invoker,
288 "*",
289 [
290 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700291 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700292 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700293 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700294 "sources_when_disabled",
mtklein457b42a2016-08-23 13:56:37 -0700295 ])
mtkleincd01b032016-08-31 04:58:19 -0700296 if (defined(invoker.sources_when_disabled)) {
297 sources = invoker.sources_when_disabled
298 }
299 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700300 }
mtkleineb3c4252016-08-23 07:38:09 -0700301 }
mtklein457b42a2016-08-23 13:56:37 -0700302}
mtklein457b42a2016-08-23 13:56:37 -0700303
mtkleina45be612016-08-29 15:22:10 -0700304optional("fontmgr_android") {
305 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700306
307 deps = [
308 "//third_party/expat",
309 "//third_party/freetype2",
310 ]
311 sources = [
312 "src/ports/SkFontMgr_android.cpp",
313 "src/ports/SkFontMgr_android_factory.cpp",
314 "src/ports/SkFontMgr_android_parser.cpp",
315 ]
316}
317
mtkleind2e39db2016-09-07 07:52:55 -0700318optional("fontmgr_custom") {
319 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
320
321 deps = [
322 "//third_party/freetype2",
323 ]
324 sources = [
325 "src/ports/SkFontMgr_custom.cpp",
326 "src/ports/SkFontMgr_custom_directory_factory.cpp",
327 ]
328}
329
mtklein3cc22182016-08-29 13:26:14 -0700330optional("fontmgr_fontconfig") {
331 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700332
333 deps = [
334 "//third_party:fontconfig",
335 "//third_party/freetype2",
336 ]
337 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700338 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700339 "src/ports/SkFontConfigInterface_direct.cpp",
340 "src/ports/SkFontConfigInterface_direct_factory.cpp",
341 "src/ports/SkFontMgr_FontConfigInterface.cpp",
342 "src/ports/SkFontMgr_fontconfig.cpp",
343 "src/ports/SkFontMgr_fontconfig_factory.cpp",
344 ]
345}
346
mtkleincdedd0e2016-09-12 15:15:44 -0700347optional("fontmgr_fuchsia") {
348 enabled = is_fuchsia && skia_use_freetype
349
350 deps = [
351 "//third_party/freetype2",
352 ]
353 sources = [
354 "src/ports/SkFontMgr_custom.cpp",
355 "src/ports/SkFontMgr_custom_empty_factory.cpp",
356 ]
357}
358
mtklein06c35c02016-09-20 12:28:12 -0700359optional("gpu") {
360 enabled = skia_enable_gpu
mtkleine9fb3d52016-09-20 15:11:46 -0700361 public_defines = []
362
mtklein06c35c02016-09-20 12:28:12 -0700363 sources = skia_gpu_sources + [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ]
364
365 # These paths need to be absolute to match the ones produced by shared_sources.gni.
366 sources -= get_path_info([
367 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
368 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
369 ],
370 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400371 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700372 if (is_android) {
373 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
374 } else if (is_linux) {
375 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
376 } else if (is_mac) {
377 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400378 } else if (is_win) {
379 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
380 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700381 } else {
382 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
383 }
mtkleine9fb3d52016-09-20 15:11:46 -0700384
385 if (skia_use_vulkan) {
386 public_defines += [ "SK_VULKAN" ]
387 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700388 if (skia_enable_vulkan_debug_layers) {
389 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
390 }
mtkleine9fb3d52016-09-20 15:11:46 -0700391 }
mtklein06c35c02016-09-20 12:28:12 -0700392}
393
mtklein63213812016-08-24 09:55:56 -0700394optional("jpeg") {
395 enabled = skia_use_libjpeg_turbo
396 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
397
mtklein63213812016-08-24 09:55:56 -0700398 deps = [
399 "//third_party/libjpeg-turbo:libjpeg",
400 ]
401 sources = [
402 "src/codec/SkJpegCodec.cpp",
403 "src/codec/SkJpegDecoderMgr.cpp",
404 "src/codec/SkJpegUtility.cpp",
405 "src/images/SkJPEGImageEncoder.cpp",
406 "src/images/SkJPEGWriteUtility.cpp",
407 ]
408}
409
410optional("pdf") {
411 enabled = skia_use_zlib
mtklein63213812016-08-24 09:55:56 -0700412
mtklein63213812016-08-24 09:55:56 -0700413 deps = [
414 "//third_party/zlib",
415 ]
brettwb9447282016-09-01 14:24:39 -0700416 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700417 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700418
419 if (skia_use_sfntly) {
420 deps += [ "//third_party/sfntly" ]
mtkleincd01b032016-08-31 04:58:19 -0700421 public_defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700422 }
423}
424
425optional("png") {
426 enabled = skia_use_libpng
427 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
428
mtklein63213812016-08-24 09:55:56 -0700429 deps = [
430 "//third_party/libpng",
431 ]
432 sources = [
433 "src/codec/SkIcoCodec.cpp",
434 "src/codec/SkPngCodec.cpp",
435 "src/images/SkPNGImageEncoder.cpp",
436 ]
437}
438
mtklein3cc22182016-08-29 13:26:14 -0700439optional("typeface_freetype") {
440 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700441
442 deps = [
443 "//third_party/freetype2",
444 ]
445 sources = [
446 "src/ports/SkFontHost_FreeType.cpp",
447 "src/ports/SkFontHost_FreeType_common.cpp",
448 ]
449}
450
mtklein457b42a2016-08-23 13:56:37 -0700451optional("webp") {
452 enabled = skia_use_libwebp
453 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
454
mtklein457b42a2016-08-23 13:56:37 -0700455 deps = [
456 "//third_party/libwebp",
457 ]
458 sources = [
459 "src/codec/SkWebpAdapterCodec.cpp",
460 "src/codec/SkWebpCodec.cpp",
461 "src/images/SkWEBPImageEncoder.cpp",
462 ]
mtkleineb3c4252016-08-23 07:38:09 -0700463}
464
mtklein63213812016-08-24 09:55:56 -0700465optional("xml") {
466 enabled = skia_use_expat
mtklein63213812016-08-24 09:55:56 -0700467
mtklein63213812016-08-24 09:55:56 -0700468 deps = [
469 "//third_party/expat",
470 ]
471 sources = [
472 "src/xml/SkDOM.cpp",
473 "src/xml/SkXMLParser.cpp",
474 "src/xml/SkXMLWriter.cpp",
475 ]
476}
477
mtkleinc04ff472016-06-23 10:29:30 -0700478component("skia") {
479 public_configs = [ ":skia_public" ]
480 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700481
482 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700483 ":arm64",
484 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700485 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700486 ":crc32",
mtklein349cece2016-08-26 08:13:04 -0700487 ":dsp",
mtkleina45be612016-08-29 15:22:10 -0700488 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700489 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700490 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700491 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700492 ":gpu",
Mike Klein78d5a3b2016-09-30 10:48:01 -0400493 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700494 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700495 ":none",
mtklein63213812016-08-24 09:55:56 -0700496 ":pdf",
497 ":png",
mtklein9b8583d2016-08-24 17:32:30 -0700498 ":sse2",
499 ":sse41",
500 ":sse42",
501 ":ssse3",
mtklein3cc22182016-08-29 13:26:14 -0700502 ":typeface_freetype",
mtkleineb3c4252016-08-23 07:38:09 -0700503 ":webp",
mtklein63213812016-08-24 09:55:56 -0700504 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700505 ]
506
mtkleinc04ff472016-06-23 10:29:30 -0700507 sources = []
brettwb9447282016-09-01 14:24:39 -0700508 sources += skia_core_sources
509 sources += skia_effects_sources
brettwb9447282016-09-01 14:24:39 -0700510 sources += skia_sksl_sources
511 sources += skia_utils_sources
mtkleinc04ff472016-06-23 10:29:30 -0700512 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700513 "src/android/SkBitmapRegionCodec.cpp",
514 "src/android/SkBitmapRegionDecoder.cpp",
515 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700516 "src/codec/SkBmpCodec.cpp",
517 "src/codec/SkBmpMaskCodec.cpp",
518 "src/codec/SkBmpRLECodec.cpp",
519 "src/codec/SkBmpStandardCodec.cpp",
520 "src/codec/SkCodec.cpp",
521 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700522 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700523 "src/codec/SkMaskSwizzler.cpp",
524 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700525 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700526 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700527 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700528 "src/codec/SkSwizzler.cpp",
529 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700530 "src/images/SkImageEncoder.cpp",
531 "src/images/SkImageEncoder_Factory.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700532 "src/images/SkKTXImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700533 "src/ports/SkDiscardableMemory_none.cpp",
534 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700535 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700536 "src/ports/SkMemory_malloc.cpp",
537 "src/ports/SkOSFile_stdio.cpp",
538 "src/sfnt/SkOTTable_name.cpp",
539 "src/sfnt/SkOTUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700540 "src/svg/SkSVGCanvas.cpp",
541 "src/svg/SkSVGDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700542 "src/utils/mac/SkStream_mac.cpp",
543 "third_party/etc1/etc1.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700544 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700545 "third_party/ktx/ktx.cpp",
546 ]
brettwb9447282016-09-01 14:24:39 -0700547
mtklein7d6fb2c2016-08-25 14:50:44 -0700548 libs = []
549
mtkleinc04ff472016-06-23 10:29:30 -0700550 if (is_win) {
551 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400552 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700553 "src/ports/SkDebug_win.cpp",
554 "src/ports/SkFontHost_win.cpp",
555 "src/ports/SkFontMgr_win_dw.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700556 "src/ports/SkImageEncoder_WIC.cpp",
557 "src/ports/SkImageGeneratorWIC.cpp",
558 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700559 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700560 "src/ports/SkScalerContext_win_dw.cpp",
561 "src/ports/SkTLS_win.cpp",
562 "src/ports/SkTypeface_win_dw.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700563 "src/xps/SkDocument_XPS.cpp",
Mike Klein4b167fc2016-10-11 18:13:53 -0400564 "src/xps/SkXPSDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700565 ]
Mike Klein69f6ed42016-10-13 15:45:07 -0400566 if (skia_use_gdi) {
567 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
568 libs += [
569 "Gdi32.lib",
570 "Usp10.lib",
571 ]
572 } else {
573 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
574 }
mtkleinb9be9792016-09-16 14:44:18 -0700575 sources -=
576 [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400577 libs += [
578 "FontSub.lib",
579 "Ole32.lib",
580 "OleAut32.lib",
581 "User32.lib",
582 ]
mtkleinc04ff472016-06-23 10:29:30 -0700583 } else {
584 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700585 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700586 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700587 "src/ports/SkTLS_pthread.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700588 "src/xps/SkDocument_XPS_None.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700589 ]
590 }
591
mtklein7d6fb2c2016-08-25 14:50:44 -0700592 if (is_android) {
593 deps += [
594 "//third_party/cpu-features",
595 "//third_party/expat",
mtklein7d6fb2c2016-08-25 14:50:44 -0700596 ]
mtklein06c35c02016-09-20 12:28:12 -0700597 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700598 libs += [
599 "EGL",
600 "GLESv2",
601 "log",
602 ]
603 }
604
mtkleinc04ff472016-06-23 10:29:30 -0700605 if (is_linux) {
mtklein09e61f72016-08-23 13:35:28 -0700606 libs += [
607 "GL",
608 "GLU",
609 "X11",
610 ]
mtklein06c35c02016-09-20 12:28:12 -0700611 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700612 }
613
614 if (is_mac) {
615 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700616 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700617 "src/ports/SkFontHost_mac.cpp",
618 "src/ports/SkImageEncoder_CG.cpp",
619 "src/ports/SkImageGeneratorCG.cpp",
620 ]
mtklein09e61f72016-08-23 13:35:28 -0700621 libs += [
622 "ApplicationServices.framework",
623 "OpenGL.framework",
624 ]
mtkleinc04ff472016-06-23 10:29:30 -0700625 }
abarth6fc8ff02016-07-15 15:15:15 -0700626
627 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700628 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700629 }
mtkleinc04ff472016-06-23 10:29:30 -0700630}
631
mtkleinada5a442016-08-02 14:28:26 -0700632skia_h_headers = exec_script("gyp/find.py",
633 [ "*.h" ] + rebase_path(skia_public_includes),
634 "list lines",
635 []) -
636 [
637 rebase_path("include/gpu/gl/GrGLConfig_chrome.h"),
638 rebase_path("include/gpu/vk/GrVkBackendContext.h"),
639 rebase_path("include/gpu/vk/GrVkDefines.h"),
640 rebase_path("include/gpu/vk/GrVkInterface.h"),
641 rebase_path("include/gpu/vk/GrVkTypes.h"),
642 rebase_path("include/ports/SkFontMgr_fontconfig.h"),
643 ]
644
mtklein1211e0c2016-07-26 13:55:45 -0700645action("skia.h") {
646 script = "gn/echo_headers.py"
647 args = [ rebase_path("$target_gen_dir/skia.h", root_build_dir) ] +
mtkleinc095df52016-08-24 12:23:52 -0700648 rebase_path(skia_h_headers, target_gen_dir)
Ben Wagnerbc344042016-09-29 15:41:53 -0400649 inputs = skia_h_headers
mtklein1211e0c2016-07-26 13:55:45 -0700650 outputs = [
651 "$target_gen_dir/skia.h",
652 ]
653}
654
mtklein06c35c02016-09-20 12:28:12 -0700655if (skia_enable_gpu && target_cpu == "x64") {
mtklein1fbdf982016-09-15 12:07:48 -0700656 # Our bots only have 64-bit libOSMesa installed.
657 # TODO: worth fixing?
658 executable("fiddle") {
659 include_dirs = [ "$target_gen_dir" ]
660 libs = []
661 if (is_linux) {
662 libs += [ "OSMesa" ]
663 }
mtklein56d56692016-09-15 11:18:55 -0700664
mtklein1fbdf982016-09-15 12:07:48 -0700665 sources = [
666 "src/images/SkForceLinking.cpp",
667 "tools/fiddle/draw.cpp",
668 "tools/fiddle/fiddle_main.cpp",
669 ]
670 deps = [
671 ":skia",
672 ":skia.h",
673 ]
674 }
mtkleinc04ff472016-06-23 10:29:30 -0700675}
mtklein25c81d42016-07-27 13:55:26 -0700676
mtkleinc095df52016-08-24 12:23:52 -0700677# Targets guarded by skia_enable_tools may use //third_party freely.
678if (skia_enable_tools) {
679 template("test_lib") {
680 config(target_name + "_config") {
681 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700682 if (defined(invoker.public_defines)) {
683 defines = invoker.public_defines
684 }
mtklein25c81d42016-07-27 13:55:26 -0700685 }
mtkleinc095df52016-08-24 12:23:52 -0700686 source_set(target_name) {
687 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
688 public_configs = [
689 ":" + target_name + "_config",
690 ":skia_private",
691 ]
692
693 if (!defined(deps)) {
694 deps = []
695 }
696 deps += [ ":skia" ]
697 testonly = true
698 }
mtklein25c81d42016-07-27 13:55:26 -0700699 }
mtklein25c81d42016-07-27 13:55:26 -0700700
mtkleinc095df52016-08-24 12:23:52 -0700701 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700702 public_include_dirs = []
703 if (skia_enable_gpu) {
704 public_defines = []
705 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700706
707 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700708 sources = [
709 "tools/gpu/GrContextFactory.cpp",
710 "tools/gpu/GrTest.cpp",
711 "tools/gpu/TestContext.cpp",
712 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -0700713 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700714 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
715 "tools/gpu/gl/debug/GrBufferObj.cpp",
716 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
717 "tools/gpu/gl/debug/GrProgramObj.cpp",
718 "tools/gpu/gl/debug/GrShaderObj.cpp",
719 "tools/gpu/gl/debug/GrTextureObj.cpp",
720 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
721 "tools/gpu/gl/null/NullGLTestContext.cpp",
722 ]
723 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700724
mtklein38925aa2016-09-21 10:11:25 -0700725 if (is_android) {
726 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
727 } else if (is_linux) {
728 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
729 } else if (is_mac) {
730 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400731 } else if (is_win) {
732 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
733 libs += [
734 "Gdi32.lib",
735 "OpenGL32.lib",
736 ]
mtklein38925aa2016-09-21 10:11:25 -0700737 }
mtklein6ef69992016-09-14 06:12:09 -0700738
mtkleind68f9b02016-09-23 13:18:41 -0700739 if (skia_use_angle) {
740 public_defines += [ "SK_ANGLE" ]
741 deps += [ "//third_party/angle2" ]
742 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
mtklein38925aa2016-09-21 10:11:25 -0700743 }
744 if (skia_use_mesa) {
745 public_defines += [ "SK_MESA" ]
746 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
747 libs += [ "OSMesa" ]
748 }
mtkleind68f9b02016-09-23 13:18:41 -0700749 if (skia_use_vulkan) {
750 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
751 }
mtkleina627b5c2016-09-20 13:36:47 -0700752 }
mtklein25c81d42016-07-27 13:55:26 -0700753 }
mtklein25c81d42016-07-27 13:55:26 -0700754
mtkleinc095df52016-08-24 12:23:52 -0700755 test_lib("flags") {
756 public_include_dirs = [ "tools/flags" ]
757 sources = [
758 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -0700759 ]
760 }
761 test_lib("common_flags") {
762 public_include_dirs = [ "tools/flags" ]
763 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700764 "tools/flags/SkCommonFlags.cpp",
765 "tools/flags/SkCommonFlagsConfig.cpp",
766 ]
767 deps = [
mtklein046cb562016-09-16 10:23:12 -0700768 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700769 ":gpu_tool_utils",
770 ]
771 }
mtklein25c81d42016-07-27 13:55:26 -0700772
mtkleinc095df52016-08-24 12:23:52 -0700773 test_lib("tool_utils") {
774 public_include_dirs = [
775 "tools",
776 "tools/debugger",
777 "tools/timer",
778 ]
779 sources = [
780 "src/images/SkForceLinking.cpp",
781 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
mtkleinb37c0342016-09-09 11:07:45 -0700782 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700783 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700784 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700785 "tools/ProcStats.cpp",
786 "tools/Resources.cpp",
787 "tools/ThermalManager.cpp",
788 "tools/UrlDataManager.cpp",
789 "tools/debugger/SkDebugCanvas.cpp",
790 "tools/debugger/SkDrawCommand.cpp",
791 "tools/debugger/SkJsonWriteBuffer.cpp",
792 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700793 "tools/picture_utils.cpp",
794 "tools/random_parse_path.cpp",
795 "tools/sk_tool_utils.cpp",
796 "tools/sk_tool_utils_font.cpp",
797 "tools/timer/Timer.cpp",
798 ]
799 deps = [
mtklein046cb562016-09-16 10:23:12 -0700800 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -0700801 ":flags",
802 "//third_party/libpng",
803 ]
804 public_deps = [
805 "//third_party/jsoncpp",
806 ]
807 }
mtklein25c81d42016-07-27 13:55:26 -0700808
mtkleinc095df52016-08-24 12:23:52 -0700809 gm_sources = exec_script("gyp/find.py",
810 [
811 "*.c*",
812 rebase_path("gm"),
813 ],
814 "list lines",
815 [])
816 test_lib("gm") {
817 public_include_dirs = [ "gm" ]
818 sources = gm_sources
819 deps = [
scroggo19b91532016-10-24 09:03:26 -0700820 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700821 ":gpu_tool_utils",
822 ":skia",
823 ":tool_utils",
824 ]
825 }
mtklein25c81d42016-07-27 13:55:26 -0700826
mtkleinc095df52016-08-24 12:23:52 -0700827 tests_sources = exec_script("gyp/find.py",
828 [
829 "*.c*",
830 rebase_path("tests"),
831 ],
832 "list lines",
833 [])
mtklein2f3416d2016-08-02 16:02:05 -0700834
mtkleinc095df52016-08-24 12:23:52 -0700835 test_lib("tests") {
836 public_include_dirs = [ "tests" ]
mtkleina45be612016-08-29 15:22:10 -0700837 sources = tests_sources - [
838 rebase_path("tests/PathOpsSkpClipTest.cpp"), # alternate main
mtkleina45be612016-08-29 15:22:10 -0700839 rebase_path("tests/SkpSkGrTest.cpp"), # doesn't compile
840 rebase_path("tests/skia_test.cpp"), # alternate main
841 ]
842 if (!fontmgr_android_enabled) {
843 sources -= [ rebase_path("tests/FontMgrAndroidParserTest.cpp") ]
844 }
mtkleinc095df52016-08-24 12:23:52 -0700845 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700846 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700847 ":flags",
848 ":gpu_tool_utils",
849 ":skia",
850 ":tool_utils",
851 "//third_party/libpng",
852 "//third_party/zlib",
853 ]
854 }
mtklein2f3416d2016-08-02 16:02:05 -0700855
mtkleinc095df52016-08-24 12:23:52 -0700856 bench_sources = exec_script("gyp/find.py",
857 [
858 "*.c*",
859 rebase_path("bench"),
860 ],
861 "list lines",
862 [])
mtklein25c81d42016-07-27 13:55:26 -0700863
mtkleinc095df52016-08-24 12:23:52 -0700864 test_lib("bench") {
865 public_include_dirs = [ "bench" ]
866 sources = bench_sources
867 sources -= [
868 rebase_path("bench/nanobench.cpp"),
869 rebase_path("bench/nanobenchAndroid.cpp"),
870 ]
871 deps = [
872 ":flags",
873 ":gm",
874 ":gpu_tool_utils",
875 ":skia",
876 ":tool_utils",
877 ]
878 }
mtklein2b6870c2016-07-28 14:17:33 -0700879
mtkleinc095df52016-08-24 12:23:52 -0700880 test_lib("experimental_svg_model") {
881 public_include_dirs = [ "experimental/svg/model" ]
882 sources = [
883 "experimental/svg/model/SkSVGAttribute.cpp",
884 "experimental/svg/model/SkSVGAttributeParser.cpp",
885 "experimental/svg/model/SkSVGCircle.cpp",
886 "experimental/svg/model/SkSVGContainer.cpp",
887 "experimental/svg/model/SkSVGDOM.cpp",
888 "experimental/svg/model/SkSVGEllipse.cpp",
889 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700890 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700891 "experimental/svg/model/SkSVGNode.cpp",
892 "experimental/svg/model/SkSVGPath.cpp",
893 "experimental/svg/model/SkSVGPoly.cpp",
894 "experimental/svg/model/SkSVGRect.cpp",
895 "experimental/svg/model/SkSVGRenderContext.cpp",
896 "experimental/svg/model/SkSVGSVG.cpp",
897 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700898 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700899 "experimental/svg/model/SkSVGTransformableNode.cpp",
900 "experimental/svg/model/SkSVGValue.cpp",
901 ]
902 deps = [
903 ":skia",
904 ]
905 }
fmalitaa2b9fdf2016-08-03 19:53:36 -0700906
Brian Osman16adfa32016-10-18 14:42:44 -0400907 test_lib("views") {
908 public_include_dirs = [ "include/views" ]
909 sources = [
910 "src/views/SkEvent.cpp",
911 "src/views/SkEventSink.cpp",
912 "src/views/SkOSMenu.cpp",
913 "src/views/SkTagList.cpp",
914 "src/views/SkTouchGesture.cpp",
915 "src/views/SkView.cpp",
916 "src/views/SkViewPriv.cpp",
917 ]
918 libs = []
919 if (!is_android) {
920 sources += [ "src/views/SkWindow.cpp" ]
921 }
Jim Van Verth4e56a912016-10-21 10:58:52 -0400922 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -0400923 public_include_dirs += [ "src/views/unix" ]
924 sources += [
925 "src/views/unix/SkOSWindow_Unix.cpp",
926 "src/views/unix/keysym2ucs.c",
927 ]
Brian Osman16adfa32016-10-18 14:42:44 -0400928 } else if (is_mac) {
929 sources += [
930 "src/views/mac/SkEventNotifier.mm",
931 "src/views/mac/SkNSView.mm",
932 "src/views/mac/SkOSWindow_Mac.mm",
933 "src/views/mac/SkTextFieldCell.m",
934 ]
935 libs += [
936 "QuartzCore.framework",
937 "Cocoa.framework",
938 "Foundation.framework",
939 ]
940 } else if (is_win) {
941 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
942 }
943 }
944
945 sample_sources = exec_script("gyp/find.py",
946 [
947 "*.c*",
948 rebase_path("samplecode"),
949 ],
950 "list lines",
951 [])
952
953 test_lib("samples") {
954 include_dirs = [ "experimental" ]
955 public_include_dirs = [ "samplecode" ]
956 sources = sample_sources
957 sources -= [
958 rebase_path("samplecode/SampleAnimator.cpp"), # relies on animator
959 rebase_path("samplecode/SampleApp.cpp"), # part of SampleApp exe, not samples lib
960 rebase_path("samplecode/SampleClamp.cpp"),
961 rebase_path("samplecode/SampleDash.cpp"),
962 rebase_path("samplecode/SampleLua.cpp"), # no Lua yet in GN
963 rebase_path("samplecode/SamplePathFill.cpp"),
964 rebase_path("samplecode/SamplePictFile.cpp"), # relies on SK_SUPPORT_LEGACY_DRAWFILTER
965 rebase_path("samplecode/SampleSkLayer.cpp"), # relies on SkMatrix44 which doesn't compile?
966 rebase_path("samplecode/SampleFontCache.cpp"), # relies on pthread.h
967 ]
968 sources += [
969 "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp",
970 "experimental/SkSetPoly3To3.cpp",
971 "experimental/SkSetPoly3To3_A.cpp",
972 "experimental/SkSetPoly3To3_D.cpp",
973 ]
974 deps = [
975 ":experimental_svg_model",
976 ":gm", # Why does SampleFilterQuality.cpp include gm.h ???
977 ":tool_utils",
978 ":views",
979 ":xml",
980 ]
981 }
982
mtklein2b6870c2016-07-28 14:17:33 -0700983 executable("dm") {
984 sources = [
985 "dm/DM.cpp",
986 "dm/DMJsonWriter.cpp",
987 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700988 ]
989 include_dirs = [ "tests" ]
990 deps = [
mtklein046cb562016-09-16 10:23:12 -0700991 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -0700992 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -0700993 ":flags",
994 ":gm",
995 ":gpu_tool_utils",
996 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -0700997 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -0700998 ":tool_utils",
999 "//third_party/jsoncpp",
1000 "//third_party/libpng",
1001 ]
1002 testonly = true
1003 }
1004
Mike Kleina3430172016-09-27 16:46:29 -04001005 if (!is_debug) { # I've benchmarked debug code once too many times...
1006 executable("monobench") {
1007 sources = [
1008 "tools/monobench.cpp",
1009 ]
1010 deps = [
1011 ":bench",
1012 ":skia",
1013 ]
1014 testonly = true
1015 }
mtklein2b6870c2016-07-28 14:17:33 -07001016 }
1017
1018 executable("nanobench") {
1019 sources = [
1020 "bench/nanobench.cpp",
1021 ]
1022 deps = [
1023 ":bench",
mtklein046cb562016-09-16 10:23:12 -07001024 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -07001025 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -07001026 ":flags",
1027 ":gm",
1028 ":gpu_tool_utils",
1029 ":skia",
1030 ":tool_utils",
1031 "//third_party/jsoncpp",
1032 ]
1033 testonly = true
1034 }
halcanary19a97202016-08-03 15:08:04 -07001035
mtklein38925aa2016-09-21 10:11:25 -07001036 if (skia_enable_gpu) {
1037 executable("skpbench") {
1038 sources = [
1039 "tools/skpbench/skpbench.cpp",
1040 ]
1041 deps = [
1042 ":flags",
1043 ":gpu_tool_utils",
1044 ":skia",
1045 ":tool_utils",
1046 ]
1047 testonly = true
1048 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001049 }
1050
Mike Klein4b167fc2016-10-11 18:13:53 -04001051 # We can't yet build ICU on Windows.
Mike Klein768bdfc2016-10-11 19:59:22 -04001052 if (!is_win) {
halcanary3eee9d92016-09-10 07:01:53 -07001053 executable("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001054 sources = [
1055 "tools/SkShaper_harfbuzz.cpp",
1056 "tools/using_skia_and_harfbuzz.cpp",
1057 ]
1058 deps = [
1059 ":skia",
1060 "//third_party/harfbuzz",
1061 ]
1062 testonly = true
1063 }
halcanary19a97202016-08-03 15:08:04 -07001064 }
halcanary3eee9d92016-09-10 07:01:53 -07001065 executable("sktexttopdf") {
1066 sources = [
1067 "tools/SkShaper_primitive.cpp",
1068 "tools/using_skia_and_harfbuzz.cpp",
1069 ]
1070 deps = [
1071 ":skia",
1072 ]
1073 testonly = true
1074 }
mtklein046cb562016-09-16 10:23:12 -07001075
1076 executable("get_images_from_skps") {
1077 sources = [
1078 "tools/get_images_from_skps.cpp",
1079 ]
1080 deps = [
1081 ":flags",
1082 ":skia",
1083 "//third_party/jsoncpp",
1084 ]
1085 testonly = true
1086 }
mtkleinecbc5262016-09-22 11:51:24 -07001087
1088 executable("skiaserve") {
1089 sources = [
1090 "tools/skiaserve/Request.cpp",
1091 "tools/skiaserve/Response.cpp",
1092 "tools/skiaserve/skiaserve.cpp",
1093 "tools/skiaserve/urlhandlers/BatchBoundsHandler.cpp",
1094 "tools/skiaserve/urlhandlers/BatchesHandler.cpp",
1095 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1096 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1097 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1098 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1099 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1100 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1101 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1102 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1103 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Ben Wagnerc03e1c52016-10-17 15:20:02 -04001104 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
mtkleinecbc5262016-09-22 11:51:24 -07001105 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1106 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1107 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1108 ]
1109 deps = [
1110 ":flags",
1111 ":gpu_tool_utils",
1112 ":skia",
1113 ":tool_utils",
1114 "//third_party/jsoncpp",
1115 "//third_party/libmicrohttpd",
1116 "//third_party/libpng",
1117 ]
1118 testonly = true
1119 }
kjlubick14f984b2016-10-03 11:49:45 -07001120
1121 executable("fuzz") {
1122 sources = [
1123 "fuzz/FilterFuzz.cpp",
1124 "fuzz/FuzzGradients.cpp",
1125 "fuzz/FuzzParsePath.cpp",
1126 "fuzz/FuzzPathop.cpp",
1127 "fuzz/FuzzScaleToSides.cpp",
1128 "fuzz/fuzz.cpp",
1129 ]
1130 deps = [
1131 ":flags",
1132 ":skia",
1133 ]
1134 testonly = true
1135 }
Mike Klein38312422016-10-05 15:41:01 -04001136
caryclark9feb6322016-10-25 08:58:26 -07001137 pathops_tests_sources = exec_script("gyp/find.py",
1138 [
1139 "PathOps*.cpp",
1140 rebase_path("tests"),
1141 ],
1142 "list lines",
1143 [])
1144
1145 executable("pathops_unittest") {
1146 sources =
1147 pathops_tests_sources -
1148 [ rebase_path("tests/PathOpsSkpClipTest.cpp") ] + # alternate main
1149 [
1150 rebase_path("tests/skia_test.cpp"),
1151 rebase_path("tests/Test.cpp"),
1152 ]
1153 deps = [
1154 ":flags",
1155 ":gpu_tool_utils",
1156 ":skia",
1157 ":tool_utils",
1158 ]
1159 testonly = true
1160 }
1161
Mike Klein38312422016-10-05 15:41:01 -04001162 executable("dump_record") {
1163 sources = [
1164 "tools/DumpRecord.cpp",
1165 "tools/dump_record.cpp",
1166 ]
1167 deps = [
1168 ":flags",
1169 ":skia",
1170 ]
1171 testonly = true
1172 }
bungemanfe917272016-10-13 17:36:40 -04001173
1174 executable("skdiff") {
1175 sources = [
1176 "tools/skdiff/skdiff.cpp",
1177 "tools/skdiff/skdiff_html.cpp",
1178 "tools/skdiff/skdiff_main.cpp",
1179 "tools/skdiff/skdiff_utils.cpp",
1180 ]
1181 deps = [
1182 ":skia",
1183 ":tool_utils",
1184 ]
1185 testonly = true
1186 }
halcanarya73d76a2016-10-17 13:19:02 -07001187
1188 executable("skp_parser") {
1189 sources = [
1190 "tools/skp_parser.cpp",
1191 ]
1192 deps = [
1193 ":skia",
1194 ":tool_utils",
1195 "//third_party/jsoncpp",
1196 ]
1197 testonly = true
1198 }
Brian Osman16adfa32016-10-18 14:42:44 -04001199
Mike Klein43c25262016-10-20 10:17:47 -04001200 if (skia_enable_gpu && (is_linux || is_win || is_mac)) {
Brian Osman16adfa32016-10-18 14:42:44 -04001201 executable("viewer") {
1202 sources = [
1203 "tools/viewer/GMSlide.cpp",
1204 "tools/viewer/ImageSlide.cpp",
1205 "tools/viewer/SKPSlide.cpp",
1206 "tools/viewer/SampleSlide.cpp",
1207 "tools/viewer/Viewer.cpp",
1208 "tools/viewer/sk_app/CommandSet.cpp",
1209 "tools/viewer/sk_app/GLWindowContext.cpp",
1210 "tools/viewer/sk_app/Window.cpp",
1211 "tools/viewer/sk_app/WindowContext.cpp",
1212 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001213 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001214
Jim Van Verth4e56a912016-10-21 10:58:52 -04001215 if (is_android) {
1216 sources += [
1217 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1218 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1219 "tools/viewer/sk_app/android/Window_android.cpp",
1220 "tools/viewer/sk_app/android/main_android.cpp",
1221 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1222 ]
1223 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001224 sources += [
1225 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1226 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1227 "tools/viewer/sk_app/unix/Window_unix.cpp",
1228 "tools/viewer/sk_app/unix/main_unix.cpp",
1229 ]
1230 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001231 sources += [
1232 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1233 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1234 "tools/viewer/sk_app/win/Window_win.cpp",
1235 "tools/viewer/sk_app/win/main_win.cpp",
1236 ]
Mike Klein43c25262016-10-20 10:17:47 -04001237 } else if (is_mac) {
1238 sources += [
1239 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1240 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1241 "tools/viewer/sk_app/mac/Window_mac.cpp",
1242 "tools/viewer/sk_app/mac/main_mac.cpp",
1243 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001244 }
1245
1246 if (skia_use_vulkan) {
1247 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001248 if (is_android) {
1249 sources +=
1250 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
1251 libs += [ "android" ]
1252 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001253 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1254 libs += [ "X11-xcb" ]
1255 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001256 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1257 }
1258 }
1259
1260 include_dirs = []
1261 deps = [
1262 ":flags",
1263 ":gm",
1264 ":gpu_tool_utils",
1265 ":samples",
1266 ":skia",
1267 ":tool_utils",
1268 ":views",
1269 "//third_party/jsoncpp",
1270 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001271 if (is_android) {
1272 deps += [ "//third_party/native_app_glue" ]
1273 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001274 deps += [ "//third_party/libsdl" ]
1275 }
Brian Osman16adfa32016-10-18 14:42:44 -04001276 testonly = true
1277 }
1278 }
mtklein25c81d42016-07-27 13:55:26 -07001279}