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
139 "src/sksl/SkSLMain.cpp",
143 # Platform-dependent SRCS for google3-default platform.
144 BASE_SRCS_UNIX = struct(
148 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
152 "src/ports/**/*.cpp",
160 # Included in :opts_ssse3 library.
163 # Included in :opts_sse4 library.
166 # Included in :opts_avx or :opts_hsw
169 "src/opts/SkBitmapProcState_opts_none.cpp",
170 "src/opts/SkBlitMask_opts_none.cpp",
171 "src/opts/SkBlitRow_opts_none.cpp",
174 "src/ports/*android*",
175 "src/ports/*chromium*",
177 "src/ports/*mozalloc*",
180 "src/ports/SkFontConfigInterface_direct_factory.cpp",
181 "src/ports/SkFontMgr_custom_directory_factory.cpp",
182 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
183 "src/ports/SkFontMgr_custom_empty_factory.cpp",
184 "src/ports/SkFontMgr_empty_factory.cpp",
185 "src/ports/SkFontMgr_fontconfig.cpp",
186 "src/ports/SkFontMgr_fontconfig_factory.cpp",
187 "src/ports/SkImageEncoder_none.cpp",
188 "src/ports/SkImageGenerator_none.cpp",
189 "src/ports/SkTLS_none.cpp",
193 # Platform-dependent SRCS for google3-default Android.
194 BASE_SRCS_ANDROID = struct(
198 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
200 # TODO(benjaminwagner): Figure out how to compile with EGL.
203 "src/ports/**/*.cpp",
215 "src/opts/SkBitmapProcState_opts_none.cpp",
216 "src/opts/SkBlitMask_opts_none.cpp",
217 "src/opts/SkBlitRow_opts_none.cpp",
219 "src/ports/*FontConfig*",
221 "src/ports/*chromium*",
222 "src/ports/*fontconfig*",
224 "src/ports/*mozalloc*",
227 "src/ports/SkDebug_stdio.cpp",
228 "src/ports/SkFontMgr_custom_directory_factory.cpp",
229 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
230 "src/ports/SkFontMgr_custom_empty_factory.cpp",
231 "src/ports/SkFontMgr_empty_factory.cpp",
232 "src/ports/SkImageEncoder_none.cpp",
233 "src/ports/SkImageGenerator_none.cpp",
234 "src/ports/SkTLS_none.cpp",
238 # Platform-dependent SRCS for google3-default iOS.
239 BASE_SRCS_IOS = struct(
243 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
244 "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp",
247 "src/ports/**/*.cpp",
249 "src/utils/mac/*.cpp",
252 "src/codec/*Gif*.cpp",
253 "src/codec/*Ico*.cpp",
254 "src/codec/*Jpeg*.cpp",
255 "src/codec/*Webp*.cpp",
257 "src/codec/*Raw*.cpp",
268 "src/opts/SkBitmapProcState_opts_none.cpp",
269 "src/opts/SkBlitMask_opts_arm*.cpp",
270 "src/opts/SkBlitRow_opts_arm*.cpp",
272 "src/ports/*FontConfig*",
273 "src/ports/*FreeType*",
275 "src/ports/*android*",
276 "src/ports/*chromium*",
277 "src/ports/*fontconfig*",
278 "src/ports/*mozalloc*",
281 "src/ports/SkFontMgr_custom.cpp",
282 "src/ports/SkFontMgr_custom_directory_factory.cpp",
283 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
284 "src/ports/SkFontMgr_custom_empty_factory.cpp",
285 "src/ports/SkFontMgr_empty_factory.cpp",
286 "src/ports/SkImageGenerator_none.cpp",
287 "src/ports/SkTLS_none.cpp",
291 ################################################################################
292 ## SSSE3/SSE4/AVX/HSW SRCS
293 ################################################################################
297 "src/opts/*SSSE3*.cpp",
298 "src/opts/*ssse3*.cpp",
304 "src/opts/*SSE4*.cpp",
305 "src/opts/*sse4*.cpp",
311 "src/opts/*_avx.cpp",
317 "src/opts/*_hsw.cpp",
321 ################################################################################
323 ################################################################################
329 exclude = PRIVATE_HDRS_INCLUDE_LIST + [
331 "include/animator/**/*",
332 "include/views/**/*",
336 ################################################################################
338 ################################################################################
349 BASE_DEPS_ANDROID = []
353 ################################################################################
355 ################################################################################
357 # Includes needed by Skia implementation. Not public includes.
361 "include/client/android",
392 ################################################################################
394 ################################################################################
396 DM_SRCS_ALL = struct(
405 "tools/BigPathBench.inc",
406 "tools/CrashHandler.cpp",
407 "tools/CrashHandler.h",
408 "tools/ProcStats.cpp",
410 "tools/Resources.cpp",
413 "tools/UrlDataManager.cpp",
414 "tools/UrlDataManager.h",
415 "tools/debugger/*.cpp",
416 "tools/debugger/*.h",
419 "tools/gpu/**/*.cpp",
421 "tools/picture_utils.cpp",
422 "tools/picture_utils.h",
423 "tools/random_parse_path.cpp",
424 "tools/random_parse_path.h",
425 "tools/sk_tool_utils.cpp",
426 "tools/sk_tool_utils.h",
427 "tools/sk_tool_utils_flags.h",
428 "tools/sk_tool_utils_font.cpp",
429 "tools/test_font_monospace.inc",
430 "tools/test_font_sans_serif.inc",
431 "tools/test_font_serif.inc",
432 "tools/test_font_index.inc",
437 "dm/DMSrcSinkAndroid.cpp", # Android-only.
438 "tests/FontMgrAndroidParserTest.cpp", # Android-only.
439 "tests/PathOpsSkpClipTest.cpp", # Alternate main.
440 "tests/skia_test.cpp", # Old main.
441 "tests/SkpSkGrTest.cpp", # Alternate main.
442 "tests/SVGDeviceTest.cpp",
443 "tools/gpu/gl/angle/*",
444 "tools/gpu/gl/egl/*",
445 "tools/gpu/gl/glx/*",
446 "tools/gpu/gl/iOS/*",
447 "tools/gpu/gl/mac/*",
448 "tools/gpu/gl/mesa/*",
449 "tools/gpu/gl/win/*",
450 "tools/timer/SysTimer_mach.cpp",
451 "tools/timer/SysTimer_windows.cpp",
455 DM_SRCS_UNIX = struct(
457 "tools/gpu/gl/CreatePlatformGLContext_none.cpp",
461 DM_SRCS_ANDROID = struct(
463 # Depends on Android HWUI library that is not available in google3.
464 #"dm/DMSrcSinkAndroid.cpp",
465 "tests/FontMgrAndroidParserTest.cpp",
466 # TODO(benjaminwagner): Figure out how to compile with EGL.
467 "tools/gpu/gl/CreatePlatformGLContext_none.cpp",
471 DM_SRCS_IOS = struct(
473 "tools/gpu/iOS/CreatePlatformGLContext_iOS.cpp",
477 ################################################################################
479 ################################################################################
486 "src/effects/gradients",
499 ################################################################################
501 ################################################################################
503 def DM_ARGS(base_dir, asan):
504 source = ["tests", "gm", "image"]
505 # TODO(benjaminwagner): f16 and serialize-8888 fail.
506 config = ["565", "8888", "pdf", "srgb", "tiles_rt", "pic"]
507 # TODO(mtklein): maybe investigate why these fail?
515 "~RecordDraw_TextBounds",
521 # Running all sources and configs under ASAN causes the test to exceed
522 # "large" size and time out.
523 source = ["tests", "gm"]
528 "~gradients_2pt_conical",
533 "~PathOpsOpCubicsThreaded",
534 "~PathOpsOpLoopsThreaded",
536 "~PathOpsTightBoundsQuads",
538 "~sk_linear_to_srgb",
541 "--src %s" % " ".join(source),
542 "--config %s" % " ".join(config),
544 "--match %s" % " ".join(match),
545 "--resourcePath %s/resources" % base_dir,
546 "--images %s/resources" % base_dir,
549 ################################################################################
551 ################################################################################
554 "-Wno-implicit-fallthrough", # Some intentional fallthrough.
555 "-Wno-deprecated-declarations", # Internal use of deprecated methods. :(
558 COPTS_ANDROID = ["-mfpu=neon"]
564 ################################################################################
566 ################################################################################
569 "PNG_SKIP_SETJMP_CHECK",
573 "SK_CODEC_DECODES_RAW",
574 "SK_HAS_GIF_LIBRARY",
575 "SK_HAS_JPEG_LIBRARY",
576 "SK_HAS_PNG_LIBRARY",
577 "SK_HAS_WEBP_LIBRARY",
581 "SK_BUILD_FOR_ANDROID",
582 "SK_CODEC_DECODES_RAW",
583 "SK_HAS_GIF_LIBRARY",
584 "SK_HAS_JPEG_LIBRARY",
585 "SK_HAS_PNG_LIBRARY",
586 "SK_HAS_WEBP_LIBRARY",
592 "SK_IGNORE_ETC1_SUPPORT",
599 "SK_USE_FREETYPE_EMBOLDEN",
600 # Turn on a few Google3-specific build fixes.
602 # Staging flags for API changes
603 "SK_SUPPORT_LEGACY_ACCESSBITMAP",
604 "SK_SUPPORT_LEGACY_ARITHMETICMODE",
605 "SK_SUPPORT_LEGACY_COLORFILTER_PTR",
606 "SK_SUPPORT_LEGACY_CREATESHADER_PTR",
607 "SK_SUPPORT_LEGACY_IMAGEFACTORY",
608 "SK_SUPPORT_LEGACY_IMAGEFILTER_PTR",
609 "SK_SUPPORT_LEGACY_MASKFILTER_PTR",
610 "SK_SUPPORT_LEGACY_MINOR_EFFECT_PTR",
611 "SK_SUPPORT_LEGACY_NEW_SURFACE_API",
612 "SK_SUPPORT_LEGACY_PATHEFFECT_PTR",
613 "SK_SUPPORT_LEGACY_PICTURE_PTR",
614 "SK_SUPPORT_LEGACY_TYPEFACE_PTR",
615 "SK_SUPPORT_LEGACY_XFERMODE_PTR",
616 "SK_SUPPORT_LEGACY_PICTUREINSTALLPIXELREF",
617 "SK_SUPPORT_LEGACY_STREAM_DATA",
618 "SK_SUPPORT_LEGACY_TEXTBLOB_BUILDER",
619 "SK_SUPPORT_LEGACY_CLIP_REGIONOPS",
620 "SK_SUPPORT_LEGACY_SHADER_ISABITMAP",
621 "SK_SUPPORT_LEGACY_XFERMODE_OBJECT",
624 ################################################################################
626 ################################################################################