blob: 1b900485b74a5624ed279e6f7f07667c3d8102de [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
brettwb9447282016-09-01 14:24:39 -07006import("//gn/shared_sources.gni")
7
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
13 skia_use_freetype = is_android || 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" ]
mtkleinc04ff472016-06-23 10:29:30 -070081}
82
83# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
84config("skia_library") {
85 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -070086 defines = [ "SKIA_IMPLEMENTATION=1" ]
87}
88
89skia_library_configs = [
90 ":skia_public",
91 ":skia_private",
92 ":skia_library",
93]
94
mtklein9b8583d2016-08-24 17:32:30 -070095# Use for CPU-specific Skia code that needs particular compiler flags.
96template("opts") {
97 if (invoker.enabled) {
98 source_set(target_name) {
99 forward_variables_from(invoker, "*")
100 configs += skia_library_configs
101 }
102 } else {
103 # If not enabled, a phony empty target that swallows all otherwise unused variables.
104 source_set(target_name) {
105 forward_variables_from(invoker,
106 "*",
107 [
108 "sources",
109 "cflags",
110 ])
111 }
112 }
anmittala7eaf2e2016-08-17 13:57:26 -0700113}
114
mtklein422310d2016-08-16 18:28:43 -0700115is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700116
mtklein7d6fb2c2016-08-25 14:50:44 -0700117opts("none") {
118 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
brettwb9447282016-09-01 14:24:39 -0700119 sources = skia_opts.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700120 cflags = []
121}
122
mtklein7d6fb2c2016-08-25 14:50:44 -0700123opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700124 enabled = current_cpu == "arm"
brettwb9447282016-09-01 14:24:39 -0700125 sources = skia_opts.armv7_sources + skia_opts.neon_sources
mtklein7d6fb2c2016-08-25 14:50:44 -0700126 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700127}
128
129opts("arm64") {
130 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700131 sources = skia_opts.arm64_sources
anmittalb8b3f712016-08-25 04:55:19 -0700132 cflags = []
133}
134
135opts("crc32") {
136 enabled = current_cpu == "arm64"
brettwb9447282016-09-01 14:24:39 -0700137 sources = skia_opts.crc32_sources
anmittalb8b3f712016-08-25 04:55:19 -0700138 cflags = [ "-march=armv8-a+crc" ]
139}
140
mtklein9b8583d2016-08-24 17:32:30 -0700141opts("sse2") {
142 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700143 sources = skia_opts.sse2_sources
mtklein9b8583d2016-08-24 17:32:30 -0700144 cflags = [ "-msse2" ]
145}
mtkleinc04ff472016-06-23 10:29:30 -0700146
mtklein9b8583d2016-08-24 17:32:30 -0700147opts("ssse3") {
148 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700149 sources = skia_opts.ssse3_sources
mtklein9b8583d2016-08-24 17:32:30 -0700150 cflags = [ "-mssse3" ]
151}
mtkleinc04ff472016-06-23 10:29:30 -0700152
mtklein9b8583d2016-08-24 17:32:30 -0700153opts("sse41") {
154 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700155 sources = skia_opts.sse41_sources
mtklein9b8583d2016-08-24 17:32:30 -0700156 cflags = [ "-msse4.1" ]
157}
mtklein4e976072016-08-08 09:06:27 -0700158
mtklein9b8583d2016-08-24 17:32:30 -0700159opts("sse42") {
160 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700161 sources = skia_opts.sse42_sources
mtklein9b8583d2016-08-24 17:32:30 -0700162 cflags = [ "-msse4.2" ]
163}
164
165opts("avx") {
166 enabled = is_x86
brettwb9447282016-09-01 14:24:39 -0700167 sources = skia_opts.avx_sources
mtklein9b8583d2016-08-24 17:32:30 -0700168 cflags = [ "-mavx" ]
mtkleinc04ff472016-06-23 10:29:30 -0700169}
170
mtklein349cece2016-08-26 08:13:04 -0700171opts("dsp") {
172 enabled = current_cpu == "mipsel"
brettwb9447282016-09-01 14:24:39 -0700173 sources = skia_opts.mips_dsp_sources
mtkleinb6064ef2016-08-30 11:49:24 -0700174 cflags = []
mtklein349cece2016-08-26 08:13:04 -0700175}
176
mtkleinc095df52016-08-24 12:23:52 -0700177# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700178template("optional") {
179 if (invoker.enabled) {
180 config(target_name + "_public") {
mtkleincd01b032016-08-31 04:58:19 -0700181 if (defined(invoker.public_defines)) {
182 defines = invoker.public_defines
183 }
mtklein457b42a2016-08-23 13:56:37 -0700184 }
185 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700186 forward_variables_from(invoker,
187 "*",
188 [
189 "public_defines",
190 "sources_when_disabled",
191 ])
mtklein457b42a2016-08-23 13:56:37 -0700192 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700193 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700194 }
195 } else {
mtklein457b42a2016-08-23 13:56:37 -0700196 source_set(target_name) {
197 forward_variables_from(invoker,
198 "*",
199 [
200 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700201 "deps",
202 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700203 "sources_when_disabled",
mtklein457b42a2016-08-23 13:56:37 -0700204 ])
mtkleincd01b032016-08-31 04:58:19 -0700205 if (defined(invoker.sources_when_disabled)) {
206 sources = invoker.sources_when_disabled
207 }
208 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700209 }
mtkleineb3c4252016-08-23 07:38:09 -0700210 }
mtklein457b42a2016-08-23 13:56:37 -0700211}
mtklein457b42a2016-08-23 13:56:37 -0700212
mtkleina45be612016-08-29 15:22:10 -0700213optional("fontmgr_android") {
214 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700215
216 deps = [
217 "//third_party/expat",
218 "//third_party/freetype2",
219 ]
220 sources = [
221 "src/ports/SkFontMgr_android.cpp",
222 "src/ports/SkFontMgr_android_factory.cpp",
223 "src/ports/SkFontMgr_android_parser.cpp",
224 ]
225}
226
mtklein3cc22182016-08-29 13:26:14 -0700227optional("fontmgr_fontconfig") {
228 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700229
230 deps = [
231 "//third_party:fontconfig",
232 "//third_party/freetype2",
233 ]
234 sources = [
235 "src/ports/SkFontConfigInterface_direct.cpp",
236 "src/ports/SkFontConfigInterface_direct_factory.cpp",
237 "src/ports/SkFontMgr_FontConfigInterface.cpp",
238 "src/ports/SkFontMgr_fontconfig.cpp",
239 "src/ports/SkFontMgr_fontconfig_factory.cpp",
240 ]
241}
242
mtklein457b42a2016-08-23 13:56:37 -0700243optional("gif") {
244 enabled = skia_use_giflib
245 public_defines = [ "SK_HAS_GIF_LIBRARY" ]
246
mtklein457b42a2016-08-23 13:56:37 -0700247 deps = [
248 "//third_party/giflib",
249 ]
250 sources = [
251 "src/codec/SkGifCodec.cpp",
252 ]
253}
254
mtklein63213812016-08-24 09:55:56 -0700255optional("jpeg") {
256 enabled = skia_use_libjpeg_turbo
257 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
258
mtklein63213812016-08-24 09:55:56 -0700259 deps = [
260 "//third_party/libjpeg-turbo:libjpeg",
261 ]
262 sources = [
263 "src/codec/SkJpegCodec.cpp",
264 "src/codec/SkJpegDecoderMgr.cpp",
265 "src/codec/SkJpegUtility.cpp",
266 "src/images/SkJPEGImageEncoder.cpp",
267 "src/images/SkJPEGWriteUtility.cpp",
268 ]
269}
270
271optional("pdf") {
272 enabled = skia_use_zlib
mtklein63213812016-08-24 09:55:56 -0700273
mtklein63213812016-08-24 09:55:56 -0700274 deps = [
275 "//third_party/zlib",
276 ]
brettwb9447282016-09-01 14:24:39 -0700277 sources = skia_pdf_sources
mtkleincd01b032016-08-31 04:58:19 -0700278 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700279
280 if (skia_use_sfntly) {
281 deps += [ "//third_party/sfntly" ]
mtkleincd01b032016-08-31 04:58:19 -0700282 public_defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700283 }
284}
285
286optional("png") {
287 enabled = skia_use_libpng
288 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
289
mtklein63213812016-08-24 09:55:56 -0700290 deps = [
291 "//third_party/libpng",
292 ]
293 sources = [
294 "src/codec/SkIcoCodec.cpp",
295 "src/codec/SkPngCodec.cpp",
296 "src/images/SkPNGImageEncoder.cpp",
297 ]
298}
299
mtklein3cc22182016-08-29 13:26:14 -0700300optional("typeface_freetype") {
301 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700302
303 deps = [
304 "//third_party/freetype2",
305 ]
306 sources = [
307 "src/ports/SkFontHost_FreeType.cpp",
308 "src/ports/SkFontHost_FreeType_common.cpp",
309 ]
310}
311
mtklein457b42a2016-08-23 13:56:37 -0700312optional("webp") {
313 enabled = skia_use_libwebp
314 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
315
mtklein457b42a2016-08-23 13:56:37 -0700316 deps = [
317 "//third_party/libwebp",
318 ]
319 sources = [
320 "src/codec/SkWebpAdapterCodec.cpp",
321 "src/codec/SkWebpCodec.cpp",
322 "src/images/SkWEBPImageEncoder.cpp",
323 ]
mtkleineb3c4252016-08-23 07:38:09 -0700324}
325
mtklein63213812016-08-24 09:55:56 -0700326optional("xml") {
327 enabled = skia_use_expat
mtklein63213812016-08-24 09:55:56 -0700328
mtklein63213812016-08-24 09:55:56 -0700329 deps = [
330 "//third_party/expat",
331 ]
332 sources = [
333 "src/xml/SkDOM.cpp",
334 "src/xml/SkXMLParser.cpp",
335 "src/xml/SkXMLWriter.cpp",
336 ]
337}
338
mtkleinc04ff472016-06-23 10:29:30 -0700339component("skia") {
340 public_configs = [ ":skia_public" ]
341 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700342
343 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700344 ":arm64",
345 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700346 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700347 ":crc32",
mtklein349cece2016-08-26 08:13:04 -0700348 ":dsp",
mtkleina45be612016-08-29 15:22:10 -0700349 ":fontmgr_android",
mtklein3cc22182016-08-29 13:26:14 -0700350 ":fontmgr_fontconfig",
mtklein457b42a2016-08-23 13:56:37 -0700351 ":gif",
mtklein63213812016-08-24 09:55:56 -0700352 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700353 ":none",
mtklein63213812016-08-24 09:55:56 -0700354 ":pdf",
355 ":png",
mtklein9b8583d2016-08-24 17:32:30 -0700356 ":sse2",
357 ":sse41",
358 ":sse42",
359 ":ssse3",
mtklein3cc22182016-08-29 13:26:14 -0700360 ":typeface_freetype",
mtkleineb3c4252016-08-23 07:38:09 -0700361 ":webp",
mtklein63213812016-08-24 09:55:56 -0700362 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700363 ]
364
mtkleinc04ff472016-06-23 10:29:30 -0700365 sources = []
brettwb9447282016-09-01 14:24:39 -0700366 sources += skia_core_sources
367 sources += skia_effects_sources
368 sources += skia_gpu_sources
369 sources += skia_sksl_sources
370 sources += skia_utils_sources
mtkleinc04ff472016-06-23 10:29:30 -0700371 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700372 "src/android/SkBitmapRegionCodec.cpp",
373 "src/android/SkBitmapRegionDecoder.cpp",
374 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700375 "src/codec/SkBmpCodec.cpp",
376 "src/codec/SkBmpMaskCodec.cpp",
377 "src/codec/SkBmpRLECodec.cpp",
378 "src/codec/SkBmpStandardCodec.cpp",
379 "src/codec/SkCodec.cpp",
380 "src/codec/SkCodecImageGenerator.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700381 "src/codec/SkMaskSwizzler.cpp",
382 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700383 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700384 "src/codec/SkSampler.cpp",
385 "src/codec/SkSwizzler.cpp",
386 "src/codec/SkWbmpCodec.cpp",
mtklein09e61f72016-08-23 13:35:28 -0700387 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700388 "src/images/SkImageEncoder.cpp",
389 "src/images/SkImageEncoder_Factory.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700390 "src/images/SkKTXImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700391 "src/ports/SkDiscardableMemory_none.cpp",
392 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700393 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700394 "src/ports/SkMemory_malloc.cpp",
395 "src/ports/SkOSFile_stdio.cpp",
396 "src/sfnt/SkOTTable_name.cpp",
397 "src/sfnt/SkOTUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700398 "src/svg/SkSVGCanvas.cpp",
399 "src/svg/SkSVGDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700400 "src/utils/mac/SkStream_mac.cpp",
401 "third_party/etc1/etc1.cpp",
402 "third_party/ktx/ktx.cpp",
403 ]
brettwb9447282016-09-01 14:24:39 -0700404
405 # These paths need to be absolute to match the ones produced by
406 # shared_sources.gni, but this file may be used from different directory
407 # locations.
408 sources -= get_path_info([
409 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
410 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
411 ],
412 "abspath")
mtkleinc04ff472016-06-23 10:29:30 -0700413
mtklein7d6fb2c2016-08-25 14:50:44 -0700414 libs = []
415
mtkleinc04ff472016-06-23 10:29:30 -0700416 if (is_win) {
417 sources += [
418 "src/ports/SkDebug_win.cpp",
419 "src/ports/SkFontHost_win.cpp",
420 "src/ports/SkFontMgr_win_dw.cpp",
421 "src/ports/SkFontMgr_win_dw_factory.cpp",
422 "src/ports/SkImageEncoder_WIC.cpp",
423 "src/ports/SkImageGeneratorWIC.cpp",
424 "src/ports/SkOSFile_win.cpp",
425 "src/ports/SkScalerContext_win_dw.cpp",
426 "src/ports/SkTLS_win.cpp",
427 "src/ports/SkTypeface_win_dw.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700428 "src/xps/SkDocument_XPS.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700429 ]
mtklein7a1f45f2016-08-04 06:19:33 -0700430 sources -= [ "src/utils/SkThreadUtils_pthread.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700431 } else {
432 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700433 "src/ports/SkOSFile_posix.cpp",
434 "src/ports/SkTLS_pthread.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700435 "src/xps/SkDocument_XPS_None.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700436 ]
437 }
438
mtklein7d6fb2c2016-08-25 14:50:44 -0700439 if (is_android) {
440 deps += [
441 "//third_party/cpu-features",
442 "//third_party/expat",
mtklein7d6fb2c2016-08-25 14:50:44 -0700443 ]
444 sources += [
445 "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp",
446 "src/ports/SkDebug_android.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700447 ]
448 libs += [
449 "EGL",
450 "GLESv2",
451 "log",
452 ]
453 }
454
mtkleinc04ff472016-06-23 10:29:30 -0700455 if (is_linux) {
mtklein09e61f72016-08-23 13:35:28 -0700456 libs += [
457 "GL",
458 "GLU",
459 "X11",
460 ]
mtkleinc04ff472016-06-23 10:29:30 -0700461 sources += [
mtklein09e61f72016-08-23 13:35:28 -0700462 "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700463 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700464 ]
465 }
466
467 if (is_mac) {
468 sources += [
mtklein09e61f72016-08-23 13:35:28 -0700469 "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700470 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700471 "src/ports/SkFontHost_mac.cpp",
472 "src/ports/SkImageEncoder_CG.cpp",
473 "src/ports/SkImageGeneratorCG.cpp",
474 ]
mtklein09e61f72016-08-23 13:35:28 -0700475 libs += [
476 "ApplicationServices.framework",
477 "OpenGL.framework",
478 ]
mtkleinc04ff472016-06-23 10:29:30 -0700479 }
abarth6fc8ff02016-07-15 15:15:15 -0700480
481 if (is_fuchsia) {
mtklein2ff47c22016-08-24 10:27:13 -0700482 sources += [
483 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700484 "src/ports/SkDebug_stdio.cpp",
mtklein2ff47c22016-08-24 10:27:13 -0700485 "src/ports/SkFontMgr_empty_factory.cpp",
486 ]
abarth6fc8ff02016-07-15 15:15:15 -0700487 }
mtkleinc04ff472016-06-23 10:29:30 -0700488}
489
mtkleinada5a442016-08-02 14:28:26 -0700490skia_h_headers = exec_script("gyp/find.py",
491 [ "*.h" ] + rebase_path(skia_public_includes),
492 "list lines",
493 []) -
494 [
495 rebase_path("include/gpu/gl/GrGLConfig_chrome.h"),
496 rebase_path("include/gpu/vk/GrVkBackendContext.h"),
497 rebase_path("include/gpu/vk/GrVkDefines.h"),
498 rebase_path("include/gpu/vk/GrVkInterface.h"),
499 rebase_path("include/gpu/vk/GrVkTypes.h"),
500 rebase_path("include/ports/SkFontMgr_fontconfig.h"),
501 ]
502
mtklein1211e0c2016-07-26 13:55:45 -0700503action("skia.h") {
504 script = "gn/echo_headers.py"
505 args = [ rebase_path("$target_gen_dir/skia.h", root_build_dir) ] +
mtkleinc095df52016-08-24 12:23:52 -0700506 rebase_path(skia_h_headers, target_gen_dir)
mtklein1211e0c2016-07-26 13:55:45 -0700507 outputs = [
508 "$target_gen_dir/skia.h",
509 ]
510}
511
512executable("fiddle") {
513 include_dirs = [ "$target_gen_dir" ]
mtklein7d10b9f2016-07-27 11:17:18 -0700514 libs = []
515 if (is_linux) {
516 libs += [ "OSMesa" ]
517 }
mtklein1211e0c2016-07-26 13:55:45 -0700518
mtkleinc04ff472016-06-23 10:29:30 -0700519 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700520 "src/images/SkForceLinking.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700521 "tools/fiddle/draw.cpp",
522 "tools/fiddle/fiddle_main.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700523 ]
524 deps = [
525 ":skia",
mtklein1211e0c2016-07-26 13:55:45 -0700526 ":skia.h",
mtkleinc04ff472016-06-23 10:29:30 -0700527 ]
mtkleinc04ff472016-06-23 10:29:30 -0700528}
mtklein25c81d42016-07-27 13:55:26 -0700529
mtkleinc095df52016-08-24 12:23:52 -0700530# Targets guarded by skia_enable_tools may use //third_party freely.
531if (skia_enable_tools) {
532 template("test_lib") {
533 config(target_name + "_config") {
534 include_dirs = invoker.public_include_dirs
mtklein25c81d42016-07-27 13:55:26 -0700535 }
mtkleinc095df52016-08-24 12:23:52 -0700536 source_set(target_name) {
537 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
538 public_configs = [
539 ":" + target_name + "_config",
540 ":skia_private",
541 ]
542
543 if (!defined(deps)) {
544 deps = []
545 }
546 deps += [ ":skia" ]
547 testonly = true
548 }
mtklein25c81d42016-07-27 13:55:26 -0700549 }
mtklein25c81d42016-07-27 13:55:26 -0700550
mtkleinc095df52016-08-24 12:23:52 -0700551 test_lib("gpu_tool_utils") {
552 public_include_dirs = [ "tools/gpu" ]
553 sources = [
554 "tools/gpu/GrContextFactory.cpp",
555 "tools/gpu/GrTest.cpp",
556 "tools/gpu/TestContext.cpp",
557 "tools/gpu/gl/GLTestContext.cpp",
558 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
559 "tools/gpu/gl/debug/GrBufferObj.cpp",
560 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
561 "tools/gpu/gl/debug/GrProgramObj.cpp",
562 "tools/gpu/gl/debug/GrShaderObj.cpp",
563 "tools/gpu/gl/debug/GrTextureObj.cpp",
564 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
565 "tools/gpu/gl/null/NullGLTestContext.cpp",
566 ]
567 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700568
mtklein7d6fb2c2016-08-25 14:50:44 -0700569 if (is_android) {
570 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
571 } else if (is_linux) {
mtkleinc095df52016-08-24 12:23:52 -0700572 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
573 } else if (is_mac) {
574 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
575 }
mtklein25c81d42016-07-27 13:55:26 -0700576 }
mtklein25c81d42016-07-27 13:55:26 -0700577
mtkleinc095df52016-08-24 12:23:52 -0700578 test_lib("flags") {
579 public_include_dirs = [ "tools/flags" ]
580 sources = [
581 "tools/flags/SkCommandLineFlags.cpp",
582 "tools/flags/SkCommonFlags.cpp",
583 "tools/flags/SkCommonFlagsConfig.cpp",
584 ]
585 deps = [
586 ":gpu_tool_utils",
587 ]
588 }
mtklein25c81d42016-07-27 13:55:26 -0700589
mtkleinc095df52016-08-24 12:23:52 -0700590 test_lib("tool_utils") {
591 public_include_dirs = [
592 "tools",
593 "tools/debugger",
594 "tools/timer",
595 ]
596 sources = [
597 "src/images/SkForceLinking.cpp",
598 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
599 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700600 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700601 "tools/ProcStats.cpp",
602 "tools/Resources.cpp",
603 "tools/ThermalManager.cpp",
604 "tools/UrlDataManager.cpp",
605 "tools/debugger/SkDebugCanvas.cpp",
606 "tools/debugger/SkDrawCommand.cpp",
607 "tools/debugger/SkJsonWriteBuffer.cpp",
608 "tools/debugger/SkObjectParser.cpp",
609 "tools/debugger/SkOverdrawMode.cpp",
610 "tools/picture_utils.cpp",
611 "tools/random_parse_path.cpp",
612 "tools/sk_tool_utils.cpp",
613 "tools/sk_tool_utils_font.cpp",
614 "tools/timer/Timer.cpp",
615 ]
616 deps = [
617 ":flags",
618 "//third_party/libpng",
619 ]
620 public_deps = [
621 "//third_party/jsoncpp",
622 ]
623 }
mtklein25c81d42016-07-27 13:55:26 -0700624
mtkleinc095df52016-08-24 12:23:52 -0700625 gm_sources = exec_script("gyp/find.py",
626 [
627 "*.c*",
628 rebase_path("gm"),
629 ],
630 "list lines",
631 [])
632 test_lib("gm") {
633 public_include_dirs = [ "gm" ]
634 sources = gm_sources
635 deps = [
636 ":gpu_tool_utils",
637 ":skia",
638 ":tool_utils",
639 ]
640 }
mtklein25c81d42016-07-27 13:55:26 -0700641
mtkleinc095df52016-08-24 12:23:52 -0700642 tests_sources = exec_script("gyp/find.py",
643 [
644 "*.c*",
645 rebase_path("tests"),
646 ],
647 "list lines",
648 [])
mtklein2f3416d2016-08-02 16:02:05 -0700649
mtkleinc095df52016-08-24 12:23:52 -0700650 test_lib("tests") {
651 public_include_dirs = [ "tests" ]
mtkleina45be612016-08-29 15:22:10 -0700652 sources = tests_sources - [
653 rebase_path("tests/PathOpsSkpClipTest.cpp"), # alternate main
mtkleina45be612016-08-29 15:22:10 -0700654 rebase_path("tests/SkpSkGrTest.cpp"), # doesn't compile
655 rebase_path("tests/skia_test.cpp"), # alternate main
656 ]
657 if (!fontmgr_android_enabled) {
658 sources -= [ rebase_path("tests/FontMgrAndroidParserTest.cpp") ]
659 }
mtkleinc095df52016-08-24 12:23:52 -0700660 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700661 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700662 ":flags",
663 ":gpu_tool_utils",
664 ":skia",
665 ":tool_utils",
666 "//third_party/libpng",
667 "//third_party/zlib",
668 ]
669 }
mtklein2f3416d2016-08-02 16:02:05 -0700670
mtkleinc095df52016-08-24 12:23:52 -0700671 bench_sources = exec_script("gyp/find.py",
672 [
673 "*.c*",
674 rebase_path("bench"),
675 ],
676 "list lines",
677 [])
mtklein25c81d42016-07-27 13:55:26 -0700678
mtkleinc095df52016-08-24 12:23:52 -0700679 test_lib("bench") {
680 public_include_dirs = [ "bench" ]
681 sources = bench_sources
682 sources -= [
683 rebase_path("bench/nanobench.cpp"),
684 rebase_path("bench/nanobenchAndroid.cpp"),
685 ]
686 deps = [
687 ":flags",
688 ":gm",
689 ":gpu_tool_utils",
690 ":skia",
691 ":tool_utils",
692 ]
693 }
mtklein2b6870c2016-07-28 14:17:33 -0700694
mtkleinc095df52016-08-24 12:23:52 -0700695 test_lib("experimental_svg_model") {
696 public_include_dirs = [ "experimental/svg/model" ]
697 sources = [
698 "experimental/svg/model/SkSVGAttribute.cpp",
699 "experimental/svg/model/SkSVGAttributeParser.cpp",
700 "experimental/svg/model/SkSVGCircle.cpp",
701 "experimental/svg/model/SkSVGContainer.cpp",
702 "experimental/svg/model/SkSVGDOM.cpp",
703 "experimental/svg/model/SkSVGEllipse.cpp",
704 "experimental/svg/model/SkSVGLine.cpp",
705 "experimental/svg/model/SkSVGNode.cpp",
706 "experimental/svg/model/SkSVGPath.cpp",
707 "experimental/svg/model/SkSVGPoly.cpp",
708 "experimental/svg/model/SkSVGRect.cpp",
709 "experimental/svg/model/SkSVGRenderContext.cpp",
710 "experimental/svg/model/SkSVGSVG.cpp",
711 "experimental/svg/model/SkSVGShape.cpp",
712 "experimental/svg/model/SkSVGTransformableNode.cpp",
713 "experimental/svg/model/SkSVGValue.cpp",
714 ]
715 deps = [
716 ":skia",
717 ]
718 }
fmalitaa2b9fdf2016-08-03 19:53:36 -0700719
mtklein2b6870c2016-07-28 14:17:33 -0700720 executable("dm") {
721 sources = [
722 "dm/DM.cpp",
723 "dm/DMJsonWriter.cpp",
724 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700725 ]
726 include_dirs = [ "tests" ]
727 deps = [
fmalitaa2b9fdf2016-08-03 19:53:36 -0700728 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -0700729 ":flags",
730 ":gm",
731 ":gpu_tool_utils",
732 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -0700733 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -0700734 ":tool_utils",
735 "//third_party/jsoncpp",
736 "//third_party/libpng",
737 ]
738 testonly = true
739 }
740
741 executable("monobench") {
742 sources = [
743 "tools/monobench.cpp",
744 ]
745 deps = [
746 ":bench",
747 ":skia",
748 ]
749 testonly = true
750 }
751
752 executable("nanobench") {
753 sources = [
754 "bench/nanobench.cpp",
755 ]
756 deps = [
757 ":bench",
758 ":flags",
759 ":gm",
760 ":gpu_tool_utils",
761 ":skia",
762 ":tool_utils",
763 "//third_party/jsoncpp",
764 ]
765 testonly = true
766 }
halcanary19a97202016-08-03 15:08:04 -0700767
mtklein6f5df6a2016-08-29 16:01:10 -0700768 if (current_cpu != "mipsel") { # Clang 3.8 crashes while compiling hb-icu.cc for mipsel.
769 executable("sktexttopdf") {
770 sources = [
771 "tools/SkShaper_harfbuzz.cpp",
772 "tools/using_skia_and_harfbuzz.cpp",
773 ]
774 deps = [
775 ":skia",
776 "//third_party/harfbuzz",
777 ]
778 testonly = true
779 }
halcanary19a97202016-08-03 15:08:04 -0700780 }
mtklein25c81d42016-07-27 13:55:26 -0700781}