blob: 258bf2d226a228c0803d7bebfe7f6ee51b6b314d [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
mtkleinc04ff472016-06-23 10:29:30 -07008declare_args() {
mtkleinc095df52016-08-24 12:23:52 -07009 skia_enable_tools = !is_fuchsia && !is_component_build
10
mtklein63213812016-08-24 09:55:56 -070011 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070012 skia_use_fontconfig = is_linux
mtkleincdedd0e2016-09-12 15:15:44 -070013 skia_use_freetype = is_android || is_fuchsia || is_linux
mtklein457b42a2016-08-23 13:56:37 -070014 skia_use_giflib = !is_fuchsia
mtklein63213812016-08-24 09:55:56 -070015 skia_use_libjpeg_turbo = true
16 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070017 skia_use_libwebp = !is_fuchsia
mtklein63213812016-08-24 09:55:56 -070018 skia_use_sfntly = !is_fuchsia
19 skia_use_zlib = true
mtkleinc04ff472016-06-23 10:29:30 -070020}
21
mtkleina45be612016-08-29 15:22:10 -070022fontmgr_android_enabled = skia_use_expat && skia_use_freetype
23
mtklein1211e0c2016-07-26 13:55:45 -070024skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070025 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070026 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070027 "include/codec",
28 "include/config",
29 "include/core",
30 "include/effects",
31 "include/gpu",
32 "include/gpu/gl",
33 "include/images",
34 "include/pathops",
35 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070036 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -070037 "include/utils",
38 "include/utils/mac",
mtklein25c81d42016-07-27 13:55:26 -070039 "include/xml",
mtklein1211e0c2016-07-26 13:55:45 -070040]
41
mtkleinc04ff472016-06-23 10:29:30 -070042# Skia public API, generally provided by :skia.
43config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -070044 include_dirs = skia_public_includes
mtkleinc04ff472016-06-23 10:29:30 -070045 defines = [ "SKIA_DLL" ]
jcgregorio5561e3d2016-08-25 09:25:11 -070046 if (is_linux) {
47 defines += [ "SK_SAMPLES_FOR_X" ]
48 }
mtkleinc04ff472016-06-23 10:29:30 -070049}
50
51# Skia internal APIs, used by Skia itself and a few test tools.
52config("skia_private") {
53 visibility = [ ":*" ]
54
55 include_dirs = [
56 "include/private",
57 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -070058 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -070059 "src/config",
60 "src/core",
61 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -070062 "src/effects/gradients",
63 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -070064 "src/gpu",
65 "src/image",
66 "src/images",
67 "src/lazy",
68 "src/opts",
69 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -070070 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -070071 "src/ports",
72 "src/sfnt",
mtklein9e0d9dd2016-08-30 10:37:19 -070073 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -070074 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -070075 "src/utils/win",
mtkleinc04ff472016-06-23 10:29:30 -070076 "third_party/etc1",
77 "third_party/ktx",
78 ]
mtklein150d1132016-08-01 06:56:40 -070079
mtklein63213812016-08-24 09:55:56 -070080 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinb37c0342016-09-09 11:07:45 -070081 if (is_android) {
82 defines += [
83 "SK_GAMMA_EXPONENT=1.4",
84 "SK_GAMMA_CONTRAST=0.0",
85 ]
86 }
mtkleinc04ff472016-06-23 10:29:30 -070087}
88
89# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
90config("skia_library") {
91 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -070092 defines = [ "SKIA_IMPLEMENTATION=1" ]
93}
94
95skia_library_configs = [
96 ":skia_public",
97 ":skia_private",
98 ":skia_library",
99]
100
mtklein9b8583d2016-08-24 17:32:30 -0700101# Use for CPU-specific Skia code that needs particular compiler flags.
102template("opts") {
103 if (invoker.enabled) {
104 source_set(target_name) {
105 forward_variables_from(invoker, "*")
106 configs += skia_library_configs
107 }
108 } else {
109 # If not enabled, a phony empty target that swallows all otherwise unused variables.
110 source_set(target_name) {
111 forward_variables_from(invoker,
112 "*",
113 [
114 "sources",
115 "cflags",
116 ])
117 }
118 }
anmittala7eaf2e2016-08-17 13:57:26 -0700119}
120
mtklein422310d2016-08-16 18:28:43 -0700121is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700122
mtklein7d6fb2c2016-08-25 14:50:44 -0700123opts("none") {
124 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700125 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700126 cflags = []
127}
128
mtklein7d6fb2c2016-08-25 14:50:44 -0700129opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700130 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700131 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700132 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700133}
134
135opts("arm64") {
136 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700137 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700138 cflags = []
139}
140
141opts("crc32") {
142 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700143 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700144 cflags = [ "-march=armv8-a+crc" ]
145}
146
mtklein9b8583d2016-08-24 17:32:30 -0700147opts("sse2") {
148 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700149 sources = skia_opts.sse2_sources
mtklein9b8583d2016-08-24 17:32:30 -0700150 cflags = [ "-msse2" ]
151}
mtkleinc04ff472016-06-23 10:29:30 -0700152
mtklein9b8583d2016-08-24 17:32:30 -0700153opts("ssse3") {
154 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700155 sources = skia_opts.ssse3_sources
mtklein9b8583d2016-08-24 17:32:30 -0700156 cflags = [ "-mssse3" ]
157}
mtkleinc04ff472016-06-23 10:29:30 -0700158
mtklein9b8583d2016-08-24 17:32:30 -0700159opts("sse41") {
160 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700161 sources = skia_opts.sse41_sources
mtklein9b8583d2016-08-24 17:32:30 -0700162 cflags = [ "-msse4.1" ]
163}
mtklein4e976072016-08-08 09:06:27 -0700164
mtklein9b8583d2016-08-24 17:32:30 -0700165opts("sse42") {
166 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700167 sources = skia_opts.sse42_sources
mtklein9b8583d2016-08-24 17:32:30 -0700168 cflags = [ "-msse4.2" ]
169}
170
171opts("avx") {
172 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700173 sources = skia_opts.avx_sources
mtklein9b8583d2016-08-24 17:32:30 -0700174 cflags = [ "-mavx" ]
mtkleinc04ff472016-06-23 10:29:30 -0700175}
176
mtklein349cece2016-08-26 08:13:04 -0700177opts("dsp") {
178 enabled = current_cpu == "mipsel"
brettwb9447282016-09-01 14:24:39 -0700179 sources = skia_opts.mips_dsp_sources
mtkleinb6064ef2016-08-30 11:49:24 -0700180 cflags = []
mtklein349cece2016-08-26 08:13:04 -0700181}
182
mtkleinc095df52016-08-24 12:23:52 -0700183# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700184template("optional") {
185 if (invoker.enabled) {
186 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700187 if (defined(invoker.public_defines)) {
188 defines = invoker.public_defines
189 }
mtklein457b42a2016-08-23 13:56:37 -0700190 }
191 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700192 forward_variables_from(invoker,
193 "*",
194 [
195 "public_defines",
196 "sources_when_disabled",
197 ])
mtklein457b42a2016-08-23 13:56:37 -0700198 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700199 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700200 }
201 } else {
mtklein457b42a2016-08-23 13:56:37 -0700202 source_set(target_name) {
203 forward_variables_from(invoker,
204 "*",
205 [
206 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700207 "deps",
208 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700209 "sources_when_disabled",
mtklein457b42a2016-08-23 13:56:37 -0700210 ])
mtkleincd01b032016-08-31 04:58:19 -0700211 if (defined(invoker.sources_when_disabled)) {
212 sources = invoker.sources_when_disabled
213 }
214 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700215 }
mtkleineb3c4252016-08-23 07:38:09 -0700216 }
mtklein457b42a2016-08-23 13:56:37 -0700217}
mtklein457b42a2016-08-23 13:56:37 -0700218
mtkleina45be612016-08-29 15:22:10 -0700219optional("fontmgr_android") {
220 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700221
222 deps = [
223 "//third_party/expat",
224 "//third_party/freetype2",
225 ]
226 sources = [
227 "src/ports/SkFontMgr_android.cpp",
228 "src/ports/SkFontMgr_android_factory.cpp",
229 "src/ports/SkFontMgr_android_parser.cpp",
230 ]
231}
232
mtkleind2e39db2016-09-07 07:52:55 -0700233optional("fontmgr_custom") {
234 enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
235
236 deps = [
237 "//third_party/freetype2",
238 ]
239 sources = [
240 "src/ports/SkFontMgr_custom.cpp",
241 "src/ports/SkFontMgr_custom_directory_factory.cpp",
242 ]
243}
244
mtklein3cc22182016-08-29 13:26:14 -0700245optional("fontmgr_fontconfig") {
246 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700247
248 deps = [
249 "//third_party:fontconfig",
250 "//third_party/freetype2",
251 ]
252 sources = [
253 "src/ports/SkFontConfigInterface_direct.cpp",
254 "src/ports/SkFontConfigInterface_direct_factory.cpp",
255 "src/ports/SkFontMgr_FontConfigInterface.cpp",
256 "src/ports/SkFontMgr_fontconfig.cpp",
257 "src/ports/SkFontMgr_fontconfig_factory.cpp",
258 ]
259}
260
mtkleincdedd0e2016-09-12 15:15:44 -0700261optional("fontmgr_fuchsia") {
262 enabled = is_fuchsia && skia_use_freetype
263
264 deps = [
265 "//third_party/freetype2",
266 ]
267 sources = [
268 "src/ports/SkFontMgr_custom.cpp",
269 "src/ports/SkFontMgr_custom_empty_factory.cpp",
270 ]
271}
272
mtklein457b42a2016-08-23 13:56:37 -0700273optional("gif") {
274 enabled = skia_use_giflib
275 public_defines = [ "SK_HAS_GIF_LIBRARY" ]
276
mtklein457b42a2016-08-23 13:56:37 -0700277 deps = [
278 "//third_party/giflib",
279 ]
280 sources = [
281 "src/codec/SkGifCodec.cpp",
282 ]
283}
284
mtklein63213812016-08-24 09:55:56 -0700285optional("jpeg") {
286 enabled = skia_use_libjpeg_turbo
287 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
288
mtklein63213812016-08-24 09:55:56 -0700289 deps = [
290 "//third_party/libjpeg-turbo:libjpeg",
291 ]
292 sources = [
293 "src/codec/SkJpegCodec.cpp",
294 "src/codec/SkJpegDecoderMgr.cpp",
295 "src/codec/SkJpegUtility.cpp",
296 "src/images/SkJPEGImageEncoder.cpp",
297 "src/images/SkJPEGWriteUtility.cpp",
298 ]
299}
300
301optional("pdf") {
302 enabled = skia_use_zlib
mtklein63213812016-08-24 09:55:56 -0700303
mtklein63213812016-08-24 09:55:56 -0700304 deps = [
305 "//third_party/zlib",
306 ]
brettwb9447282016-09-01 14:24:39 -0700307 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700308 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700309
310 if (skia_use_sfntly) {
311 deps += [ "//third_party/sfntly" ]
mtkleincd01b032016-08-31 04:58:19 -0700312 public_defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700313 }
314}
315
316optional("png") {
317 enabled = skia_use_libpng
318 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
319
mtklein63213812016-08-24 09:55:56 -0700320 deps = [
321 "//third_party/libpng",
322 ]
323 sources = [
324 "src/codec/SkIcoCodec.cpp",
325 "src/codec/SkPngCodec.cpp",
326 "src/images/SkPNGImageEncoder.cpp",
327 ]
328}
329
mtklein3cc22182016-08-29 13:26:14 -0700330optional("typeface_freetype") {
331 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700332
333 deps = [
334 "//third_party/freetype2",
335 ]
336 sources = [
337 "src/ports/SkFontHost_FreeType.cpp",
338 "src/ports/SkFontHost_FreeType_common.cpp",
339 ]
340}
341
mtklein457b42a2016-08-23 13:56:37 -0700342optional("webp") {
343 enabled = skia_use_libwebp
344 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
345
mtklein457b42a2016-08-23 13:56:37 -0700346 deps = [
347 "//third_party/libwebp",
348 ]
349 sources = [
350 "src/codec/SkWebpAdapterCodec.cpp",
351 "src/codec/SkWebpCodec.cpp",
352 "src/images/SkWEBPImageEncoder.cpp",
353 ]
mtkleineb3c4252016-08-23 07:38:09 -0700354}
355
mtklein63213812016-08-24 09:55:56 -0700356optional("xml") {
357 enabled = skia_use_expat
mtklein63213812016-08-24 09:55:56 -0700358
mtklein63213812016-08-24 09:55:56 -0700359 deps = [
360 "//third_party/expat",
361 ]
362 sources = [
363 "src/xml/SkDOM.cpp",
364 "src/xml/SkXMLParser.cpp",
365 "src/xml/SkXMLWriter.cpp",
366 ]
367}
368
mtkleinc04ff472016-06-23 10:29:30 -0700369component("skia") {
370 public_configs = [ ":skia_public" ]
371 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700372
373 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700374 ":arm64",
375 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700376 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700377 ":crc32",
mtklein349cece2016-08-26 08:13:04 -0700378 ":dsp",
mtkleina45be612016-08-29 15:22:10 -0700379 ":fontmgr_android",
mtkleind2e39db2016-09-07 07:52:55 -0700380 ":fontmgr_custom",
mtklein3cc22182016-08-29 13:26:14 -0700381 ":fontmgr_fontconfig",
mtkleincdedd0e2016-09-12 15:15:44 -0700382 ":fontmgr_fuchsia",
mtklein457b42a2016-08-23 13:56:37 -0700383 ":gif",
mtklein63213812016-08-24 09:55:56 -0700384 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700385 ":none",
mtklein63213812016-08-24 09:55:56 -0700386 ":pdf",
387 ":png",
mtklein9b8583d2016-08-24 17:32:30 -0700388 ":sse2",
389 ":sse41",
390 ":sse42",
391 ":ssse3",
mtklein3cc22182016-08-29 13:26:14 -0700392 ":typeface_freetype",
mtkleineb3c4252016-08-23 07:38:09 -0700393 ":webp",
mtklein63213812016-08-24 09:55:56 -0700394 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700395 ]
396
mtkleinc04ff472016-06-23 10:29:30 -0700397 sources = []
brettwb9447282016-09-01 14:24:39 -0700398 sources += skia_core_sources
399 sources += skia_effects_sources
400 sources += skia_gpu_sources
401 sources += skia_sksl_sources
402 sources += skia_utils_sources
mtkleinc04ff472016-06-23 10:29:30 -0700403 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700404 "src/android/SkBitmapRegionCodec.cpp",
405 "src/android/SkBitmapRegionDecoder.cpp",
406 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700407 "src/codec/SkBmpCodec.cpp",
408 "src/codec/SkBmpMaskCodec.cpp",
409 "src/codec/SkBmpRLECodec.cpp",
410 "src/codec/SkBmpStandardCodec.cpp",
411 "src/codec/SkCodec.cpp",
412 "src/codec/SkCodecImageGenerator.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700413 "src/codec/SkMaskSwizzler.cpp",
414 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700415 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700416 "src/codec/SkSampler.cpp",
417 "src/codec/SkSwizzler.cpp",
418 "src/codec/SkWbmpCodec.cpp",
mtklein09e61f72016-08-23 13:35:28 -0700419 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700420 "src/images/SkImageEncoder.cpp",
421 "src/images/SkImageEncoder_Factory.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700422 "src/images/SkKTXImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700423 "src/ports/SkDiscardableMemory_none.cpp",
424 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700425 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700426 "src/ports/SkMemory_malloc.cpp",
427 "src/ports/SkOSFile_stdio.cpp",
428 "src/sfnt/SkOTTable_name.cpp",
429 "src/sfnt/SkOTUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700430 "src/svg/SkSVGCanvas.cpp",
431 "src/svg/SkSVGDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700432 "src/utils/mac/SkStream_mac.cpp",
433 "third_party/etc1/etc1.cpp",
434 "third_party/ktx/ktx.cpp",
435 ]
brettwb9447282016-09-01 14:24:39 -0700436
437 # These paths need to be absolute to match the ones produced by
438 # shared_sources.gni, but this file may be used from different directory
439 # locations.
440 sources -= get_path_info([
441 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
442 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
443 ],
444 "abspath")
mtkleinc04ff472016-06-23 10:29:30 -0700445
mtklein7d6fb2c2016-08-25 14:50:44 -0700446 libs = []
447
mtkleinc04ff472016-06-23 10:29:30 -0700448 if (is_win) {
449 sources += [
450 "src/ports/SkDebug_win.cpp",
451 "src/ports/SkFontHost_win.cpp",
452 "src/ports/SkFontMgr_win_dw.cpp",
453 "src/ports/SkFontMgr_win_dw_factory.cpp",
454 "src/ports/SkImageEncoder_WIC.cpp",
455 "src/ports/SkImageGeneratorWIC.cpp",
456 "src/ports/SkOSFile_win.cpp",
457 "src/ports/SkScalerContext_win_dw.cpp",
458 "src/ports/SkTLS_win.cpp",
459 "src/ports/SkTypeface_win_dw.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700460 "src/xps/SkDocument_XPS.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700461 ]
mtklein7a1f45f2016-08-04 06:19:33 -0700462 sources -= [ "src/utils/SkThreadUtils_pthread.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700463 } else {
464 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700465 "src/ports/SkOSFile_posix.cpp",
466 "src/ports/SkTLS_pthread.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700467 "src/xps/SkDocument_XPS_None.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700468 ]
469 }
470
mtklein7d6fb2c2016-08-25 14:50:44 -0700471 if (is_android) {
472 deps += [
473 "//third_party/cpu-features",
474 "//third_party/expat",
mtklein7d6fb2c2016-08-25 14:50:44 -0700475 ]
476 sources += [
477 "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp",
478 "src/ports/SkDebug_android.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700479 ]
480 libs += [
481 "EGL",
482 "GLESv2",
483 "log",
484 ]
485 }
486
mtkleinc04ff472016-06-23 10:29:30 -0700487 if (is_linux) {
mtklein09e61f72016-08-23 13:35:28 -0700488 libs += [
489 "GL",
490 "GLU",
491 "X11",
492 ]
mtkleinc04ff472016-06-23 10:29:30 -0700493 sources += [
mtklein09e61f72016-08-23 13:35:28 -0700494 "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700495 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700496 ]
497 }
498
499 if (is_mac) {
500 sources += [
mtklein09e61f72016-08-23 13:35:28 -0700501 "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700502 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700503 "src/ports/SkFontHost_mac.cpp",
504 "src/ports/SkImageEncoder_CG.cpp",
505 "src/ports/SkImageGeneratorCG.cpp",
506 ]
mtklein09e61f72016-08-23 13:35:28 -0700507 libs += [
508 "ApplicationServices.framework",
509 "OpenGL.framework",
510 ]
mtkleinc04ff472016-06-23 10:29:30 -0700511 }
abarth6fc8ff02016-07-15 15:15:15 -0700512
513 if (is_fuchsia) {
mikejurka21cc9952016-09-13 16:15:03 -0700514 sources += [
515 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
516 "src/ports/SkDebug_stdio.cpp",
517 ]
abarth6fc8ff02016-07-15 15:15:15 -0700518 }
mtkleinc04ff472016-06-23 10:29:30 -0700519}
520
mtkleinada5a442016-08-02 14:28:26 -0700521skia_h_headers = exec_script("gyp/find.py",
522 [ "*.h" ] + rebase_path(skia_public_includes),
523 "list lines",
524 []) -
525 [
526 rebase_path("include/gpu/gl/GrGLConfig_chrome.h"),
527 rebase_path("include/gpu/vk/GrVkBackendContext.h"),
528 rebase_path("include/gpu/vk/GrVkDefines.h"),
529 rebase_path("include/gpu/vk/GrVkInterface.h"),
530 rebase_path("include/gpu/vk/GrVkTypes.h"),
531 rebase_path("include/ports/SkFontMgr_fontconfig.h"),
532 ]
533
mtklein1211e0c2016-07-26 13:55:45 -0700534action("skia.h") {
535 script = "gn/echo_headers.py"
536 args = [ rebase_path("$target_gen_dir/skia.h", root_build_dir) ] +
mtkleinc095df52016-08-24 12:23:52 -0700537 rebase_path(skia_h_headers, target_gen_dir)
mtklein1211e0c2016-07-26 13:55:45 -0700538 outputs = [
539 "$target_gen_dir/skia.h",
540 ]
541}
542
543executable("fiddle") {
544 include_dirs = [ "$target_gen_dir" ]
mtklein7d10b9f2016-07-27 11:17:18 -0700545 libs = []
546 if (is_linux) {
547 libs += [ "OSMesa" ]
548 }
mtklein1211e0c2016-07-26 13:55:45 -0700549
mtkleinc04ff472016-06-23 10:29:30 -0700550 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700551 "src/images/SkForceLinking.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700552 "tools/fiddle/draw.cpp",
553 "tools/fiddle/fiddle_main.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700554 ]
555 deps = [
556 ":skia",
mtklein1211e0c2016-07-26 13:55:45 -0700557 ":skia.h",
mtkleinc04ff472016-06-23 10:29:30 -0700558 ]
mtkleinc04ff472016-06-23 10:29:30 -0700559}
mtklein25c81d42016-07-27 13:55:26 -0700560
mtkleinc095df52016-08-24 12:23:52 -0700561# Targets guarded by skia_enable_tools may use //third_party freely.
562if (skia_enable_tools) {
563 template("test_lib") {
564 config(target_name + "_config") {
565 include_dirs = invoker.public_include_dirs
mtklein25c81d42016-07-27 13:55:26 -0700566 }
mtkleinc095df52016-08-24 12:23:52 -0700567 source_set(target_name) {
568 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
569 public_configs = [
570 ":" + target_name + "_config",
571 ":skia_private",
572 ]
573
574 if (!defined(deps)) {
575 deps = []
576 }
577 deps += [ ":skia" ]
578 testonly = true
579 }
mtklein25c81d42016-07-27 13:55:26 -0700580 }
mtklein25c81d42016-07-27 13:55:26 -0700581
mtkleinc095df52016-08-24 12:23:52 -0700582 test_lib("gpu_tool_utils") {
583 public_include_dirs = [ "tools/gpu" ]
584 sources = [
585 "tools/gpu/GrContextFactory.cpp",
586 "tools/gpu/GrTest.cpp",
587 "tools/gpu/TestContext.cpp",
588 "tools/gpu/gl/GLTestContext.cpp",
589 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
590 "tools/gpu/gl/debug/GrBufferObj.cpp",
591 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
592 "tools/gpu/gl/debug/GrProgramObj.cpp",
593 "tools/gpu/gl/debug/GrShaderObj.cpp",
594 "tools/gpu/gl/debug/GrTextureObj.cpp",
595 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
596 "tools/gpu/gl/null/NullGLTestContext.cpp",
597 ]
598 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700599
mtklein7d6fb2c2016-08-25 14:50:44 -0700600 if (is_android) {
601 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
602 } else if (is_linux) {
mtkleinc095df52016-08-24 12:23:52 -0700603 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
604 } else if (is_mac) {
605 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
606 }
mtklein25c81d42016-07-27 13:55:26 -0700607 }
mtklein25c81d42016-07-27 13:55:26 -0700608
mtkleinc095df52016-08-24 12:23:52 -0700609 test_lib("flags") {
610 public_include_dirs = [ "tools/flags" ]
611 sources = [
612 "tools/flags/SkCommandLineFlags.cpp",
613 "tools/flags/SkCommonFlags.cpp",
614 "tools/flags/SkCommonFlagsConfig.cpp",
615 ]
616 deps = [
617 ":gpu_tool_utils",
618 ]
619 }
mtklein25c81d42016-07-27 13:55:26 -0700620
mtkleinc095df52016-08-24 12:23:52 -0700621 test_lib("tool_utils") {
622 public_include_dirs = [
623 "tools",
624 "tools/debugger",
625 "tools/timer",
626 ]
627 sources = [
628 "src/images/SkForceLinking.cpp",
629 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
mtkleinb37c0342016-09-09 11:07:45 -0700630 "tools/AndroidSkDebugToStdOut.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700631 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700632 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700633 "tools/ProcStats.cpp",
634 "tools/Resources.cpp",
635 "tools/ThermalManager.cpp",
636 "tools/UrlDataManager.cpp",
637 "tools/debugger/SkDebugCanvas.cpp",
638 "tools/debugger/SkDrawCommand.cpp",
639 "tools/debugger/SkJsonWriteBuffer.cpp",
640 "tools/debugger/SkObjectParser.cpp",
641 "tools/debugger/SkOverdrawMode.cpp",
642 "tools/picture_utils.cpp",
643 "tools/random_parse_path.cpp",
644 "tools/sk_tool_utils.cpp",
645 "tools/sk_tool_utils_font.cpp",
646 "tools/timer/Timer.cpp",
647 ]
648 deps = [
649 ":flags",
650 "//third_party/libpng",
651 ]
652 public_deps = [
653 "//third_party/jsoncpp",
654 ]
655 }
mtklein25c81d42016-07-27 13:55:26 -0700656
mtkleinc095df52016-08-24 12:23:52 -0700657 gm_sources = exec_script("gyp/find.py",
658 [
659 "*.c*",
660 rebase_path("gm"),
661 ],
662 "list lines",
663 [])
664 test_lib("gm") {
665 public_include_dirs = [ "gm" ]
666 sources = gm_sources
667 deps = [
668 ":gpu_tool_utils",
669 ":skia",
670 ":tool_utils",
671 ]
672 }
mtklein25c81d42016-07-27 13:55:26 -0700673
mtkleinc095df52016-08-24 12:23:52 -0700674 tests_sources = exec_script("gyp/find.py",
675 [
676 "*.c*",
677 rebase_path("tests"),
678 ],
679 "list lines",
680 [])
mtklein2f3416d2016-08-02 16:02:05 -0700681
mtkleinc095df52016-08-24 12:23:52 -0700682 test_lib("tests") {
683 public_include_dirs = [ "tests" ]
mtkleina45be612016-08-29 15:22:10 -0700684 sources = tests_sources - [
685 rebase_path("tests/PathOpsSkpClipTest.cpp"), # alternate main
mtkleina45be612016-08-29 15:22:10 -0700686 rebase_path("tests/SkpSkGrTest.cpp"), # doesn't compile
687 rebase_path("tests/skia_test.cpp"), # alternate main
688 ]
689 if (!fontmgr_android_enabled) {
690 sources -= [ rebase_path("tests/FontMgrAndroidParserTest.cpp") ]
691 }
mtkleinc095df52016-08-24 12:23:52 -0700692 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700693 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700694 ":flags",
695 ":gpu_tool_utils",
696 ":skia",
697 ":tool_utils",
698 "//third_party/libpng",
699 "//third_party/zlib",
700 ]
701 }
mtklein2f3416d2016-08-02 16:02:05 -0700702
mtkleinc095df52016-08-24 12:23:52 -0700703 bench_sources = exec_script("gyp/find.py",
704 [
705 "*.c*",
706 rebase_path("bench"),
707 ],
708 "list lines",
709 [])
mtklein25c81d42016-07-27 13:55:26 -0700710
mtkleinc095df52016-08-24 12:23:52 -0700711 test_lib("bench") {
712 public_include_dirs = [ "bench" ]
713 sources = bench_sources
714 sources -= [
715 rebase_path("bench/nanobench.cpp"),
716 rebase_path("bench/nanobenchAndroid.cpp"),
717 ]
718 deps = [
719 ":flags",
720 ":gm",
721 ":gpu_tool_utils",
722 ":skia",
723 ":tool_utils",
724 ]
725 }
mtklein2b6870c2016-07-28 14:17:33 -0700726
mtkleinc095df52016-08-24 12:23:52 -0700727 test_lib("experimental_svg_model") {
728 public_include_dirs = [ "experimental/svg/model" ]
729 sources = [
730 "experimental/svg/model/SkSVGAttribute.cpp",
731 "experimental/svg/model/SkSVGAttributeParser.cpp",
732 "experimental/svg/model/SkSVGCircle.cpp",
733 "experimental/svg/model/SkSVGContainer.cpp",
734 "experimental/svg/model/SkSVGDOM.cpp",
735 "experimental/svg/model/SkSVGEllipse.cpp",
736 "experimental/svg/model/SkSVGLine.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700737 "experimental/svg/model/SkSVGLinearGradient.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700738 "experimental/svg/model/SkSVGNode.cpp",
739 "experimental/svg/model/SkSVGPath.cpp",
740 "experimental/svg/model/SkSVGPoly.cpp",
741 "experimental/svg/model/SkSVGRect.cpp",
742 "experimental/svg/model/SkSVGRenderContext.cpp",
743 "experimental/svg/model/SkSVGSVG.cpp",
744 "experimental/svg/model/SkSVGShape.cpp",
fmalita28d5b722016-09-12 17:06:47 -0700745 "experimental/svg/model/SkSVGStop.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700746 "experimental/svg/model/SkSVGTransformableNode.cpp",
747 "experimental/svg/model/SkSVGValue.cpp",
748 ]
749 deps = [
750 ":skia",
751 ]
752 }
fmalitaa2b9fdf2016-08-03 19:53:36 -0700753
mtklein2b6870c2016-07-28 14:17:33 -0700754 executable("dm") {
755 sources = [
756 "dm/DM.cpp",
757 "dm/DMJsonWriter.cpp",
758 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700759 ]
760 include_dirs = [ "tests" ]
761 deps = [
fmalitaa2b9fdf2016-08-03 19:53:36 -0700762 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -0700763 ":flags",
764 ":gm",
765 ":gpu_tool_utils",
766 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -0700767 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -0700768 ":tool_utils",
769 "//third_party/jsoncpp",
770 "//third_party/libpng",
771 ]
772 testonly = true
773 }
774
775 executable("monobench") {
776 sources = [
777 "tools/monobench.cpp",
778 ]
779 deps = [
780 ":bench",
781 ":skia",
782 ]
783 testonly = true
784 }
785
786 executable("nanobench") {
787 sources = [
788 "bench/nanobench.cpp",
789 ]
790 deps = [
791 ":bench",
792 ":flags",
793 ":gm",
794 ":gpu_tool_utils",
795 ":skia",
796 ":tool_utils",
797 "//third_party/jsoncpp",
798 ]
799 testonly = true
800 }
halcanary19a97202016-08-03 15:08:04 -0700801
mtklein6f5df6a2016-08-29 16:01:10 -0700802 if (current_cpu != "mipsel") { # Clang 3.8 crashes while compiling hb-icu.cc for mipsel.
halcanary3eee9d92016-09-10 07:01:53 -0700803 executable("sktexttopdf-hb") {
mtklein6f5df6a2016-08-29 16:01:10 -0700804 sources = [
805 "tools/SkShaper_harfbuzz.cpp",
806 "tools/using_skia_and_harfbuzz.cpp",
807 ]
808 deps = [
809 ":skia",
810 "//third_party/harfbuzz",
811 ]
812 testonly = true
813 }
halcanary19a97202016-08-03 15:08:04 -0700814 }
halcanary3eee9d92016-09-10 07:01:53 -0700815 executable("sktexttopdf") {
816 sources = [
817 "tools/SkShaper_primitive.cpp",
818 "tools/using_skia_and_harfbuzz.cpp",
819 ]
820 deps = [
821 ":skia",
822 ]
823 testonly = true
824 }
mtklein25c81d42016-07-27 13:55:26 -0700825}