blob: 128f853673cdd0e5155240236b72710541700fa5 [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?
benjaminwagner2211a7b2015-12-01 11:12:05 -080099 "src/fonts/SkFontMgr_fontconfig.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700100 "src/gpu/gl/android/*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700101 "src/gpu/gl/egl/*",
benjaminwagneraf3b35e2016-03-28 13:27:28 -0700102 "src/gpu/gl/glfw/*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700103 "src/gpu/gl/glx/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700104 "src/gpu/gl/iOS/*",
105 "src/gpu/gl/mac/*",
106 "src/gpu/gl/win/*",
iroth76a12252016-01-07 07:11:39 -0800107 "src/images/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700108 "src/opts/**/*",
109 "src/ports/**/*",
110 "src/utils/android/**/*",
111 "src/utils/mac/**/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700112 "src/utils/SkThreadUtils_win.cpp", # Windows-only. Move to ports?
113 "src/utils/win/**/*",
114 "src/views/sdl/*",
115 "src/views/win/*",
116 "src/views/unix/*",
117
118 # Exclude multiple definitions.
119 # TODO(mtklein): Move to opts?
benjaminwagnerca26a182016-03-14 15:21:12 -0700120 "src/pdf/SkDocument_PDF_None.cpp", # We use src/pdf/SkPDFDocument.cpp.
benjaminwagner86ea33e2015-10-26 10:46:25 -0700121 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
122 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
iroth5f0de062016-02-17 12:47:27 -0800123 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700124
125 # Exclude files that don't compile with the current DEFINES.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700126 "src/gpu/gl/mesa/*", # Requires SK_MESA define.
benjaminwagner921e48b2016-07-15 11:27:27 -0700127 "src/svg/**/*", # Depends on XML.
128 "src/xml/**/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700129
benjaminwagner39e7aa42015-11-18 13:26:10 -0800130 # Conflicting dependencies among Lua versions. See cl/107087297.
131 "src/utils/SkLua*",
132
benjaminwagner6f6bef82015-10-15 08:09:44 -0700133 # Not used.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700134 "src/views/**/*",
egdaniel32119f12016-02-22 10:07:54 -0800135
136 # Currently exclude all vulkan specific files
137 "src/gpu/vk/*",
benjaminwagner2214de42016-07-02 05:12:46 -0700138 "src/sksl/**/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700139 ],
140)
141
142# Platform-dependent SRCS for google3-default platform.
benjaminwagner56f6d062016-01-13 10:45:19 -0800143BASE_SRCS_UNIX = struct(
144 include = [
irothd2ccc772016-01-25 11:24:57 -0800145 "src/android/*",
iroth76a12252016-01-07 07:11:39 -0800146 "src/codec/*",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800147 "src/fonts/SkFontMgr_fontconfig.cpp",
iroth5f0de062016-02-17 12:47:27 -0800148 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
iroth76a12252016-01-07 07:11:39 -0800149 "src/images/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700150 "src/opts/**/*.cpp",
151 "src/opts/**/*.h",
152 "src/ports/**/*.cpp",
153 "src/ports/**/*.h",
154 ],
155 exclude = [
156 "src/opts/*arm*",
157 "src/opts/*mips*",
158 "src/opts/*NEON*",
159 "src/opts/*neon*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700160 # Included in :opts_ssse3 library.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700161 "src/opts/*SSSE3*",
162 "src/opts/*ssse3*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700163 # Included in :opts_sse4 library.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700164 "src/opts/*SSE4*",
165 "src/opts/*sse4*",
mtkleinf6d8d282015-12-17 10:18:04 -0800166 # Included in :opts_avx or :opts_avx2
167 "src/opts/*avx*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700168 "src/opts/SkBitmapProcState_opts_none.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700169 "src/opts/SkBlitMask_opts_none.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700170 "src/opts/SkBlitRow_opts_none.cpp",
msarett6b4985c2016-03-10 07:15:59 -0800171 "src/ports/*CG*",
msarettfc0b6d12016-03-17 13:50:17 -0700172 "src/ports/*WIC*",
mtklein3f193a92016-03-10 08:52:05 -0800173 "src/ports/*android*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700174 "src/ports/*chromium*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700175 "src/ports/*mac*",
176 "src/ports/*mozalloc*",
177 "src/ports/*nacl*",
178 "src/ports/*win*",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800179 "src/ports/SkFontConfigInterface_direct_factory.cpp",
180 "src/ports/SkFontMgr_custom_directory_factory.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700181 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700182 "src/ports/SkFontMgr_custom_empty_factory.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700183 "src/ports/SkFontMgr_empty_factory.cpp",
benjaminwagner404816e2015-12-03 05:04:03 -0800184 "src/ports/SkFontMgr_fontconfig.cpp",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800185 "src/ports/SkFontMgr_fontconfig_factory.cpp",
msarettc1d03122016-03-25 08:58:55 -0700186 "src/ports/SkImageEncoder_none.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700187 "src/ports/SkImageGenerator_none.cpp",
188 "src/ports/SkTLS_none.cpp",
mtkleind55d13a2015-08-18 08:51:49 -0700189 ],
190)
191
benjaminwagner86ea33e2015-10-26 10:46:25 -0700192# Platform-dependent SRCS for google3-default Android.
benjaminwagner56f6d062016-01-13 10:45:19 -0800193BASE_SRCS_ANDROID = struct(
194 include = [
irothd2ccc772016-01-25 11:24:57 -0800195 "src/android/*",
iroth76a12252016-01-07 07:11:39 -0800196 "src/codec/*",
iroth5f0de062016-02-17 12:47:27 -0800197 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
iroth76a12252016-01-07 07:11:39 -0800198 "src/images/*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700199 # TODO(benjaminwagner): Figure out how to compile with EGL.
benjaminwagner86ea33e2015-10-26 10:46:25 -0700200 "src/opts/**/*.cpp",
201 "src/opts/**/*.h",
202 "src/ports/**/*.cpp",
203 "src/ports/**/*.h",
204 ],
205 exclude = [
206 "src/opts/*mips*",
207 "src/opts/*SSE2*",
208 "src/opts/*SSSE3*",
209 "src/opts/*ssse3*",
210 "src/opts/*SSE4*",
211 "src/opts/*sse4*",
mtkleinf6d8d282015-12-17 10:18:04 -0800212 "src/opts/*avx*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700213 "src/opts/*x86*",
214 "src/opts/SkBitmapProcState_opts_none.cpp",
215 "src/opts/SkBlitMask_opts_none.cpp",
216 "src/opts/SkBlitRow_opts_none.cpp",
msarett6b4985c2016-03-10 07:15:59 -0800217 "src/ports/*CG*",
mtklein3f193a92016-03-10 08:52:05 -0800218 "src/ports/*FontConfig*",
msarettfc0b6d12016-03-17 13:50:17 -0700219 "src/ports/*WIC*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700220 "src/ports/*chromium*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700221 "src/ports/*fontconfig*",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700222 "src/ports/*mac*",
223 "src/ports/*mozalloc*",
224 "src/ports/*nacl*",
225 "src/ports/*win*",
226 "src/ports/SkDebug_stdio.cpp",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800227 "src/ports/SkFontConfigInterface_direct_factory.cpp",
228 "src/ports/SkFontConfigInterface_direct_google3_factory.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700229 "src/ports/SkFontMgr_custom_directory_factory.cpp",
230 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700231 "src/ports/SkFontMgr_custom_empty_factory.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700232 "src/ports/SkFontMgr_empty_factory.cpp",
msarettc1d03122016-03-25 08:58:55 -0700233 "src/ports/SkImageEncoder_none.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700234 "src/ports/SkImageGenerator_none.cpp",
235 "src/ports/SkTLS_none.cpp",
236 ],
237)
238
iroth8b99ef42015-11-02 11:11:21 -0800239# Platform-dependent SRCS for google3-default iOS.
benjaminwagner56f6d062016-01-13 10:45:19 -0800240BASE_SRCS_IOS = struct(
241 include = [
msarett2775cf52016-02-17 14:14:25 -0800242 "src/android/*",
243 "src/codec/*",
iroth5f0de062016-02-17 12:47:27 -0800244 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
245 "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800246 "src/opts/**/*.cpp",
247 "src/opts/**/*.h",
248 "src/ports/**/*.cpp",
249 "src/ports/**/*.h",
irothab669de2016-02-16 19:17:01 -0800250 "src/utils/mac/*.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800251 ],
252 exclude = [
msarett2775cf52016-02-17 14:14:25 -0800253 "src/codec/*Gif*.cpp",
254 "src/codec/*Ico*.cpp",
255 "src/codec/*Jpeg*.cpp",
256 "src/codec/*Webp*.cpp",
257 "src/codec/*Png*",
258 "src/codec/*Raw*.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800259 "src/opts/*mips*",
260 "src/opts/*NEON*",
261 "src/opts/*neon*",
262 "src/opts/*SSE2*",
263 "src/opts/*SSSE3*",
264 "src/opts/*ssse3*",
265 "src/opts/*SSE4*",
266 "src/opts/*sse4*",
mtkleinf6d8d282015-12-17 10:18:04 -0800267 "src/opts/*avx*",
iroth8b99ef42015-11-02 11:11:21 -0800268 "src/opts/*x86*",
269 "src/opts/SkBitmapProcState_opts_none.cpp",
irothd2ccc772016-01-25 11:24:57 -0800270 "src/opts/SkBlitMask_opts_arm*.cpp",
271 "src/opts/SkBlitRow_opts_arm*.cpp",
mtklein3f193a92016-03-10 08:52:05 -0800272 "src/ports/*CG*",
273 "src/ports/*FontConfig*",
274 "src/ports/*FreeType*",
msarettfc0b6d12016-03-17 13:50:17 -0700275 "src/ports/*WIC*",
iroth8b99ef42015-11-02 11:11:21 -0800276 "src/ports/*android*",
277 "src/ports/*chromium*",
278 "src/ports/*fontconfig*",
iroth8b99ef42015-11-02 11:11:21 -0800279 "src/ports/*mozalloc*",
280 "src/ports/*nacl*",
281 "src/ports/*win*",
iroth8b99ef42015-11-02 11:11:21 -0800282 "src/ports/SkFontMgr_custom.cpp",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800283 "src/ports/SkFontConfigInterface_direct_factory.cpp",
284 "src/ports/SkFontConfigInterface_direct_google3_factory.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800285 "src/ports/SkFontMgr_custom_directory_factory.cpp",
286 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
benjaminwagnerd9dd5812016-03-21 10:45:01 -0700287 "src/ports/SkFontMgr_custom_empty_factory.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800288 "src/ports/SkFontMgr_empty_factory.cpp",
iroth8b99ef42015-11-02 11:11:21 -0800289 "src/ports/SkImageGenerator_none.cpp",
290 "src/ports/SkTLS_none.cpp",
291 ],
292)
293
benjaminwagner56f6d062016-01-13 10:45:19 -0800294################################################################################
295## SSSE3/SSE4/AVX/AVX2 SRCS
296################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700297
benjaminwagner56f6d062016-01-13 10:45:19 -0800298SSSE3_SRCS = struct(
299 include = [
mtkleind55d13a2015-08-18 08:51:49 -0700300 "src/opts/*SSSE3*.cpp",
301 "src/opts/*ssse3*.cpp",
benjaminwagner89061ed2016-01-25 09:29:08 -0800302 ],
303)
mtkleind55d13a2015-08-18 08:51:49 -0700304
benjaminwagner56f6d062016-01-13 10:45:19 -0800305SSE4_SRCS = struct(
306 include = [
mtkleind55d13a2015-08-18 08:51:49 -0700307 "src/opts/*SSE4*.cpp",
308 "src/opts/*sse4*.cpp",
benjaminwagner89061ed2016-01-25 09:29:08 -0800309 ],
310)
benjaminwagner787ca872015-08-17 12:58:10 -0700311
benjaminwagner56f6d062016-01-13 10:45:19 -0800312AVX_SRCS = struct(
313 include = [
mtkleinf6d8d282015-12-17 10:18:04 -0800314 "src/opts/*_avx.cpp",
benjaminwagner89061ed2016-01-25 09:29:08 -0800315 ],
316)
mtkleinf6d8d282015-12-17 10:18:04 -0800317
benjaminwagner56f6d062016-01-13 10:45:19 -0800318AVX2_SRCS = struct(
319 include = [
mtkleinf6d8d282015-12-17 10:18:04 -0800320 "src/opts/*_avx2.cpp",
benjaminwagner89061ed2016-01-25 09:29:08 -0800321 ],
322)
mtkleinf6d8d282015-12-17 10:18:04 -0800323
benjaminwagner56f6d062016-01-13 10:45:19 -0800324################################################################################
325## BASE_HDRS
326################################################################################
327
328BASE_HDRS = struct(
329 include = [
benjaminwagner787ca872015-08-17 12:58:10 -0700330 "include/**/*.h",
331 ],
benjaminwagner99fb6702016-07-28 15:12:21 -0700332 exclude = PRIVATE_HDRS_INCLUDE_LIST + [
benjaminwagner6f6bef82015-10-15 08:09:44 -0700333 # Not used.
334 "include/animator/**/*",
335 "include/views/**/*",
benjaminwagner89061ed2016-01-25 09:29:08 -0800336 ],
337)
benjaminwagner787ca872015-08-17 12:58:10 -0700338
benjaminwagner56f6d062016-01-13 10:45:19 -0800339################################################################################
340## BASE_DEPS
341################################################################################
342
343BASE_DEPS_ALL = []
344
benjaminwagner39e7aa42015-11-18 13:26:10 -0800345BASE_DEPS_UNIX = [
iroth330043c2016-01-12 14:22:24 -0800346 ":opts_ssse3",
benjaminwagner56f6d062016-01-13 10:45:19 -0800347 ":opts_sse4",
348 ":opts_avx",
349 ":opts_avx2",
benjaminwagner39e7aa42015-11-18 13:26:10 -0800350]
351
352BASE_DEPS_ANDROID = []
353
354BASE_DEPS_IOS = []
355
benjaminwagner56f6d062016-01-13 10:45:19 -0800356################################################################################
357## INCLUDES
358################################################################################
benjaminwagner39e7aa42015-11-18 13:26:10 -0800359
benjaminwagner787ca872015-08-17 12:58:10 -0700360# Includes needed by Skia implementation. Not public includes.
361INCLUDES = [
benjaminwagnerfa7e1a02015-11-13 12:27:08 -0800362 "include/android",
benjaminwagner787ca872015-08-17 12:58:10 -0700363 "include/c",
robertphillips188d44c2016-02-01 04:54:14 -0800364 "include/client/android",
benjaminwagner787ca872015-08-17 12:58:10 -0700365 "include/codec",
366 "include/config",
367 "include/core",
benjaminwagner787ca872015-08-17 12:58:10 -0700368 "include/effects",
369 "include/gpu",
370 "include/images",
371 "include/pathops",
benjaminwagner787ca872015-08-17 12:58:10 -0700372 "include/pipe",
373 "include/ports",
374 "include/private",
375 "include/utils",
iroth8b99ef42015-11-02 11:11:21 -0800376 "include/utils/mac",
377 "include/utils/win",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700378 "include/svg",
benjaminwagner787ca872015-08-17 12:58:10 -0700379 "include/xml",
benjaminwagnerfa7e1a02015-11-13 12:27:08 -0800380 "src/codec",
benjaminwagner787ca872015-08-17 12:58:10 -0700381 "src/core",
benjaminwagner787ca872015-08-17 12:58:10 -0700382 "src/gpu",
383 "src/image",
384 "src/lazy",
385 "src/opts",
benjaminwagner2211a7b2015-12-01 11:12:05 -0800386 "src/ports",
benjaminwagner787ca872015-08-17 12:58:10 -0700387 "src/pdf",
benjaminwagner787ca872015-08-17 12:58:10 -0700388 "src/sfnt",
389 "src/utils",
390 "third_party/etc1",
391 "third_party/ktx",
benjaminwagner56f6d062016-01-13 10:45:19 -0800392]
benjaminwagner787ca872015-08-17 12:58:10 -0700393
benjaminwagner56f6d062016-01-13 10:45:19 -0800394################################################################################
395## DM_SRCS
396################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700397
benjaminwagner56f6d062016-01-13 10:45:19 -0800398DM_SRCS_ALL = struct(
399 include = [
benjaminwagner6f6bef82015-10-15 08:09:44 -0700400 "dm/*.cpp",
401 "dm/*.h",
402 "gm/*.c",
403 "gm/*.cpp",
404 "gm/*.h",
405 "tests/*.cpp",
406 "tests/*.h",
benjaminwagner99fb6702016-07-28 15:12:21 -0700407 "tools/BigPathBench.inc",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700408 "tools/CrashHandler.cpp",
409 "tools/CrashHandler.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700410 "tools/ProcStats.cpp",
411 "tools/ProcStats.h",
412 "tools/Resources.cpp",
413 "tools/Resources.h",
benjaminwagner99fb6702016-07-28 15:12:21 -0700414 "tools/SkJSONCPP.h",
415 "tools/UrlDataManager.cpp",
416 "tools/UrlDataManager.h",
417 "tools/debugger/*.cpp",
418 "tools/debugger/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700419 "tools/flags/*.cpp",
420 "tools/flags/*.h",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700421 "tools/gpu/**/*.cpp",
422 "tools/gpu/**/*.h",
brianosman6d3119c2016-04-19 19:41:54 -0700423 "tools/picture_utils.cpp",
benjaminwagner99fb6702016-07-28 15:12:21 -0700424 "tools/picture_utils.h",
mtkleine1fc4522016-02-09 12:32:52 -0800425 "tools/random_parse_path.cpp",
426 "tools/random_parse_path.h",
benjaminwagner32885142015-10-24 07:55:31 -0700427 "tools/sk_tool_utils.cpp",
428 "tools/sk_tool_utils.h",
benjaminwagner99fb6702016-07-28 15:12:21 -0700429 "tools/sk_tool_utils_flags.h",
benjaminwagner32885142015-10-24 07:55:31 -0700430 "tools/sk_tool_utils_font.cpp",
benjaminwagner99fb6702016-07-28 15:12:21 -0700431 "tools/test_font_monospace.inc",
432 "tools/test_font_sans_serif.inc",
433 "tools/test_font_serif.inc",
434 "tools/test_font_index.inc",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700435 "tools/timer/*.cpp",
436 "tools/timer/*.h",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700437 ],
438 exclude = [
benjaminwagner86ea33e2015-10-26 10:46:25 -0700439 "dm/DMSrcSinkAndroid.cpp", # Android-only.
440 "tests/FontMgrAndroidParserTest.cpp", # Android-only.
441 "tests/PathOpsSkpClipTest.cpp", # Alternate main.
benjaminwagner6f6bef82015-10-15 08:09:44 -0700442 "tests/skia_test.cpp", # Old main.
443 "tests/SkpSkGrTest.cpp", # Alternate main.
benjaminwagner2214de42016-07-02 05:12:46 -0700444 "tests/SkSLErrorTest.cpp", # Excluded along with Vulkan.
benjaminwagner921e48b2016-07-15 11:27:27 -0700445 "tests/SVGDeviceTest.cpp",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700446 "tools/gpu/gl/angle/*",
447 "tools/gpu/gl/command_buffer/*",
448 "tools/gpu/gl/egl/*",
449 "tools/gpu/gl/glx/*",
450 "tools/gpu/gl/iOS/*",
451 "tools/gpu/gl/mac/*",
452 "tools/gpu/gl/mesa/*",
453 "tools/gpu/gl/win/*",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700454 "tools/timer/SysTimer_mach.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700455 "tools/timer/SysTimer_windows.cpp",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700456 ],
457)
458
benjaminwagner38d68bc2016-04-01 05:00:51 -0700459DM_SRCS_UNIX = struct(
460 include = [
461 "tools/gpu/gl/CreatePlatformGLContext_none.cpp",
462 ],
463)
benjaminwagner86ea33e2015-10-26 10:46:25 -0700464
benjaminwagner56f6d062016-01-13 10:45:19 -0800465DM_SRCS_ANDROID = struct(
466 include = [
benjaminwagner86ea33e2015-10-26 10:46:25 -0700467 # Depends on Android HWUI library that is not available in google3.
468 #"dm/DMSrcSinkAndroid.cpp",
469 "tests/FontMgrAndroidParserTest.cpp",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700470 # TODO(benjaminwagner): Figure out how to compile with EGL.
471 "tools/gpu/gl/CreatePlatformGLContext_none.cpp",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700472 ],
473)
474
benjaminwagner38d68bc2016-04-01 05:00:51 -0700475DM_SRCS_IOS = struct(
476 include = [
477 "tools/gpu/iOS/CreatePlatformGLContext_iOS.cpp",
478 ],
479)
benjaminwagner56f6d062016-01-13 10:45:19 -0800480
481################################################################################
482## DM_INCLUDES
483################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700484
benjaminwagner6f6bef82015-10-15 08:09:44 -0700485DM_INCLUDES = [
benjaminwagnerb1fe8f62016-02-01 09:05:08 -0800486 "dm",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700487 "gm",
488 "src/codec",
489 "src/effects",
benjaminwagnerbc9a9b42016-02-22 13:30:39 -0800490 "src/effects/gradients",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700491 "src/fonts",
492 "src/pathops",
493 "src/pipe/utils",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700494 "src/ports",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700495 "tests",
496 "tools",
benjaminwagner99fb6702016-07-28 15:12:21 -0700497 "tools/debugger",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700498 "tools/flags",
benjaminwagner38d68bc2016-04-01 05:00:51 -0700499 "tools/gpu",
benjaminwagner6f6bef82015-10-15 08:09:44 -0700500 "tools/timer",
501]
502
benjaminwagner56f6d062016-01-13 10:45:19 -0800503################################################################################
504## DM_ARGS
505################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700506
benjaminwagner83906ae2016-05-01 15:02:25 -0700507def DM_ARGS(base_dir, asan):
508 source = ["tests", "gm", "image"]
509 # TODO(benjaminwagner): f16 and serialize-8888 fail.
510 config = ["565", "8888", "pdf", "srgb", "tiles_rt", "pic"]
511 # TODO(mtklein): maybe investigate why these fail?
512 match = [
513 "~Canvas",
514 "~Codec",
515 "~Codec_Dimensions",
516 "~Codec_stripes",
517 "~FontMgr",
518 "~PaintBreakText",
519 "~RecordDraw_TextBounds",
520 "~Scalar",
521 "~skps",
522 "~Stream",
523 ]
524 if asan:
525 # Running all sources and configs under ASAN causes the test to exceed
526 # "large" size and time out.
527 source = ["tests", "gm"]
528 config = ["8888"]
529 match += [
530 "~clippedcubic2",
531 "~conicpaths",
532 "~gradients_2pt_conical",
533 "~Math",
534 "~Matrix",
535 "~PathOpsCubic",
benjaminwagnerb5188622016-06-29 10:26:44 -0700536 "~PathOpsFailOp",
caryclark523e76d2016-07-19 12:27:32 -0700537 "~PathOpsOpCubicsThreaded",
benjaminwagner83906ae2016-05-01 15:02:25 -0700538 "~PathOpsOpLoopsThreaded",
539 "~PathOpsSimplify",
540 "~PathOpsTightBoundsQuads",
541 "~Point",
benjaminwagner1d352312016-07-25 06:32:13 -0700542 "~sk_linear_to_srgb",
benjaminwagner56f6d062016-01-13 10:45:19 -0800543 ]
benjaminwagner83906ae2016-05-01 15:02:25 -0700544 return [
545 "--src %s" % " ".join(source),
546 "--config %s" % " ".join(config),
547 "--verbose",
548 "--match %s" % " ".join(match),
549 "--resourcePath %s/resources" % base_dir,
550 "--images %s/resources" % base_dir,
551 ]
benjaminwagner56f6d062016-01-13 10:45:19 -0800552
553################################################################################
554## COPTS
555################################################################################
iroth8b99ef42015-11-02 11:11:21 -0800556
benjaminwagner86ea33e2015-10-26 10:46:25 -0700557COPTS_UNIX = [
benjaminwagner787ca872015-08-17 12:58:10 -0700558 "-Wno-implicit-fallthrough", # Some intentional fallthrough.
benjaminwagner7d974f52015-10-19 13:55:55 -0700559 "-Wno-deprecated-declarations", # Internal use of deprecated methods. :(
benjaminwagner787ca872015-08-17 12:58:10 -0700560]
561
benjaminwagner56f6d062016-01-13 10:45:19 -0800562COPTS_ANDROID = ["-mfpu=neon"]
563
564COPTS_IOS = []
565
566COPTS_ALL = []
567
568################################################################################
569## DEFINES
570################################################################################
571
572DEFINES_UNIX = [
scroggo7732c0c2016-06-22 07:25:16 -0700573 "PNG_SKIP_SETJMP_CHECK",
benjaminwagner56f6d062016-01-13 10:45:19 -0800574 "SK_BUILD_FOR_UNIX",
575 "SK_SAMPLES_FOR_X",
576 "SK_SFNTLY_SUBSETTER",
benjaminwagner186e0b92016-02-11 16:00:24 -0800577 "SK_CODEC_DECODES_RAW",
msarettad3a5c62016-05-06 07:21:26 -0700578 "SK_HAS_GIF_LIBRARY",
579 "SK_HAS_JPEG_LIBRARY",
scroggoe6939c12016-06-21 14:13:40 -0700580 "SK_HAS_PNG_LIBRARY",
scroggo7732c0c2016-06-22 07:25:16 -0700581 "SK_HAS_WEBP_LIBRARY",
msarett7f119ca2016-07-19 10:48:58 -0700582 "TURBO_HAS_CROP",
583 "TURBO_HAS_SKIP",
584 "TURBO_HAS_565",
benjaminwagner56f6d062016-01-13 10:45:19 -0800585]
benjaminwagner86ea33e2015-10-26 10:46:25 -0700586
587DEFINES_ANDROID = [
588 "SK_BUILD_FOR_ANDROID",
benjaminwagner186e0b92016-02-11 16:00:24 -0800589 "SK_CODEC_DECODES_RAW",
msarettad3a5c62016-05-06 07:21:26 -0700590 "SK_HAS_GIF_LIBRARY",
591 "SK_HAS_JPEG_LIBRARY",
scroggoe6939c12016-06-21 14:13:40 -0700592 "SK_HAS_PNG_LIBRARY",
scroggo7732c0c2016-06-22 07:25:16 -0700593 "SK_HAS_WEBP_LIBRARY",
msarett7f119ca2016-07-19 10:48:58 -0700594 "TURBO_HAS_CROP",
595 "TURBO_HAS_SKIP",
596 "TURBO_HAS_565",
benjaminwagner86ea33e2015-10-26 10:46:25 -0700597]
598
iroth8b99ef42015-11-02 11:11:21 -0800599DEFINES_IOS = [
600 "SK_BUILD_FOR_IOS",
sdefresnee3fa8112016-06-01 07:08:56 -0700601 "SK_BUILD_NO_OPTS",
iroth8b99ef42015-11-02 11:11:21 -0800602 "SK_IGNORE_ETC1_SUPPORT",
irothd2ccc772016-01-25 11:24:57 -0800603 "SKNX_NO_SIMD",
iroth8b99ef42015-11-02 11:11:21 -0800604]
605
benjaminwagner86ea33e2015-10-26 10:46:25 -0700606DEFINES_ALL = [
benjaminwagner787ca872015-08-17 12:58:10 -0700607 # Chrome DEFINES.
608 "SK_USE_FLOATBITS",
609 "SK_USE_FREETYPE_EMBOLDEN",
610 # Turn on a few Google3-specific build fixes.
611 "GOOGLE3",
reedd053ce92016-03-22 10:17:23 -0700612 # Staging flags for API changes
benjaminwagnerbddb3722016-07-22 06:19:21 -0700613 "SK_SUPPORT_LEGACY_ACCESSBITMAP",
reedd9ddad22016-07-25 09:41:58 -0700614 "SK_SUPPORT_LEGACY_BITMAP_GETTEXTURE",
reedd053ce92016-03-22 10:17:23 -0700615 "SK_SUPPORT_LEGACY_COLORFILTER_PTR",
616 "SK_SUPPORT_LEGACY_CREATESHADER_PTR",
benjaminwagnerbddb3722016-07-22 06:19:21 -0700617 "SK_SUPPORT_LEGACY_IMAGEFACTORY",
benjaminwagner31dcc2a2016-04-01 06:54:34 -0700618 "SK_SUPPORT_LEGACY_IMAGEFILTER_PTR",
benjaminwagnerbddb3722016-07-22 06:19:21 -0700619 "SK_SUPPORT_LEGACY_MASKFILTER_PTR",
benjaminwagner31dcc2a2016-04-01 06:54:34 -0700620 "SK_SUPPORT_LEGACY_MINOR_EFFECT_PTR",
621 "SK_SUPPORT_LEGACY_NEW_SURFACE_API",
622 "SK_SUPPORT_LEGACY_PATHEFFECT_PTR",
fmalita41c40962016-03-24 11:05:28 -0700623 "SK_SUPPORT_LEGACY_PICTURE_PTR",
bungeman13b9c952016-05-12 10:09:30 -0700624 "SK_SUPPORT_LEGACY_TYPEFACE_PTR",
benjaminwagnerbddb3722016-07-22 06:19:21 -0700625 "SK_SUPPORT_LEGACY_XFERMODE_PTR",
benjaminwagner787ca872015-08-17 12:58:10 -0700626]
627
benjaminwagner56f6d062016-01-13 10:45:19 -0800628################################################################################
629## LINKOPTS
630################################################################################
benjaminwagner86ea33e2015-10-26 10:46:25 -0700631
benjaminwagner56f6d062016-01-13 10:45:19 -0800632LINKOPTS_UNIX = []
benjaminwagner6f6bef82015-10-15 08:09:44 -0700633
benjaminwagner56f6d062016-01-13 10:45:19 -0800634LINKOPTS_ANDROID = [
635 "-lEGL",
636]
benjaminwagner6f6bef82015-10-15 08:09:44 -0700637
benjaminwagner56f6d062016-01-13 10:45:19 -0800638LINKOPTS_IOS = []
benjaminwagner6f6bef82015-10-15 08:09:44 -0700639
benjaminwagner56f6d062016-01-13 10:45:19 -0800640LINKOPTS_ALL = [
641 "-ldl",
642]