blob: 794a375b05220152d85c6b11b6b7311091dcd9b9 [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() {
7}
8
mtklein1211e0c2016-07-26 13:55:45 -07009skia_public_includes = [
mtklein25c81d42016-07-27 13:55:26 -070010 "include/android",
mtklein1211e0c2016-07-26 13:55:45 -070011 "include/codec",
12 "include/config",
13 "include/core",
14 "include/effects",
15 "include/gpu",
16 "include/gpu/gl",
17 "include/images",
18 "include/pathops",
19 "include/ports",
mtklein25c81d42016-07-27 13:55:26 -070020 "include/svg",
mtklein1211e0c2016-07-26 13:55:45 -070021 "include/utils",
22 "include/utils/mac",
mtklein25c81d42016-07-27 13:55:26 -070023 "include/xml",
mtklein1211e0c2016-07-26 13:55:45 -070024
mtklein7d10b9f2016-07-27 11:17:18 -070025 "include/c", # TODO: move back to top, order shouldn't matter
mtklein1211e0c2016-07-26 13:55:45 -070026]
27
mtkleinc04ff472016-06-23 10:29:30 -070028# Skia public API, generally provided by :skia.
29config("skia_public") {
mtklein1211e0c2016-07-26 13:55:45 -070030 include_dirs = skia_public_includes
mtkleinc04ff472016-06-23 10:29:30 -070031 defines = [ "SKIA_DLL" ]
32}
33
34# Skia internal APIs, used by Skia itself and a few test tools.
35config("skia_private") {
36 visibility = [ ":*" ]
37
38 include_dirs = [
39 "include/private",
40 "src/c",
mtklein1211e0c2016-07-26 13:55:45 -070041 "src/codec",
mtkleinc04ff472016-06-23 10:29:30 -070042 "src/config",
43 "src/core",
44 "src/effects",
mtklein25c81d42016-07-27 13:55:26 -070045 "src/effects/gradients",
46 "src/fonts",
mtkleinc04ff472016-06-23 10:29:30 -070047 "src/gpu",
48 "src/image",
49 "src/images",
50 "src/lazy",
51 "src/opts",
52 "src/pathops",
53 "src/ports",
54 "src/sfnt",
55 "src/utils",
56 "third_party/etc1",
57 "third_party/ktx",
58 ]
59}
60
61# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
62config("skia_library") {
63 visibility = [ ":*" ]
mtkleinc04ff472016-06-23 10:29:30 -070064 defines = [ "SKIA_IMPLEMENTATION=1" ]
65}
66
67skia_library_configs = [
68 ":skia_public",
69 ":skia_private",
70 ":skia_library",
71]
72
mtklein7fbfbbe2016-07-21 12:25:45 -070073core_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -070074 [
75 rebase_path("gyp/core.gypi"),
76 "--replace=<(skia_include_path)=include",
77 "--replace=<(skia_src_path)=src",
78 ],
79 "scope",
80 [ "gyp/core.gypi" ])
81
mtklein7fbfbbe2016-07-21 12:25:45 -070082effects_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -070083 [
84 rebase_path("gyp/effects.gypi"),
85 "--replace=<(skia_include_path)=include",
86 "--replace=<(skia_src_path)=src",
87 ],
88 "scope",
89 [ "gyp/effects.gypi" ])
90
mtklein7fbfbbe2016-07-21 12:25:45 -070091gpu_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -070092 [
93 rebase_path("gyp/gpu.gypi"),
94 "--replace=<(skia_include_path)=include",
95 "--replace=<(skia_src_path)=src",
96 ],
97 "scope",
98 [ "gyp/gpu.gypi" ])
99
mtklein7fbfbbe2016-07-21 12:25:45 -0700100opts_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700101 [
102 rebase_path("gyp/opts.gypi"),
103 "--replace=<(skia_include_path)=include",
104 "--replace=<(skia_src_path)=src",
105 ],
106 "scope",
107 [ "gyp/opts.gypi" ])
108
mtklein7fbfbbe2016-07-21 12:25:45 -0700109pdf_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700110 [
111 rebase_path("gyp/pdf.gypi"),
112 "--replace=<(skia_include_path)=include",
113 "--replace=<(skia_src_path)=src",
114 ],
115 "scope",
116 [ "gyp/pdf.gypi" ])
117
mtklein7fbfbbe2016-07-21 12:25:45 -0700118utils_gypi = exec_script("gn/gypi_to_gn.py",
mtkleinc04ff472016-06-23 10:29:30 -0700119 [
120 rebase_path("gyp/utils.gypi"),
121 "--replace=<(skia_include_path)=include",
122 "--replace=<(skia_src_path)=src",
123 ],
124 "scope",
125 [ "gyp/utils.gypi" ])
126
127source_set("opts_ssse3") {
128 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700129
130 sources = opts_gypi.ssse3_sources
131 cflags = [ "-mssse3" ]
132}
133
134source_set("opts_sse41") {
135 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700136
137 sources = opts_gypi.sse41_sources
138 cflags = [ "-msse4.1" ]
139}
140
141source_set("opts_avx") {
142 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700143
144 sources = opts_gypi.avx_sources
145 cflags = [ "-mavx" ]
146}
147
148component("skia") {
149 public_configs = [ ":skia_public" ]
150 configs += skia_library_configs
mtkleinc04ff472016-06-23 10:29:30 -0700151
152 deps = [
153 ":opts_avx",
154 ":opts_sse41",
155 ":opts_ssse3",
mtklein25c81d42016-07-27 13:55:26 -0700156 "//third_party/expat",
157 "//third_party/giflib",
mtklein7d10b9f2016-07-27 11:17:18 -0700158 "//third_party/libjpeg_turbo",
159 "//third_party/libpng",
mtklein25c81d42016-07-27 13:55:26 -0700160 "//third_party/libwebp",
abarth6fc8ff02016-07-15 15:15:15 -0700161 "//third_party/zlib",
mtkleinc04ff472016-06-23 10:29:30 -0700162 ]
163
mtklein1211e0c2016-07-26 13:55:45 -0700164 defines = [
mtklein25c81d42016-07-27 13:55:26 -0700165 "SK_HAS_GIF_LIBRARY",
mtklein1211e0c2016-07-26 13:55:45 -0700166 "SK_HAS_JPEG_LIBRARY",
167 "SK_HAS_PNG_LIBRARY",
mtklein25c81d42016-07-27 13:55:26 -0700168 "SK_HAS_WEBP_LIBRARY",
mtklein1211e0c2016-07-26 13:55:45 -0700169 ]
170
mtklein7fbfbbe2016-07-21 12:25:45 -0700171 libs = [ "pthread" ]
mtkleinc04ff472016-06-23 10:29:30 -0700172
173 sources = []
174 sources += core_gypi.sources
175 sources += effects_gypi.sources
176 sources += gpu_gypi.skgpu_sources
177 sources += opts_gypi.sse2_sources
178 sources += pdf_gypi.sources
179 sources += utils_gypi.sources
180 sources += [
mtklein25c81d42016-07-27 13:55:26 -0700181 "src/android/SkBitmapRegionCodec.cpp",
182 "src/android/SkBitmapRegionDecoder.cpp",
183 "src/codec/SkAndroidCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700184 "src/codec/SkBmpCodec.cpp",
185 "src/codec/SkBmpMaskCodec.cpp",
186 "src/codec/SkBmpRLECodec.cpp",
187 "src/codec/SkBmpStandardCodec.cpp",
188 "src/codec/SkCodec.cpp",
189 "src/codec/SkCodecImageGenerator.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700190 "src/codec/SkGifCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700191 "src/codec/SkIcoCodec.cpp",
192 "src/codec/SkJpegCodec.cpp",
193 "src/codec/SkJpegDecoderMgr.cpp",
194 "src/codec/SkJpegUtility.cpp",
195 "src/codec/SkMaskSwizzler.cpp",
196 "src/codec/SkMasks.cpp",
197 "src/codec/SkPngCodec.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700198 "src/codec/SkSampledCodec.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700199 "src/codec/SkSampler.cpp",
200 "src/codec/SkSwizzler.cpp",
201 "src/codec/SkWbmpCodec.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700202 "src/codec/SkWebpAdapterCodec.cpp",
203 "src/codec/SkWebpCodec.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700204 "src/images/SkImageEncoder.cpp",
205 "src/images/SkImageEncoder_Factory.cpp",
206 "src/ports/SkDiscardableMemory_none.cpp",
207 "src/ports/SkGlobalInitialization_default.cpp",
mtklein1211e0c2016-07-26 13:55:45 -0700208 "src/ports/SkImageGenerator_skia.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700209 "src/ports/SkMemory_malloc.cpp",
210 "src/ports/SkOSFile_stdio.cpp",
211 "src/sfnt/SkOTTable_name.cpp",
212 "src/sfnt/SkOTUtils.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700213 "src/svg/SkSVGCanvas.cpp",
214 "src/svg/SkSVGDevice.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700215 "src/utils/mac/SkStream_mac.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700216 "src/xml/SkDOM.cpp",
217 "src/xml/SkXMLParser.cpp",
218 "src/xml/SkXMLWriter.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700219 "third_party/etc1/etc1.cpp",
220 "third_party/ktx/ktx.cpp",
221 ]
222
223 if (is_win) {
224 sources += [
225 "src/ports/SkDebug_win.cpp",
226 "src/ports/SkFontHost_win.cpp",
227 "src/ports/SkFontMgr_win_dw.cpp",
228 "src/ports/SkFontMgr_win_dw_factory.cpp",
229 "src/ports/SkImageEncoder_WIC.cpp",
230 "src/ports/SkImageGeneratorWIC.cpp",
231 "src/ports/SkOSFile_win.cpp",
232 "src/ports/SkScalerContext_win_dw.cpp",
233 "src/ports/SkTLS_win.cpp",
234 "src/ports/SkTypeface_win_dw.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700235 "src/xps/SkDocument_XPS.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700236 ]
237 } else {
238 sources += [
239 "src/ports/SkDebug_stdio.cpp",
240 "src/ports/SkOSFile_posix.cpp",
241 "src/ports/SkTLS_pthread.cpp",
mtklein25c81d42016-07-27 13:55:26 -0700242 "src/xps/SkDocument_XPS_None.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700243 ]
244 }
245
246 if (is_linux) {
247 deps += [
248 "third_party:fontconfig",
249 "third_party:freetype2",
mtkleinc04ff472016-06-23 10:29:30 -0700250 ]
251 sources += [
252 "src/fonts/SkFontMgr_fontconfig.cpp",
253 "src/images/SkJPEGImageEncoder.cpp",
254 "src/images/SkJPEGWriteUtility.cpp",
255 "src/images/SkPNGImageEncoder.cpp",
256 "src/ports/SkFontConfigInterface_direct.cpp",
257 "src/ports/SkFontConfigInterface_direct_factory.cpp",
258 "src/ports/SkFontHost_FreeType.cpp",
259 "src/ports/SkFontHost_FreeType_common.cpp",
260 "src/ports/SkFontHost_fontconfig.cpp",
261 ]
262 }
263
264 if (is_mac) {
265 sources += [
266 "src/ports/SkFontHost_mac.cpp",
267 "src/ports/SkImageEncoder_CG.cpp",
268 "src/ports/SkImageGeneratorCG.cpp",
269 ]
270 libs += [ "ApplicationServices.framework" ]
271 }
abarth6fc8ff02016-07-15 15:15:15 -0700272
273 if (is_fuchsia) {
mtkleine817ddf2016-07-19 06:03:22 -0700274 sources += [ "src/ports/SkFontMgr_empty_factory.cpp" ]
abarth6fc8ff02016-07-15 15:15:15 -0700275 }
mtkleinc04ff472016-06-23 10:29:30 -0700276}
277
mtklein1211e0c2016-07-26 13:55:45 -0700278action("skia.h") {
279 script = "gn/echo_headers.py"
280 args = [ rebase_path("$target_gen_dir/skia.h", root_build_dir) ] +
281 rebase_path(skia_public_includes, root_build_dir)
282 outputs = [
283 "$target_gen_dir/skia.h",
284 ]
285}
286
287executable("fiddle") {
288 include_dirs = [ "$target_gen_dir" ]
mtklein7d10b9f2016-07-27 11:17:18 -0700289 libs = []
290 if (is_linux) {
291 libs += [ "OSMesa" ]
292 }
mtklein1211e0c2016-07-26 13:55:45 -0700293
mtkleinc04ff472016-06-23 10:29:30 -0700294 sources = [
mtklein1211e0c2016-07-26 13:55:45 -0700295 "tools/fiddle/draw.cpp",
296 "tools/fiddle/fiddle_main.cpp",
mtkleinc04ff472016-06-23 10:29:30 -0700297 ]
298 deps = [
299 ":skia",
mtklein1211e0c2016-07-26 13:55:45 -0700300 ":skia.h",
mtkleinc04ff472016-06-23 10:29:30 -0700301 ]
mtkleinc04ff472016-06-23 10:29:30 -0700302}
mtklein25c81d42016-07-27 13:55:26 -0700303
304template("test_lib") {
305 config(target_name + "_config") {
306 include_dirs = invoker.public_include_dirs
307 }
308 source_set(target_name) {
309 forward_variables_from(invoker, "*", [ "public_include_dirs" ])
310 public_configs = [
311 ":" + target_name + "_config",
312 ":skia_private",
313 ]
314
315 if (!defined(deps)) {
316 deps = []
317 }
318 deps += [ ":skia" ]
319 testonly = true
320 }
321}
322
323test_lib("gpu_tool_utils") {
324 public_include_dirs = [ "tools/gpu" ]
325 sources = [
326 "tools/gpu/GrContextFactory.cpp",
327 "tools/gpu/GrTest.cpp",
328 "tools/gpu/TestContext.cpp",
329 "tools/gpu/gl/GLTestContext.cpp",
330 "tools/gpu/gl/debug/DebugGLTestContext.cpp",
331 "tools/gpu/gl/debug/GrBufferObj.cpp",
332 "tools/gpu/gl/debug/GrFrameBufferObj.cpp",
333 "tools/gpu/gl/debug/GrProgramObj.cpp",
334 "tools/gpu/gl/debug/GrShaderObj.cpp",
335 "tools/gpu/gl/debug/GrTextureObj.cpp",
336 "tools/gpu/gl/debug/GrTextureUnitObj.cpp",
337 "tools/gpu/gl/null/NullGLTestContext.cpp",
338 ]
339 libs = []
340
341 if (is_linux) {
342 sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
343 libs += [
344 "GL",
345 "GLU",
346 "X11",
347 ]
348 } else if (is_mac) {
349 sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
350 libs += [ "OpenGL.framework" ]
351 }
352}
353
354test_lib("flags") {
355 public_include_dirs = [ "tools/flags" ]
356 sources = [
357 "tools/flags/SkCommandLineFlags.cpp",
358 "tools/flags/SkCommonFlags.cpp",
359 "tools/flags/SkCommonFlagsConfig.cpp",
360 ]
361 deps = [
362 ":gpu_tool_utils",
363 ]
364}
365
366test_lib("tool_utils") {
367 public_include_dirs = [
368 "tools",
369 "tools/timer",
370 ]
371 sources = [
372 "src/utils/SkMultiPictureDocumentReader.cpp", # TODO(halcanary): move to tools?
373 "tools/ProcStats.cpp",
374 "tools/Resources.cpp",
375 "tools/picture_utils.cpp",
376 "tools/random_parse_path.cpp",
377 "tools/sk_tool_utils.cpp",
378 "tools/sk_tool_utils_font.cpp",
379 "tools/timer/Timer.cpp",
380 ]
381 deps = [
382 ":flags",
383 ]
384}
385
386gm_sources = exec_script("gyp/find.py",
387 [
388 rebase_path("gm"),
389 "*.c*",
390 ],
391 "list lines",
392 [])
393test_lib("gm") {
394 public_include_dirs = [ "gm" ]
395 sources = gm_sources
396 deps = [
397 ":gpu_tool_utils",
398 ":skia",
399 ":tool_utils",
400 ]
401}
402
403executable("dm") {
404 sources = [
405 "dm/DM.cpp",
406 "dm/DMJsonWriter.cpp",
407 "dm/DMSrcSink.cpp",
408
409 # TODO: tests for real
410 "tests/Test.cpp",
411 ]
412 include_dirs = [ "tests" ]
413 deps = [
414 ":flags",
415 ":gm",
416 ":gpu_tool_utils",
417 ":skia",
418 ":tool_utils",
419 "//third_party/jsoncpp",
420 "//third_party/libpng",
421 ]
422 testonly = true
423}