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/gif/*.cpp",
88 "third_party/gif/*.h",
89 "third_party/ktx/*.cpp",
90 "third_party/ktx/*.h",
92 # Note: PRIVATE_HDRS_INCLUDE_LIST is excluded from BASE_SRCS_ALL here
93 # because they are required to appear in srcs for some rules but hdrs for
94 # other rules. See internal cl/119566959.
95 exclude = PRIVATE_HDRS_INCLUDE_LIST + [
96 # Exclude platform-dependent files.
99 "src/device/xps/*", # Windows-only. Move to ports?
100 "src/doc/*_XPS.cpp", # Windows-only. Move to ports?
101 "src/gpu/gl/android/*",
111 "src/utils/android/**/*",
112 "src/utils/mac/**/*",
113 "src/utils/SkThreadUtils_win.cpp", # Windows-only. Move to ports?
114 "src/utils/win/**/*",
119 # Exclude multiple definitions.
120 # TODO(mtklein): Move to opts?
121 "src/pdf/SkDocument_PDF_None.cpp", # We use src/pdf/SkPDFDocument.cpp.
122 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
123 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
124 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
126 # Exclude files that don't compile with the current DEFINES.
127 "src/gpu/gl/mesa/*", # Requires SK_MESA define.
128 "src/svg/**/*", # Depends on XML.
131 # Conflicting dependencies among Lua versions. See cl/107087297.
137 # Currently exclude all vulkan specific files
141 "src/sksl/SkSLMain.cpp",
145 # Platform-dependent SRCS for google3-default platform.
146 BASE_SRCS_UNIX = struct(
150 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
154 "src/ports/**/*.cpp",
162 # Included in :opts_ssse3 library.
165 # Included in :opts_sse4 library.
168 # Included in :opts_avx or :opts_hsw
171 "src/opts/SkBitmapProcState_opts_none.cpp",
172 "src/opts/SkBlitMask_opts_none.cpp",
173 "src/opts/SkBlitRow_opts_none.cpp",
176 "src/ports/*android*",
177 "src/ports/*chromium*",
179 "src/ports/*mozalloc*",
182 "src/ports/SkFontMgr_custom_directory_factory.cpp",
183 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
184 "src/ports/SkFontMgr_custom_empty_factory.cpp",
185 "src/ports/SkFontMgr_empty_factory.cpp",
186 "src/ports/SkFontMgr_fontconfig.cpp",
187 "src/ports/SkFontMgr_fontconfig_factory.cpp",
188 "src/ports/SkImageEncoder_none.cpp",
189 "src/ports/SkImageGenerator_none.cpp",
190 "src/ports/SkTLS_none.cpp",
194 # Platform-dependent SRCS for google3-default Android.
195 BASE_SRCS_ANDROID = struct(
199 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
201 # TODO(benjaminwagner): Figure out how to compile with EGL.
204 "src/ports/**/*.cpp",
216 "src/opts/SkBitmapProcState_opts_none.cpp",
217 "src/opts/SkBlitMask_opts_none.cpp",
218 "src/opts/SkBlitRow_opts_none.cpp",
220 "src/ports/*FontConfig*",
222 "src/ports/*chromium*",
223 "src/ports/*fontconfig*",
225 "src/ports/*mozalloc*",
228 "src/ports/SkDebug_stdio.cpp",
229 "src/ports/SkFontMgr_custom_directory_factory.cpp",
230 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
231 "src/ports/SkFontMgr_custom_empty_factory.cpp",
232 "src/ports/SkFontMgr_empty_factory.cpp",
233 "src/ports/SkImageEncoder_none.cpp",
234 "src/ports/SkImageGenerator_none.cpp",
235 "src/ports/SkTLS_none.cpp",
239 # Platform-dependent SRCS for google3-default iOS.
240 BASE_SRCS_IOS = struct(
244 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
245 "src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp",
248 "src/ports/**/*.cpp",
250 "src/utils/mac/*.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",
393 ################################################################################
395 ################################################################################
397 DM_SRCS_ALL = struct(
406 "tools/BigPathBench.inc",
407 "tools/CrashHandler.cpp",
408 "tools/CrashHandler.h",
409 "tools/ProcStats.cpp",
411 "tools/Resources.cpp",
414 "tools/UrlDataManager.cpp",
415 "tools/UrlDataManager.h",
416 "tools/debugger/*.cpp",
417 "tools/debugger/*.h",
420 "tools/gpu/**/*.cpp",
422 "tools/picture_utils.cpp",
423 "tools/picture_utils.h",
424 "tools/random_parse_path.cpp",
425 "tools/random_parse_path.h",
426 "tools/sk_tool_utils.cpp",
427 "tools/sk_tool_utils.h",
428 "tools/sk_tool_utils_flags.h",
429 "tools/sk_tool_utils_font.cpp",
430 "tools/test_font_monospace.inc",
431 "tools/test_font_sans_serif.inc",
432 "tools/test_font_serif.inc",
433 "tools/test_font_index.inc",
438 "dm/DMSrcSinkAndroid.cpp", # Android-only.
439 "tests/FontMgrAndroidParserTest.cpp", # Android-only.
440 "tests/PathOpsSkpClipTest.cpp", # Alternate main.
441 "tests/skia_test.cpp", # Old main.
442 "tests/SkpSkGrTest.cpp", # Alternate main.
443 "tests/SVGDeviceTest.cpp",
444 "tools/gpu/gl/angle/*",
445 "tools/gpu/gl/egl/*",
446 "tools/gpu/gl/glx/*",
447 "tools/gpu/gl/iOS/*",
448 "tools/gpu/gl/mac/*",
449 "tools/gpu/gl/mesa/*",
450 "tools/gpu/gl/win/*",
451 "tools/timer/SysTimer_mach.cpp",
452 "tools/timer/SysTimer_windows.cpp",
456 DM_SRCS_UNIX = struct(
458 "tools/gpu/gl/CreatePlatformGLContext_none.cpp",
462 DM_SRCS_ANDROID = struct(
464 # Depends on Android HWUI library that is not available in google3.
465 #"dm/DMSrcSinkAndroid.cpp",
466 "tests/FontMgrAndroidParserTest.cpp",
467 # TODO(benjaminwagner): Figure out how to compile with EGL.
468 "tools/gpu/gl/CreatePlatformGLContext_none.cpp",
472 DM_SRCS_IOS = struct(
474 "tools/gpu/iOS/CreatePlatformGLContext_iOS.cpp",
478 ################################################################################
480 ################################################################################
487 "src/effects/gradients",
500 ################################################################################
502 ################################################################################
504 def DM_ARGS(base_dir, asan):
505 source = ["tests", "gm", "image"]
506 # TODO(benjaminwagner): f16 and serialize-8888 fail.
507 config = ["565", "8888", "pdf", "srgb", "tiles_rt", "pic"]
508 # TODO(mtklein): maybe investigate why these fail?
516 "~RecordDraw_TextBounds",
522 # Running all sources and configs under ASAN causes the test to exceed
523 # "large" size and time out.
524 source = ["tests", "gm"]
529 "~gradients_2pt_conical",
534 "~PathOpsOpCubicsThreaded",
535 "~PathOpsOpLoopsThreaded",
537 "~PathOpsTightBoundsQuads",
539 "~sk_linear_to_srgb",
542 "--src %s" % " ".join(source),
543 "--config %s" % " ".join(config),
545 "--match %s" % " ".join(match),
546 "--resourcePath %s/resources" % base_dir,
547 "--images %s/resources" % base_dir,
550 ################################################################################
552 ################################################################################
555 "-Wno-implicit-fallthrough", # Some intentional fallthrough.
556 "-Wno-deprecated-declarations", # Internal use of deprecated methods. :(
559 COPTS_ANDROID = ["-mfpu=neon"]
565 ################################################################################
567 ################################################################################
570 "PNG_SKIP_SETJMP_CHECK",
574 "SK_CODEC_DECODES_RAW",
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_JPEG_LIBRARY",
584 "SK_HAS_PNG_LIBRARY",
585 "SK_HAS_WEBP_LIBRARY",
591 "SK_IGNORE_ETC1_SUPPORT",
598 "SK_USE_FREETYPE_EMBOLDEN",
599 # Turn on a few Google3-specific build fixes.
601 # Staging flags for API changes
602 "SK_SUPPORT_LEGACY_ACCESSBITMAP",
603 "SK_SUPPORT_LEGACY_CLIP_REGIONOPS",
604 "SK_SUPPORT_LEGACY_XFERMODE_IS_PUBLIC",
605 # Temporarily Disable analytic AA for Google3
609 ################################################################################
611 ################################################################################