blob: dc3edba1cc3a9a8cb4dca604ee9ffd9b08b25df5 [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/**/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -070034 "src/utils/SkThreadUtils_win.cpp", # Windows-only. Move to ports?
35 "src/utils/win/**/*",
36 "src/views/sdl/*",
37 "src/views/win/*",
38 "src/views/unix/*",
39
40 # Exclude multiple definitions.
41 # TODO(mtklein): Move to opts?
mtkleind55d13a2015-08-18 08:51:49 -070042 "src/doc/SkDocument_PDF_None.cpp", # We use SkDocument_PDF.cpp.
benjaminwagner6f6bef82015-10-15 08:09:44 -070043 "src/fonts/*fontconfig*",
44 "src/gpu/gl/egl/*", # Conflicts with gpu/gl/glx.
45 "src/gpu/gl/nacl/*", # Conflicts with gpu/gl/glx.
46 "src/gpu/gl/GrGLDefaultInterface_none.cpp", # Conflicts with src/gpu/gl/GrGLDefaultInterface_native.cpp
47 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp", # Conflicts with src/gpu/gl/glx/GrGLCreateNativeInterface_glx.cpp
48
49 # Exclude files that don't compile with the current DEFINES.
50 "src/gpu/gl/angle/*", # Requires SK_ANGLE define.
51 "src/gpu/gl/command_buffer/*", # unknown type name 'HMODULE'
52 "src/gpu/gl/mesa/*", # Requires SK_MESA define.
53 "src/svg/parser/*", # Missing SkSVG.h.
54
benjaminwagner6f6bef82015-10-15 08:09:44 -070055 # Not used.
56 "src/animator/**/*",
57 "src/views/**/*",
58 "src/xml/SkBML_Verbs.h",
59 "src/xml/SkBML_XMLParser.cpp",
60 "src/xml/SkXMLPullParser.cpp",
61 ],
62)
63
64# Platform-dependent SRCS for google3-default platform.
65PLATFORM_SRCS = glob(
66 [
67 "src/opts/**/*.cpp",
68 "src/opts/**/*.h",
69 "src/ports/**/*.cpp",
70 "src/ports/**/*.h",
71 ],
72 exclude = [
73 "src/opts/*arm*",
74 "src/opts/*mips*",
75 "src/opts/*NEON*",
76 "src/opts/*neon*",
77 "src/opts/*SSSE3*",
78 "src/opts/*ssse3*",
79 "src/opts/*SSE4*",
80 "src/opts/*sse4*",
81 "src/opts/SkBlitMask_opts_none.cpp",
82 "src/opts/SkBitmapProcState_opts_none.cpp",
83 "src/opts/SkBlitRow_opts_none.cpp",
84 "src/ports/*android*",
85 "src/ports/*chromium*",
86 "src/ports/*CG*",
87 "src/ports/*fontconfig*",
88 "src/ports/*FontConfig*",
89 "src/ports/*mac*",
90 "src/ports/*mozalloc*",
91 "src/ports/*nacl*",
92 "src/ports/*win*",
93 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
94 "src/ports/SkFontMgr_empty_factory.cpp",
95 "src/ports/SkImageDecoder_WIC.cpp",
96 "src/ports/SkImageDecoder_empty.cpp",
97 "src/ports/SkImageGenerator_none.cpp",
98 "src/ports/SkTLS_none.cpp",
mtkleind55d13a2015-08-18 08:51:49 -070099 ],
100)
101
102SRCS_SSSE3 = glob(
103 [
104 "src/opts/*SSSE3*.cpp",
105 "src/opts/*ssse3*.cpp",
106 ],
107)
108
109SRCS_SSE4 = glob(
110 [
111 "src/opts/*SSE4*.cpp",
112 "src/opts/*sse4*.cpp",
benjaminwagner787ca872015-08-17 12:58:10 -0700113 ],
114)
115
116HDRS = glob(
117 [
118 "include/**/*.h",
119 ],
mtkleind55d13a2015-08-18 08:51:49 -0700120 exclude = [
benjaminwagner6f6bef82015-10-15 08:09:44 -0700121 "include/private/**/*",
122
123 # Not used.
124 "include/animator/**/*",
125 "include/views/**/*",
126 "include/xml/SkBML_WXMLParser.h",
127 "include/xml/SkBML_XMLParser.h",
mtkleind55d13a2015-08-18 08:51:49 -0700128 ],
benjaminwagner787ca872015-08-17 12:58:10 -0700129)
130
131# Includes needed by Skia implementation. Not public includes.
132INCLUDES = [
benjaminwagner787ca872015-08-17 12:58:10 -0700133 "include/c",
134 "include/codec",
135 "include/config",
136 "include/core",
benjaminwagner787ca872015-08-17 12:58:10 -0700137 "include/effects",
138 "include/gpu",
139 "include/images",
140 "include/pathops",
benjaminwagner787ca872015-08-17 12:58:10 -0700141 "include/pipe",
142 "include/ports",
143 "include/private",
144 "include/utils",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700145 "include/svg",
benjaminwagner787ca872015-08-17 12:58:10 -0700146 "include/xml",
147 "src/core",
benjaminwagner787ca872015-08-17 12:58:10 -0700148 "src/gpu",
149 "src/image",
150 "src/lazy",
151 "src/opts",
152 "src/pdf",
benjaminwagner787ca872015-08-17 12:58:10 -0700153 "src/sfnt",
154 "src/utils",
155 "third_party/etc1",
156 "third_party/ktx",
157]
158
benjaminwagner6f6bef82015-10-15 08:09:44 -0700159DM_SRCS = glob(
160 [
161 "dm/*.cpp",
162 "dm/*.h",
163 "gm/*.c",
164 "gm/*.cpp",
165 "gm/*.h",
166 "tests/*.cpp",
167 "tests/*.h",
168 "tools/CrashHandler.cpp",
169 "tools/CrashHandler.h",
170 "tools/LazyDecodeBitmap.cpp",
171 "tools/LazyDecodeBitmap.h",
172 "tools/ProcStats.cpp",
173 "tools/ProcStats.h",
174 "tools/Resources.cpp",
175 "tools/Resources.h",
176 "tools/SkBitmapRegionDecoderInterface.cpp",
177 "tools/SkBitmapRegionDecoderInterface.h",
178 "tools/SkBitmapRegionSampler.cpp",
179 "tools/SkBitmapRegionSampler.h",
180 "tools/SkBitmapRegionCanvas.cpp",
181 "tools/SkBitmapRegionCanvas.h",
182 "tools/flags/*.cpp",
183 "tools/flags/*.h",
184 "tools/timer/*.cpp",
185 "tools/timer/*.h",
186 "tools/sk_tool_utils.cpp",
187 "tools/sk_tool_utils_font.cpp",
188 "tools/sk_tool_utils.h",
189 ],
190 exclude = [
191 "tests/skia_test.cpp", # Old main.
192 "tests/SkpSkGrTest.cpp", # Alternate main.
193 "tests/PathOpsSkpClipTest.cpp", # Alternate main.
194 "tests/FontMgrAndroidParserTest.cpp", # Android-only.
195 "dm/DMSrcSinkAndroid.cpp", # Android-only.
196 "tools/timer/SysTimer_windows.cpp",
197 "tools/timer/SysTimer_mach.cpp",
198 ],
199)
200
201DM_INCLUDES = [
202 "gm",
203 "src/codec",
204 "src/effects",
205 "src/fonts",
206 "src/pathops",
207 "src/pipe/utils",
208 "src/utils/debugger",
209 "tests",
210 "tools",
211 "tools/flags",
212 "tools/timer",
213]
214
benjaminwagner787ca872015-08-17 12:58:10 -0700215COPTS = [
benjaminwagner787ca872015-08-17 12:58:10 -0700216 "-Wno-implicit-fallthrough", # Some intentional fallthrough.
benjaminwagner7d974f52015-10-19 13:55:55 -0700217 "-Wno-deprecated-declarations", # Internal use of deprecated methods. :(
benjaminwagner787ca872015-08-17 12:58:10 -0700218]
219
220DEFINES = [
221 # It'd be nice for fastbuild, dbg -> SK_DEBUG, opt -> SK_RELEASE.
222 "SK_RELEASE",
223 # Chrome DEFINES.
224 "SK_USE_FLOATBITS",
225 "SK_USE_FREETYPE_EMBOLDEN",
226 # Turn on a few Google3-specific build fixes.
227 "GOOGLE3",
228 "SK_BUILD_FOR_UNIX",
229 "SK_SAMPLES_FOR_X",
230]
231
232LINKOPTS = ["-ldl"]
benjaminwagner6f6bef82015-10-15 08:09:44 -0700233
234cc_library(
235 name = "opts_ssse3",
236 srcs = SRCS_SSSE3,
237 copts = COPTS + ["-mssse3"],
238 defines = DEFINES,
239 includes = INCLUDES,
240)
241
242cc_library(
243 name = "opts_sse4",
244 srcs = SRCS_SSE4,
245 copts = COPTS + ["-msse4"],
246 defines = DEFINES,
247 includes = INCLUDES,
248)
249
250cc_library(
251 name = "skia",
252 srcs = SRCS + PLATFORM_SRCS,
253 hdrs = HDRS,
254 copts = COPTS,
255 defines = DEFINES,
256 includes = INCLUDES,
257 linkopts = LINKOPTS,
258 visibility = [":skia_clients"],
259 deps = EXTERNAL_DEPS + [
260 ":opts_sse4",
261 ":opts_ssse3",
262 ],
263)
264
265cc_test(
266 name = "dm",
267 size = "large",
268 srcs = DM_SRCS,
269 args = [
270 "--nogpu",
271 "--verbose",
272 # TODO(mtklein): maybe investigate why these fail?
benjaminwagner4d5de042015-10-21 13:07:07 -0700273 "--match ~FontMgr ~Scalar ~Canvas ~Codec_stripes ~Codec_Dimensions ~Codec ~Stream ~skps ~Math",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700274 "--resourcePath %s/resources" % BASE_DIR,
275 "--images %s/resources" % BASE_DIR,
276 ],
277 copts = COPTS,
benjaminwagner964eeba2015-10-20 13:00:48 -0700278 data = glob(["resources/**/*"]),
benjaminwagner6f6bef82015-10-15 08:09:44 -0700279 defines = DEFINES,
280 includes = DM_INCLUDES,
281 deps = DM_EXTERNAL_DEPS + [
282 ":skia",
283 ],
284)