blob: 832b3ad2edeed5a366fd90ab5f05ddadfd0a1c69 [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",
14 "src/**/*.c",
benjaminwagner787ca872015-08-17 12:58:10 -070015
mtkleind55d13a2015-08-18 08:51:49 -070016 # Third Party
benjaminwagner787ca872015-08-17 12:58:10 -070017 "third_party/etc1/*.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -070018 "third_party/etc1/*.h",
benjaminwagner787ca872015-08-17 12:58:10 -070019 "third_party/ktx/*.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -070020 "third_party/ktx/*.h",
benjaminwagner787ca872015-08-17 12:58:10 -070021 ],
22 exclude = [
benjaminwagner6f6bef82015-10-15 08:09:44 -070023 # Exclude platform-dependent files.
24 "src/device/xps/*", # Windows-only. Move to ports?
25 "src/doc/*_XPS.cpp", # Windows-only. Move to ports?
26 "src/gpu/gl/android/*",
27 "src/gpu/gl/iOS/*",
28 "src/gpu/gl/mac/*",
29 "src/gpu/gl/win/*",
30 "src/opts/**/*",
31 "src/ports/**/*",
32 "src/utils/android/**/*",
33 "src/utils/mac/**/*",
34 "src/utils/SkThreadUtils_pthread_mach.cpp", # Mac-only. Move to ports?
35 "src/utils/SkThreadUtils_pthread_other.cpp", # Non-Mac-non-Linux. Move to ports?
36 "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*",
46 "src/gpu/gl/egl/*", # Conflicts with gpu/gl/glx.
47 "src/gpu/gl/nacl/*", # Conflicts with gpu/gl/glx.
48 "src/gpu/gl/GrGLDefaultInterface_none.cpp", # Conflicts with src/gpu/gl/GrGLDefaultInterface_native.cpp
49 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp", # Conflicts with src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp
50
51 # Exclude files that don't compile with the current DEFINES.
52 "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
57 # Dependency on files outside src.
58 "src/svg/skp2svg.cpp", # Depends on tools/LazyDecodeBitmap.h.
59
60 # Not used.
61 "src/animator/**/*",
62 "src/views/**/*",
63 "src/xml/SkBML_Verbs.h",
64 "src/xml/SkBML_XMLParser.cpp",
65 "src/xml/SkXMLPullParser.cpp",
66 ],
67)
68
69# Platform-dependent SRCS for google3-default platform.
70PLATFORM_SRCS = glob(
71 [
72 "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*",
82 "src/opts/*SSSE3*",
83 "src/opts/*ssse3*",
84 "src/opts/*SSE4*",
85 "src/opts/*sse4*",
86 "src/opts/SkBlitMask_opts_none.cpp",
87 "src/opts/SkBitmapProcState_opts_none.cpp",
88 "src/opts/SkBlitRow_opts_none.cpp",
89 "src/ports/*android*",
90 "src/ports/*chromium*",
91 "src/ports/*CG*",
92 "src/ports/*fontconfig*",
93 "src/ports/*FontConfig*",
94 "src/ports/*mac*",
95 "src/ports/*mozalloc*",
96 "src/ports/*nacl*",
97 "src/ports/*win*",
98 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
99 "src/ports/SkFontMgr_empty_factory.cpp",
100 "src/ports/SkImageDecoder_WIC.cpp",
101 "src/ports/SkImageDecoder_empty.cpp",
102 "src/ports/SkImageGenerator_none.cpp",
103 "src/ports/SkTLS_none.cpp",
mtkleind55d13a2015-08-18 08:51:49 -0700104 ],
105)
106
107SRCS_SSSE3 = glob(
108 [
109 "src/opts/*SSSE3*.cpp",
110 "src/opts/*ssse3*.cpp",
111 ],
112)
113
114SRCS_SSE4 = glob(
115 [
116 "src/opts/*SSE4*.cpp",
117 "src/opts/*sse4*.cpp",
benjaminwagner787ca872015-08-17 12:58:10 -0700118 ],
119)
120
121HDRS = glob(
122 [
123 "include/**/*.h",
124 ],
mtkleind55d13a2015-08-18 08:51:49 -0700125 exclude = [
benjaminwagner6f6bef82015-10-15 08:09:44 -0700126 "include/private/**/*",
127
128 # Not used.
129 "include/animator/**/*",
130 "include/views/**/*",
131 "include/xml/SkBML_WXMLParser.h",
132 "include/xml/SkBML_XMLParser.h",
mtkleind55d13a2015-08-18 08:51:49 -0700133 ],
benjaminwagner787ca872015-08-17 12:58:10 -0700134)
135
136# Includes needed by Skia implementation. Not public includes.
137INCLUDES = [
benjaminwagner787ca872015-08-17 12:58:10 -0700138 "include/c",
139 "include/codec",
140 "include/config",
141 "include/core",
benjaminwagner787ca872015-08-17 12:58:10 -0700142 "include/effects",
143 "include/gpu",
144 "include/images",
145 "include/pathops",
benjaminwagner787ca872015-08-17 12:58:10 -0700146 "include/pipe",
147 "include/ports",
148 "include/private",
149 "include/utils",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700150 "include/svg",
benjaminwagner787ca872015-08-17 12:58:10 -0700151 "include/xml",
152 "src/core",
benjaminwagner787ca872015-08-17 12:58:10 -0700153 "src/gpu",
154 "src/image",
155 "src/lazy",
156 "src/opts",
157 "src/pdf",
benjaminwagner787ca872015-08-17 12:58:10 -0700158 "src/sfnt",
159 "src/utils",
160 "third_party/etc1",
161 "third_party/ktx",
162]
163
benjaminwagner6f6bef82015-10-15 08:09:44 -0700164DM_SRCS = glob(
165 [
166 "dm/*.cpp",
167 "dm/*.h",
168 "gm/*.c",
169 "gm/*.cpp",
170 "gm/*.h",
171 "tests/*.cpp",
172 "tests/*.h",
173 "tools/CrashHandler.cpp",
174 "tools/CrashHandler.h",
175 "tools/LazyDecodeBitmap.cpp",
176 "tools/LazyDecodeBitmap.h",
177 "tools/ProcStats.cpp",
178 "tools/ProcStats.h",
179 "tools/Resources.cpp",
180 "tools/Resources.h",
181 "tools/SkBitmapRegionDecoderInterface.cpp",
182 "tools/SkBitmapRegionDecoderInterface.h",
183 "tools/SkBitmapRegionSampler.cpp",
184 "tools/SkBitmapRegionSampler.h",
185 "tools/SkBitmapRegionCanvas.cpp",
186 "tools/SkBitmapRegionCanvas.h",
187 "tools/flags/*.cpp",
188 "tools/flags/*.h",
189 "tools/timer/*.cpp",
190 "tools/timer/*.h",
191 "tools/sk_tool_utils.cpp",
192 "tools/sk_tool_utils_font.cpp",
193 "tools/sk_tool_utils.h",
194 ],
195 exclude = [
196 "tests/skia_test.cpp", # Old main.
197 "tests/SkpSkGrTest.cpp", # Alternate main.
198 "tests/PathOpsSkpClipTest.cpp", # Alternate main.
199 "tests/FontMgrAndroidParserTest.cpp", # Android-only.
200 "dm/DMSrcSinkAndroid.cpp", # Android-only.
201 "tools/timer/SysTimer_windows.cpp",
202 "tools/timer/SysTimer_mach.cpp",
203 ],
204)
205
206DM_INCLUDES = [
207 "gm",
208 "src/codec",
209 "src/effects",
210 "src/fonts",
211 "src/pathops",
212 "src/pipe/utils",
213 "src/utils/debugger",
214 "tests",
215 "tools",
216 "tools/flags",
217 "tools/timer",
218]
219
benjaminwagner787ca872015-08-17 12:58:10 -0700220COPTS = [
benjaminwagner787ca872015-08-17 12:58:10 -0700221 "-Wno-implicit-fallthrough", # Some intentional fallthrough.
222]
223
224DEFINES = [
225 # It'd be nice for fastbuild, dbg -> SK_DEBUG, opt -> SK_RELEASE.
226 "SK_RELEASE",
227 # Chrome DEFINES.
228 "SK_USE_FLOATBITS",
229 "SK_USE_FREETYPE_EMBOLDEN",
230 # Turn on a few Google3-specific build fixes.
231 "GOOGLE3",
232 "SK_BUILD_FOR_UNIX",
233 "SK_SAMPLES_FOR_X",
234]
235
236LINKOPTS = ["-ldl"]
benjaminwagner6f6bef82015-10-15 08:09:44 -0700237
238cc_library(
239 name = "opts_ssse3",
240 srcs = SRCS_SSSE3,
241 copts = COPTS + ["-mssse3"],
242 defines = DEFINES,
243 includes = INCLUDES,
244)
245
246cc_library(
247 name = "opts_sse4",
248 srcs = SRCS_SSE4,
249 copts = COPTS + ["-msse4"],
250 defines = DEFINES,
251 includes = INCLUDES,
252)
253
254cc_library(
255 name = "skia",
256 srcs = SRCS + PLATFORM_SRCS,
257 hdrs = HDRS,
258 copts = COPTS,
259 defines = DEFINES,
260 includes = INCLUDES,
261 linkopts = LINKOPTS,
262 visibility = [":skia_clients"],
263 deps = EXTERNAL_DEPS + [
264 ":opts_sse4",
265 ":opts_ssse3",
266 ],
267)
268
269cc_test(
270 name = "dm",
271 size = "large",
272 srcs = DM_SRCS,
273 args = [
274 "--nogpu",
275 "--verbose",
276 # TODO(mtklein): maybe investigate why these fail?
277 "--match ~FontMgr ~Gif ~Scalar ~Canvas ~Codec_stripes ~Stream ~skps",
278 # TODO(benjaminwagner): dm can't find resources when running on TAP.
279 "--resourcePath %s/resources" % BASE_DIR,
280 "--images %s/resources" % BASE_DIR,
281 ],
282 copts = COPTS,
283 data = glob(["resources/*"]),
284 defines = DEFINES,
285 includes = DM_INCLUDES,
286 deps = DM_EXTERNAL_DEPS + [
287 ":skia",
288 ],
289)