blob: 446345b5eb163f8e21d45ac0a6fa421ec1ad8802 [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
6declare_args() {
mtkleinc095df52016-08-24 12:23:52 -07007 skia_enable_tools = !is_fuchsia && !is_component_build
8
mtklein63213812016-08-24 09:55:56 -07009 skia_use_expat = true
mtklein3cc22182016-08-29 13:26:14 -070010 skia_use_fontconfig = is_linux
11 skia_use_freetype = is_android || is_linux
mtklein457b42a2016-08-23 13:56:37 -070012 skia_use_giflib = !is_fuchsia
mtklein63213812016-08-24 09:55:56 -070013 skia_use_libjpeg_turbo = true
14 skia_use_libpng = true
mtkleineb3c4252016-08-23 07:38:09 -070015 skia_use_libwebp = !is_fuchsia
mtklein63213812016-08-24 09:55:56 -070016 skia_use_sfntly = !is_fuchsia
17 skia_use_zlib = true
mtkleinc04ff472016-06-23 10:29:30 -070018}
19
mtkleina45be612016-08-29 15:22:10 -070020fontmgr_android_enabled = skia_use_expat && skia_use_freetype
21
mtklein1211e0c2016-07-26 13:55:45 -070022skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070023 "include/android",
mtkleinfa84d942016-07-28 09:45:14 -070024 "include/c",
mtklein1211e0c2016-07-26 13:55:45 -070025 "include/codec",
26 "include/config",
27 "include/core",
28 "include/effects",
29 "include/gpu",
30 "include/gpu/gl",
31 "include/images",
32 "include/pathops",
33 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070034 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -070035 "include/utils",
36 "include/utils/mac",
mtklein25c81d42016-07-27 13:55:26 -070037 "include/xml",
mtklein1211e0c2016-07-26 13:55:45 -070038]
39
mtkleinc04ff472016-06-23 10:29:30 -070040# Skia public API, generally provided by :skia.
41config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -070042 include_dirs = skia_public_includes
mtkleinc04ff472016-06-23 10:29:30 -070043 defines = [ "SKIA_DLL" ]
jcgregorio5561e3d2016-08-25 09:25:11 -070044 if (is_linux) {
45 defines += [ "SK_SAMPLES_FOR_X" ]
46 }
mtkleinc04ff472016-06-23 10:29:30 -070047}
48
49# Skia internal APIs, used by Skia itself and a few test tools.
50config("skia_private") {
51 visibility = [ ":*" ]
52
53 include_dirs = [
54 "include/private",
55 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -070056 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -070057 "src/config",
58 "src/core",
59 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -070060 "src/effects/gradients",
61 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -070062 "src/gpu",
63 "src/image",
64 "src/images",
65 "src/lazy",
66 "src/opts",
67 "src/pathops",
mtklein2b6870c2016-07-28 14:17:33 -070068 "src/pdf",
mtkleinc04ff472016-06-23 10:29:30 -070069 "src/ports",
70 "src/sfnt",
mtklein9e0d9dd2016-08-30 10:37:19 -070071 "src/sksl",
mtkleinc04ff472016-06-23 10:29:30 -070072 "src/utils",
mtklein7a1f45f2016-08-04 06:19:33 -070073 "src/utils/win",
mtkleinc04ff472016-06-23 10:29:30 -070074 "third_party/etc1",
75 "third_party/ktx",
76 ]
mtklein150d1132016-08-01 06:56:40 -070077
mtklein63213812016-08-24 09:55:56 -070078 defines = [ "SK_GAMMA_APPLY_TO_A8" ]
mtkleinc04ff472016-06-23 10:29:30 -070079}
80
81# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
82config("skia_library") {
83 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -070084 defines = [ "SKIA_IMPLEMENTATION=1" ]
85}
86
87skia_library_configs = [
88 ":skia_public",
89 ":skia_private",
90 ":skia_library",
91]
92
mtklein7fbfbbe2016-07-21 12:25:45 -070093core_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -070094 [
95 rebase_path("gyp/core.gypi"),
96 "--replace=<(skia_include_path)=include",
97 "--replace=<(skia_src_path)=src",
98 ],
99 "scope",
100 [ "gyp/core.gypi" ])
101
mtklein7fbfbbe2016-07-21 12:25:45 -0700102effects_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700103 [
104 rebase_path("gyp/effects.gypi"),
105 "--replace=<(skia_include_path)=include",
106 "--replace=<(skia_src_path)=src",
107 ],
108 "scope",
109 [ "gyp/effects.gypi" ])
110
mtklein7fbfbbe2016-07-21 12:25:45 -0700111gpu_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700112 [
113 rebase_path("gyp/gpu.gypi"),
114 "--replace=<(skia_include_path)=include",
115 "--replace=<(skia_src_path)=src",
116 ],
117 "scope",
118 [ "gyp/gpu.gypi" ])
119
mtklein7fbfbbe2016-07-21 12:25:45 -0700120opts_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700121 [
122 rebase_path("gyp/opts.gypi"),
123 "--replace=<(skia_include_path)=include",
124 "--replace=<(skia_src_path)=src",
125 ],
126 "scope",
127 [ "gyp/opts.gypi" ])
128
mtklein7fbfbbe2016-07-21 12:25:45 -0700129pdf_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700130 [
131 rebase_path("gyp/pdf.gypi"),
132 "--replace=<(skia_include_path)=include",
133 "--replace=<(skia_src_path)=src",
134 ],
135 "scope",
136 [ "gyp/pdf.gypi" ])
137
mtklein9e0d9dd2016-08-30 10:37:19 -0700138sksl_gypi = exec_script("gn/gypi_to_gn.py",
139 [
140 rebase_path("gyp/sksl.gypi"),
141 "--replace=<(skia_include_path)=include",
142 "--replace=<(skia_src_path)=src",
143 ],
144 "scope",
145 [ "gyp/sksl.gypi" ])
146
mtklein7fbfbbe2016-07-21 12:25:45 -0700147utils_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700148 [
149 rebase_path("gyp/utils.gypi"),
150 "--replace=<(skia_include_path)=include",
151 "--replace=<(skia_src_path)=src",
152 ],
153 "scope",
154 [ "gyp/utils.gypi" ])
155
mtklein9b8583d2016-08-24 17:32:30 -0700156# Use for CPU-specific Skia code that needs particular compiler flags.
157template("opts") {
158 if (invoker.enabled) {
159 source_set(target_name) {
160 forward_variables_from(invoker, "*")
161 configs += skia_library_configs
162 }
163 } else {
164 # If not enabled, a phony empty target that swallows all otherwise unused variables.
165 source_set(target_name) {
166 forward_variables_from(invoker,
167 "*",
168 [
169 "sources",
170 "cflags",
171 ])
172 }
173 }
anmittala7eaf2e2016-08-17 13:57:26 -0700174}
175
mtklein422310d2016-08-16 18:28:43 -0700176is_x86 = current_cpu == "x64" || current_cpu == "x86"
mtkleinc04ff472016-06-23 10:29:30 -0700177
mtklein7d6fb2c2016-08-25 14:50:44 -0700178opts("none") {
179 enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
180 sources = opts_gypi.none_sources
anmittalb8b3f712016-08-25 04:55:19 -0700181 cflags = []
182}
183
mtklein7d6fb2c2016-08-25 14:50:44 -0700184opts("armv7") {
anmittalb8b3f712016-08-25 04:55:19 -0700185 enabled = current_cpu == "arm"
mtklein7d6fb2c2016-08-25 14:50:44 -0700186 sources = opts_gypi.armv7_sources + opts_gypi.neon_sources
187 cflags = []
anmittalb8b3f712016-08-25 04:55:19 -0700188}
189
190opts("arm64") {
191 enabled = current_cpu == "arm64"
192 sources = opts_gypi.arm64_sources
193 cflags = []
194}
195
196opts("crc32") {
197 enabled = current_cpu == "arm64"
198 sources = opts_gypi.crc32_sources
199 cflags = [ "-march=armv8-a+crc" ]
200}
201
mtklein9b8583d2016-08-24 17:32:30 -0700202opts("sse2") {
203 enabled = is_x86
204 sources = opts_gypi.sse2_sources
205 cflags = [ "-msse2" ]
206}
mtkleinc04ff472016-06-23 10:29:30 -0700207
mtklein9b8583d2016-08-24 17:32:30 -0700208opts("ssse3") {
209 enabled = is_x86
210 sources = opts_gypi.ssse3_sources
211 cflags = [ "-mssse3" ]
212}
mtkleinc04ff472016-06-23 10:29:30 -0700213
mtklein9b8583d2016-08-24 17:32:30 -0700214opts("sse41") {
215 enabled = is_x86
216 sources = opts_gypi.sse41_sources
217 cflags = [ "-msse4.1" ]
218}
mtklein4e976072016-08-08 09:06:27 -0700219
mtklein9b8583d2016-08-24 17:32:30 -0700220opts("sse42") {
221 enabled = is_x86
222 sources = opts_gypi.sse42_sources
223 cflags = [ "-msse4.2" ]
224}
225
226opts("avx") {
227 enabled = is_x86
228 sources = opts_gypi.avx_sources
229 cflags = [ "-mavx" ]
mtkleinc04ff472016-06-23 10:29:30 -0700230}
231
mtklein349cece2016-08-26 08:13:04 -0700232opts("dsp") {
233 enabled = current_cpu == "mipsel"
234 sources = opts_gypi.mips_dsp_sources
mtkleinb6064ef2016-08-30 11:49:24 -0700235 cflags = []
mtklein349cece2016-08-26 08:13:04 -0700236}
237
mtkleinc095df52016-08-24 12:23:52 -0700238# Any feature of Skia that requires third-party code should be optional and use this template.
mtklein457b42a2016-08-23 13:56:37 -0700239template("optional") {
240 if (invoker.enabled) {
241 config(target_name + "_public") {
242 defines = invoker.public_defines
243 }
244 source_set(target_name) {
245 forward_variables_from(invoker, "*", [ "public_defines" ])
246 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700247 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700248 }
249 } else {
250 # If not enabled, a phony empty target that swallows all otherwise unused variables.
251 source_set(target_name) {
252 forward_variables_from(invoker,
253 "*",
254 [
255 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700256 "deps",
257 "sources",
258 ])
259 }
mtkleineb3c4252016-08-23 07:38:09 -0700260 }
mtklein457b42a2016-08-23 13:56:37 -0700261}
mtklein457b42a2016-08-23 13:56:37 -0700262
mtkleina45be612016-08-29 15:22:10 -0700263optional("fontmgr_android") {
264 enabled = fontmgr_android_enabled
265 public_defines = []
266
267 deps = [
268 "//third_party/expat",
269 "//third_party/freetype2",
270 ]
271 sources = [
272 "src/ports/SkFontMgr_android.cpp",
273 "src/ports/SkFontMgr_android_factory.cpp",
274 "src/ports/SkFontMgr_android_parser.cpp",
275 ]
276}
277
mtklein3cc22182016-08-29 13:26:14 -0700278optional("fontmgr_fontconfig") {
279 enabled = skia_use_freetype && skia_use_fontconfig
280 public_defines = []
281
282 deps = [
283 "//third_party:fontconfig",
284 "//third_party/freetype2",
285 ]
286 sources = [
287 "src/ports/SkFontConfigInterface_direct.cpp",
288 "src/ports/SkFontConfigInterface_direct_factory.cpp",
289 "src/ports/SkFontMgr_FontConfigInterface.cpp",
290 "src/ports/SkFontMgr_fontconfig.cpp",
291 "src/ports/SkFontMgr_fontconfig_factory.cpp",
292 ]
293}
294
mtklein457b42a2016-08-23 13:56:37 -0700295optional("gif") {
296 enabled = skia_use_giflib
297 public_defines = [ "SK_HAS_GIF_LIBRARY" ]
298
mtklein457b42a2016-08-23 13:56:37 -0700299 deps = [
300 "//third_party/giflib",
301 ]
302 sources = [
303 "src/codec/SkGifCodec.cpp",
304 ]
305}
306
mtklein63213812016-08-24 09:55:56 -0700307optional("jpeg") {
308 enabled = skia_use_libjpeg_turbo
309 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
310
mtklein63213812016-08-24 09:55:56 -0700311 deps = [
312 "//third_party/libjpeg-turbo:libjpeg",
313 ]
314 sources = [
315 "src/codec/SkJpegCodec.cpp",
316 "src/codec/SkJpegDecoderMgr.cpp",
317 "src/codec/SkJpegUtility.cpp",
318 "src/images/SkJPEGImageEncoder.cpp",
319 "src/images/SkJPEGWriteUtility.cpp",
320 ]
321}
322
323optional("pdf") {
324 enabled = skia_use_zlib
325 public_defines = []
326
mtklein63213812016-08-24 09:55:56 -0700327 deps = [
328 "//third_party/zlib",
329 ]
330 sources = pdf_gypi.sources
331
332 if (skia_use_sfntly) {
333 deps += [ "//third_party/sfntly" ]
halcanary650e20d2016-08-25 09:07:02 -0700334 public_defines += [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700335 }
336}
337
338optional("png") {
339 enabled = skia_use_libpng
340 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
341
mtklein63213812016-08-24 09:55:56 -0700342 deps = [
343 "//third_party/libpng",
344 ]
345 sources = [
346 "src/codec/SkIcoCodec.cpp",
347 "src/codec/SkPngCodec.cpp",
348 "src/images/SkPNGImageEncoder.cpp",
349 ]
350}
351
mtklein3cc22182016-08-29 13:26:14 -0700352optional("typeface_freetype") {
353 enabled = skia_use_freetype
354 public_defines = []
355
356 deps = [
357 "//third_party/freetype2",
358 ]
359 sources = [
360 "src/ports/SkFontHost_FreeType.cpp",
361 "src/ports/SkFontHost_FreeType_common.cpp",
362 ]
363}
364
mtklein457b42a2016-08-23 13:56:37 -0700365optional("webp") {
366 enabled = skia_use_libwebp
367 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
368
mtklein457b42a2016-08-23 13:56:37 -0700369 deps = [
370 "//third_party/libwebp",
371 ]
372 sources = [
373 "src/codec/SkWebpAdapterCodec.cpp",
374 "src/codec/SkWebpCodec.cpp",
375 "src/images/SkWEBPImageEncoder.cpp",
376 ]
mtkleineb3c4252016-08-23 07:38:09 -0700377}
378
mtklein63213812016-08-24 09:55:56 -0700379optional("xml") {
380 enabled = skia_use_expat
381 public_defines = []
382
mtklein63213812016-08-24 09:55:56 -0700383 deps = [
384 "//third_party/expat",
385 ]
386 sources = [
387 "src/xml/SkDOM.cpp",
388 "src/xml/SkXMLParser.cpp",
389 "src/xml/SkXMLWriter.cpp",
390 ]
391}
392
mtkleinc04ff472016-06-23 10:29:30 -0700393component("skia") {
394 public_configs = [ ":skia_public" ]
395 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700396
397 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700398 ":arm64",
399 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700400 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700401 ":crc32",
mtklein349cece2016-08-26 08:13:04 -0700402 ":dsp",
mtkleina45be612016-08-29 15:22:10 -0700403 ":fontmgr_android",
mtklein3cc22182016-08-29 13:26:14 -0700404 ":fontmgr_fontconfig",
mtklein457b42a2016-08-23 13:56:37 -0700405 ":gif",
mtklein63213812016-08-24 09:55:56 -0700406 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700407 ":none",
mtklein63213812016-08-24 09:55:56 -0700408 ":pdf",
409 ":png",
mtklein9b8583d2016-08-24 17:32:30 -0700410 ":sse2",
411 ":sse41",
412 ":sse42",
413 ":ssse3",
mtklein3cc22182016-08-29 13:26:14 -0700414 ":typeface_freetype",
mtkleineb3c4252016-08-23 07:38:09 -0700415 ":webp",
mtklein63213812016-08-24 09:55:56 -0700416 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700417 ]
418
mtkleinc04ff472016-06-23 10:29:30 -0700419 sources = []
420 sources += core_gypi.sources
421 sources += effects_gypi.sources
422 sources += gpu_gypi.skgpu_sources
mtklein9e0d9dd2016-08-30 10:37:19 -0700423 sources += sksl_gypi.sources
mtkleinc04ff472016-06-23 10:29:30 -0700424 sources += utils_gypi.sources
425 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700426 "src/android/SkBitmapRegionCodec.cpp",
427 "src/android/SkBitmapRegionDecoder.cpp",
428 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700429 "src/codec/SkBmpCodec.cpp",
430 "src/codec/SkBmpMaskCodec.cpp",
431 "src/codec/SkBmpRLECodec.cpp",
432 "src/codec/SkBmpStandardCodec.cpp",
433 "src/codec/SkCodec.cpp",
434 "src/codec/SkCodecImageGenerator.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700435 "src/codec/SkMaskSwizzler.cpp",
436 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700437 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700438 "src/codec/SkSampler.cpp",
439 "src/codec/SkSwizzler.cpp",
440 "src/codec/SkWbmpCodec.cpp",
mtklein09e61f72016-08-23 13:35:28 -0700441 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700442 "src/images/SkImageEncoder.cpp",
443 "src/images/SkImageEncoder_Factory.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700444 "src/images/SkKTXImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700445 "src/ports/SkDiscardableMemory_none.cpp",
446 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700447 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700448 "src/ports/SkMemory_malloc.cpp",
449 "src/ports/SkOSFile_stdio.cpp",
450 "src/sfnt/SkOTTable_name.cpp",
451 "src/sfnt/SkOTUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700452 "src/svg/SkSVGCanvas.cpp",
453 "src/svg/SkSVGDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700454 "src/utils/mac/SkStream_mac.cpp",
455 "third_party/etc1/etc1.cpp",
456 "third_party/ktx/ktx.cpp",
457 ]
mtklein09e61f72016-08-23 13:35:28 -0700458 sources -= [
459 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
460 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
461 ]
mtkleinc04ff472016-06-23 10:29:30 -0700462
mtklein7d6fb2c2016-08-25 14:50:44 -0700463 libs = []
464
mtkleinc04ff472016-06-23 10:29:30 -0700465 if (is_win) {
466 sources += [
467 "src/ports/SkDebug_win.cpp",
468 "src/ports/SkFontHost_win.cpp",
469 "src/ports/SkFontMgr_win_dw.cpp",
470 "src/ports/SkFontMgr_win_dw_factory.cpp",
471 "src/ports/SkImageEncoder_WIC.cpp",
472 "src/ports/SkImageGeneratorWIC.cpp",
473 "src/ports/SkOSFile_win.cpp",
474 "src/ports/SkScalerContext_win_dw.cpp",
475 "src/ports/SkTLS_win.cpp",
476 "src/ports/SkTypeface_win_dw.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700477 "src/xps/SkDocument_XPS.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700478 ]
mtklein7a1f45f2016-08-04 06:19:33 -0700479 sources -= [ "src/utils/SkThreadUtils_pthread.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700480 } else {
481 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700482 "src/ports/SkOSFile_posix.cpp",
483 "src/ports/SkTLS_pthread.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700484 "src/xps/SkDocument_XPS_None.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700485 ]
486 }
487
mtklein7d6fb2c2016-08-25 14:50:44 -0700488 if (is_android) {
489 deps += [
490 "//third_party/cpu-features",
491 "//third_party/expat",
mtklein7d6fb2c2016-08-25 14:50:44 -0700492 ]
493 sources += [
494 "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp",
495 "src/ports/SkDebug_android.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700496 ]
497 libs += [
498 "EGL",
499 "GLESv2",
500 "log",
501 ]
502 }
503
mtkleinc04ff472016-06-23 10:29:30 -0700504 if (is_linux) {
mtklein09e61f72016-08-23 13:35:28 -0700505 libs += [
506 "GL",
507 "GLU",
508 "X11",
509 ]
mtkleinc04ff472016-06-23 10:29:30 -0700510 sources += [
mtklein09e61f72016-08-23 13:35:28 -0700511 "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700512 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700513 ]
514 }
515
516 if (is_mac) {
517 sources += [
mtklein09e61f72016-08-23 13:35:28 -0700518 "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700519 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700520 "src/ports/SkFontHost_mac.cpp",
521 "src/ports/SkImageEncoder_CG.cpp",
522 "src/ports/SkImageGeneratorCG.cpp",
523 ]
mtklein09e61f72016-08-23 13:35:28 -0700524 libs += [
525 "ApplicationServices.framework",
526 "OpenGL.framework",
527 ]
mtkleinc04ff472016-06-23 10:29:30 -0700528 }
abarth6fc8ff02016-07-15 15:15:15 -0700529
530 if (is_fuchsia) {
mtklein2ff47c22016-08-24 10:27:13 -0700531 sources += [
532 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700533 "src/ports/SkDebug_stdio.cpp",
mtklein2ff47c22016-08-24 10:27:13 -0700534 "src/ports/SkFontMgr_empty_factory.cpp",
535 ]
abarth6fc8ff02016-07-15 15:15:15 -0700536 }
mtkleinc04ff472016-06-23 10:29:30 -0700537}
538
mtkleinada5a442016-08-02 14:28:26 -0700539skia_h_headers = exec_script("gyp/find.py",
540 [ "*.h" ] + rebase_path(skia_public_includes),
541 "list lines",
542 []) -
543 [
544 rebase_path("include/gpu/gl/GrGLConfig_chrome.h"),
545 rebase_path("include/gpu/vk/GrVkBackendContext.h"),
546 rebase_path("include/gpu/vk/GrVkDefines.h"),
547 rebase_path("include/gpu/vk/GrVkInterface.h"),
548 rebase_path("include/gpu/vk/GrVkTypes.h"),
549 rebase_path("include/ports/SkFontMgr_fontconfig.h"),
550 ]
551
mtklein1211e0c2016-07-26 13:55:45 -0700552action("skia.h") {
553 script = "gn/echo_headers.py"
554 args = [ rebase_path("$target_gen_dir/skia.h", root_build_dir) ] +
mtkleinc095df52016-08-24 12:23:52 -0700555 rebase_path(skia_h_headers, target_gen_dir)
mtklein1211e0c2016-07-26 13:55:45 -0700556 outputs = [
557 "$target_gen_dir/skia.h",
558 ]
559}
560
561executable("fiddle") {
562 include_dirs = [ "$target_gen_dir" ]
mtklein7d10b9f2016-07-27 11:17:18 -0700563 libs = []
564 if (is_linux) {
565 libs += [ "OSMesa" ]
566 }
mtklein1211e0c2016-07-26 13:55:45 -0700567
mtkleinc04ff472016-06-23 10:29:30 -0700568 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700569 "src/images/SkForceLinking.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700570 "tools/fiddle/draw.cpp",
571 "tools/fiddle/fiddle_main.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700572 ]
573 deps = [
574 ":skia",
mtklein1211e0c2016-07-26 13:55:45 -0700575 ":skia.h",
mtkleinc04ff472016-06-23 10:29:30 -0700576 ]
mtkleinc04ff472016-06-23 10:29:30 -0700577}
mtklein25c81d42016-07-27 13:55:26 -0700578
mtkleinc095df52016-08-24 12:23:52 -0700579# Targets guarded by skia_enable_tools may use //third_party freely.
580if (skia_enable_tools) {
581 template("test_lib") {
582 config(target_name + "_config") {
583 include_dirs = invoker.public_include_dirs
mtklein25c81d42016-07-27 13:55:26 -0700584 }
mtkleinc095df52016-08-24 12:23:52 -0700585 source_set(target_name) {
586 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
587 public_configs = [
588 ":" + target_name + "_config",
589 ":skia_private",
590 ]
591
592 if (!defined(deps)) {
593 deps = []
594 }
595 deps += [ ":skia" ]
596 testonly = true
597 }
mtklein25c81d42016-07-27 13:55:26 -0700598 }
mtklein25c81d42016-07-27 13:55:26 -0700599
mtkleinc095df52016-08-24 12:23:52 -0700600 test_lib("gpu_tool_utils") {
601 public_include_dirs = [ "tools/gpu" ]
602 sources = [
603 "tools/gpu/GrContextFactory.cpp",
604 "tools/gpu/GrTest.cpp",
605 "tools/gpu/TestContext.cpp",
606 "tools/gpu/gl/GLTestContext.cpp",
607 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
608 "tools/gpu/gl/debug/GrBufferObj.cpp",
609 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
610 "tools/gpu/gl/debug/GrProgramObj.cpp",
611 "tools/gpu/gl/debug/GrShaderObj.cpp",
612 "tools/gpu/gl/debug/GrTextureObj.cpp",
613 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
614 "tools/gpu/gl/null/NullGLTestContext.cpp",
615 ]
616 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700617
mtklein7d6fb2c2016-08-25 14:50:44 -0700618 if (is_android) {
619 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
620 } else if (is_linux) {
mtkleinc095df52016-08-24 12:23:52 -0700621 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
622 } else if (is_mac) {
623 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
624 }
mtklein25c81d42016-07-27 13:55:26 -0700625 }
mtklein25c81d42016-07-27 13:55:26 -0700626
mtkleinc095df52016-08-24 12:23:52 -0700627 test_lib("flags") {
628 public_include_dirs = [ "tools/flags" ]
629 sources = [
630 "tools/flags/SkCommandLineFlags.cpp",
631 "tools/flags/SkCommonFlags.cpp",
632 "tools/flags/SkCommonFlagsConfig.cpp",
633 ]
634 deps = [
635 ":gpu_tool_utils",
636 ]
637 }
mtklein25c81d42016-07-27 13:55:26 -0700638
mtkleinc095df52016-08-24 12:23:52 -0700639 test_lib("tool_utils") {
640 public_include_dirs = [
641 "tools",
642 "tools/debugger",
643 "tools/timer",
644 ]
645 sources = [
646 "src/images/SkForceLinking.cpp",
647 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
648 "tools/CrashHandler.cpp",
649 "tools/ProcStats.cpp",
650 "tools/Resources.cpp",
651 "tools/ThermalManager.cpp",
652 "tools/UrlDataManager.cpp",
653 "tools/debugger/SkDebugCanvas.cpp",
654 "tools/debugger/SkDrawCommand.cpp",
655 "tools/debugger/SkJsonWriteBuffer.cpp",
656 "tools/debugger/SkObjectParser.cpp",
657 "tools/debugger/SkOverdrawMode.cpp",
658 "tools/picture_utils.cpp",
659 "tools/random_parse_path.cpp",
660 "tools/sk_tool_utils.cpp",
661 "tools/sk_tool_utils_font.cpp",
662 "tools/timer/Timer.cpp",
663 ]
664 deps = [
665 ":flags",
666 "//third_party/libpng",
667 ]
668 public_deps = [
669 "//third_party/jsoncpp",
670 ]
671 }
mtklein25c81d42016-07-27 13:55:26 -0700672
mtkleinc095df52016-08-24 12:23:52 -0700673 gm_sources = exec_script("gyp/find.py",
674 [
675 "*.c*",
676 rebase_path("gm"),
677 ],
678 "list lines",
679 [])
680 test_lib("gm") {
681 public_include_dirs = [ "gm" ]
682 sources = gm_sources
683 deps = [
684 ":gpu_tool_utils",
685 ":skia",
686 ":tool_utils",
687 ]
688 }
mtklein25c81d42016-07-27 13:55:26 -0700689
mtkleinc095df52016-08-24 12:23:52 -0700690 tests_sources = exec_script("gyp/find.py",
691 [
692 "*.c*",
693 rebase_path("tests"),
694 ],
695 "list lines",
696 [])
mtklein2f3416d2016-08-02 16:02:05 -0700697
mtkleinc095df52016-08-24 12:23:52 -0700698 test_lib("tests") {
699 public_include_dirs = [ "tests" ]
mtkleina45be612016-08-29 15:22:10 -0700700 sources = tests_sources - [
701 rebase_path("tests/PathOpsSkpClipTest.cpp"), # alternate main
mtkleina45be612016-08-29 15:22:10 -0700702 rebase_path("tests/SkpSkGrTest.cpp"), # doesn't compile
703 rebase_path("tests/skia_test.cpp"), # alternate main
704 ]
705 if (!fontmgr_android_enabled) {
706 sources -= [ rebase_path("tests/FontMgrAndroidParserTest.cpp") ]
707 }
mtkleinc095df52016-08-24 12:23:52 -0700708 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700709 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700710 ":flags",
711 ":gpu_tool_utils",
712 ":skia",
713 ":tool_utils",
714 "//third_party/libpng",
715 "//third_party/zlib",
716 ]
717 }
mtklein2f3416d2016-08-02 16:02:05 -0700718
mtkleinc095df52016-08-24 12:23:52 -0700719 bench_sources = exec_script("gyp/find.py",
720 [
721 "*.c*",
722 rebase_path("bench"),
723 ],
724 "list lines",
725 [])
mtklein25c81d42016-07-27 13:55:26 -0700726
mtkleinc095df52016-08-24 12:23:52 -0700727 test_lib("bench") {
728 public_include_dirs = [ "bench" ]
729 sources = bench_sources
730 sources -= [
731 rebase_path("bench/nanobench.cpp"),
732 rebase_path("bench/nanobenchAndroid.cpp"),
733 ]
734 deps = [
735 ":flags",
736 ":gm",
737 ":gpu_tool_utils",
738 ":skia",
739 ":tool_utils",
740 ]
741 }
mtklein2b6870c2016-07-28 14:17:33 -0700742
mtkleinc095df52016-08-24 12:23:52 -0700743 test_lib("experimental_svg_model") {
744 public_include_dirs = [ "experimental/svg/model" ]
745 sources = [
746 "experimental/svg/model/SkSVGAttribute.cpp",
747 "experimental/svg/model/SkSVGAttributeParser.cpp",
748 "experimental/svg/model/SkSVGCircle.cpp",
749 "experimental/svg/model/SkSVGContainer.cpp",
750 "experimental/svg/model/SkSVGDOM.cpp",
751 "experimental/svg/model/SkSVGEllipse.cpp",
752 "experimental/svg/model/SkSVGLine.cpp",
753 "experimental/svg/model/SkSVGNode.cpp",
754 "experimental/svg/model/SkSVGPath.cpp",
755 "experimental/svg/model/SkSVGPoly.cpp",
756 "experimental/svg/model/SkSVGRect.cpp",
757 "experimental/svg/model/SkSVGRenderContext.cpp",
758 "experimental/svg/model/SkSVGSVG.cpp",
759 "experimental/svg/model/SkSVGShape.cpp",
760 "experimental/svg/model/SkSVGTransformableNode.cpp",
761 "experimental/svg/model/SkSVGValue.cpp",
762 ]
763 deps = [
764 ":skia",
765 ]
766 }
fmalitaa2b9fdf2016-08-03 19:53:36 -0700767
mtklein2b6870c2016-07-28 14:17:33 -0700768 executable("dm") {
769 sources = [
770 "dm/DM.cpp",
771 "dm/DMJsonWriter.cpp",
772 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700773 ]
774 include_dirs = [ "tests" ]
775 deps = [
fmalitaa2b9fdf2016-08-03 19:53:36 -0700776 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -0700777 ":flags",
778 ":gm",
779 ":gpu_tool_utils",
780 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -0700781 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -0700782 ":tool_utils",
783 "//third_party/jsoncpp",
784 "//third_party/libpng",
785 ]
786 testonly = true
787 }
788
789 executable("monobench") {
790 sources = [
791 "tools/monobench.cpp",
792 ]
793 deps = [
794 ":bench",
795 ":skia",
796 ]
797 testonly = true
798 }
799
800 executable("nanobench") {
801 sources = [
802 "bench/nanobench.cpp",
803 ]
804 deps = [
805 ":bench",
806 ":flags",
807 ":gm",
808 ":gpu_tool_utils",
809 ":skia",
810 ":tool_utils",
811 "//third_party/jsoncpp",
812 ]
813 testonly = true
814 }
halcanary19a97202016-08-03 15:08:04 -0700815
mtklein6f5df6a2016-08-29 16:01:10 -0700816 if (current_cpu != "mipsel") { # Clang 3.8 crashes while compiling hb-icu.cc for mipsel.
817 executable("sktexttopdf") {
818 sources = [
819 "tools/SkShaper_harfbuzz.cpp",
820 "tools/using_skia_and_harfbuzz.cpp",
821 ]
822 deps = [
823 ":skia",
824 "//third_party/harfbuzz",
825 ]
826 testonly = true
827 }
halcanary19a97202016-08-03 15:08:04 -0700828 }
mtklein25c81d42016-07-27 13:55:26 -0700829}