blob: e3dcadee7d7c8f9123ef87cad9e86feada13e0b3 [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
benjaminwagner99fb6702016-07-28 15:12:21 -070058PRIVATE_HDRS_INCLUDE_LIST = [
59 "include/private/**/*.h",
60 "src/**/*.inc",
iroth849b1752016-04-11 13:45:51 -070061]
62
63PRIVATE_HDRS = struct(
benjaminwagner99fb6702016-07-28 15:12:21 -070064 include = PRIVATE_HDRS_INCLUDE_LIST,
65)
66
67ALL_HDRS = struct(
68 include = [
69 "src/**/*.h",
70 "include/**/*.h",
71 ],
iroth849b1752016-04-11 13:45:51 -070072)
73
74################################################################################
benjaminwagner56f6d062016-01-13 10:45:19 -080075## BASE_SRCS
76################################################################################
benjaminwagner787ca872015-08-17 12:58:10 -070077
benjaminwagner39e7aa42015-11-18 13:26:10 -080078# All platform-independent SRCS.
benjaminwagner56f6d062016-01-13 10:45:19 -080079BASE_SRCS_ALL = struct(
80 include = [
benjaminwagner6f6bef82015-10-15 08:09:44 -070081 "src/**/*.h",
82 "src/**/*.cpp",
benjaminwagner787ca872015-08-17 12:58:10 -070083
mtkleind55d13a2015-08-18 08:51:49 -070084 # Third Party
benjaminwagner787ca872015-08-17 12:58:10 -070085 "third_party/etc1/*.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -070086 "third_party/etc1/*.h",
benjaminwagner787ca872015-08-17 12:58:10 -070087 "third_party/ktx/*.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -070088 "third_party/ktx/*.h",
benjaminwagner787ca872015-08-17 12:58:10 -070089 ],
benjaminwagner99fb6702016-07-28 15:12:21 -070090 # Note: PRIVATE_HDRS_INCLUDE_LIST is excluded from BASE_SRCS_ALL here
91 # because they are required to appear in srcs for some rules but hdrs for
92 # other rules. See internal cl/119566959.
93 exclude = PRIVATE_HDRS_INCLUDE_LIST + [
benjaminwagner6f6bef82015-10-15 08:09:44 -070094 # Exclude platform-dependent files.
irothd2ccc772016-01-25 11:24:57 -080095 "src/android/*",
iroth76a12252016-01-07 07:11:39 -080096 "src/codec/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -070097 "src/device/xps/*", # Windows-only. Move to ports?
98 "src/doc/*_XPS.cpp", # Windows-only. Move to ports?
99 "src/gpu/gl/android/*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700100 "src/gpu/gl/egl/*",
benjaminwagneraf3b35e2016-03-28 13:27:28 -0700101 "src/gpu/gl/glfw/*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700102 "src/gpu/gl/glx/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700103 "src/gpu/gl/iOS/*",
104 "src/gpu/gl/mac/*",
105 "src/gpu/gl/win/*",
iroth76a12252016-01-07 07:11:39 -0800106 "src/images/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700107 "src/opts/**/*",
108 "src/ports/**/*",
109 "src/utils/android/**/*",
110 "src/utils/mac/**/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700111 "src/utils/SkThreadUtils_win.cpp", # Windows-only. Move to ports?
112 "src/utils/win/**/*",
113 "src/views/sdl/*",
114 "src/views/win/*",
115 "src/views/unix/*",
116
117 # Exclude multiple definitions.
118 # TODO(mtklein): Move to opts?
benjaminwagnerca26a182016-03-14 15:21:12 -0700119 "src/pdf/SkDocument_PDF_None.cpp", # We use src/pdf/SkPDFDocument.cpp.
benjaminwagner86ea33e2015-10-26 10:46:25 -0700120 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
121 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
iroth5f0de062016-02-17 12:47:27 -0800122 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700123
124 # Exclude files that don't compile with the current DEFINES.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700125 "src/gpu/gl/mesa/*", # Requires SK_MESA define.
benjaminwagner921e48b2016-07-15 11:27:27 -0700126 "src/svg/**/*", # Depends on XML.
127 "src/xml/**/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700128
benjaminwagner39e7aa42015-11-18 13:26:10 -0800129 # Conflicting dependencies among Lua versions. See cl/107087297.
130 "src/utils/SkLua*",
131
benjaminwagner6f6bef82015-10-15 08:09:44 -0700132 # Not used.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700133 "src/views/**/*",
egdaniel32119f12016-02-22 10:07:54 -0800134
135 # Currently exclude all vulkan specific files
136 "src/gpu/vk/*",
benjaminwagner2214de42016-07-02 05:12:46 -0700137 "src/sksl/**/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700138 ],
139)
140
141# Platform-dependent SRCS for google3-default platform.
benjaminwagner56f6d062016-01-13 10:45:19 -0800142BASE_SRCS_UNIX = struct(
143 include = [
irothd2ccc772016-01-25 11:24:57 -0800144 "src/android/*",
iroth76a12252016-01-07 07:11:39 -0800145 "src/codec/*",
iroth5f0de062016-02-17 12:47:27 -0800146 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
iroth76a12252016-01-07 07:11:39 -0800147 "src/images/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700148 "src/opts/**/*.cpp",
149 "src/opts/**/*.h",
150 "src/ports/**/*.cpp",
151 "src/ports/**/*.h",
152 ],
153 exclude = [
154 "src/opts/*arm*",
155 "src/opts/*mips*",
156 "src/opts/*NEON*",
157 "src/opts/*neon*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700158 # Included in :opts_ssse3 library.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700159 "src/opts/*SSSE3*",
160 "src/opts/*ssse3*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700161 # Included in :opts_sse4 library.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700162 "src/opts/*SSE4*",
163 "src/opts/*sse4*",
mtkleinf6d8d282015-12-17 10:18:04 -0800164 # Included in :opts_avx or :opts_avx2
165 "src/opts/*avx*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700166 "src/opts/SkBitmapProcState_opts_none.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700167 "src/opts/SkBlitMask_opts_none.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700168 "src/opts/SkBlitRow_opts_none.cpp",
msarett6b4985c2016-03-10 07:15:59 -0800169 "src/ports/*CG*",
msarettfc0b6d12016-03-17 13:50:17 -0700170 "src/ports/*WIC*",
mtklein3f193a92016-03-10 08:52:05 -0800171 "src/ports/*android*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700172 "src/ports/*chromium*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700173 "src/ports/*mac*",
174 "src/ports/*mozalloc*",
175 "src/ports/*nacl*",
176 "src/ports/*win*",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800177 "src/ports/SkFontConfigInterface_direct_factory.cpp",
178 "src/ports/SkFontMgr_custom_directory_factory.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700179 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700180 "src/ports/SkFontMgr_custom_empty_factory.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700181 "src/ports/SkFontMgr_empty_factory.cpp",
benjaminwagner404816e2015-12-03 05:04:03 -0800182 "src/ports/SkFontMgr_fontconfig.cpp",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800183 "src/ports/SkFontMgr_fontconfig_factory.cpp",
msarettc1d03122016-03-25 08:58:55 -0700184 "src/ports/SkImageEncoder_none.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700185 "src/ports/SkImageGenerator_none.cpp",
186 "src/ports/SkTLS_none.cpp",
mtkleind55d13a2015-08-18 08:51:49 -0700187 ],
188)
189
benjaminwagner86ea33e2015-10-26 10:46:25 -0700190# Platform-dependent SRCS for google3-default Android.
benjaminwagner56f6d062016-01-13 10:45:19 -0800191BASE_SRCS_ANDROID = struct(
192 include = [
irothd2ccc772016-01-25 11:24:57 -0800193 "src/android/*",
iroth76a12252016-01-07 07:11:39 -0800194 "src/codec/*",
iroth5f0de062016-02-17 12:47:27 -0800195 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
iroth76a12252016-01-07 07:11:39 -0800196 "src/images/*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700197 # TODO(benjaminwagner): Figure out how to compile with EGL.
benjaminwagner86ea33e2015-10-26 10:46:25 -0700198 "src/opts/**/*.cpp",
199 "src/opts/**/*.h",
200 "src/ports/**/*.cpp",
201 "src/ports/**/*.h",
202 ],
203 exclude = [
204 "src/opts/*mips*",
205 "src/opts/*SSE2*",
206 "src/opts/*SSSE3*",
207 "src/opts/*ssse3*",
208 "src/opts/*SSE4*",
209 "src/opts/*sse4*",
mtkleinf6d8d282015-12-17 10:18:04 -0800210 "src/opts/*avx*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700211 "src/opts/*x86*",
212 "src/opts/SkBitmapProcState_opts_none.cpp",
213 "src/opts/SkBlitMask_opts_none.cpp",
214 "src/opts/SkBlitRow_opts_none.cpp",
msarett6b4985c2016-03-10 07:15:59 -0800215 "src/ports/*CG*",
mtklein3f193a92016-03-10 08:52:05 -0800216 "src/ports/*FontConfig*",
msarettfc0b6d12016-03-17 13:50:17 -0700217 "src/ports/*WIC*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700218 "src/ports/*chromium*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700219 "src/ports/*fontconfig*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700220 "src/ports/*mac*",
221 "src/ports/*mozalloc*",
222 "src/ports/*nacl*",
223 "src/ports/*win*",
224 "src/ports/SkDebug_stdio.cpp",
225 "src/ports/SkFontMgr_custom_directory_factory.cpp",
226 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700227 "src/ports/SkFontMgr_custom_empty_factory.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700228 "src/ports/SkFontMgr_empty_factory.cpp",
msarettc1d03122016-03-25 08:58:55 -0700229 "src/ports/SkImageEncoder_none.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700230 "src/ports/SkImageGenerator_none.cpp",
231 "src/ports/SkTLS_none.cpp",
232 ],
233)
234
iroth8b99ef42015-11-02 11:11:21 -0800235# Platform-dependent SRCS for google3-default iOS.
benjaminwagner56f6d062016-01-13 10:45:19 -0800236BASE_SRCS_IOS = struct(
237 include = [
msarett2775cf52016-02-17 14:14:25 -0800238 "src/android/*",
239 "src/codec/*",
iroth5f0de062016-02-17 12:47:27 -0800240 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
241 "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800242 "src/opts/**/*.cpp",
243 "src/opts/**/*.h",
244 "src/ports/**/*.cpp",
245 "src/ports/**/*.h",
irothab669de2016-02-16 19:17:01 -0800246 "src/utils/mac/*.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800247 ],
248 exclude = [
msarett2775cf52016-02-17 14:14:25 -0800249 "src/codec/*Gif*.cpp",
250 "src/codec/*Ico*.cpp",
251 "src/codec/*Jpeg*.cpp",
252 "src/codec/*Webp*.cpp",
253 "src/codec/*Png*",
254 "src/codec/*Raw*.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800255 "src/opts/*mips*",
256 "src/opts/*NEON*",
257 "src/opts/*neon*",
258 "src/opts/*SSE2*",
259 "src/opts/*SSSE3*",
260 "src/opts/*ssse3*",
261 "src/opts/*SSE4*",
262 "src/opts/*sse4*",
mtkleinf6d8d282015-12-17 10:18:04 -0800263 "src/opts/*avx*",
iroth8b99ef42015-11-02 11:11:21 -0800264 "src/opts/*x86*",
265 "src/opts/SkBitmapProcState_opts_none.cpp",
irothd2ccc772016-01-25 11:24:57 -0800266 "src/opts/SkBlitMask_opts_arm*.cpp",
267 "src/opts/SkBlitRow_opts_arm*.cpp",
mtklein3f193a92016-03-10 08:52:05 -0800268 "src/ports/*CG*",
269 "src/ports/*FontConfig*",
270 "src/ports/*FreeType*",
msarettfc0b6d12016-03-17 13:50:17 -0700271 "src/ports/*WIC*",
iroth8b99ef42015-11-02 11:11:21 -0800272 "src/ports/*android*",
273 "src/ports/*chromium*",
274 "src/ports/*fontconfig*",
iroth8b99ef42015-11-02 11:11:21 -0800275 "src/ports/*mozalloc*",
276 "src/ports/*nacl*",
277 "src/ports/*win*",
iroth8b99ef42015-11-02 11:11:21 -0800278 "src/ports/SkFontMgr_custom.cpp",
279 "src/ports/SkFontMgr_custom_directory_factory.cpp",
280 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700281 "src/ports/SkFontMgr_custom_empty_factory.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800282 "src/ports/SkFontMgr_empty_factory.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800283 "src/ports/SkImageGenerator_none.cpp",
284 "src/ports/SkTLS_none.cpp",
285 ],
286)
287
benjaminwagner56f6d062016-01-13 10:45:19 -0800288################################################################################
289## SSSE3/SSE4/AVX/AVX2 SRCS
290################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700291
benjaminwagner56f6d062016-01-13 10:45:19 -0800292SSSE3_SRCS = struct(
293 include = [
mtkleind55d13a2015-08-18 08:51:49 -0700294 "src/opts/*SSSE3*.cpp",
295 "src/opts/*ssse3*.cpp",
benjaminwagner89061ed2016-01-25 09:29:08 -0800296 ],
297)
mtkleind55d13a2015-08-18 08:51:49 -0700298
benjaminwagner56f6d062016-01-13 10:45:19 -0800299SSE4_SRCS = struct(
300 include = [
mtkleind55d13a2015-08-18 08:51:49 -0700301 "src/opts/*SSE4*.cpp",
302 "src/opts/*sse4*.cpp",
benjaminwagner89061ed2016-01-25 09:29:08 -0800303 ],
304)
benjaminwagner787ca872015-08-17 12:58:10 -0700305
benjaminwagner56f6d062016-01-13 10:45:19 -0800306AVX_SRCS = struct(
307 include = [
mtkleinf6d8d282015-12-17 10:18:04 -0800308 "src/opts/*_avx.cpp",
benjaminwagner89061ed2016-01-25 09:29:08 -0800309 ],
310)
mtkleinf6d8d282015-12-17 10:18:04 -0800311
benjaminwagner56f6d062016-01-13 10:45:19 -0800312AVX2_SRCS = struct(
313 include = [
mtkleinf6d8d282015-12-17 10:18:04 -0800314 "src/opts/*_avx2.cpp",
benjaminwagner89061ed2016-01-25 09:29:08 -0800315 ],
316)
mtkleinf6d8d282015-12-17 10:18:04 -0800317
benjaminwagner56f6d062016-01-13 10:45:19 -0800318################################################################################
319## BASE_HDRS
320################################################################################
321
322BASE_HDRS = struct(
323 include = [
benjaminwagner787ca872015-08-17 12:58:10 -0700324 "include/**/*.h",
325 ],
benjaminwagner99fb6702016-07-28 15:12:21 -0700326 exclude = PRIVATE_HDRS_INCLUDE_LIST + [
benjaminwagner6f6bef82015-10-15 08:09:44 -0700327 # Not used.
328 "include/animator/**/*",
329 "include/views/**/*",
benjaminwagner89061ed2016-01-25 09:29:08 -0800330 ],
331)
benjaminwagner787ca872015-08-17 12:58:10 -0700332
benjaminwagner56f6d062016-01-13 10:45:19 -0800333################################################################################
334## BASE_DEPS
335################################################################################
336
337BASE_DEPS_ALL = []
338
benjaminwagner39e7aa42015-11-18 13:26:10 -0800339BASE_DEPS_UNIX = [
iroth330043c2016-01-12 14:22:24 -0800340 ":opts_ssse3",
benjaminwagner56f6d062016-01-13 10:45:19 -0800341 ":opts_sse4",
342 ":opts_avx",
343 ":opts_avx2",
benjaminwagner39e7aa42015-11-18 13:26:10 -0800344]
345
346BASE_DEPS_ANDROID = []
347
348BASE_DEPS_IOS = []
349
benjaminwagner56f6d062016-01-13 10:45:19 -0800350################################################################################
351## INCLUDES
352################################################################################
benjaminwagner39e7aa42015-11-18 13:26:10 -0800353
benjaminwagner787ca872015-08-17 12:58:10 -0700354# Includes needed by Skia implementation. Not public includes.
355INCLUDES = [
benjaminwagnerfa7e1a02015-11-13 12:27:08 -0800356 "include/android",
benjaminwagner787ca872015-08-17 12:58:10 -0700357 "include/c",
robertphillips188d44c2016-02-01 04:54:14 -0800358 "include/client/android",
benjaminwagner787ca872015-08-17 12:58:10 -0700359 "include/codec",
360 "include/config",
361 "include/core",
benjaminwagner787ca872015-08-17 12:58:10 -0700362 "include/effects",
363 "include/gpu",
364 "include/images",
365 "include/pathops",
benjaminwagner787ca872015-08-17 12:58:10 -0700366 "include/pipe",
367 "include/ports",
368 "include/private",
369 "include/utils",
iroth8b99ef42015-11-02 11:11:21 -0800370 "include/utils/mac",
371 "include/utils/win",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700372 "include/svg",
benjaminwagner787ca872015-08-17 12:58:10 -0700373 "include/xml",
benjaminwagnerfa7e1a02015-11-13 12:27:08 -0800374 "src/codec",
benjaminwagner787ca872015-08-17 12:58:10 -0700375 "src/core",
benjaminwagner787ca872015-08-17 12:58:10 -0700376 "src/gpu",
377 "src/image",
378 "src/lazy",
379 "src/opts",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800380 "src/ports",
benjaminwagner787ca872015-08-17 12:58:10 -0700381 "src/pdf",
benjaminwagner787ca872015-08-17 12:58:10 -0700382 "src/sfnt",
383 "src/utils",
384 "third_party/etc1",
385 "third_party/ktx",
benjaminwagner56f6d062016-01-13 10:45:19 -0800386]
benjaminwagner787ca872015-08-17 12:58:10 -0700387
benjaminwagner56f6d062016-01-13 10:45:19 -0800388################################################################################
389## DM_SRCS
390################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700391
benjaminwagner56f6d062016-01-13 10:45:19 -0800392DM_SRCS_ALL = struct(
393 include = [
benjaminwagner6f6bef82015-10-15 08:09:44 -0700394 "dm/*.cpp",
395 "dm/*.h",
396 "gm/*.c",
397 "gm/*.cpp",
398 "gm/*.h",
399 "tests/*.cpp",
400 "tests/*.h",
benjaminwagner99fb6702016-07-28 15:12:21 -0700401 "tools/BigPathBench.inc",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700402 "tools/CrashHandler.cpp",
403 "tools/CrashHandler.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700404 "tools/ProcStats.cpp",
405 "tools/ProcStats.h",
406 "tools/Resources.cpp",
407 "tools/Resources.h",
benjaminwagner99fb6702016-07-28 15:12:21 -0700408 "tools/SkJSONCPP.h",
409 "tools/UrlDataManager.cpp",
410 "tools/UrlDataManager.h",
411 "tools/debugger/*.cpp",
412 "tools/debugger/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700413 "tools/flags/*.cpp",
414 "tools/flags/*.h",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700415 "tools/gpu/**/*.cpp",
416 "tools/gpu/**/*.h",
brianosman6d3119c2016-04-19 19:41:54 -0700417 "tools/picture_utils.cpp",
benjaminwagner99fb6702016-07-28 15:12:21 -0700418 "tools/picture_utils.h",
mtkleine1fc4522016-02-09 12:32:52 -0800419 "tools/random_parse_path.cpp",
420 "tools/random_parse_path.h",
benjaminwagner32885142015-10-24 07:55:31 -0700421 "tools/sk_tool_utils.cpp",
422 "tools/sk_tool_utils.h",
benjaminwagner99fb6702016-07-28 15:12:21 -0700423 "tools/sk_tool_utils_flags.h",
benjaminwagner32885142015-10-24 07:55:31 -0700424 "tools/sk_tool_utils_font.cpp",
benjaminwagner99fb6702016-07-28 15:12:21 -0700425 "tools/test_font_monospace.inc",
426 "tools/test_font_sans_serif.inc",
427 "tools/test_font_serif.inc",
428 "tools/test_font_index.inc",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700429 "tools/timer/*.cpp",
430 "tools/timer/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700431 ],
432 exclude = [
benjaminwagner86ea33e2015-10-26 10:46:25 -0700433 "dm/DMSrcSinkAndroid.cpp", # Android-only.
434 "tests/FontMgrAndroidParserTest.cpp", # Android-only.
435 "tests/PathOpsSkpClipTest.cpp", # Alternate main.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700436 "tests/skia_test.cpp", # Old main.
437 "tests/SkpSkGrTest.cpp", # Alternate main.
ethannicholasf789b382016-08-03 12:43:36 -0700438 "tests/SkSL*.cpp", # Excluded along with Vulkan.
benjaminwagner921e48b2016-07-15 11:27:27 -0700439 "tests/SVGDeviceTest.cpp",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700440 "tools/gpu/gl/angle/*",
441 "tools/gpu/gl/command_buffer/*",
442 "tools/gpu/gl/egl/*",
443 "tools/gpu/gl/glx/*",
444 "tools/gpu/gl/iOS/*",
445 "tools/gpu/gl/mac/*",
446 "tools/gpu/gl/mesa/*",
447 "tools/gpu/gl/win/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700448 "tools/timer/SysTimer_mach.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700449 "tools/timer/SysTimer_windows.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700450 ],
451)
452
benjaminwagner38d68bc2016-04-01 05:00:51 -0700453DM_SRCS_UNIX = struct(
454 include = [
455 "tools/gpu/gl/CreatePlatformGLContext_none.cpp",
456 ],
457)
benjaminwagner86ea33e2015-10-26 10:46:25 -0700458
benjaminwagner56f6d062016-01-13 10:45:19 -0800459DM_SRCS_ANDROID = struct(
460 include = [
benjaminwagner86ea33e2015-10-26 10:46:25 -0700461 # Depends on Android HWUI library that is not available in google3.
462 #"dm/DMSrcSinkAndroid.cpp",
463 "tests/FontMgrAndroidParserTest.cpp",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700464 # TODO(benjaminwagner): Figure out how to compile with EGL.
465 "tools/gpu/gl/CreatePlatformGLContext_none.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700466 ],
467)
468
benjaminwagner38d68bc2016-04-01 05:00:51 -0700469DM_SRCS_IOS = struct(
470 include = [
471 "tools/gpu/iOS/CreatePlatformGLContext_iOS.cpp",
472 ],
473)
benjaminwagner56f6d062016-01-13 10:45:19 -0800474
475################################################################################
476## DM_INCLUDES
477################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700478
benjaminwagner6f6bef82015-10-15 08:09:44 -0700479DM_INCLUDES = [
benjaminwagnerb1fe8f62016-02-01 09:05:08 -0800480 "dm",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700481 "gm",
482 "src/codec",
483 "src/effects",
benjaminwagnerbc9a9b42016-02-22 13:30:39 -0800484 "src/effects/gradients",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700485 "src/fonts",
486 "src/pathops",
487 "src/pipe/utils",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700488 "src/ports",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700489 "tests",
490 "tools",
benjaminwagner99fb6702016-07-28 15:12:21 -0700491 "tools/debugger",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700492 "tools/flags",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700493 "tools/gpu",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700494 "tools/timer",
495]
496
benjaminwagner56f6d062016-01-13 10:45:19 -0800497################################################################################
498## DM_ARGS
499################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700500
benjaminwagner83906ae2016-05-01 15:02:25 -0700501def DM_ARGS(base_dir, asan):
502 source = ["tests", "gm", "image"]
503 # TODO(benjaminwagner): f16 and serialize-8888 fail.
504 config = ["565", "8888", "pdf", "srgb", "tiles_rt", "pic"]
505 # TODO(mtklein): maybe investigate why these fail?
506 match = [
507 "~Canvas",
508 "~Codec",
509 "~Codec_Dimensions",
510 "~Codec_stripes",
511 "~FontMgr",
512 "~PaintBreakText",
513 "~RecordDraw_TextBounds",
514 "~Scalar",
515 "~skps",
516 "~Stream",
517 ]
518 if asan:
519 # Running all sources and configs under ASAN causes the test to exceed
520 # "large" size and time out.
521 source = ["tests", "gm"]
522 config = ["8888"]
523 match += [
524 "~clippedcubic2",
525 "~conicpaths",
526 "~gradients_2pt_conical",
527 "~Math",
528 "~Matrix",
529 "~PathOpsCubic",
benjaminwagnerb5188622016-06-29 10:26:44 -0700530 "~PathOpsFailOp",
caryclark523e76d2016-07-19 12:27:32 -0700531 "~PathOpsOpCubicsThreaded",
benjaminwagner83906ae2016-05-01 15:02:25 -0700532 "~PathOpsOpLoopsThreaded",
533 "~PathOpsSimplify",
534 "~PathOpsTightBoundsQuads",
535 "~Point",
benjaminwagner1d352312016-07-25 06:32:13 -0700536 "~sk_linear_to_srgb",
benjaminwagner56f6d062016-01-13 10:45:19 -0800537 ]
benjaminwagner83906ae2016-05-01 15:02:25 -0700538 return [
539 "--src %s" % " ".join(source),
540 "--config %s" % " ".join(config),
541 "--verbose",
542 "--match %s" % " ".join(match),
543 "--resourcePath %s/resources" % base_dir,
544 "--images %s/resources" % base_dir,
545 ]
benjaminwagner56f6d062016-01-13 10:45:19 -0800546
547################################################################################
548## COPTS
549################################################################################
iroth8b99ef42015-11-02 11:11:21 -0800550
benjaminwagner86ea33e2015-10-26 10:46:25 -0700551COPTS_UNIX = [
benjaminwagner787ca872015-08-17 12:58:10 -0700552 "-Wno-implicit-fallthrough", # Some intentional fallthrough.
benjaminwagner7d974f52015-10-19 13:55:55 -0700553 "-Wno-deprecated-declarations", # Internal use of deprecated methods. :(
benjaminwagner787ca872015-08-17 12:58:10 -0700554]
555
benjaminwagner56f6d062016-01-13 10:45:19 -0800556COPTS_ANDROID = ["-mfpu=neon"]
557
558COPTS_IOS = []
559
560COPTS_ALL = []
561
562################################################################################
563## DEFINES
564################################################################################
565
566DEFINES_UNIX = [
scroggo7732c0c2016-06-22 07:25:16 -0700567 "PNG_SKIP_SETJMP_CHECK",
benjaminwagner56f6d062016-01-13 10:45:19 -0800568 "SK_BUILD_FOR_UNIX",
569 "SK_SAMPLES_FOR_X",
halcanary650e20d2016-08-25 09:07:02 -0700570 "SK_PDF_USE_SFNTLY",
benjaminwagner186e0b92016-02-11 16:00:24 -0800571 "SK_CODEC_DECODES_RAW",
msarettad3a5c62016-05-06 07:21:26 -0700572 "SK_HAS_GIF_LIBRARY",
573 "SK_HAS_JPEG_LIBRARY",
scroggoe6939c12016-06-21 14:13:40 -0700574 "SK_HAS_PNG_LIBRARY",
scroggo7732c0c2016-06-22 07:25:16 -0700575 "SK_HAS_WEBP_LIBRARY",
benjaminwagner56f6d062016-01-13 10:45:19 -0800576]
benjaminwagner86ea33e2015-10-26 10:46:25 -0700577
578DEFINES_ANDROID = [
579 "SK_BUILD_FOR_ANDROID",
benjaminwagner186e0b92016-02-11 16:00:24 -0800580 "SK_CODEC_DECODES_RAW",
msarettad3a5c62016-05-06 07:21:26 -0700581 "SK_HAS_GIF_LIBRARY",
582 "SK_HAS_JPEG_LIBRARY",
scroggoe6939c12016-06-21 14:13:40 -0700583 "SK_HAS_PNG_LIBRARY",
scroggo7732c0c2016-06-22 07:25:16 -0700584 "SK_HAS_WEBP_LIBRARY",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700585]
586
iroth8b99ef42015-11-02 11:11:21 -0800587DEFINES_IOS = [
588 "SK_BUILD_FOR_IOS",
sdefresnee3fa8112016-06-01 07:08:56 -0700589 "SK_BUILD_NO_OPTS",
iroth8b99ef42015-11-02 11:11:21 -0800590 "SK_IGNORE_ETC1_SUPPORT",
irothd2ccc772016-01-25 11:24:57 -0800591 "SKNX_NO_SIMD",
iroth8b99ef42015-11-02 11:11:21 -0800592]
593
benjaminwagner86ea33e2015-10-26 10:46:25 -0700594DEFINES_ALL = [
benjaminwagner787ca872015-08-17 12:58:10 -0700595 # Chrome DEFINES.
596 "SK_USE_FLOATBITS",
597 "SK_USE_FREETYPE_EMBOLDEN",
598 # Turn on a few Google3-specific build fixes.
599 "GOOGLE3",
reedd053ce92016-03-22 10:17:23 -0700600 # Staging flags for API changes
benjaminwagnerbddb3722016-07-22 06:19:21 -0700601 "SK_SUPPORT_LEGACY_ACCESSBITMAP",
reedd053ce92016-03-22 10:17:23 -0700602 "SK_SUPPORT_LEGACY_COLORFILTER_PTR",
603 "SK_SUPPORT_LEGACY_CREATESHADER_PTR",
benjaminwagnerbddb3722016-07-22 06:19:21 -0700604 "SK_SUPPORT_LEGACY_IMAGEFACTORY",
benjaminwagner31dcc2a2016-04-01 06:54:34 -0700605 "SK_SUPPORT_LEGACY_IMAGEFILTER_PTR",
benjaminwagnerbddb3722016-07-22 06:19:21 -0700606 "SK_SUPPORT_LEGACY_MASKFILTER_PTR",
benjaminwagner31dcc2a2016-04-01 06:54:34 -0700607 "SK_SUPPORT_LEGACY_MINOR_EFFECT_PTR",
robertphillips0652baa2016-08-08 09:17:20 -0700608 "SK_SUPPORT_LEGACY_NEW_SURFACE_API",
benjaminwagner31dcc2a2016-04-01 06:54:34 -0700609 "SK_SUPPORT_LEGACY_PATHEFFECT_PTR",
fmalita41c40962016-03-24 11:05:28 -0700610 "SK_SUPPORT_LEGACY_PICTURE_PTR",
bungeman13b9c952016-05-12 10:09:30 -0700611 "SK_SUPPORT_LEGACY_TYPEFACE_PTR",
benjaminwagnerbddb3722016-07-22 06:19:21 -0700612 "SK_SUPPORT_LEGACY_XFERMODE_PTR",
reeddfd32b72016-08-11 05:04:51 -0700613 "SK_SUPPORT_LEGACY_PICTUREINSTALLPIXELREF",
benjaminwagner787ca872015-08-17 12:58:10 -0700614]
615
benjaminwagner56f6d062016-01-13 10:45:19 -0800616################################################################################
617## LINKOPTS
618################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700619
benjaminwagner56f6d062016-01-13 10:45:19 -0800620LINKOPTS_UNIX = []
benjaminwagner6f6bef82015-10-15 08:09:44 -0700621
benjaminwagner56f6d062016-01-13 10:45:19 -0800622LINKOPTS_ANDROID = [
623 "-lEGL",
624]
benjaminwagner6f6bef82015-10-15 08:09:44 -0700625
benjaminwagner56f6d062016-01-13 10:45:19 -0800626LINKOPTS_IOS = []
benjaminwagner6f6bef82015-10-15 08:09:44 -0700627
benjaminwagner56f6d062016-01-13 10:45:19 -0800628LINKOPTS_ALL = [
629 "-ldl",
630]