blob: 6cb551690895eeb75a88421fb33fc4f2ae8e9cf8 [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") {
mtkleincd01b032016-08-31 04:58:19 -0700242 if (defined(invoker.public_defines)) {
243 defines = invoker.public_defines
244 }
mtklein457b42a2016-08-23 13:56:37 -0700245 }
246 source_set(target_name) {
mtkleincd01b032016-08-31 04:58:19 -0700247 forward_variables_from(invoker,
248 "*",
249 [
250 "public_defines",
251 "sources_when_disabled",
252 ])
mtklein457b42a2016-08-23 13:56:37 -0700253 all_dependent_configs = [ ":" + target_name + "_public" ]
mtklein9b8583d2016-08-24 17:32:30 -0700254 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700255 }
256 } else {
mtklein457b42a2016-08-23 13:56:37 -0700257 source_set(target_name) {
258 forward_variables_from(invoker,
259 "*",
260 [
261 "public_defines",
mtklein457b42a2016-08-23 13:56:37 -0700262 "deps",
263 "sources",
mtkleincd01b032016-08-31 04:58:19 -0700264 "sources_when_disabled",
mtklein457b42a2016-08-23 13:56:37 -0700265 ])
mtkleincd01b032016-08-31 04:58:19 -0700266 if (defined(invoker.sources_when_disabled)) {
267 sources = invoker.sources_when_disabled
268 }
269 configs += skia_library_configs
mtklein457b42a2016-08-23 13:56:37 -0700270 }
mtkleineb3c4252016-08-23 07:38:09 -0700271 }
mtklein457b42a2016-08-23 13:56:37 -0700272}
mtklein457b42a2016-08-23 13:56:37 -0700273
mtkleina45be612016-08-29 15:22:10 -0700274optional("fontmgr_android") {
275 enabled = fontmgr_android_enabled
mtkleina45be612016-08-29 15:22:10 -0700276
277 deps = [
278 "//third_party/expat",
279 "//third_party/freetype2",
280 ]
281 sources = [
282 "src/ports/SkFontMgr_android.cpp",
283 "src/ports/SkFontMgr_android_factory.cpp",
284 "src/ports/SkFontMgr_android_parser.cpp",
285 ]
286}
287
mtklein3cc22182016-08-29 13:26:14 -0700288optional("fontmgr_fontconfig") {
289 enabled = skia_use_freetype && skia_use_fontconfig
mtklein3cc22182016-08-29 13:26:14 -0700290
291 deps = [
292 "//third_party:fontconfig",
293 "//third_party/freetype2",
294 ]
295 sources = [
296 "src/ports/SkFontConfigInterface_direct.cpp",
297 "src/ports/SkFontConfigInterface_direct_factory.cpp",
298 "src/ports/SkFontMgr_FontConfigInterface.cpp",
299 "src/ports/SkFontMgr_fontconfig.cpp",
300 "src/ports/SkFontMgr_fontconfig_factory.cpp",
301 ]
302}
303
mtklein457b42a2016-08-23 13:56:37 -0700304optional("gif") {
305 enabled = skia_use_giflib
306 public_defines = [ "SK_HAS_GIF_LIBRARY" ]
307
mtklein457b42a2016-08-23 13:56:37 -0700308 deps = [
309 "//third_party/giflib",
310 ]
311 sources = [
312 "src/codec/SkGifCodec.cpp",
313 ]
314}
315
mtklein63213812016-08-24 09:55:56 -0700316optional("jpeg") {
317 enabled = skia_use_libjpeg_turbo
318 public_defines = [ "SK_HAS_JPEG_LIBRARY" ]
319
mtklein63213812016-08-24 09:55:56 -0700320 deps = [
321 "//third_party/libjpeg-turbo:libjpeg",
322 ]
323 sources = [
324 "src/codec/SkJpegCodec.cpp",
325 "src/codec/SkJpegDecoderMgr.cpp",
326 "src/codec/SkJpegUtility.cpp",
327 "src/images/SkJPEGImageEncoder.cpp",
328 "src/images/SkJPEGWriteUtility.cpp",
329 ]
330}
331
332optional("pdf") {
333 enabled = skia_use_zlib
mtklein63213812016-08-24 09:55:56 -0700334
mtklein63213812016-08-24 09:55:56 -0700335 deps = [
336 "//third_party/zlib",
337 ]
338 sources = pdf_gypi.sources
mtkleincd01b032016-08-31 04:58:19 -0700339 sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
mtklein63213812016-08-24 09:55:56 -0700340
341 if (skia_use_sfntly) {
342 deps += [ "//third_party/sfntly" ]
mtkleincd01b032016-08-31 04:58:19 -0700343 public_defines = [ "SK_PDF_USE_SFNTLY" ]
mtklein63213812016-08-24 09:55:56 -0700344 }
345}
346
347optional("png") {
348 enabled = skia_use_libpng
349 public_defines = [ "SK_HAS_PNG_LIBRARY" ]
350
mtklein63213812016-08-24 09:55:56 -0700351 deps = [
352 "//third_party/libpng",
353 ]
354 sources = [
355 "src/codec/SkIcoCodec.cpp",
356 "src/codec/SkPngCodec.cpp",
357 "src/images/SkPNGImageEncoder.cpp",
358 ]
359}
360
mtklein3cc22182016-08-29 13:26:14 -0700361optional("typeface_freetype") {
362 enabled = skia_use_freetype
mtklein3cc22182016-08-29 13:26:14 -0700363
364 deps = [
365 "//third_party/freetype2",
366 ]
367 sources = [
368 "src/ports/SkFontHost_FreeType.cpp",
369 "src/ports/SkFontHost_FreeType_common.cpp",
370 ]
371}
372
mtklein457b42a2016-08-23 13:56:37 -0700373optional("webp") {
374 enabled = skia_use_libwebp
375 public_defines = [ "SK_HAS_WEBP_LIBRARY" ]
376
mtklein457b42a2016-08-23 13:56:37 -0700377 deps = [
378 "//third_party/libwebp",
379 ]
380 sources = [
381 "src/codec/SkWebpAdapterCodec.cpp",
382 "src/codec/SkWebpCodec.cpp",
383 "src/images/SkWEBPImageEncoder.cpp",
384 ]
mtkleineb3c4252016-08-23 07:38:09 -0700385}
386
mtklein63213812016-08-24 09:55:56 -0700387optional("xml") {
388 enabled = skia_use_expat
mtklein63213812016-08-24 09:55:56 -0700389
mtklein63213812016-08-24 09:55:56 -0700390 deps = [
391 "//third_party/expat",
392 ]
393 sources = [
394 "src/xml/SkDOM.cpp",
395 "src/xml/SkXMLParser.cpp",
396 "src/xml/SkXMLWriter.cpp",
397 ]
398}
399
mtkleinc04ff472016-06-23 10:29:30 -0700400component("skia") {
401 public_configs = [ ":skia_public" ]
402 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700403
404 deps = [
anmittalb8b3f712016-08-25 04:55:19 -0700405 ":arm64",
406 ":armv7",
mtklein9b8583d2016-08-24 17:32:30 -0700407 ":avx",
anmittalb8b3f712016-08-25 04:55:19 -0700408 ":crc32",
mtklein349cece2016-08-26 08:13:04 -0700409 ":dsp",
mtkleina45be612016-08-29 15:22:10 -0700410 ":fontmgr_android",
mtklein3cc22182016-08-29 13:26:14 -0700411 ":fontmgr_fontconfig",
mtklein457b42a2016-08-23 13:56:37 -0700412 ":gif",
mtklein63213812016-08-24 09:55:56 -0700413 ":jpeg",
mtklein9b8583d2016-08-24 17:32:30 -0700414 ":none",
mtklein63213812016-08-24 09:55:56 -0700415 ":pdf",
416 ":png",
mtklein9b8583d2016-08-24 17:32:30 -0700417 ":sse2",
418 ":sse41",
419 ":sse42",
420 ":ssse3",
mtklein3cc22182016-08-29 13:26:14 -0700421 ":typeface_freetype",
mtkleineb3c4252016-08-23 07:38:09 -0700422 ":webp",
mtklein63213812016-08-24 09:55:56 -0700423 ":xml",
mtkleinc04ff472016-06-23 10:29:30 -0700424 ]
425
mtkleinc04ff472016-06-23 10:29:30 -0700426 sources = []
427 sources += core_gypi.sources
428 sources += effects_gypi.sources
429 sources += gpu_gypi.skgpu_sources
mtklein9e0d9dd2016-08-30 10:37:19 -0700430 sources += sksl_gypi.sources
mtkleinc04ff472016-06-23 10:29:30 -0700431 sources += utils_gypi.sources
432 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700433 "src/android/SkBitmapRegionCodec.cpp",
434 "src/android/SkBitmapRegionDecoder.cpp",
435 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700436 "src/codec/SkBmpCodec.cpp",
437 "src/codec/SkBmpMaskCodec.cpp",
438 "src/codec/SkBmpRLECodec.cpp",
439 "src/codec/SkBmpStandardCodec.cpp",
440 "src/codec/SkCodec.cpp",
441 "src/codec/SkCodecImageGenerator.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700442 "src/codec/SkMaskSwizzler.cpp",
443 "src/codec/SkMasks.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700444 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700445 "src/codec/SkSampler.cpp",
446 "src/codec/SkSwizzler.cpp",
447 "src/codec/SkWbmpCodec.cpp",
mtklein09e61f72016-08-23 13:35:28 -0700448 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700449 "src/images/SkImageEncoder.cpp",
450 "src/images/SkImageEncoder_Factory.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700451 "src/images/SkKTXImageEncoder.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700452 "src/ports/SkDiscardableMemory_none.cpp",
453 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700454 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700455 "src/ports/SkMemory_malloc.cpp",
456 "src/ports/SkOSFile_stdio.cpp",
457 "src/sfnt/SkOTTable_name.cpp",
458 "src/sfnt/SkOTUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700459 "src/svg/SkSVGCanvas.cpp",
460 "src/svg/SkSVGDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700461 "src/utils/mac/SkStream_mac.cpp",
462 "third_party/etc1/etc1.cpp",
463 "third_party/ktx/ktx.cpp",
464 ]
mtklein09e61f72016-08-23 13:35:28 -0700465 sources -= [
466 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
467 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
468 ]
mtkleinc04ff472016-06-23 10:29:30 -0700469
mtklein7d6fb2c2016-08-25 14:50:44 -0700470 libs = []
471
mtkleinc04ff472016-06-23 10:29:30 -0700472 if (is_win) {
473 sources += [
474 "src/ports/SkDebug_win.cpp",
475 "src/ports/SkFontHost_win.cpp",
476 "src/ports/SkFontMgr_win_dw.cpp",
477 "src/ports/SkFontMgr_win_dw_factory.cpp",
478 "src/ports/SkImageEncoder_WIC.cpp",
479 "src/ports/SkImageGeneratorWIC.cpp",
480 "src/ports/SkOSFile_win.cpp",
481 "src/ports/SkScalerContext_win_dw.cpp",
482 "src/ports/SkTLS_win.cpp",
483 "src/ports/SkTypeface_win_dw.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700484 "src/xps/SkDocument_XPS.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700485 ]
mtklein7a1f45f2016-08-04 06:19:33 -0700486 sources -= [ "src/utils/SkThreadUtils_pthread.cpp" ]
mtkleinc04ff472016-06-23 10:29:30 -0700487 } else {
488 sources += [
mtkleinc04ff472016-06-23 10:29:30 -0700489 "src/ports/SkOSFile_posix.cpp",
490 "src/ports/SkTLS_pthread.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700491 "src/xps/SkDocument_XPS_None.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700492 ]
493 }
494
mtklein7d6fb2c2016-08-25 14:50:44 -0700495 if (is_android) {
496 deps += [
497 "//third_party/cpu-features",
498 "//third_party/expat",
mtklein7d6fb2c2016-08-25 14:50:44 -0700499 ]
500 sources += [
501 "src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp",
502 "src/ports/SkDebug_android.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700503 ]
504 libs += [
505 "EGL",
506 "GLESv2",
507 "log",
508 ]
509 }
510
mtkleinc04ff472016-06-23 10:29:30 -0700511 if (is_linux) {
mtklein09e61f72016-08-23 13:35:28 -0700512 libs += [
513 "GL",
514 "GLU",
515 "X11",
516 ]
mtkleinc04ff472016-06-23 10:29:30 -0700517 sources += [
mtklein09e61f72016-08-23 13:35:28 -0700518 "src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700519 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700520 ]
521 }
522
523 if (is_mac) {
524 sources += [
mtklein09e61f72016-08-23 13:35:28 -0700525 "src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700526 "src/ports/SkDebug_stdio.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700527 "src/ports/SkFontHost_mac.cpp",
528 "src/ports/SkImageEncoder_CG.cpp",
529 "src/ports/SkImageGeneratorCG.cpp",
530 ]
mtklein09e61f72016-08-23 13:35:28 -0700531 libs += [
532 "ApplicationServices.framework",
533 "OpenGL.framework",
534 ]
mtkleinc04ff472016-06-23 10:29:30 -0700535 }
abarth6fc8ff02016-07-15 15:15:15 -0700536
537 if (is_fuchsia) {
mtklein2ff47c22016-08-24 10:27:13 -0700538 sources += [
539 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
mtklein7d6fb2c2016-08-25 14:50:44 -0700540 "src/ports/SkDebug_stdio.cpp",
mtklein2ff47c22016-08-24 10:27:13 -0700541 "src/ports/SkFontMgr_empty_factory.cpp",
542 ]
abarth6fc8ff02016-07-15 15:15:15 -0700543 }
mtkleinc04ff472016-06-23 10:29:30 -0700544}
545
mtkleinada5a442016-08-02 14:28:26 -0700546skia_h_headers = exec_script("gyp/find.py",
547 [ "*.h" ] + rebase_path(skia_public_includes),
548 "list lines",
549 []) -
550 [
551 rebase_path("include/gpu/gl/GrGLConfig_chrome.h"),
552 rebase_path("include/gpu/vk/GrVkBackendContext.h"),
553 rebase_path("include/gpu/vk/GrVkDefines.h"),
554 rebase_path("include/gpu/vk/GrVkInterface.h"),
555 rebase_path("include/gpu/vk/GrVkTypes.h"),
556 rebase_path("include/ports/SkFontMgr_fontconfig.h"),
557 ]
558
mtklein1211e0c2016-07-26 13:55:45 -0700559action("skia.h") {
560 script = "gn/echo_headers.py"
561 args = [ rebase_path("$target_gen_dir/skia.h", root_build_dir) ] +
mtkleinc095df52016-08-24 12:23:52 -0700562 rebase_path(skia_h_headers, target_gen_dir)
mtklein1211e0c2016-07-26 13:55:45 -0700563 outputs = [
564 "$target_gen_dir/skia.h",
565 ]
566}
567
568executable("fiddle") {
569 include_dirs = [ "$target_gen_dir" ]
mtklein7d10b9f2016-07-27 11:17:18 -0700570 libs = []
571 if (is_linux) {
572 libs += [ "OSMesa" ]
573 }
mtklein1211e0c2016-07-26 13:55:45 -0700574
mtkleinc04ff472016-06-23 10:29:30 -0700575 sources = [
mtkleinc095df52016-08-24 12:23:52 -0700576 "src/images/SkForceLinking.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700577 "tools/fiddle/draw.cpp",
578 "tools/fiddle/fiddle_main.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700579 ]
580 deps = [
581 ":skia",
mtklein1211e0c2016-07-26 13:55:45 -0700582 ":skia.h",
mtkleinc04ff472016-06-23 10:29:30 -0700583 ]
mtkleinc04ff472016-06-23 10:29:30 -0700584}
mtklein25c81d42016-07-27 13:55:26 -0700585
mtkleinc095df52016-08-24 12:23:52 -0700586# Targets guarded by skia_enable_tools may use //third_party freely.
587if (skia_enable_tools) {
588 template("test_lib") {
589 config(target_name + "_config") {
590 include_dirs = invoker.public_include_dirs
mtklein25c81d42016-07-27 13:55:26 -0700591 }
mtkleinc095df52016-08-24 12:23:52 -0700592 source_set(target_name) {
593 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
594 public_configs = [
595 ":" + target_name + "_config",
596 ":skia_private",
597 ]
598
599 if (!defined(deps)) {
600 deps = []
601 }
602 deps += [ ":skia" ]
603 testonly = true
604 }
mtklein25c81d42016-07-27 13:55:26 -0700605 }
mtklein25c81d42016-07-27 13:55:26 -0700606
mtkleinc095df52016-08-24 12:23:52 -0700607 test_lib("gpu_tool_utils") {
608 public_include_dirs = [ "tools/gpu" ]
609 sources = [
610 "tools/gpu/GrContextFactory.cpp",
611 "tools/gpu/GrTest.cpp",
612 "tools/gpu/TestContext.cpp",
613 "tools/gpu/gl/GLTestContext.cpp",
614 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
615 "tools/gpu/gl/debug/GrBufferObj.cpp",
616 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
617 "tools/gpu/gl/debug/GrProgramObj.cpp",
618 "tools/gpu/gl/debug/GrShaderObj.cpp",
619 "tools/gpu/gl/debug/GrTextureObj.cpp",
620 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
621 "tools/gpu/gl/null/NullGLTestContext.cpp",
622 ]
623 libs = []
mtklein25c81d42016-07-27 13:55:26 -0700624
mtklein7d6fb2c2016-08-25 14:50:44 -0700625 if (is_android) {
626 sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
627 } else if (is_linux) {
mtkleinc095df52016-08-24 12:23:52 -0700628 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
629 } else if (is_mac) {
630 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
631 }
mtklein25c81d42016-07-27 13:55:26 -0700632 }
mtklein25c81d42016-07-27 13:55:26 -0700633
mtkleinc095df52016-08-24 12:23:52 -0700634 test_lib("flags") {
635 public_include_dirs = [ "tools/flags" ]
636 sources = [
637 "tools/flags/SkCommandLineFlags.cpp",
638 "tools/flags/SkCommonFlags.cpp",
639 "tools/flags/SkCommonFlagsConfig.cpp",
640 ]
641 deps = [
642 ":gpu_tool_utils",
643 ]
644 }
mtklein25c81d42016-07-27 13:55:26 -0700645
mtkleinc095df52016-08-24 12:23:52 -0700646 test_lib("tool_utils") {
647 public_include_dirs = [
648 "tools",
649 "tools/debugger",
650 "tools/timer",
651 ]
652 sources = [
653 "src/images/SkForceLinking.cpp",
654 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
655 "tools/CrashHandler.cpp",
mtklein0590fa52016-09-01 07:06:54 -0700656 "tools/LsanSuppressions.cpp",
mtkleinc095df52016-08-24 12:23:52 -0700657 "tools/ProcStats.cpp",
658 "tools/Resources.cpp",
659 "tools/ThermalManager.cpp",
660 "tools/UrlDataManager.cpp",
661 "tools/debugger/SkDebugCanvas.cpp",
662 "tools/debugger/SkDrawCommand.cpp",
663 "tools/debugger/SkJsonWriteBuffer.cpp",
664 "tools/debugger/SkObjectParser.cpp",
665 "tools/debugger/SkOverdrawMode.cpp",
666 "tools/picture_utils.cpp",
667 "tools/random_parse_path.cpp",
668 "tools/sk_tool_utils.cpp",
669 "tools/sk_tool_utils_font.cpp",
670 "tools/timer/Timer.cpp",
671 ]
672 deps = [
673 ":flags",
674 "//third_party/libpng",
675 ]
676 public_deps = [
677 "//third_party/jsoncpp",
678 ]
679 }
mtklein25c81d42016-07-27 13:55:26 -0700680
mtkleinc095df52016-08-24 12:23:52 -0700681 gm_sources = exec_script("gyp/find.py",
682 [
683 "*.c*",
684 rebase_path("gm"),
685 ],
686 "list lines",
687 [])
688 test_lib("gm") {
689 public_include_dirs = [ "gm" ]
690 sources = gm_sources
691 deps = [
692 ":gpu_tool_utils",
693 ":skia",
694 ":tool_utils",
695 ]
696 }
mtklein25c81d42016-07-27 13:55:26 -0700697
mtkleinc095df52016-08-24 12:23:52 -0700698 tests_sources = exec_script("gyp/find.py",
699 [
700 "*.c*",
701 rebase_path("tests"),
702 ],
703 "list lines",
704 [])
mtklein2f3416d2016-08-02 16:02:05 -0700705
mtkleinc095df52016-08-24 12:23:52 -0700706 test_lib("tests") {
707 public_include_dirs = [ "tests" ]
mtkleina45be612016-08-29 15:22:10 -0700708 sources = tests_sources - [
709 rebase_path("tests/PathOpsSkpClipTest.cpp"), # alternate main
mtkleina45be612016-08-29 15:22:10 -0700710 rebase_path("tests/SkpSkGrTest.cpp"), # doesn't compile
711 rebase_path("tests/skia_test.cpp"), # alternate main
712 ]
713 if (!fontmgr_android_enabled) {
714 sources -= [ rebase_path("tests/FontMgrAndroidParserTest.cpp") ]
715 }
mtkleinc095df52016-08-24 12:23:52 -0700716 deps = [
fmalita6cf896d2016-08-25 08:44:35 -0700717 ":experimental_svg_model",
mtkleinc095df52016-08-24 12:23:52 -0700718 ":flags",
719 ":gpu_tool_utils",
720 ":skia",
721 ":tool_utils",
722 "//third_party/libpng",
723 "//third_party/zlib",
724 ]
725 }
mtklein2f3416d2016-08-02 16:02:05 -0700726
mtkleinc095df52016-08-24 12:23:52 -0700727 bench_sources = exec_script("gyp/find.py",
728 [
729 "*.c*",
730 rebase_path("bench"),
731 ],
732 "list lines",
733 [])
mtklein25c81d42016-07-27 13:55:26 -0700734
mtkleinc095df52016-08-24 12:23:52 -0700735 test_lib("bench") {
736 public_include_dirs = [ "bench" ]
737 sources = bench_sources
738 sources -= [
739 rebase_path("bench/nanobench.cpp"),
740 rebase_path("bench/nanobenchAndroid.cpp"),
741 ]
742 deps = [
743 ":flags",
744 ":gm",
745 ":gpu_tool_utils",
746 ":skia",
747 ":tool_utils",
748 ]
749 }
mtklein2b6870c2016-07-28 14:17:33 -0700750
mtkleinc095df52016-08-24 12:23:52 -0700751 test_lib("experimental_svg_model") {
752 public_include_dirs = [ "experimental/svg/model" ]
753 sources = [
754 "experimental/svg/model/SkSVGAttribute.cpp",
755 "experimental/svg/model/SkSVGAttributeParser.cpp",
756 "experimental/svg/model/SkSVGCircle.cpp",
757 "experimental/svg/model/SkSVGContainer.cpp",
758 "experimental/svg/model/SkSVGDOM.cpp",
759 "experimental/svg/model/SkSVGEllipse.cpp",
760 "experimental/svg/model/SkSVGLine.cpp",
761 "experimental/svg/model/SkSVGNode.cpp",
762 "experimental/svg/model/SkSVGPath.cpp",
763 "experimental/svg/model/SkSVGPoly.cpp",
764 "experimental/svg/model/SkSVGRect.cpp",
765 "experimental/svg/model/SkSVGRenderContext.cpp",
766 "experimental/svg/model/SkSVGSVG.cpp",
767 "experimental/svg/model/SkSVGShape.cpp",
768 "experimental/svg/model/SkSVGTransformableNode.cpp",
769 "experimental/svg/model/SkSVGValue.cpp",
770 ]
771 deps = [
772 ":skia",
773 ]
774 }
fmalitaa2b9fdf2016-08-03 19:53:36 -0700775
mtklein2b6870c2016-07-28 14:17:33 -0700776 executable("dm") {
777 sources = [
778 "dm/DM.cpp",
779 "dm/DMJsonWriter.cpp",
780 "dm/DMSrcSink.cpp",
mtklein2b6870c2016-07-28 14:17:33 -0700781 ]
782 include_dirs = [ "tests" ]
783 deps = [
fmalitaa2b9fdf2016-08-03 19:53:36 -0700784 ":experimental_svg_model",
mtklein2b6870c2016-07-28 14:17:33 -0700785 ":flags",
786 ":gm",
787 ":gpu_tool_utils",
788 ":skia",
mtklein2f3416d2016-08-02 16:02:05 -0700789 ":tests",
mtklein2b6870c2016-07-28 14:17:33 -0700790 ":tool_utils",
791 "//third_party/jsoncpp",
792 "//third_party/libpng",
793 ]
794 testonly = true
795 }
796
797 executable("monobench") {
798 sources = [
799 "tools/monobench.cpp",
800 ]
801 deps = [
802 ":bench",
803 ":skia",
804 ]
805 testonly = true
806 }
807
808 executable("nanobench") {
809 sources = [
810 "bench/nanobench.cpp",
811 ]
812 deps = [
813 ":bench",
814 ":flags",
815 ":gm",
816 ":gpu_tool_utils",
817 ":skia",
818 ":tool_utils",
819 "//third_party/jsoncpp",
820 ]
821 testonly = true
822 }
halcanary19a97202016-08-03 15:08:04 -0700823
mtklein6f5df6a2016-08-29 16:01:10 -0700824 if (current_cpu != "mipsel") { # Clang 3.8 crashes while compiling hb-icu.cc for mipsel.
825 executable("sktexttopdf") {
826 sources = [
827 "tools/SkShaper_harfbuzz.cpp",
828 "tools/using_skia_and_harfbuzz.cpp",
829 ]
830 deps = [
831 ":skia",
832 "//third_party/harfbuzz",
833 ]
834 testonly = true
835 }
halcanary19a97202016-08-03 15:08:04 -0700836 }
mtklein25c81d42016-07-27 13:55:26 -0700837}