blob: bca4b789a2ebeef64244e5151bf9e3ce9c4656c5 [file] [log] [blame]
benjaminwagner56f6d062016-01-13 10:45:19 -08001################################################################################
2# Skylark macros
3################################################################################
benjaminwagner787ca872015-08-17 12:58:10 -07004
benjaminwagner56f6d062016-01-13 10:45:19 -08005is_bazel = not hasattr(native, "genmpm")
6
7def portable_select(select_dict, bazel_condition, default_condition):
8 """Replaces select() with a Bazel-friendly wrapper.
9
10 Args:
11 select_dict: Dictionary in the same format as select().
12 Returns:
13 If Blaze platform, returns select() using select_dict.
14 If Bazel platform, returns dependencies for condition
15 bazel_condition, or empty list if none specified.
16 """
17 if is_bazel:
18 return select_dict.get(bazel_condition, select_dict[default_condition])
19 else:
20 return select(select_dict)
21
22def skia_select(conditions, results):
23 """Replaces select() for conditions [UNIX, ANDROID, IOS]
24
25 Args:
26 conditions: [CONDITION_UNIX, CONDITION_ANDROID, CONDITION_IOS]
27 results: [RESULT_UNIX, RESULT_ANDROID, RESULT_IOS]
28 Returns:
29 The result matching the platform condition.
30 """
31 if len(conditions) != 3 or len(results) != 3:
32 fail("Must provide exactly 3 conditions and 3 results")
33
34 selector = {}
35 for i in range(3):
36 selector[conditions[i]] = results[i]
37 return portable_select(selector, conditions[2], conditions[0])
38
39def skia_glob(srcs):
40 """Replaces glob() with a version that accepts a struct.
41
42 Args:
43 srcs: struct(include=[], exclude=[])
44 Returns:
45 Equivalent of glob(srcs.include, exclude=srcs.exclude)
46 """
47 if hasattr(srcs, 'include'):
48 if hasattr(srcs, 'exclude'):
49 return native.glob(srcs.include, exclude=srcs.exclude)
50 else:
51 return native.glob(srcs.include)
52 return []
53
54################################################################################
iroth849b1752016-04-11 13:45:51 -070055## PRIVATE_HDRS
56################################################################################
57
58PRIVATE_HDRS_LIST = [
59 "include/private/**/*",
60 "src/utils/SkWhitelistChecksums.cpp",
61]
62
63PRIVATE_HDRS = struct(
64 include = PRIVATE_HDRS_LIST,
65)
66
67################################################################################
benjaminwagner56f6d062016-01-13 10:45:19 -080068## BASE_SRCS
69################################################################################
benjaminwagner787ca872015-08-17 12:58:10 -070070
benjaminwagner39e7aa42015-11-18 13:26:10 -080071# All platform-independent SRCS.
benjaminwagner56f6d062016-01-13 10:45:19 -080072BASE_SRCS_ALL = struct(
73 include = [
benjaminwagner6f6bef82015-10-15 08:09:44 -070074 "src/**/*.h",
75 "src/**/*.cpp",
benjaminwagner787ca872015-08-17 12:58:10 -070076
mtkleind55d13a2015-08-18 08:51:49 -070077 # Third Party
benjaminwagner787ca872015-08-17 12:58:10 -070078 "third_party/etc1/*.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -070079 "third_party/etc1/*.h",
benjaminwagner787ca872015-08-17 12:58:10 -070080 "third_party/ktx/*.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -070081 "third_party/ktx/*.h",
scroggo39658252016-06-02 12:59:59 -070082
83 "third_party/libpng/*.c",
84 "third_party/libpng/*.h",
benjaminwagner787ca872015-08-17 12:58:10 -070085 ],
iroth849b1752016-04-11 13:45:51 -070086 exclude = PRIVATE_HDRS_LIST + [
benjaminwagner6f6bef82015-10-15 08:09:44 -070087 # Exclude platform-dependent files.
irothd2ccc772016-01-25 11:24:57 -080088 "src/android/*",
iroth76a12252016-01-07 07:11:39 -080089 "src/codec/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -070090 "src/device/xps/*", # Windows-only. Move to ports?
91 "src/doc/*_XPS.cpp", # Windows-only. Move to ports?
benjaminwagner2211a7b2015-12-01 11:12:05 -080092 "src/fonts/SkFontMgr_fontconfig.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -070093 "src/gpu/gl/android/*",
benjaminwagner86ea33e2015-10-26 10:46:25 -070094 "src/gpu/gl/egl/*",
benjaminwagneraf3b35e2016-03-28 13:27:28 -070095 "src/gpu/gl/glfw/*",
benjaminwagner86ea33e2015-10-26 10:46:25 -070096 "src/gpu/gl/glx/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -070097 "src/gpu/gl/iOS/*",
98 "src/gpu/gl/mac/*",
99 "src/gpu/gl/win/*",
iroth76a12252016-01-07 07:11:39 -0800100 "src/images/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700101 "src/opts/**/*",
102 "src/ports/**/*",
103 "src/utils/android/**/*",
104 "src/utils/mac/**/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700105 "src/utils/SkThreadUtils_win.cpp", # Windows-only. Move to ports?
106 "src/utils/win/**/*",
107 "src/views/sdl/*",
108 "src/views/win/*",
109 "src/views/unix/*",
110
111 # Exclude multiple definitions.
112 # TODO(mtklein): Move to opts?
benjaminwagnerca26a182016-03-14 15:21:12 -0700113 "src/pdf/SkDocument_PDF_None.cpp", # We use src/pdf/SkPDFDocument.cpp.
benjaminwagner86ea33e2015-10-26 10:46:25 -0700114 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
115 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
iroth5f0de062016-02-17 12:47:27 -0800116 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700117
118 # Exclude files that don't compile with the current DEFINES.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700119 "src/gpu/gl/mesa/*", # Requires SK_MESA define.
120 "src/svg/parser/*", # Missing SkSVG.h.
121
benjaminwagner39e7aa42015-11-18 13:26:10 -0800122 # Conflicting dependencies among Lua versions. See cl/107087297.
123 "src/utils/SkLua*",
124
benjaminwagner6f6bef82015-10-15 08:09:44 -0700125 # Not used.
126 "src/animator/**/*",
127 "src/views/**/*",
128 "src/xml/SkBML_Verbs.h",
129 "src/xml/SkBML_XMLParser.cpp",
130 "src/xml/SkXMLPullParser.cpp",
egdaniel32119f12016-02-22 10:07:54 -0800131
132 # Currently exclude all vulkan specific files
133 "src/gpu/vk/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700134 ],
135)
136
137# Platform-dependent SRCS for google3-default platform.
benjaminwagner56f6d062016-01-13 10:45:19 -0800138BASE_SRCS_UNIX = struct(
139 include = [
irothd2ccc772016-01-25 11:24:57 -0800140 "src/android/*",
iroth76a12252016-01-07 07:11:39 -0800141 "src/codec/*",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800142 "src/fonts/SkFontMgr_fontconfig.cpp",
iroth5f0de062016-02-17 12:47:27 -0800143 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
iroth76a12252016-01-07 07:11:39 -0800144 "src/images/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700145 "src/opts/**/*.cpp",
146 "src/opts/**/*.h",
147 "src/ports/**/*.cpp",
148 "src/ports/**/*.h",
149 ],
150 exclude = [
151 "src/opts/*arm*",
152 "src/opts/*mips*",
153 "src/opts/*NEON*",
154 "src/opts/*neon*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700155 # Included in :opts_ssse3 library.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700156 "src/opts/*SSSE3*",
157 "src/opts/*ssse3*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700158 # Included in :opts_sse4 library.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700159 "src/opts/*SSE4*",
160 "src/opts/*sse4*",
mtkleinf6d8d282015-12-17 10:18:04 -0800161 # Included in :opts_avx or :opts_avx2
162 "src/opts/*avx*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700163 "src/opts/SkBitmapProcState_opts_none.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700164 "src/opts/SkBlitMask_opts_none.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700165 "src/opts/SkBlitRow_opts_none.cpp",
msarett6b4985c2016-03-10 07:15:59 -0800166 "src/ports/*CG*",
msarettfc0b6d12016-03-17 13:50:17 -0700167 "src/ports/*WIC*",
mtklein3f193a92016-03-10 08:52:05 -0800168 "src/ports/*android*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700169 "src/ports/*chromium*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700170 "src/ports/*mac*",
171 "src/ports/*mozalloc*",
172 "src/ports/*nacl*",
173 "src/ports/*win*",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800174 "src/ports/SkFontConfigInterface_direct_factory.cpp",
175 "src/ports/SkFontMgr_custom_directory_factory.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700176 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700177 "src/ports/SkFontMgr_custom_empty_factory.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700178 "src/ports/SkFontMgr_empty_factory.cpp",
benjaminwagner404816e2015-12-03 05:04:03 -0800179 "src/ports/SkFontMgr_fontconfig.cpp",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800180 "src/ports/SkFontMgr_fontconfig_factory.cpp",
msarettc1d03122016-03-25 08:58:55 -0700181 "src/ports/SkImageEncoder_none.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700182 "src/ports/SkImageGenerator_none.cpp",
183 "src/ports/SkTLS_none.cpp",
mtkleind55d13a2015-08-18 08:51:49 -0700184 ],
185)
186
benjaminwagner86ea33e2015-10-26 10:46:25 -0700187# Platform-dependent SRCS for google3-default Android.
benjaminwagner56f6d062016-01-13 10:45:19 -0800188BASE_SRCS_ANDROID = struct(
189 include = [
irothd2ccc772016-01-25 11:24:57 -0800190 "src/android/*",
iroth76a12252016-01-07 07:11:39 -0800191 "src/codec/*",
iroth5f0de062016-02-17 12:47:27 -0800192 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
iroth76a12252016-01-07 07:11:39 -0800193 "src/images/*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700194 # TODO(benjaminwagner): Figure out how to compile with EGL.
benjaminwagner86ea33e2015-10-26 10:46:25 -0700195 "src/opts/**/*.cpp",
196 "src/opts/**/*.h",
197 "src/ports/**/*.cpp",
198 "src/ports/**/*.h",
199 ],
200 exclude = [
201 "src/opts/*mips*",
202 "src/opts/*SSE2*",
203 "src/opts/*SSSE3*",
204 "src/opts/*ssse3*",
205 "src/opts/*SSE4*",
206 "src/opts/*sse4*",
mtkleinf6d8d282015-12-17 10:18:04 -0800207 "src/opts/*avx*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700208 "src/opts/*x86*",
209 "src/opts/SkBitmapProcState_opts_none.cpp",
210 "src/opts/SkBlitMask_opts_none.cpp",
211 "src/opts/SkBlitRow_opts_none.cpp",
msarett6b4985c2016-03-10 07:15:59 -0800212 "src/ports/*CG*",
mtklein3f193a92016-03-10 08:52:05 -0800213 "src/ports/*FontConfig*",
msarettfc0b6d12016-03-17 13:50:17 -0700214 "src/ports/*WIC*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700215 "src/ports/*chromium*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700216 "src/ports/*fontconfig*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700217 "src/ports/*mac*",
218 "src/ports/*mozalloc*",
219 "src/ports/*nacl*",
220 "src/ports/*win*",
221 "src/ports/SkDebug_stdio.cpp",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800222 "src/ports/SkFontConfigInterface_direct_factory.cpp",
223 "src/ports/SkFontConfigInterface_direct_google3_factory.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700224 "src/ports/SkFontMgr_custom_directory_factory.cpp",
225 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700226 "src/ports/SkFontMgr_custom_empty_factory.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700227 "src/ports/SkFontMgr_empty_factory.cpp",
msarettc1d03122016-03-25 08:58:55 -0700228 "src/ports/SkImageEncoder_none.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700229 "src/ports/SkImageGenerator_none.cpp",
230 "src/ports/SkTLS_none.cpp",
231 ],
232)
233
iroth8b99ef42015-11-02 11:11:21 -0800234# Platform-dependent SRCS for google3-default iOS.
benjaminwagner56f6d062016-01-13 10:45:19 -0800235BASE_SRCS_IOS = struct(
236 include = [
msarett2775cf52016-02-17 14:14:25 -0800237 "src/android/*",
238 "src/codec/*",
iroth5f0de062016-02-17 12:47:27 -0800239 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
240 "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800241 "src/opts/**/*.cpp",
242 "src/opts/**/*.h",
243 "src/ports/**/*.cpp",
244 "src/ports/**/*.h",
irothab669de2016-02-16 19:17:01 -0800245 "src/utils/mac/*.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800246 ],
247 exclude = [
msarett2775cf52016-02-17 14:14:25 -0800248 "src/codec/*Gif*.cpp",
249 "src/codec/*Ico*.cpp",
250 "src/codec/*Jpeg*.cpp",
251 "src/codec/*Webp*.cpp",
252 "src/codec/*Png*",
253 "src/codec/*Raw*.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800254 "src/opts/*mips*",
255 "src/opts/*NEON*",
256 "src/opts/*neon*",
257 "src/opts/*SSE2*",
258 "src/opts/*SSSE3*",
259 "src/opts/*ssse3*",
260 "src/opts/*SSE4*",
261 "src/opts/*sse4*",
mtkleinf6d8d282015-12-17 10:18:04 -0800262 "src/opts/*avx*",
iroth8b99ef42015-11-02 11:11:21 -0800263 "src/opts/*x86*",
264 "src/opts/SkBitmapProcState_opts_none.cpp",
irothd2ccc772016-01-25 11:24:57 -0800265 "src/opts/SkBlitMask_opts_arm*.cpp",
266 "src/opts/SkBlitRow_opts_arm*.cpp",
mtklein3f193a92016-03-10 08:52:05 -0800267 "src/ports/*CG*",
268 "src/ports/*FontConfig*",
269 "src/ports/*FreeType*",
msarettfc0b6d12016-03-17 13:50:17 -0700270 "src/ports/*WIC*",
iroth8b99ef42015-11-02 11:11:21 -0800271 "src/ports/*android*",
272 "src/ports/*chromium*",
273 "src/ports/*fontconfig*",
iroth8b99ef42015-11-02 11:11:21 -0800274 "src/ports/*mozalloc*",
275 "src/ports/*nacl*",
276 "src/ports/*win*",
iroth8b99ef42015-11-02 11:11:21 -0800277 "src/ports/SkFontMgr_custom.cpp",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800278 "src/ports/SkFontConfigInterface_direct_factory.cpp",
279 "src/ports/SkFontConfigInterface_direct_google3_factory.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800280 "src/ports/SkFontMgr_custom_directory_factory.cpp",
281 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700282 "src/ports/SkFontMgr_custom_empty_factory.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800283 "src/ports/SkFontMgr_empty_factory.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800284 "src/ports/SkImageGenerator_none.cpp",
285 "src/ports/SkTLS_none.cpp",
286 ],
287)
288
benjaminwagner56f6d062016-01-13 10:45:19 -0800289################################################################################
290## SSSE3/SSE4/AVX/AVX2 SRCS
291################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700292
benjaminwagner56f6d062016-01-13 10:45:19 -0800293SSSE3_SRCS = struct(
294 include = [
mtkleind55d13a2015-08-18 08:51:49 -0700295 "src/opts/*SSSE3*.cpp",
296 "src/opts/*ssse3*.cpp",
benjaminwagner89061ed2016-01-25 09:29:08 -0800297 ],
298)
mtkleind55d13a2015-08-18 08:51:49 -0700299
benjaminwagner56f6d062016-01-13 10:45:19 -0800300SSE4_SRCS = struct(
301 include = [
mtkleind55d13a2015-08-18 08:51:49 -0700302 "src/opts/*SSE4*.cpp",
303 "src/opts/*sse4*.cpp",
benjaminwagner89061ed2016-01-25 09:29:08 -0800304 ],
305)
benjaminwagner787ca872015-08-17 12:58:10 -0700306
benjaminwagner56f6d062016-01-13 10:45:19 -0800307AVX_SRCS = struct(
308 include = [
mtkleinf6d8d282015-12-17 10:18:04 -0800309 "src/opts/*_avx.cpp",
benjaminwagner89061ed2016-01-25 09:29:08 -0800310 ],
311)
mtkleinf6d8d282015-12-17 10:18:04 -0800312
benjaminwagner56f6d062016-01-13 10:45:19 -0800313AVX2_SRCS = struct(
314 include = [
mtkleinf6d8d282015-12-17 10:18:04 -0800315 "src/opts/*_avx2.cpp",
benjaminwagner89061ed2016-01-25 09:29:08 -0800316 ],
317)
mtkleinf6d8d282015-12-17 10:18:04 -0800318
benjaminwagner56f6d062016-01-13 10:45:19 -0800319################################################################################
320## BASE_HDRS
321################################################################################
322
323BASE_HDRS = struct(
324 include = [
benjaminwagner787ca872015-08-17 12:58:10 -0700325 "include/**/*.h",
326 ],
iroth849b1752016-04-11 13:45:51 -0700327 exclude = PRIVATE_HDRS_LIST + [
benjaminwagner6f6bef82015-10-15 08:09:44 -0700328 # Not used.
329 "include/animator/**/*",
330 "include/views/**/*",
331 "include/xml/SkBML_WXMLParser.h",
332 "include/xml/SkBML_XMLParser.h",
benjaminwagner89061ed2016-01-25 09:29:08 -0800333 ],
334)
benjaminwagner787ca872015-08-17 12:58:10 -0700335
benjaminwagner56f6d062016-01-13 10:45:19 -0800336################################################################################
337## BASE_DEPS
338################################################################################
339
340BASE_DEPS_ALL = []
341
benjaminwagner39e7aa42015-11-18 13:26:10 -0800342BASE_DEPS_UNIX = [
iroth330043c2016-01-12 14:22:24 -0800343 ":opts_ssse3",
benjaminwagner56f6d062016-01-13 10:45:19 -0800344 ":opts_sse4",
345 ":opts_avx",
346 ":opts_avx2",
benjaminwagner39e7aa42015-11-18 13:26:10 -0800347]
348
349BASE_DEPS_ANDROID = []
350
351BASE_DEPS_IOS = []
352
benjaminwagner56f6d062016-01-13 10:45:19 -0800353################################################################################
354## INCLUDES
355################################################################################
benjaminwagner39e7aa42015-11-18 13:26:10 -0800356
benjaminwagner787ca872015-08-17 12:58:10 -0700357# Includes needed by Skia implementation. Not public includes.
358INCLUDES = [
benjaminwagnerfa7e1a02015-11-13 12:27:08 -0800359 "include/android",
benjaminwagner787ca872015-08-17 12:58:10 -0700360 "include/c",
robertphillips188d44c2016-02-01 04:54:14 -0800361 "include/client/android",
benjaminwagner787ca872015-08-17 12:58:10 -0700362 "include/codec",
363 "include/config",
364 "include/core",
benjaminwagner787ca872015-08-17 12:58:10 -0700365 "include/effects",
366 "include/gpu",
367 "include/images",
368 "include/pathops",
benjaminwagner787ca872015-08-17 12:58:10 -0700369 "include/pipe",
370 "include/ports",
371 "include/private",
372 "include/utils",
iroth8b99ef42015-11-02 11:11:21 -0800373 "include/utils/mac",
374 "include/utils/win",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700375 "include/svg",
benjaminwagner787ca872015-08-17 12:58:10 -0700376 "include/xml",
benjaminwagnerfa7e1a02015-11-13 12:27:08 -0800377 "src/codec",
benjaminwagner787ca872015-08-17 12:58:10 -0700378 "src/core",
benjaminwagner787ca872015-08-17 12:58:10 -0700379 "src/gpu",
380 "src/image",
381 "src/lazy",
382 "src/opts",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800383 "src/ports",
benjaminwagner787ca872015-08-17 12:58:10 -0700384 "src/pdf",
benjaminwagner787ca872015-08-17 12:58:10 -0700385 "src/sfnt",
386 "src/utils",
387 "third_party/etc1",
388 "third_party/ktx",
scroggo39658252016-06-02 12:59:59 -0700389 "third_party/libpng",
benjaminwagner56f6d062016-01-13 10:45:19 -0800390]
benjaminwagner787ca872015-08-17 12:58:10 -0700391
benjaminwagner56f6d062016-01-13 10:45:19 -0800392################################################################################
393## DM_SRCS
394################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700395
benjaminwagner56f6d062016-01-13 10:45:19 -0800396DM_SRCS_ALL = struct(
397 include = [
benjaminwagner6f6bef82015-10-15 08:09:44 -0700398 "dm/*.cpp",
399 "dm/*.h",
400 "gm/*.c",
401 "gm/*.cpp",
402 "gm/*.h",
403 "tests/*.cpp",
404 "tests/*.h",
405 "tools/CrashHandler.cpp",
406 "tools/CrashHandler.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700407 "tools/ProcStats.cpp",
408 "tools/ProcStats.h",
409 "tools/Resources.cpp",
410 "tools/Resources.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700411 "tools/flags/*.cpp",
412 "tools/flags/*.h",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700413 "tools/gpu/**/*.cpp",
414 "tools/gpu/**/*.h",
brianosman6d3119c2016-04-19 19:41:54 -0700415 "tools/picture_utils.cpp",
mtkleine1fc4522016-02-09 12:32:52 -0800416 "tools/random_parse_path.cpp",
417 "tools/random_parse_path.h",
benjaminwagner32885142015-10-24 07:55:31 -0700418 "tools/sk_tool_utils.cpp",
419 "tools/sk_tool_utils.h",
420 "tools/sk_tool_utils_font.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700421 "tools/timer/*.cpp",
422 "tools/timer/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700423 ],
424 exclude = [
benjaminwagner86ea33e2015-10-26 10:46:25 -0700425 "dm/DMSrcSinkAndroid.cpp", # Android-only.
426 "tests/FontMgrAndroidParserTest.cpp", # Android-only.
427 "tests/PathOpsSkpClipTest.cpp", # Alternate main.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700428 "tests/skia_test.cpp", # Old main.
429 "tests/SkpSkGrTest.cpp", # Alternate main.
benjaminwagner38d68bc2016-04-01 05:00:51 -0700430 "tools/gpu/gl/angle/*",
431 "tools/gpu/gl/command_buffer/*",
432 "tools/gpu/gl/egl/*",
433 "tools/gpu/gl/glx/*",
434 "tools/gpu/gl/iOS/*",
435 "tools/gpu/gl/mac/*",
436 "tools/gpu/gl/mesa/*",
437 "tools/gpu/gl/win/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700438 "tools/timer/SysTimer_mach.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700439 "tools/timer/SysTimer_windows.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700440 ],
441)
442
benjaminwagner38d68bc2016-04-01 05:00:51 -0700443DM_SRCS_UNIX = struct(
444 include = [
445 "tools/gpu/gl/CreatePlatformGLContext_none.cpp",
446 ],
447)
benjaminwagner86ea33e2015-10-26 10:46:25 -0700448
benjaminwagner56f6d062016-01-13 10:45:19 -0800449DM_SRCS_ANDROID = struct(
450 include = [
benjaminwagner86ea33e2015-10-26 10:46:25 -0700451 # Depends on Android HWUI library that is not available in google3.
452 #"dm/DMSrcSinkAndroid.cpp",
453 "tests/FontMgrAndroidParserTest.cpp",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700454 # TODO(benjaminwagner): Figure out how to compile with EGL.
455 "tools/gpu/gl/CreatePlatformGLContext_none.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700456 ],
457)
458
benjaminwagner38d68bc2016-04-01 05:00:51 -0700459DM_SRCS_IOS = struct(
460 include = [
461 "tools/gpu/iOS/CreatePlatformGLContext_iOS.cpp",
462 ],
463)
benjaminwagner56f6d062016-01-13 10:45:19 -0800464
465################################################################################
466## DM_INCLUDES
467################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700468
benjaminwagner6f6bef82015-10-15 08:09:44 -0700469DM_INCLUDES = [
benjaminwagnerb1fe8f62016-02-01 09:05:08 -0800470 "dm",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700471 "gm",
472 "src/codec",
473 "src/effects",
benjaminwagnerbc9a9b42016-02-22 13:30:39 -0800474 "src/effects/gradients",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700475 "src/fonts",
476 "src/pathops",
477 "src/pipe/utils",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700478 "src/ports",
ethannicholas3cb95422016-02-09 12:44:06 -0800479 "tools/debugger",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700480 "tests",
481 "tools",
482 "tools/flags",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700483 "tools/gpu",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700484 "tools/timer",
485]
486
benjaminwagner56f6d062016-01-13 10:45:19 -0800487################################################################################
488## DM_ARGS
489################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700490
benjaminwagner83906ae2016-05-01 15:02:25 -0700491def DM_ARGS(base_dir, asan):
492 source = ["tests", "gm", "image"]
493 # TODO(benjaminwagner): f16 and serialize-8888 fail.
494 config = ["565", "8888", "pdf", "srgb", "tiles_rt", "pic"]
495 # TODO(mtklein): maybe investigate why these fail?
496 match = [
497 "~Canvas",
498 "~Codec",
499 "~Codec_Dimensions",
500 "~Codec_stripes",
501 "~FontMgr",
502 "~PaintBreakText",
503 "~RecordDraw_TextBounds",
504 "~Scalar",
505 "~skps",
506 "~Stream",
507 ]
508 if asan:
509 # Running all sources and configs under ASAN causes the test to exceed
510 # "large" size and time out.
511 source = ["tests", "gm"]
512 config = ["8888"]
513 match += [
514 "~clippedcubic2",
515 "~conicpaths",
516 "~gradients_2pt_conical",
517 "~Math",
518 "~Matrix",
519 "~PathOpsCubic",
520 "~PathOpsOpLoopsThreaded",
521 "~PathOpsSimplify",
522 "~PathOpsTightBoundsQuads",
523 "~Point",
benjaminwagner56f6d062016-01-13 10:45:19 -0800524 ]
benjaminwagner83906ae2016-05-01 15:02:25 -0700525 return [
526 "--src %s" % " ".join(source),
527 "--config %s" % " ".join(config),
528 "--verbose",
529 "--match %s" % " ".join(match),
530 "--resourcePath %s/resources" % base_dir,
531 "--images %s/resources" % base_dir,
532 ]
benjaminwagner56f6d062016-01-13 10:45:19 -0800533
534################################################################################
535## COPTS
536################################################################################
iroth8b99ef42015-11-02 11:11:21 -0800537
benjaminwagner86ea33e2015-10-26 10:46:25 -0700538COPTS_UNIX = [
benjaminwagner787ca872015-08-17 12:58:10 -0700539 "-Wno-implicit-fallthrough", # Some intentional fallthrough.
benjaminwagner7d974f52015-10-19 13:55:55 -0700540 "-Wno-deprecated-declarations", # Internal use of deprecated methods. :(
benjaminwagner787ca872015-08-17 12:58:10 -0700541]
542
benjaminwagner56f6d062016-01-13 10:45:19 -0800543COPTS_ANDROID = ["-mfpu=neon"]
544
545COPTS_IOS = []
546
547COPTS_ALL = []
548
549################################################################################
550## DEFINES
551################################################################################
552
553DEFINES_UNIX = [
msarett70e418b2016-02-12 12:35:48 -0800554 "PNG_SKIP_SETJMP_CHECK",
benjaminwagner56f6d062016-01-13 10:45:19 -0800555 "SK_BUILD_FOR_UNIX",
556 "SK_SAMPLES_FOR_X",
557 "SK_SFNTLY_SUBSETTER",
benjaminwagner186e0b92016-02-11 16:00:24 -0800558 "SK_CODEC_DECODES_RAW",
msarettad3a5c62016-05-06 07:21:26 -0700559 "SK_HAS_GIF_LIBRARY",
560 "SK_HAS_JPEG_LIBRARY",
561 "SK_HAS_PNG_LIBRARY",
562 "SK_HAS_WEBP_LIBRARY",
benjaminwagner56f6d062016-01-13 10:45:19 -0800563]
benjaminwagner86ea33e2015-10-26 10:46:25 -0700564
565DEFINES_ANDROID = [
566 "SK_BUILD_FOR_ANDROID",
benjaminwagner186e0b92016-02-11 16:00:24 -0800567 "SK_CODEC_DECODES_RAW",
msarettad3a5c62016-05-06 07:21:26 -0700568 "SK_HAS_GIF_LIBRARY",
569 "SK_HAS_JPEG_LIBRARY",
570 "SK_HAS_PNG_LIBRARY",
571 "SK_HAS_WEBP_LIBRARY",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700572]
573
iroth8b99ef42015-11-02 11:11:21 -0800574DEFINES_IOS = [
575 "SK_BUILD_FOR_IOS",
sdefresnee3fa8112016-06-01 07:08:56 -0700576 "SK_BUILD_NO_OPTS",
iroth8b99ef42015-11-02 11:11:21 -0800577 "SK_IGNORE_ETC1_SUPPORT",
irothd2ccc772016-01-25 11:24:57 -0800578 "SKNX_NO_SIMD",
iroth8b99ef42015-11-02 11:11:21 -0800579]
580
benjaminwagner86ea33e2015-10-26 10:46:25 -0700581DEFINES_ALL = [
benjaminwagner787ca872015-08-17 12:58:10 -0700582 # Chrome DEFINES.
583 "SK_USE_FLOATBITS",
584 "SK_USE_FREETYPE_EMBOLDEN",
585 # Turn on a few Google3-specific build fixes.
586 "GOOGLE3",
reedd053ce92016-03-22 10:17:23 -0700587 # Staging flags for API changes
588 "SK_SUPPORT_LEGACY_COLORFILTER_PTR",
589 "SK_SUPPORT_LEGACY_CREATESHADER_PTR",
benjaminwagner31dcc2a2016-04-01 06:54:34 -0700590 "SK_SUPPORT_LEGACY_IMAGEFILTER_PTR",
591 "SK_SUPPORT_LEGACY_MINOR_EFFECT_PTR",
592 "SK_SUPPORT_LEGACY_NEW_SURFACE_API",
593 "SK_SUPPORT_LEGACY_PATHEFFECT_PTR",
fmalita41c40962016-03-24 11:05:28 -0700594 "SK_SUPPORT_LEGACY_PICTURE_PTR",
reedefdfd512016-04-04 10:02:58 -0700595 "SK_SUPPORT_LEGACY_MASKFILTER_PTR",
reed2a041042016-04-15 10:56:51 -0700596 "SK_SUPPORT_LEGACY_IMAGEFACTORY",
reedcfb6bdf2016-03-29 11:32:50 -0700597 "SK_SUPPORT_LEGACY_XFERMODE_PTR",
bungeman13b9c952016-05-12 10:09:30 -0700598 "SK_SUPPORT_LEGACY_TYPEFACE_PTR",
benjaminwagner787ca872015-08-17 12:58:10 -0700599]
600
benjaminwagner56f6d062016-01-13 10:45:19 -0800601################################################################################
602## LINKOPTS
603################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700604
benjaminwagner56f6d062016-01-13 10:45:19 -0800605LINKOPTS_UNIX = []
benjaminwagner6f6bef82015-10-15 08:09:44 -0700606
benjaminwagner56f6d062016-01-13 10:45:19 -0800607LINKOPTS_ANDROID = [
608 "-lEGL",
609]
benjaminwagner6f6bef82015-10-15 08:09:44 -0700610
benjaminwagner56f6d062016-01-13 10:45:19 -0800611LINKOPTS_IOS = []
benjaminwagner6f6bef82015-10-15 08:09:44 -0700612
benjaminwagner56f6d062016-01-13 10:45:19 -0800613LINKOPTS_ALL = [
614 "-ldl",
615]