blob: 61fb53fcc2c54dce8c29ae6ba7c2195c0d9c7f58 [file] [log] [blame]
benjaminwagner787ca872015-08-17 12:58:10 -07001# Description:
2# Skia graphics library.
3#
4# Definitions for Google BUILD file.
5
6exports_files(["BUILD.public"])
7
8# Platform-independent SRCS
9SRCS = glob(
10 [
mtkleind55d13a2015-08-18 08:51:49 -070011 "include/private/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -070012 "src/**/*.h",
13 "src/**/*.cpp",
benjaminwagner787ca872015-08-17 12:58:10 -070014
mtkleind55d13a2015-08-18 08:51:49 -070015 # Third Party
benjaminwagner787ca872015-08-17 12:58:10 -070016 "third_party/etc1/*.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -070017 "third_party/etc1/*.h",
benjaminwagner787ca872015-08-17 12:58:10 -070018 "third_party/ktx/*.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -070019 "third_party/ktx/*.h",
benjaminwagner787ca872015-08-17 12:58:10 -070020 ],
21 exclude = [
benjaminwagner6f6bef82015-10-15 08:09:44 -070022 # Exclude platform-dependent files.
23 "src/device/xps/*", # Windows-only. Move to ports?
24 "src/doc/*_XPS.cpp", # Windows-only. Move to ports?
25 "src/gpu/gl/android/*",
benjaminwagner86ea33e2015-10-26 10:46:25 -070026 "src/gpu/gl/egl/*",
27 "src/gpu/gl/glx/*",
28 "src/gpu/gl/nacl/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -070029 "src/gpu/gl/iOS/*",
30 "src/gpu/gl/mac/*",
31 "src/gpu/gl/win/*",
32 "src/opts/**/*",
33 "src/ports/**/*",
34 "src/utils/android/**/*",
35 "src/utils/mac/**/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -070036 "src/utils/SkThreadUtils_win.cpp", # Windows-only. Move to ports?
37 "src/utils/win/**/*",
38 "src/views/sdl/*",
39 "src/views/win/*",
40 "src/views/unix/*",
41
42 # Exclude multiple definitions.
43 # TODO(mtklein): Move to opts?
mtkleind55d13a2015-08-18 08:51:49 -070044 "src/doc/SkDocument_PDF_None.cpp", # We use SkDocument_PDF.cpp.
benjaminwagner6f6bef82015-10-15 08:09:44 -070045 "src/fonts/*fontconfig*",
benjaminwagner86ea33e2015-10-26 10:46:25 -070046 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
47 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
48 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -070049
50 # Exclude files that don't compile with the current DEFINES.
benjaminwagneraada3e82015-10-27 09:14:29 -070051 "src/codec/SkJpegCodec.cpp", # libjpeg_turbo version mismatch.
benjaminwagner6f6bef82015-10-15 08:09:44 -070052 "src/gpu/gl/angle/*", # Requires SK_ANGLE define.
53 "src/gpu/gl/command_buffer/*", # unknown type name 'HMODULE'
54 "src/gpu/gl/mesa/*", # Requires SK_MESA define.
55 "src/svg/parser/*", # Missing SkSVG.h.
56
benjaminwagner6f6bef82015-10-15 08:09:44 -070057 # Not used.
58 "src/animator/**/*",
59 "src/views/**/*",
60 "src/xml/SkBML_Verbs.h",
61 "src/xml/SkBML_XMLParser.cpp",
62 "src/xml/SkXMLPullParser.cpp",
63 ],
64)
65
66# Platform-dependent SRCS for google3-default platform.
benjaminwagner86ea33e2015-10-26 10:46:25 -070067SRCS_UNIX = glob(
benjaminwagner6f6bef82015-10-15 08:09:44 -070068 [
benjaminwagner86ea33e2015-10-26 10:46:25 -070069 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
70 "src/gpu/gl/glx/**/*.cpp",
71 "src/gpu/gl/glx/**/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -070072 "src/opts/**/*.cpp",
73 "src/opts/**/*.h",
74 "src/ports/**/*.cpp",
75 "src/ports/**/*.h",
76 ],
77 exclude = [
78 "src/opts/*arm*",
79 "src/opts/*mips*",
80 "src/opts/*NEON*",
81 "src/opts/*neon*",
benjaminwagner86ea33e2015-10-26 10:46:25 -070082 # Included in :opts_ssse3 library.
benjaminwagner6f6bef82015-10-15 08:09:44 -070083 "src/opts/*SSSE3*",
84 "src/opts/*ssse3*",
benjaminwagner86ea33e2015-10-26 10:46:25 -070085 # Included in :opts_sse4 library.
benjaminwagner6f6bef82015-10-15 08:09:44 -070086 "src/opts/*SSE4*",
87 "src/opts/*sse4*",
benjaminwagner6f6bef82015-10-15 08:09:44 -070088 "src/opts/SkBitmapProcState_opts_none.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -070089 "src/opts/SkBlitMask_opts_none.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -070090 "src/opts/SkBlitRow_opts_none.cpp",
91 "src/ports/*android*",
92 "src/ports/*chromium*",
93 "src/ports/*CG*",
94 "src/ports/*fontconfig*",
95 "src/ports/*FontConfig*",
96 "src/ports/*mac*",
97 "src/ports/*mozalloc*",
98 "src/ports/*nacl*",
99 "src/ports/*win*",
100 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
101 "src/ports/SkFontMgr_empty_factory.cpp",
102 "src/ports/SkImageDecoder_WIC.cpp",
103 "src/ports/SkImageDecoder_empty.cpp",
104 "src/ports/SkImageGenerator_none.cpp",
105 "src/ports/SkTLS_none.cpp",
mtkleind55d13a2015-08-18 08:51:49 -0700106 ],
107)
108
benjaminwagner86ea33e2015-10-26 10:46:25 -0700109# Platform-dependent SRCS for google3-default Android.
110SRCS_ANDROID = glob(
111 [
112 # TODO(benjaminwagner): Figure out how to compile with EGL.
113 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
114 "src/gpu/gl/nacl/SkCreatePlatformGLContext_nacl.cpp",
115 "src/opts/**/*.cpp",
116 "src/opts/**/*.h",
117 "src/ports/**/*.cpp",
118 "src/ports/**/*.h",
119 ],
120 exclude = [
121 "src/opts/*mips*",
122 "src/opts/*SSE2*",
123 "src/opts/*SSSE3*",
124 "src/opts/*ssse3*",
125 "src/opts/*SSE4*",
126 "src/opts/*sse4*",
127 "src/opts/*x86*",
128 "src/opts/SkBitmapProcState_opts_none.cpp",
129 "src/opts/SkBlitMask_opts_none.cpp",
130 "src/opts/SkBlitRow_opts_none.cpp",
131 "src/ports/*chromium*",
132 "src/ports/*CG*",
133 "src/ports/*fontconfig*",
134 "src/ports/*FontConfig*",
135 "src/ports/*mac*",
136 "src/ports/*mozalloc*",
137 "src/ports/*nacl*",
138 "src/ports/*win*",
139 "src/ports/SkDebug_stdio.cpp",
140 "src/ports/SkFontMgr_custom_directory_factory.cpp",
141 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
142 "src/ports/SkFontMgr_empty_factory.cpp",
143 "src/ports/SkImageDecoder_WIC.cpp",
144 "src/ports/SkImageDecoder_empty.cpp",
145 "src/ports/SkImageGenerator_none.cpp",
146 "src/ports/SkTLS_none.cpp",
147 ],
148)
149
150PLATFORM_SRCS = select({
151 CONDITION_ANDROID: SRCS_ANDROID,
152 "//conditions:default": SRCS_UNIX,
153})
154
mtkleind55d13a2015-08-18 08:51:49 -0700155SRCS_SSSE3 = glob(
156 [
157 "src/opts/*SSSE3*.cpp",
158 "src/opts/*ssse3*.cpp",
159 ],
160)
161
162SRCS_SSE4 = glob(
163 [
164 "src/opts/*SSE4*.cpp",
165 "src/opts/*sse4*.cpp",
benjaminwagner787ca872015-08-17 12:58:10 -0700166 ],
167)
168
169HDRS = glob(
170 [
171 "include/**/*.h",
172 ],
mtkleind55d13a2015-08-18 08:51:49 -0700173 exclude = [
benjaminwagner6f6bef82015-10-15 08:09:44 -0700174 "include/private/**/*",
175
176 # Not used.
177 "include/animator/**/*",
178 "include/views/**/*",
179 "include/xml/SkBML_WXMLParser.h",
180 "include/xml/SkBML_XMLParser.h",
mtkleind55d13a2015-08-18 08:51:49 -0700181 ],
benjaminwagner787ca872015-08-17 12:58:10 -0700182)
183
184# Includes needed by Skia implementation. Not public includes.
185INCLUDES = [
benjaminwagner787ca872015-08-17 12:58:10 -0700186 "include/c",
187 "include/codec",
188 "include/config",
189 "include/core",
benjaminwagner787ca872015-08-17 12:58:10 -0700190 "include/effects",
191 "include/gpu",
192 "include/images",
193 "include/pathops",
benjaminwagner787ca872015-08-17 12:58:10 -0700194 "include/pipe",
195 "include/ports",
196 "include/private",
197 "include/utils",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700198 "include/svg",
benjaminwagner787ca872015-08-17 12:58:10 -0700199 "include/xml",
200 "src/core",
benjaminwagner787ca872015-08-17 12:58:10 -0700201 "src/gpu",
202 "src/image",
203 "src/lazy",
204 "src/opts",
205 "src/pdf",
benjaminwagner787ca872015-08-17 12:58:10 -0700206 "src/sfnt",
207 "src/utils",
208 "third_party/etc1",
209 "third_party/ktx",
210]
211
benjaminwagner86ea33e2015-10-26 10:46:25 -0700212DEPS_UNIX = [
213 ":opts_sse4",
214 ":opts_ssse3",
215]
216
217DEPS_ANDROID = []
218
219DEPS = select({
benjaminwagner8a3760f2015-10-29 13:40:27 -0700220 CONDITION_ANDROID: DEPS_ANDROID + EXTERNAL_DEPS_ANDROID + EXTERNAL_DEPS_ALL,
221 "//conditions:default": DEPS_UNIX + EXTERNAL_DEPS_UNIX + EXTERNAL_DEPS_ALL,
benjaminwagner86ea33e2015-10-26 10:46:25 -0700222})
223
224# Platform-independent SRCS for DM.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700225DM_SRCS = glob(
226 [
227 "dm/*.cpp",
228 "dm/*.h",
229 "gm/*.c",
230 "gm/*.cpp",
231 "gm/*.h",
232 "tests/*.cpp",
233 "tests/*.h",
234 "tools/CrashHandler.cpp",
235 "tools/CrashHandler.h",
236 "tools/LazyDecodeBitmap.cpp",
237 "tools/LazyDecodeBitmap.h",
238 "tools/ProcStats.cpp",
239 "tools/ProcStats.h",
240 "tools/Resources.cpp",
241 "tools/Resources.h",
benjaminwagner32885142015-10-24 07:55:31 -0700242 "tools/SkBitmapRegionCanvas.cpp",
243 "tools/SkBitmapRegionCanvas.h",
244 "tools/SkBitmapRegionCodec.cpp",
245 "tools/SkBitmapRegionCodec.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700246 "tools/SkBitmapRegionDecoderInterface.cpp",
247 "tools/SkBitmapRegionDecoderInterface.h",
248 "tools/SkBitmapRegionSampler.cpp",
249 "tools/SkBitmapRegionSampler.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700250 "tools/flags/*.cpp",
251 "tools/flags/*.h",
benjaminwagner32885142015-10-24 07:55:31 -0700252 "tools/sk_tool_utils.cpp",
253 "tools/sk_tool_utils.h",
254 "tools/sk_tool_utils_font.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700255 "tools/timer/*.cpp",
256 "tools/timer/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700257 ],
258 exclude = [
benjaminwagner86ea33e2015-10-26 10:46:25 -0700259 "dm/DMSrcSinkAndroid.cpp", # Android-only.
260 "tests/FontMgrAndroidParserTest.cpp", # Android-only.
261 "tests/PathOpsSkpClipTest.cpp", # Alternate main.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700262 "tests/skia_test.cpp", # Old main.
263 "tests/SkpSkGrTest.cpp", # Alternate main.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700264 "tools/timer/SysTimer_mach.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700265 "tools/timer/SysTimer_windows.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700266 ],
267)
268
benjaminwagner86ea33e2015-10-26 10:46:25 -0700269DM_SRCS_UNIX = []
270
271DM_SRCS_ANDROID = glob(
272 [
273 # Depends on Android HWUI library that is not available in google3.
274 #"dm/DMSrcSinkAndroid.cpp",
275 "tests/FontMgrAndroidParserTest.cpp",
276 ],
277)
278
279DM_PLATFORM_SRCS = select({
280 CONDITION_ANDROID: DM_SRCS_ANDROID,
281 "//conditions:default": DM_SRCS_UNIX,
282})
283
benjaminwagner6f6bef82015-10-15 08:09:44 -0700284DM_INCLUDES = [
285 "gm",
286 "src/codec",
287 "src/effects",
288 "src/fonts",
289 "src/pathops",
290 "src/pipe/utils",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700291 "src/ports",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700292 "src/utils/debugger",
293 "tests",
294 "tools",
295 "tools/flags",
296 "tools/timer",
297]
298
benjaminwagner86ea33e2015-10-26 10:46:25 -0700299COPTS_ANDROID = [
300 "-mfpu=neon",
301]
302
303COPTS_UNIX = [
benjaminwagner787ca872015-08-17 12:58:10 -0700304 "-Wno-implicit-fallthrough", # Some intentional fallthrough.
benjaminwagner7d974f52015-10-19 13:55:55 -0700305 "-Wno-deprecated-declarations", # Internal use of deprecated methods. :(
benjaminwagner787ca872015-08-17 12:58:10 -0700306]
307
benjaminwagner86ea33e2015-10-26 10:46:25 -0700308COPTS = select({
309 CONDITION_ANDROID: COPTS_ANDROID,
310 "//conditions:default": COPTS_UNIX,
311})
312
313DEFINES_ANDROID = [
314 "SK_BUILD_FOR_ANDROID",
315 # TODO(benjaminwagner): Try to get png library updated?
316 "SK_PNG_NO_INDEX_SUPPORTED",
317]
318
319DEFINES_UNIX = [
320 "SK_BUILD_FOR_UNIX",
321 "SK_SAMPLES_FOR_X",
322]
323
324DEFINES_ALL = [
benjaminwagner787ca872015-08-17 12:58:10 -0700325 # Chrome DEFINES.
326 "SK_USE_FLOATBITS",
327 "SK_USE_FREETYPE_EMBOLDEN",
328 # Turn on a few Google3-specific build fixes.
329 "GOOGLE3",
benjaminwagner787ca872015-08-17 12:58:10 -0700330]
331
benjaminwagner86ea33e2015-10-26 10:46:25 -0700332DEFINES = select({
333 CONDITION_ANDROID: DEFINES_ANDROID,
334 "//conditions:default": DEFINES_UNIX,
335}) + DEFINES_ALL
336
337LINKOPTS = select({
338 CONDITION_ANDROID: [
339 "-ldl",
340 "-lEGL",
341 ],
342 "//conditions:default": ["-ldl"],
343})
benjaminwagner6f6bef82015-10-15 08:09:44 -0700344
345cc_library(
346 name = "opts_ssse3",
347 srcs = SRCS_SSSE3,
348 copts = COPTS + ["-mssse3"],
349 defines = DEFINES,
350 includes = INCLUDES,
benjaminwagner8a3760f2015-10-29 13:40:27 -0700351 deps = EXTERNAL_DEPS_ALL,
benjaminwagner6f6bef82015-10-15 08:09:44 -0700352)
353
354cc_library(
355 name = "opts_sse4",
356 srcs = SRCS_SSE4,
357 copts = COPTS + ["-msse4"],
358 defines = DEFINES,
359 includes = INCLUDES,
benjaminwagner8a3760f2015-10-29 13:40:27 -0700360 deps = EXTERNAL_DEPS_ALL,
benjaminwagner6f6bef82015-10-15 08:09:44 -0700361)
362
363cc_library(
364 name = "skia",
365 srcs = SRCS + PLATFORM_SRCS,
366 hdrs = HDRS,
367 copts = COPTS,
368 defines = DEFINES,
369 includes = INCLUDES,
370 linkopts = LINKOPTS,
371 visibility = [":skia_clients"],
benjaminwagner86ea33e2015-10-26 10:46:25 -0700372 deps = DEPS,
benjaminwagner6f6bef82015-10-15 08:09:44 -0700373)
374
375cc_test(
376 name = "dm",
377 size = "large",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700378 srcs = DM_SRCS + DM_PLATFORM_SRCS,
benjaminwagner6f6bef82015-10-15 08:09:44 -0700379 args = [
380 "--nogpu",
381 "--verbose",
382 # TODO(mtklein): maybe investigate why these fail?
benjaminwagner8a3760f2015-10-29 13:40:27 -0700383 "--match ~FontMgr ~Scalar ~Canvas ~Codec_stripes ~Codec_Dimensions ~Codec ~Stream ~skps ~Math ~RecordDraw_TextBounds",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700384 "--resourcePath %s/resources" % BASE_DIR,
385 "--images %s/resources" % BASE_DIR,
386 ],
387 copts = COPTS,
benjaminwagner964eeba2015-10-20 13:00:48 -0700388 data = glob(["resources/**/*"]),
benjaminwagner6f6bef82015-10-15 08:09:44 -0700389 defines = DEFINES,
390 includes = DM_INCLUDES,
391 deps = DM_EXTERNAL_DEPS + [
392 ":skia",
benjaminwagner8a3760f2015-10-29 13:40:27 -0700393 ] + EXTERNAL_DEPS_ALL,
benjaminwagner6f6bef82015-10-15 08:09:44 -0700394)