blob: e57cd0eec33345a15077c1bd2ca9768df42212fa [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
Jim Van Verthb6c5e532016-10-28 10:38:08 -0400109 defines = [
110 "SK_GAMMA_APPLY_TO_A8",
111 "SK_INTERNAL",
112 ]
mtkleinb37c0342016-09-09 11:07:45 -0700113 if (is_android) {
114 defines += [
115 "SK_GAMMA_EXPONENT=1.4",
116 "SK_GAMMA_CONTRAST=0.0",
117 ]
118 }
mtklein88a7ac02016-09-14 11:16:49 -0700119 if (is_official_build || is_android) {
120 # TODO(bsalomon): it'd be nice to make Android normal.
121 defines += [ "SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0" ]
122 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400123 libs = []
124 lib_dirs = []
125 if (skia_use_vulkan) {
126 if (skia_vulkan_sdk != "") {
Mike Klein487bfc22016-10-14 14:04:56 -0400127 if (is_win) {
128 include_dirs += [ "$skia_vulkan_sdk/Include/" ]
129 lib_dirs += [ "$skia_vulkan_sdk/Bin" ]
130 } else {
Greg Daniel686bb212016-10-27 10:48:48 -0400131 include_dirs += [ "$skia_vulkan_sdk/include/" ]
132 lib_dirs += [ "$skia_vulkan_sdk/lib/" ]
Mike Klein487bfc22016-10-14 14:04:56 -0400133 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400134 }
Mike Klein487bfc22016-10-14 14:04:56 -0400135 if (is_win) {
136 libs += [ "vulkan-1.lib" ]
137 } else {
138 libs += [ "vulkan" ]
139 }
Brian Salomon789e25e2016-09-30 13:41:03 -0400140 }
mtkleinc04ff472016-06-23 10:29:30 -0700141}
142
143# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
144config("skia_library") {
145 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -0700146 defines = [ "SKIA_IMPLEMENTATION=1" ]
147}
148
149skia_library_configs = [
150 ":skia_public",
151 ":skia_private",
152 ":skia_library",
153]
154
mtklein9b8583d2016-08-24 17:32:30 -0700155# Use for CPU-specific Skia code that needs particular compiler flags.
156template("opts") {
157 if (invoker.enabled) {
158 source_set(target_name) {
159 forward_variables_from(invoker, "*")
160 configs += skia_library_configs
161 }
162 } else {
163 # If not enabled, a phony empty target that swallows all otherwise unused variables.
164 source_set(target_name) {
165 forward_variables_from(invoker,
166 "*",
167 [
168 "sources",
169 "cflags",
170 ])
171 }
172 }
anmittala7eaf2e2016-08-17 13:57:26 -0700173}
174
mtklein422310d2016-08-16 18:28:43 -0700175is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700176
mtklein7d6fb2c2016-08-25 14:50:44 -0700177opts("none") {
178 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700179 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700180 cflags = []
181}
182
mtklein7d6fb2c2016-08-25 14:50:44 -0700183opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700184 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700185 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700186 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700187}
188
189opts("arm64") {
190 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700191 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700192 cflags = []
193}
194
195opts("crc32") {
196 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700197 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700198 cflags = [ "-march=armv8-a+crc" ]
199}
200
mtklein9b8583d2016-08-24 17:32:30 -0700201opts("sse2") {
202 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700203 sources = skia_opts.sse2_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400204 if (is_win) {
205 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
206 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400207 cflags = [ "-msse2" ]
208 }
mtklein9b8583d2016-08-24 17:32:30 -0700209}
mtkleinc04ff472016-06-23 10:29:30 -0700210
mtklein9b8583d2016-08-24 17:32:30 -0700211opts("ssse3") {
212 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700213 sources = skia_opts.ssse3_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400214 if (is_win) {
215 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
216 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400217 cflags = [ "-mssse3" ]
218 }
mtklein9b8583d2016-08-24 17:32:30 -0700219}
mtkleinc04ff472016-06-23 10:29:30 -0700220
mtklein9b8583d2016-08-24 17:32:30 -0700221opts("sse41") {
222 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700223 sources = skia_opts.sse41_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400224 if (is_win) {
225 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
226 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400227 cflags = [ "-msse4.1" ]
228 }
mtklein9b8583d2016-08-24 17:32:30 -0700229}
mtklein4e976072016-08-08 09:06:27 -0700230
mtklein9b8583d2016-08-24 17:32:30 -0700231opts("sse42") {
232 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700233 sources = skia_opts.sse42_sources
Mike Kleind8765e32016-10-19 13:39:13 -0400234 if (is_win) {
235 defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
236 } else {
Mike Klein3eb71212016-10-11 17:08:53 -0400237 cflags = [ "-msse4.2" ]
238 }
mtklein9b8583d2016-08-24 17:32:30 -0700239}
240
241opts("avx") {
242 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700243 sources = skia_opts.avx_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400244 if (is_win) {
245 cflags = [ "/arch:AVX" ]
246 } else {
247 cflags = [ "-mavx" ]
248 }
mtkleinc04ff472016-06-23 10:29:30 -0700249}
250
Mike Klein78d5a3b2016-09-30 10:48:01 -0400251opts("hsw") {
252 enabled = is_x86
253 sources = skia_opts.hsw_sources
Mike Klein3eb71212016-10-11 17:08:53 -0400254 if (is_win) {
255 cflags = [ "/arch:AVX2" ]
256 } else {
257 cflags = [
258 "-mavx2",
259 "-mbmi",
260 "-mbmi2",
261 "-mf16c",
262 "-mfma",
263 ]
264 }
Mike Klein78d5a3b2016-09-30 10:48:01 -0400265}
266
mtklein349cece2016-08-26 08:13:04 -0700267opts("dsp") {
268 enabled = current_cpu == "mipsel"
brettwb9447282016-09-01 14:24:39 -0700269 sources = skia_opts.mips_dsp_sources
mtkleinb6064ef2016-08-30 11:49:24 -0700270 cflags = []
mtklein349cece2016-08-26 08:13:04 -0700271}
272
mtkleinc095df52016-08-24 12:23:52 -0700273# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700274template("optional") {
275 if (invoker.enabled) {
276 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700277 if (defined(invoker.public_defines)) {
278 defines = invoker.public_defines
279 }
mtklein457b42a2016-08-23 13:56:37 -0700280 }
281 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700282 forward_variables_from(invoker,
283 "*",
284 [
285 "public_defines",
286 "sources_when_disabled",
287 ])
mtklein457b42a2016-08-23 13:56:37 -0700288 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700289 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700290 }
291 } else {
mtklein457b42a2016-08-23 13:56:37 -0700292 source_set(target_name) {
293 forward_variables_from(invoker,
294 "*",
295 [
296 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700297 "deps",
mtklein6ef69992016-09-14 06:12:09 -0700298 "libs",
mtklein457b42a2016-08-23 13:56:37 -0700299 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700300 "sources_when_disabled",
mtklein457b42a2016-08-23 13:56:37 -0700301 ])
mtkleincd01b032016-08-31 04:58:19 -0700302 if (defined(invoker.sources_when_disabled)) {
303 sources = invoker.sources_when_disabled
304 }
305 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700306 }
mtkleineb3c4252016-08-23 07:38:09 -0700307 }
mtklein457b42a2016-08-23 13:56:37 -0700308}
mtklein457b42a2016-08-23 13:56:37 -0700309
mtkleina45be612016-08-29 15:22:10 -0700310optional("fontmgr_android") {
311 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700312
313 deps = [
314 "//third_party/expat",
315 "//third_party/freetype2",
316 ]
317 sources = [
318 "src/ports/SkFontMgr_android.cpp",
319 "src/ports/SkFontMgr_android_factory.cpp",
320 "src/ports/SkFontMgr_android_parser.cpp",
321 ]
322}
323
mtkleind2e39db2016-09-07 07:52:55 -0700324optional("fontmgr_custom") {
325 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
326
327 deps = [
328 "//third_party/freetype2",
329 ]
330 sources = [
331 "src/ports/SkFontMgr_custom.cpp",
332 "src/ports/SkFontMgr_custom_directory_factory.cpp",
333 ]
334}
335
mtklein3cc22182016-08-29 13:26:14 -0700336optional("fontmgr_fontconfig") {
337 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700338
339 deps = [
340 "//third_party:fontconfig",
341 "//third_party/freetype2",
342 ]
343 sources = [
bungeman1ae0e012016-09-19 12:13:16 -0700344 "src/ports/SkFontConfigInterface.cpp",
mtklein3cc22182016-08-29 13:26:14 -0700345 "src/ports/SkFontConfigInterface_direct.cpp",
346 "src/ports/SkFontConfigInterface_direct_factory.cpp",
347 "src/ports/SkFontMgr_FontConfigInterface.cpp",
348 "src/ports/SkFontMgr_fontconfig.cpp",
349 "src/ports/SkFontMgr_fontconfig_factory.cpp",
350 ]
351}
352
mtkleincdedd0e2016-09-12 15:15:44 -0700353optional("fontmgr_fuchsia") {
354 enabled = is_fuchsia && skia_use_freetype
355
356 deps = [
357 "//third_party/freetype2",
358 ]
359 sources = [
360 "src/ports/SkFontMgr_custom.cpp",
361 "src/ports/SkFontMgr_custom_empty_factory.cpp",
362 ]
363}
364
mtklein06c35c02016-09-20 12:28:12 -0700365optional("gpu") {
366 enabled = skia_enable_gpu
mtkleine9fb3d52016-09-20 15:11:46 -0700367 public_defines = []
368
mtklein06c35c02016-09-20 12:28:12 -0700369 sources = skia_gpu_sources + [ "src/gpu/gl/GrGLDefaultInterface_native.cpp" ]
370
371 # These paths need to be absolute to match the ones produced by shared_sources.gni.
372 sources -= get_path_info([
373 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
374 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
375 ],
376 "abspath")
Mike Klein703cf5a2016-10-13 17:18:04 -0400377 libs = []
mtklein06c35c02016-09-20 12:28:12 -0700378 if (is_android) {
379 sources += [ "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp" ]
380 } else if (is_linux) {
381 sources += [ "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp" ]
382 } else if (is_mac) {
383 sources += [ "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp" ]
Mike Klein703cf5a2016-10-13 17:18:04 -0400384 } else if (is_win) {
385 sources += [ "src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp" ]
386 libs += [ "OpenGL32.lib" ]
mtklein06c35c02016-09-20 12:28:12 -0700387 } else {
388 sources += [ "src/gpu/gl/GrGLCreateNativeInterface_none.cpp" ]
389 }
mtkleine9fb3d52016-09-20 15:11:46 -0700390
391 if (skia_use_vulkan) {
392 public_defines += [ "SK_VULKAN" ]
393 sources += skia_vk_sources
egdaniele4a9bd72016-09-21 07:36:14 -0700394 if (skia_enable_vulkan_debug_layers) {
395 public_defines += [ "SK_ENABLE_VK_LAYERS" ]
396 }
mtkleine9fb3d52016-09-20 15:11:46 -0700397 }
mtklein06c35c02016-09-20 12:28:12 -0700398}
399
mtklein63213812016-08-24 09:55:56 -0700400optional("jpeg") {
401 enabled = skia_use_libjpeg_turbo
402 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
403
mtklein63213812016-08-24 09:55:56 -0700404 deps = [
405 "//third_party/libjpeg-turbo:libjpeg",
406 ]
407 sources = [
408 "src/codec/SkJpegCodec.cpp",
409 "src/codec/SkJpegDecoderMgr.cpp",
410 "src/codec/SkJpegUtility.cpp",
411 "src/images/SkJPEGImageEncoder.cpp",
412 "src/images/SkJPEGWriteUtility.cpp",
413 ]
414}
415
416optional("pdf") {
417 enabled = skia_use_zlib
mtklein63213812016-08-24 09:55:56 -0700418
mtklein63213812016-08-24 09:55:56 -0700419 deps = [
420 "//third_party/zlib",
421 ]
brettwb9447282016-09-01 14:24:39 -0700422 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700423 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700424
425 if (skia_use_sfntly) {
426 deps += [ "//third_party/sfntly" ]
mtkleincd01b032016-08-31 04:58:19 -0700427 public_defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700428 }
429}
430
431optional("png") {
432 enabled = skia_use_libpng
433 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
434
mtklein63213812016-08-24 09:55:56 -0700435 deps = [
436 "//third_party/libpng",
437 ]
438 sources = [
439 "src/codec/SkIcoCodec.cpp",
440 "src/codec/SkPngCodec.cpp",
441 "src/images/SkPNGImageEncoder.cpp",
442 ]
443}
444
mtklein3cc22182016-08-29 13:26:14 -0700445optional("typeface_freetype") {
446 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700447
448 deps = [
449 "//third_party/freetype2",
450 ]
451 sources = [
452 "src/ports/SkFontHost_FreeType.cpp",
453 "src/ports/SkFontHost_FreeType_common.cpp",
454 ]
455}
456
mtklein457b42a2016-08-23 13:56:37 -0700457optional("webp") {
458 enabled = skia_use_libwebp
459 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
460
mtklein457b42a2016-08-23 13:56:37 -0700461 deps = [
462 "//third_party/libwebp",
463 ]
464 sources = [
465 "src/codec/SkWebpAdapterCodec.cpp",
466 "src/codec/SkWebpCodec.cpp",
467 "src/images/SkWEBPImageEncoder.cpp",
468 ]
mtkleineb3c4252016-08-23 07:38:09 -0700469}
470
mtklein63213812016-08-24 09:55:56 -0700471optional("xml") {
472 enabled = skia_use_expat
mtklein63213812016-08-24 09:55:56 -0700473
mtklein63213812016-08-24 09:55:56 -0700474 deps = [
475 "//third_party/expat",
476 ]
477 sources = [
478 "src/xml/SkDOM.cpp",
479 "src/xml/SkXMLParser.cpp",
480 "src/xml/SkXMLWriter.cpp",
481 ]
482}
483
mtkleinc04ff472016-06-23 10:29:30 -0700484component("skia") {
485 public_configs = [ ":skia_public" ]
486 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700487
488 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700489 ":arm64",
490 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700491 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700492 ":crc32",
mtklein349cece2016-08-26 08:13:04 -0700493 ":dsp",
mtkleina45be612016-08-29 15:22:10 -0700494 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700495 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700496 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700497 ":fontmgr_fuchsia",
mtklein06c35c02016-09-20 12:28:12 -0700498 ":gpu",
Mike Klein78d5a3b2016-09-30 10:48:01 -0400499 ":hsw",
mtklein63213812016-08-24 09:55:56 -0700500 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700501 ":none",
mtklein63213812016-08-24 09:55:56 -0700502 ":pdf",
503 ":png",
mtklein9b8583d2016-08-24 17:32:30 -0700504 ":sse2",
505 ":sse41",
506 ":sse42",
507 ":ssse3",
mtklein3cc22182016-08-29 13:26:14 -0700508 ":typeface_freetype",
mtkleineb3c4252016-08-23 07:38:09 -0700509 ":webp",
mtklein63213812016-08-24 09:55:56 -0700510 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700511 ]
512
mtkleinc04ff472016-06-23 10:29:30 -0700513 sources = []
brettwb9447282016-09-01 14:24:39 -0700514 sources += skia_core_sources
515 sources += skia_effects_sources
brettwb9447282016-09-01 14:24:39 -0700516 sources += skia_sksl_sources
517 sources += skia_utils_sources
mtkleinc04ff472016-06-23 10:29:30 -0700518 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700519 "src/android/SkBitmapRegionCodec.cpp",
520 "src/android/SkBitmapRegionDecoder.cpp",
521 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700522 "src/codec/SkBmpCodec.cpp",
523 "src/codec/SkBmpMaskCodec.cpp",
524 "src/codec/SkBmpRLECodec.cpp",
525 "src/codec/SkBmpStandardCodec.cpp",
526 "src/codec/SkCodec.cpp",
527 "src/codec/SkCodecImageGenerator.cpp",
scroggo19b91532016-10-24 09:03:26 -0700528 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700529 "src/codec/SkMaskSwizzler.cpp",
530 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700531 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700532 "src/codec/SkSampler.cpp",
scroggo19b91532016-10-24 09:03:26 -0700533 "src/codec/SkStreamBuffer.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700534 "src/codec/SkSwizzler.cpp",
535 "src/codec/SkWbmpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700536 "src/images/SkImageEncoder.cpp",
537 "src/images/SkImageEncoder_Factory.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700538 "src/images/SkKTXImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700539 "src/ports/SkDiscardableMemory_none.cpp",
540 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700541 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700542 "src/ports/SkMemory_malloc.cpp",
543 "src/ports/SkOSFile_stdio.cpp",
544 "src/sfnt/SkOTTable_name.cpp",
545 "src/sfnt/SkOTUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700546 "src/svg/SkSVGCanvas.cpp",
547 "src/svg/SkSVGDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700548 "src/utils/mac/SkStream_mac.cpp",
549 "third_party/etc1/etc1.cpp",
scroggo3d3a65c2016-10-24 12:28:30 -0700550 "third_party/gif/SkGifImageReader.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700551 "third_party/ktx/ktx.cpp",
552 ]
brettwb9447282016-09-01 14:24:39 -0700553
mtklein7d6fb2c2016-08-25 14:50:44 -0700554 libs = []
555
mtkleinc04ff472016-06-23 10:29:30 -0700556 if (is_win) {
557 sources += [
Mike Kleinae7e6712016-10-11 17:49:33 -0400558 "src/fonts/SkFontMgr_indirect.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700559 "src/ports/SkDebug_win.cpp",
560 "src/ports/SkFontHost_win.cpp",
561 "src/ports/SkFontMgr_win_dw.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700562 "src/ports/SkImageEncoder_WIC.cpp",
563 "src/ports/SkImageGeneratorWIC.cpp",
564 "src/ports/SkOSFile_win.cpp",
mtklein605d9522016-09-21 14:01:32 -0700565 "src/ports/SkOSLibrary_win.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700566 "src/ports/SkScalerContext_win_dw.cpp",
567 "src/ports/SkTLS_win.cpp",
568 "src/ports/SkTypeface_win_dw.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700569 "src/xps/SkDocument_XPS.cpp",
Mike Klein4b167fc2016-10-11 18:13:53 -0400570 "src/xps/SkXPSDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700571 ]
Mike Klein69f6ed42016-10-13 15:45:07 -0400572 if (skia_use_gdi) {
573 sources += [ "src/ports/SkFontMgr_win_gdi_factory.cpp" ]
574 libs += [
575 "Gdi32.lib",
576 "Usp10.lib",
577 ]
578 } else {
579 sources += [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
580 }
mtkleinb9be9792016-09-16 14:44:18 -0700581 sources -=
582 [ get_path_info("src/utils/SkThreadUtils_pthread.cpp", "abspath") ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400583 libs += [
584 "FontSub.lib",
585 "Ole32.lib",
586 "OleAut32.lib",
587 "User32.lib",
588 ]
mtkleinc04ff472016-06-23 10:29:30 -0700589 } else {
590 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700591 "src/ports/SkOSFile_posix.cpp",
mtklein605d9522016-09-21 14:01:32 -0700592 "src/ports/SkOSLibrary_posix.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700593 "src/ports/SkTLS_pthread.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700594 "src/xps/SkDocument_XPS_None.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700595 ]
596 }
597
mtklein7d6fb2c2016-08-25 14:50:44 -0700598 if (is_android) {
599 deps += [
600 "//third_party/cpu-features",
601 "//third_party/expat",
mtklein7d6fb2c2016-08-25 14:50:44 -0700602 ]
mtklein06c35c02016-09-20 12:28:12 -0700603 sources += [ "src/ports/SkDebug_android.cpp" ]
mtklein7d6fb2c2016-08-25 14:50:44 -0700604 libs += [
605 "EGL",
606 "GLESv2",
607 "log",
608 ]
609 }
610
mtkleinc04ff472016-06-23 10:29:30 -0700611 if (is_linux) {
mtklein09e61f72016-08-23 13:35:28 -0700612 libs += [
613 "GL",
614 "GLU",
615 "X11",
616 ]
mtklein06c35c02016-09-20 12:28:12 -0700617 sources += [ "src/ports/SkDebug_stdio.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700618 }
619
620 if (is_mac) {
621 sources += [
mtklein7d6fb2c2016-08-25 14:50:44 -0700622 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700623 "src/ports/SkFontHost_mac.cpp",
624 "src/ports/SkImageEncoder_CG.cpp",
625 "src/ports/SkImageGeneratorCG.cpp",
626 ]
mtklein09e61f72016-08-23 13:35:28 -0700627 libs += [
628 "ApplicationServices.framework",
629 "OpenGL.framework",
630 ]
mtkleinc04ff472016-06-23 10:29:30 -0700631 }
abarth6fc8ff02016-07-15 15:15:15 -0700632
633 if (is_fuchsia) {
mtklein06c35c02016-09-20 12:28:12 -0700634 sources += [ "src/ports/SkDebug_stdio.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700635 }
mtkleinc04ff472016-06-23 10:29:30 -0700636}
637
mtkleinada5a442016-08-02 14:28:26 -0700638skia_h_headers = exec_script("gyp/find.py",
639 [ "*.h" ] + rebase_path(skia_public_includes),
640 "list lines",
641 []) -
642 [
643 rebase_path("include/gpu/gl/GrGLConfig_chrome.h"),
644 rebase_path("include/gpu/vk/GrVkBackendContext.h"),
645 rebase_path("include/gpu/vk/GrVkDefines.h"),
646 rebase_path("include/gpu/vk/GrVkInterface.h"),
647 rebase_path("include/gpu/vk/GrVkTypes.h"),
648 rebase_path("include/ports/SkFontMgr_fontconfig.h"),
649 ]
650
mtklein1211e0c2016-07-26 13:55:45 -0700651action("skia.h") {
652 script = "gn/echo_headers.py"
653 args = [ rebase_path("$target_gen_dir/skia.h", root_build_dir) ] +
mtkleinc095df52016-08-24 12:23:52 -0700654 rebase_path(skia_h_headers, target_gen_dir)
Ben Wagnerbc344042016-09-29 15:41:53 -0400655 inputs = skia_h_headers
mtklein1211e0c2016-07-26 13:55:45 -0700656 outputs = [
657 "$target_gen_dir/skia.h",
658 ]
659}
660
mtklein06c35c02016-09-20 12:28:12 -0700661if (skia_enable_gpu && target_cpu == "x64") {
mtklein1fbdf982016-09-15 12:07:48 -0700662 # Our bots only have 64-bit libOSMesa installed.
663 # TODO: worth fixing?
664 executable("fiddle") {
665 include_dirs = [ "$target_gen_dir" ]
666 libs = []
667 if (is_linux) {
668 libs += [ "OSMesa" ]
669 }
mtklein56d56692016-09-15 11:18:55 -0700670
mtklein1fbdf982016-09-15 12:07:48 -0700671 sources = [
672 "src/images/SkForceLinking.cpp",
673 "tools/fiddle/draw.cpp",
674 "tools/fiddle/fiddle_main.cpp",
675 ]
676 deps = [
677 ":skia",
678 ":skia.h",
679 ]
680 }
mtkleinc04ff472016-06-23 10:29:30 -0700681}
mtklein25c81d42016-07-27 13:55:26 -0700682
mtkleinc095df52016-08-24 12:23:52 -0700683# Targets guarded by skia_enable_tools may use //third_party freely.
684if (skia_enable_tools) {
685 template("test_lib") {
686 config(target_name + "_config") {
687 include_dirs = invoker.public_include_dirs
mtkleina627b5c2016-09-20 13:36:47 -0700688 if (defined(invoker.public_defines)) {
689 defines = invoker.public_defines
690 }
mtklein25c81d42016-07-27 13:55:26 -0700691 }
mtkleinc095df52016-08-24 12:23:52 -0700692 source_set(target_name) {
693 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
694 public_configs = [
695 ":" + target_name + "_config",
696 ":skia_private",
697 ]
698
699 if (!defined(deps)) {
700 deps = []
701 }
702 deps += [ ":skia" ]
703 testonly = true
704 }
mtklein25c81d42016-07-27 13:55:26 -0700705 }
mtklein25c81d42016-07-27 13:55:26 -0700706
mtkleinc095df52016-08-24 12:23:52 -0700707 test_lib("gpu_tool_utils") {
mtklein38925aa2016-09-21 10:11:25 -0700708 public_include_dirs = []
709 if (skia_enable_gpu) {
710 public_defines = []
711 public_include_dirs += [ "tools/gpu" ]
mtkleind68f9b02016-09-23 13:18:41 -0700712
713 deps = []
mtklein38925aa2016-09-21 10:11:25 -0700714 sources = [
715 "tools/gpu/GrContextFactory.cpp",
716 "tools/gpu/GrTest.cpp",
717 "tools/gpu/TestContext.cpp",
718 "tools/gpu/gl/GLTestContext.cpp",
mtklein605d9522016-09-21 14:01:32 -0700719 "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp",
mtklein38925aa2016-09-21 10:11:25 -0700720 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
721 "tools/gpu/gl/debug/GrBufferObj.cpp",
722 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
723 "tools/gpu/gl/debug/GrProgramObj.cpp",
724 "tools/gpu/gl/debug/GrShaderObj.cpp",
725 "tools/gpu/gl/debug/GrTextureObj.cpp",
726 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
727 "tools/gpu/gl/null/NullGLTestContext.cpp",
728 ]
729 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700730
mtklein38925aa2016-09-21 10:11:25 -0700731 if (is_android) {
732 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
733 } else if (is_linux) {
734 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
735 } else if (is_mac) {
736 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
Mike Klein4b167fc2016-10-11 18:13:53 -0400737 } else if (is_win) {
738 sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
739 libs += [
740 "Gdi32.lib",
741 "OpenGL32.lib",
742 ]
mtklein38925aa2016-09-21 10:11:25 -0700743 }
mtklein6ef69992016-09-14 06:12:09 -0700744
mtkleind68f9b02016-09-23 13:18:41 -0700745 if (skia_use_angle) {
746 public_defines += [ "SK_ANGLE" ]
747 deps += [ "//third_party/angle2" ]
748 sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
mtklein38925aa2016-09-21 10:11:25 -0700749 }
750 if (skia_use_mesa) {
751 public_defines += [ "SK_MESA" ]
752 sources += [ "tools/gpu/gl/mesa/GLTestContext_mesa.cpp" ]
753 libs += [ "OSMesa" ]
754 }
mtkleind68f9b02016-09-23 13:18:41 -0700755 if (skia_use_vulkan) {
756 sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
757 }
mtkleina627b5c2016-09-20 13:36:47 -0700758 }
mtklein25c81d42016-07-27 13:55:26 -0700759 }
mtklein25c81d42016-07-27 13:55:26 -0700760
mtkleinc095df52016-08-24 12:23:52 -0700761 test_lib("flags") {
762 public_include_dirs = [ "tools/flags" ]
763 sources = [
764 "tools/flags/SkCommandLineFlags.cpp",
mtklein046cb562016-09-16 10:23:12 -0700765 ]
766 }
767 test_lib("common_flags") {
768 public_include_dirs = [ "tools/flags" ]
769 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700770 "tools/flags/SkCommonFlags.cpp",
771 "tools/flags/SkCommonFlagsConfig.cpp",
772 ]
773 deps = [
mtklein046cb562016-09-16 10:23:12 -0700774 ":flags",
mtkleinc095df52016-08-24 12:23:52 -0700775 ":gpu_tool_utils",
776 ]
777 }
mtklein25c81d42016-07-27 13:55:26 -0700778
mtkleinc095df52016-08-24 12:23:52 -0700779 test_lib("tool_utils") {
780 public_include_dirs = [
781 "tools",
782 "tools/debugger",
783 "tools/timer",
784 ]
785 sources = [
786 "src/images/SkForceLinking.cpp",
787 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
mtkleinb37c0342016-09-09 11:07:45 -0700788 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700789 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700790 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700791 "tools/ProcStats.cpp",
792 "tools/Resources.cpp",
793 "tools/ThermalManager.cpp",
794 "tools/UrlDataManager.cpp",
795 "tools/debugger/SkDebugCanvas.cpp",
796 "tools/debugger/SkDrawCommand.cpp",
797 "tools/debugger/SkJsonWriteBuffer.cpp",
798 "tools/debugger/SkObjectParser.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700799 "tools/picture_utils.cpp",
800 "tools/random_parse_path.cpp",
801 "tools/sk_tool_utils.cpp",
802 "tools/sk_tool_utils_font.cpp",
803 "tools/timer/Timer.cpp",
804 ]
805 deps = [
mtklein046cb562016-09-16 10:23:12 -0700806 ":common_flags",
mtkleinc095df52016-08-24 12:23:52 -0700807 ":flags",
808 "//third_party/libpng",
809 ]
810 public_deps = [
811 "//third_party/jsoncpp",
812 ]
813 }
mtklein25c81d42016-07-27 13:55:26 -0700814
Mike Klein6e744122016-10-27 12:21:40 -0400815 import("gn/gm.gni")
mtkleinc095df52016-08-24 12:23:52 -0700816 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
Mike Klein6e744122016-10-27 12:21:40 -0400827 import("gn/tests.gni")
mtkleinc095df52016-08-24 12:23:52 -0700828 test_lib("tests") {
829 public_include_dirs = [ "tests" ]
Mike Klein6e744122016-10-27 12:21:40 -0400830 sources = tests_sources + pathops_tests_sources
mtkleina45be612016-08-29 15:22:10 -0700831 if (!fontmgr_android_enabled) {
Mike Klein6e744122016-10-27 12:21:40 -0400832 sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
mtkleina45be612016-08-29 15:22:10 -0700833 }
mtkleinc095df52016-08-24 12:23:52 -0700834 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700835 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700836 ":flags",
837 ":gpu_tool_utils",
838 ":skia",
839 ":tool_utils",
840 "//third_party/libpng",
841 "//third_party/zlib",
842 ]
843 }
mtklein2f3416d2016-08-02 16:02:05 -0700844
Mike Klein6e744122016-10-27 12:21:40 -0400845 import("gn/bench.gni")
mtkleinc095df52016-08-24 12:23:52 -0700846 test_lib("bench") {
847 public_include_dirs = [ "bench" ]
848 sources = bench_sources
mtkleinc095df52016-08-24 12:23:52 -0700849 deps = [
850 ":flags",
851 ":gm",
852 ":gpu_tool_utils",
853 ":skia",
854 ":tool_utils",
855 ]
856 }
mtklein2b6870c2016-07-28 14:17:33 -0700857
mtkleinc095df52016-08-24 12:23:52 -0700858 test_lib("experimental_svg_model") {
859 public_include_dirs = [ "experimental/svg/model" ]
860 sources = [
861 "experimental/svg/model/SkSVGAttribute.cpp",
862 "experimental/svg/model/SkSVGAttributeParser.cpp",
863 "experimental/svg/model/SkSVGCircle.cpp",
864 "experimental/svg/model/SkSVGContainer.cpp",
865 "experimental/svg/model/SkSVGDOM.cpp",
866 "experimental/svg/model/SkSVGEllipse.cpp",
867 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700868 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700869 "experimental/svg/model/SkSVGNode.cpp",
870 "experimental/svg/model/SkSVGPath.cpp",
871 "experimental/svg/model/SkSVGPoly.cpp",
872 "experimental/svg/model/SkSVGRect.cpp",
873 "experimental/svg/model/SkSVGRenderContext.cpp",
874 "experimental/svg/model/SkSVGSVG.cpp",
875 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700876 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700877 "experimental/svg/model/SkSVGTransformableNode.cpp",
878 "experimental/svg/model/SkSVGValue.cpp",
879 ]
880 deps = [
881 ":skia",
882 ]
883 }
fmalitaa2b9fdf2016-08-03 19:53:36 -0700884
Brian Osman16adfa32016-10-18 14:42:44 -0400885 test_lib("views") {
886 public_include_dirs = [ "include/views" ]
887 sources = [
888 "src/views/SkEvent.cpp",
889 "src/views/SkEventSink.cpp",
890 "src/views/SkOSMenu.cpp",
891 "src/views/SkTagList.cpp",
892 "src/views/SkTouchGesture.cpp",
893 "src/views/SkView.cpp",
894 "src/views/SkViewPriv.cpp",
895 ]
896 libs = []
897 if (!is_android) {
898 sources += [ "src/views/SkWindow.cpp" ]
899 }
Jim Van Verth4e56a912016-10-21 10:58:52 -0400900 if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -0400901 public_include_dirs += [ "src/views/unix" ]
902 sources += [
903 "src/views/unix/SkOSWindow_Unix.cpp",
904 "src/views/unix/keysym2ucs.c",
905 ]
Brian Osman16adfa32016-10-18 14:42:44 -0400906 } else if (is_mac) {
907 sources += [
908 "src/views/mac/SkEventNotifier.mm",
909 "src/views/mac/SkNSView.mm",
910 "src/views/mac/SkOSWindow_Mac.mm",
911 "src/views/mac/SkTextFieldCell.m",
912 ]
913 libs += [
914 "QuartzCore.framework",
915 "Cocoa.framework",
916 "Foundation.framework",
917 ]
918 } else if (is_win) {
919 sources += [ "src/views/win/SkOSWindow_win.cpp" ]
920 }
921 }
922
Mike Klein6e744122016-10-27 12:21:40 -0400923 import("gn/samples.gni")
Brian Osman16adfa32016-10-18 14:42:44 -0400924 test_lib("samples") {
Brian Osman16adfa32016-10-18 14:42:44 -0400925 public_include_dirs = [ "samplecode" ]
Mike Klein6e744122016-10-27 12:21:40 -0400926 include_dirs = [ "experimental" ]
927 sources = samples_sources + [
928 "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp",
929 "experimental/SkSetPoly3To3.cpp",
930 "experimental/SkSetPoly3To3_A.cpp",
931 "experimental/SkSetPoly3To3_D.cpp",
932 ]
Brian Osman16adfa32016-10-18 14:42:44 -0400933 deps = [
934 ":experimental_svg_model",
Mike Klein6e744122016-10-27 12:21:40 -0400935 ":gm",
Brian Osman16adfa32016-10-18 14:42:44 -0400936 ":tool_utils",
937 ":views",
938 ":xml",
939 ]
940 }
941
mtklein2b6870c2016-07-28 14:17:33 -0700942 executable("dm") {
943 sources = [
944 "dm/DM.cpp",
945 "dm/DMJsonWriter.cpp",
946 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700947 ]
948 include_dirs = [ "tests" ]
949 deps = [
mtklein046cb562016-09-16 10:23:12 -0700950 ":common_flags",
fmalitaa2b9fdf2016-08-03 19:53:36 -0700951 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -0700952 ":flags",
953 ":gm",
954 ":gpu_tool_utils",
955 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -0700956 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -0700957 ":tool_utils",
958 "//third_party/jsoncpp",
959 "//third_party/libpng",
960 ]
961 testonly = true
962 }
963
Mike Kleina3430172016-09-27 16:46:29 -0400964 if (!is_debug) { # I've benchmarked debug code once too many times...
965 executable("monobench") {
966 sources = [
967 "tools/monobench.cpp",
968 ]
969 deps = [
970 ":bench",
971 ":skia",
972 ]
973 testonly = true
974 }
mtklein2b6870c2016-07-28 14:17:33 -0700975 }
976
977 executable("nanobench") {
978 sources = [
979 "bench/nanobench.cpp",
980 ]
981 deps = [
982 ":bench",
mtklein046cb562016-09-16 10:23:12 -0700983 ":common_flags",
fmalita6519c212016-09-14 08:05:17 -0700984 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -0700985 ":flags",
986 ":gm",
987 ":gpu_tool_utils",
988 ":skia",
989 ":tool_utils",
990 "//third_party/jsoncpp",
991 ]
992 testonly = true
993 }
halcanary19a97202016-08-03 15:08:04 -0700994
Jim Van Verth57a98fc2016-10-28 13:35:50 -0400995 if (is_linux || is_win || is_mac) {
Jim Van Verthb6c5e532016-10-28 10:38:08 -0400996 executable("SampleApp") {
mtklein38925aa2016-09-21 10:11:25 -0700997 sources = [
Jim Van Verthb6c5e532016-10-28 10:38:08 -0400998 "samplecode/SampleApp.cpp",
999 "samplecode/SamplePictFile.cpp",
mtklein38925aa2016-09-21 10:11:25 -07001000 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001001 if (is_mac) {
1002 sources += [ "src/views/mac/skia_mac.mm" ]
1003 } else if (is_win) {
1004 sources += [ "src/views/win/skia_win.cpp" ]
1005 } else if (is_linux) {
1006 sources += [ "src/views/unix/skia_unix.cpp" ]
1007 }
mtklein38925aa2016-09-21 10:11:25 -07001008 deps = [
1009 ":flags",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001010 ":gm",
mtklein38925aa2016-09-21 10:11:25 -07001011 ":gpu_tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001012 ":samples",
mtklein38925aa2016-09-21 10:11:25 -07001013 ":skia",
1014 ":tool_utils",
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001015 ":views",
mtklein38925aa2016-09-21 10:11:25 -07001016 ]
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001017 if (skia_use_angle) {
1018 deps += [ "//third_party/angle2" ]
1019 }
mtklein38925aa2016-09-21 10:11:25 -07001020 testonly = true
1021 }
Jim Van Verthb6c5e532016-10-28 10:38:08 -04001022
1023 if (skia_enable_gpu) {
1024 executable("skpbench") {
1025 sources = [
1026 "tools/skpbench/skpbench.cpp",
1027 ]
1028 deps = [
1029 ":flags",
1030 ":gpu_tool_utils",
1031 ":skia",
1032 ":tool_utils",
1033 ]
1034 testonly = true
1035 }
1036 }
csmartdalton4b5179b2016-09-19 11:03:58 -07001037 }
1038
Mike Klein4b167fc2016-10-11 18:13:53 -04001039 # We can't yet build ICU on Windows.
Mike Klein768bdfc2016-10-11 19:59:22 -04001040 if (!is_win) {
halcanary3eee9d92016-09-10 07:01:53 -07001041 executable("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -07001042 sources = [
1043 "tools/SkShaper_harfbuzz.cpp",
1044 "tools/using_skia_and_harfbuzz.cpp",
1045 ]
1046 deps = [
1047 ":skia",
1048 "//third_party/harfbuzz",
1049 ]
1050 testonly = true
1051 }
halcanary19a97202016-08-03 15:08:04 -07001052 }
halcanary3eee9d92016-09-10 07:01:53 -07001053 executable("sktexttopdf") {
1054 sources = [
1055 "tools/SkShaper_primitive.cpp",
1056 "tools/using_skia_and_harfbuzz.cpp",
1057 ]
1058 deps = [
1059 ":skia",
1060 ]
1061 testonly = true
1062 }
mtklein046cb562016-09-16 10:23:12 -07001063
1064 executable("get_images_from_skps") {
1065 sources = [
1066 "tools/get_images_from_skps.cpp",
1067 ]
1068 deps = [
1069 ":flags",
1070 ":skia",
1071 "//third_party/jsoncpp",
1072 ]
1073 testonly = true
1074 }
mtkleinecbc5262016-09-22 11:51:24 -07001075
1076 executable("skiaserve") {
1077 sources = [
1078 "tools/skiaserve/Request.cpp",
1079 "tools/skiaserve/Response.cpp",
1080 "tools/skiaserve/skiaserve.cpp",
1081 "tools/skiaserve/urlhandlers/BatchBoundsHandler.cpp",
1082 "tools/skiaserve/urlhandlers/BatchesHandler.cpp",
1083 "tools/skiaserve/urlhandlers/BreakHandler.cpp",
1084 "tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
1085 "tools/skiaserve/urlhandlers/CmdHandler.cpp",
1086 "tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
1087 "tools/skiaserve/urlhandlers/DataHandler.cpp",
1088 "tools/skiaserve/urlhandlers/DownloadHandler.cpp",
1089 "tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
1090 "tools/skiaserve/urlhandlers/ImgHandler.cpp",
1091 "tools/skiaserve/urlhandlers/InfoHandler.cpp",
Ben Wagnerc03e1c52016-10-17 15:20:02 -04001092 "tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
mtkleinecbc5262016-09-22 11:51:24 -07001093 "tools/skiaserve/urlhandlers/PostHandler.cpp",
1094 "tools/skiaserve/urlhandlers/QuitHandler.cpp",
1095 "tools/skiaserve/urlhandlers/RootHandler.cpp",
1096 ]
1097 deps = [
1098 ":flags",
1099 ":gpu_tool_utils",
1100 ":skia",
1101 ":tool_utils",
1102 "//third_party/jsoncpp",
1103 "//third_party/libmicrohttpd",
1104 "//third_party/libpng",
1105 ]
1106 testonly = true
1107 }
kjlubick14f984b2016-10-03 11:49:45 -07001108
1109 executable("fuzz") {
Mike Klein6e55fef2016-10-26 11:41:47 -04001110 if (is_skia_standalone) {
1111 configs -= [ "//gn:no_exceptions" ]
1112 }
kjlubick14f984b2016-10-03 11:49:45 -07001113 sources = [
1114 "fuzz/FilterFuzz.cpp",
1115 "fuzz/FuzzGradients.cpp",
1116 "fuzz/FuzzParsePath.cpp",
1117 "fuzz/FuzzPathop.cpp",
1118 "fuzz/FuzzScaleToSides.cpp",
1119 "fuzz/fuzz.cpp",
1120 ]
1121 deps = [
1122 ":flags",
1123 ":skia",
1124 ]
1125 testonly = true
1126 }
Mike Klein38312422016-10-05 15:41:01 -04001127
caryclark9feb6322016-10-25 08:58:26 -07001128 executable("pathops_unittest") {
Mike Klein6e744122016-10-27 12:21:40 -04001129 sources = pathops_tests_sources + [
Mike Klein6e55fef2016-10-26 11:41:47 -04001130 rebase_path("tests/skia_test.cpp"),
1131 rebase_path("tests/Test.cpp"),
1132 ]
caryclark9feb6322016-10-25 08:58:26 -07001133 deps = [
1134 ":flags",
1135 ":gpu_tool_utils",
1136 ":skia",
1137 ":tool_utils",
1138 ]
1139 testonly = true
1140 }
1141
Mike Klein38312422016-10-05 15:41:01 -04001142 executable("dump_record") {
1143 sources = [
1144 "tools/DumpRecord.cpp",
1145 "tools/dump_record.cpp",
1146 ]
1147 deps = [
1148 ":flags",
1149 ":skia",
1150 ]
1151 testonly = true
1152 }
bungemanfe917272016-10-13 17:36:40 -04001153
1154 executable("skdiff") {
1155 sources = [
1156 "tools/skdiff/skdiff.cpp",
1157 "tools/skdiff/skdiff_html.cpp",
1158 "tools/skdiff/skdiff_main.cpp",
1159 "tools/skdiff/skdiff_utils.cpp",
1160 ]
1161 deps = [
1162 ":skia",
1163 ":tool_utils",
1164 ]
1165 testonly = true
1166 }
halcanarya73d76a2016-10-17 13:19:02 -07001167
1168 executable("skp_parser") {
1169 sources = [
1170 "tools/skp_parser.cpp",
1171 ]
1172 deps = [
1173 ":skia",
1174 ":tool_utils",
1175 "//third_party/jsoncpp",
1176 ]
1177 testonly = true
1178 }
Brian Osman16adfa32016-10-18 14:42:44 -04001179
Mike Klein43c25262016-10-20 10:17:47 -04001180 if (skia_enable_gpu && (is_linux || is_win || is_mac)) {
Brian Osman16adfa32016-10-18 14:42:44 -04001181 executable("viewer") {
1182 sources = [
1183 "tools/viewer/GMSlide.cpp",
1184 "tools/viewer/ImageSlide.cpp",
1185 "tools/viewer/SKPSlide.cpp",
1186 "tools/viewer/SampleSlide.cpp",
1187 "tools/viewer/Viewer.cpp",
1188 "tools/viewer/sk_app/CommandSet.cpp",
1189 "tools/viewer/sk_app/GLWindowContext.cpp",
1190 "tools/viewer/sk_app/Window.cpp",
1191 "tools/viewer/sk_app/WindowContext.cpp",
1192 ]
Brian Osman2dd96932016-10-18 15:33:53 -04001193 libs = []
Brian Osman16adfa32016-10-18 14:42:44 -04001194
Jim Van Verth4e56a912016-10-21 10:58:52 -04001195 if (is_android) {
1196 sources += [
1197 "tools/viewer/sk_app/android/GLWindowContext_android.cpp",
1198 "tools/viewer/sk_app/android/RasterWindowContext_android.cpp",
1199 "tools/viewer/sk_app/android/Window_android.cpp",
1200 "tools/viewer/sk_app/android/main_android.cpp",
1201 "tools/viewer/sk_app/android/surface_glue_android.cpp",
1202 ]
1203 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001204 sources += [
1205 "tools/viewer/sk_app/unix/GLWindowContext_unix.cpp",
1206 "tools/viewer/sk_app/unix/RasterWindowContext_unix.cpp",
1207 "tools/viewer/sk_app/unix/Window_unix.cpp",
1208 "tools/viewer/sk_app/unix/main_unix.cpp",
1209 ]
1210 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001211 sources += [
1212 "tools/viewer/sk_app/win/GLWindowContext_win.cpp",
1213 "tools/viewer/sk_app/win/RasterWindowContext_win.cpp",
1214 "tools/viewer/sk_app/win/Window_win.cpp",
1215 "tools/viewer/sk_app/win/main_win.cpp",
1216 ]
Mike Klein43c25262016-10-20 10:17:47 -04001217 } else if (is_mac) {
1218 sources += [
1219 "tools/viewer/sk_app/mac/GLWindowContext_mac.cpp",
1220 "tools/viewer/sk_app/mac/RasterWindowContext_mac.cpp",
1221 "tools/viewer/sk_app/mac/Window_mac.cpp",
1222 "tools/viewer/sk_app/mac/main_mac.cpp",
1223 ]
Brian Osman16adfa32016-10-18 14:42:44 -04001224 }
1225
1226 if (skia_use_vulkan) {
1227 sources += [ "tools/viewer/sk_app/VulkanWindowContext.cpp" ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001228 if (is_android) {
1229 sources +=
1230 [ "tools/viewer/sk_app/android/VulkanWindowContext_android.cpp" ]
1231 libs += [ "android" ]
1232 } else if (is_linux) {
Brian Osman2dd96932016-10-18 15:33:53 -04001233 sources += [ "tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp" ]
1234 libs += [ "X11-xcb" ]
1235 } else if (is_win) {
Brian Osman16adfa32016-10-18 14:42:44 -04001236 sources += [ "tools/viewer/sk_app/win/VulkanWindowContext_win.cpp" ]
1237 }
1238 }
1239
1240 include_dirs = []
1241 deps = [
1242 ":flags",
1243 ":gm",
1244 ":gpu_tool_utils",
1245 ":samples",
1246 ":skia",
1247 ":tool_utils",
1248 ":views",
1249 "//third_party/jsoncpp",
1250 ]
Jim Van Verth4e56a912016-10-21 10:58:52 -04001251 if (is_android) {
1252 deps += [ "//third_party/native_app_glue" ]
1253 } else if (is_mac) {
Mike Klein43c25262016-10-20 10:17:47 -04001254 deps += [ "//third_party/libsdl" ]
1255 }
Brian Osman16adfa32016-10-18 14:42:44 -04001256 testonly = true
1257 }
1258 }
mtklein25c81d42016-07-27 13:55:26 -07001259}