1 ################################################################################
3 ################################################################################
5 is_bazel = not hasattr(native, "genmpm")
7 def portable_select(select_dict, bazel_condition, default_condition):
8 """Replaces select() with a Bazel-friendly wrapper.
11 select_dict: Dictionary in the same format as select().
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.
18 return select_dict.get(bazel_condition, select_dict[default_condition])
20 return select(select_dict)
22 def skia_select(conditions, results):
23 """Replaces select() for conditions [UNIX, ANDROID, IOS]
26 conditions: [CONDITION_UNIX, CONDITION_ANDROID, CONDITION_IOS]
27 results: [RESULT_UNIX, RESULT_ANDROID, RESULT_IOS]
29 The result matching the platform condition.
31 if len(conditions) != 3 or len(results) != 3:
32 fail("Must provide exactly 3 conditions and 3 results")
36 selector[conditions[i]] = results[i]
37 return portable_select(selector, conditions[2], conditions[0])
40 """Replaces glob() with a version that accepts a struct.
43 srcs: struct(include=[], exclude=[])
45 Equivalent of glob(srcs.include, exclude=srcs.exclude)
47 if hasattr(srcs, 'include'):
48 if hasattr(srcs, 'exclude'):
49 return native.glob(srcs.include, exclude=srcs.exclude)
51 return native.glob(srcs.include)
54 ################################################################################
56 ################################################################################
58 PRIVATE_HDRS_INCLUDE_LIST = [
59 "include/private/**/*.h",
63 PRIVATE_HDRS = struct(
64 include = PRIVATE_HDRS_INCLUDE_LIST,
74 ################################################################################
76 ################################################################################
78 # All platform-independent SRCS.
79 BASE_SRCS_ALL = struct(
85 "third_party/etc1/*.cpp",
86 "third_party/etc1/*.h",
87 "third_party/ktx/*.cpp",
88 "third_party/ktx/*.h",
90 # 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 + [
94 # Exclude platform-dependent files.
97 "src/device/xps/*", # Windows-only. Move to ports?
98 "src/doc/*_XPS.cpp", # Windows-only. Move to ports?
99 "src/gpu/gl/android/*",
109 "src/utils/android/**/*",
110 "src/utils/mac/**/*",
111 "src/utils/SkThreadUtils_win.cpp", # Windows-only. Move to ports?
112 "src/utils/win/**/*",
117 # Exclude multiple definitions.
118 # TODO(mtklein): Move to opts?
119 "src/pdf/SkDocument_PDF_None.cpp", # We use src/pdf/SkPDFDocument.cpp.
120 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
121 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
122 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
124 # Exclude files that don't compile with the current DEFINES.
125 "src/gpu/gl/mesa/*", # Requires SK_MESA define.
126 "src/svg/**/*", # Depends on XML.
129 # Conflicting dependencies among Lua versions. See cl/107087297.
135 # Currently exclude all vulkan specific files
141 # Platform-dependent SRCS for google3-default platform.
142 BASE_SRCS_UNIX = struct(
146 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
150 "src/ports/**/*.cpp",
158 # Included in :opts_ssse3 library.
161 # Included in :opts_sse4 library.
164 # Included in :opts_avx or :opts_avx2
166 "src/opts/SkBitmapProcState_opts_none.cpp",
167 "src/opts/SkBlitMask_opts_none.cpp",
168 "src/opts/SkBlitRow_opts_none.cpp",
171 "src/ports/*android*",
172 "src/ports/*chromium*",
174 "src/ports/*mozalloc*",
177 "src/ports/SkFontConfigInterface_direct_factory.cpp",
178 "src/ports/SkFontMgr_custom_directory_factory.cpp",
179 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
180 "src/ports/SkFontMgr_custom_empty_factory.cpp",
181 "src/ports/SkFontMgr_empty_factory.cpp",
182 "src/ports/SkFontMgr_fontconfig.cpp",
183 "src/ports/SkFontMgr_fontconfig_factory.cpp",
184 "src/ports/SkImageEncoder_none.cpp",
185 "src/ports/SkImageGenerator_none.cpp",
186 "src/ports/SkTLS_none.cpp",
190 # Platform-dependent SRCS for google3-default Android.
191 BASE_SRCS_ANDROID = struct(
195 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
197 # TODO(benjaminwagner): Figure out how to compile with EGL.
200 "src/ports/**/*.cpp",
212 "src/opts/SkBitmapProcState_opts_none.cpp",
213 "src/opts/SkBlitMask_opts_none.cpp",
214 "src/opts/SkBlitRow_opts_none.cpp",
216 "src/ports/*FontConfig*",
218 "src/ports/*chromium*",
219 "src/ports/*fontconfig*",
221 "src/ports/*mozalloc*",
224 "src/ports/SkDebug_stdio.cpp",
225 "src/ports/SkFontMgr_custom_directory_factory.cpp",
226 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
227 "src/ports/SkFontMgr_custom_empty_factory.cpp",
228 "src/ports/SkFontMgr_empty_factory.cpp",
229 "src/ports/SkImageEncoder_none.cpp",
230 "src/ports/SkImageGenerator_none.cpp",
231 "src/ports/SkTLS_none.cpp",
235 # Platform-dependent SRCS for google3-default iOS.
236 BASE_SRCS_IOS = struct(
240 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
241 "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp",
244 "src/ports/**/*.cpp",
246 "src/utils/mac/*.cpp",
249 "src/codec/*Gif*.cpp",
250 "src/codec/*Ico*.cpp",
251 "src/codec/*Jpeg*.cpp",
252 "src/codec/*Webp*.cpp",
254 "src/codec/*Raw*.cpp",
265 "src/opts/SkBitmapProcState_opts_none.cpp",
266 "src/opts/SkBlitMask_opts_arm*.cpp",
267 "src/opts/SkBlitRow_opts_arm*.cpp",
269 "src/ports/*FontConfig*",
270 "src/ports/*FreeType*",
272 "src/ports/*android*",
273 "src/ports/*chromium*",
274 "src/ports/*fontconfig*",
275 "src/ports/*mozalloc*",
278 "src/ports/SkFontMgr_custom.cpp",
279 "src/ports/SkFontMgr_custom_directory_factory.cpp",
280 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
281 "src/ports/SkFontMgr_custom_empty_factory.cpp",
282 "src/ports/SkFontMgr_empty_factory.cpp",
283 "src/ports/SkImageGenerator_none.cpp",
284 "src/ports/SkTLS_none.cpp",
288 ################################################################################
289 ## SSSE3/SSE4/AVX/AVX2 SRCS
290 ################################################################################
294 "src/opts/*SSSE3*.cpp",
295 "src/opts/*ssse3*.cpp",
301 "src/opts/*SSE4*.cpp",
302 "src/opts/*sse4*.cpp",
308 "src/opts/*_avx.cpp",
314 "src/opts/*_avx2.cpp",
318 ################################################################################
320 ################################################################################
326 exclude = PRIVATE_HDRS_INCLUDE_LIST + [
328 "include/animator/**/*",
329 "include/views/**/*",
333 ################################################################################
335 ################################################################################
346 BASE_DEPS_ANDROID = []
350 ################################################################################
352 ################################################################################
354 # Includes needed by Skia implementation. Not public includes.
358 "include/client/android",
388 ################################################################################
390 ################################################################################
392 DM_SRCS_ALL = struct(
401 "tools/BigPathBench.inc",
402 "tools/CrashHandler.cpp",
403 "tools/CrashHandler.h",
404 "tools/ProcStats.cpp",
406 "tools/Resources.cpp",
409 "tools/UrlDataManager.cpp",
410 "tools/UrlDataManager.h",
411 "tools/debugger/*.cpp",
412 "tools/debugger/*.h",
415 "tools/gpu/**/*.cpp",
417 "tools/picture_utils.cpp",
418 "tools/picture_utils.h",
419 "tools/random_parse_path.cpp",
420 "tools/random_parse_path.h",
421 "tools/sk_tool_utils.cpp",
422 "tools/sk_tool_utils.h",
423 "tools/sk_tool_utils_flags.h",
424 "tools/sk_tool_utils_font.cpp",
425 "tools/test_font_monospace.inc",
426 "tools/test_font_sans_serif.inc",
427 "tools/test_font_serif.inc",
428 "tools/test_font_index.inc",
433 "dm/DMSrcSinkAndroid.cpp", # Android-only.
434 "tests/FontMgrAndroidParserTest.cpp", # Android-only.
435 "tests/PathOpsSkpClipTest.cpp", # Alternate main.
436 "tests/skia_test.cpp", # Old main.
437 "tests/SkpSkGrTest.cpp", # Alternate main.
438 "tests/SkSL*.cpp", # Excluded along with Vulkan.
439 "tests/SVGDeviceTest.cpp",
440 "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/*",
448 "tools/timer/SysTimer_mach.cpp",
449 "tools/timer/SysTimer_windows.cpp",
453 DM_SRCS_UNIX = struct(
455 "tools/gpu/gl/CreatePlatformGLContext_none.cpp",
459 DM_SRCS_ANDROID = struct(
461 # Depends on Android HWUI library that is not available in google3.
462 #"dm/DMSrcSinkAndroid.cpp",
463 "tests/FontMgrAndroidParserTest.cpp",
464 # TODO(benjaminwagner): Figure out how to compile with EGL.
465 "tools/gpu/gl/CreatePlatformGLContext_none.cpp",
469 DM_SRCS_IOS = struct(
471 "tools/gpu/iOS/CreatePlatformGLContext_iOS.cpp",
475 ################################################################################
477 ################################################################################
484 "src/effects/gradients",
497 ################################################################################
499 ################################################################################
501 def 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?
513 "~RecordDraw_TextBounds",
519 # Running all sources and configs under ASAN causes the test to exceed
520 # "large" size and time out.
521 source = ["tests", "gm"]
526 "~gradients_2pt_conical",
531 "~PathOpsOpCubicsThreaded",
532 "~PathOpsOpLoopsThreaded",
534 "~PathOpsTightBoundsQuads",
536 "~sk_linear_to_srgb",
539 "--src %s" % " ".join(source),
540 "--config %s" % " ".join(config),
542 "--match %s" % " ".join(match),
543 "--resourcePath %s/resources" % base_dir,
544 "--images %s/resources" % base_dir,
547 ################################################################################
549 ################################################################################
552 "-Wno-implicit-fallthrough", # Some intentional fallthrough.
553 "-Wno-deprecated-declarations", # Internal use of deprecated methods. :(
556 COPTS_ANDROID = ["-mfpu=neon"]
562 ################################################################################
564 ################################################################################
567 "PNG_SKIP_SETJMP_CHECK",
570 "SK_SFNTLY_SUBSETTER",
571 "SK_CODEC_DECODES_RAW",
572 "SK_HAS_GIF_LIBRARY",
573 "SK_HAS_JPEG_LIBRARY",
574 "SK_HAS_PNG_LIBRARY",
575 "SK_HAS_WEBP_LIBRARY",
579 "SK_BUILD_FOR_ANDROID",
580 "SK_CODEC_DECODES_RAW",
581 "SK_HAS_GIF_LIBRARY",
582 "SK_HAS_JPEG_LIBRARY",
583 "SK_HAS_PNG_LIBRARY",
584 "SK_HAS_WEBP_LIBRARY",
590 "SK_IGNORE_ETC1_SUPPORT",
597 "SK_USE_FREETYPE_EMBOLDEN",
598 # Turn on a few Google3-specific build fixes.
600 # Staging flags for API changes
601 "SK_SUPPORT_LEGACY_ACCESSBITMAP",
602 "SK_SUPPORT_LEGACY_BITMAP_GETTEXTURE",
603 "SK_SUPPORT_LEGACY_COLORFILTER_PTR",
604 "SK_SUPPORT_LEGACY_CREATESHADER_PTR",
605 "SK_SUPPORT_LEGACY_IMAGEFACTORY",
606 "SK_SUPPORT_LEGACY_IMAGEFILTER_PTR",
607 "SK_SUPPORT_LEGACY_MASKFILTER_PTR",
608 "SK_SUPPORT_LEGACY_MINOR_EFFECT_PTR",
609 "SK_SUPPORT_LEGACY_NEW_SURFACE_API",
610 "SK_SUPPORT_LEGACY_PATHEFFECT_PTR",
611 "SK_SUPPORT_LEGACY_PICTURE_PTR",
612 "SK_SUPPORT_LEGACY_TYPEFACE_PTR",
613 "SK_SUPPORT_LEGACY_XFERMODE_PTR",
614 "SK_SUPPORT_LEGACY_PICTUREINSTALLPIXELREF",
617 ################################################################################
619 ################################################################################