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/*",
112 "src/utils/android/**/*",
113 "src/utils/mac/**/*",
114 "src/utils/SkThreadUtils_win.cpp", # Windows-only. Move to ports?
115 "src/utils/win/**/*",
120 # Exclude multiple definitions.
121 # TODO(mtklein): Move to opts?
122 "src/pdf/SkDocument_PDF_None.cpp", # We use src/pdf/SkPDFDocument.cpp.
123 "src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
124 "src/gpu/gl/GrGLDefaultInterface_native.cpp",
125 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
127 # Exclude files that don't compile with the current DEFINES.
128 "src/gpu/gl/mesa/*", # Requires SK_MESA define.
129 "src/svg/**/*", # Depends on XML.
132 # Conflicting dependencies among Lua versions. See cl/107087297.
138 # Currently exclude all vulkan specific files
142 "src/sksl/SkSLMain.cpp",
146 # Platform-dependent SRCS for google3-default platform.
147 BASE_SRCS_UNIX = struct(
151 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
155 "src/ports/**/*.cpp",
163 # Included in :opts_ssse3 library.
166 # Included in :opts_sse4 library.
169 # Included in :opts_avx or :opts_hsw
172 "src/opts/SkBitmapProcState_opts_none.cpp",
173 "src/opts/SkBlitMask_opts_none.cpp",
174 "src/opts/SkBlitRow_opts_none.cpp",
177 "src/ports/*android*",
178 "src/ports/*chromium*",
180 "src/ports/*mozalloc*",
183 "src/ports/SkFontMgr_custom_directory_factory.cpp",
184 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
185 "src/ports/SkFontMgr_custom_empty_factory.cpp",
186 "src/ports/SkFontMgr_empty_factory.cpp",
187 "src/ports/SkFontMgr_fontconfig.cpp",
188 "src/ports/SkFontMgr_fontconfig_factory.cpp",
189 "src/ports/SkImageEncoder_none.cpp",
190 "src/ports/SkImageGenerator_none.cpp",
191 "src/ports/SkTLS_none.cpp",
195 # Platform-dependent SRCS for google3-default Android.
196 BASE_SRCS_ANDROID = struct(
200 "src/gpu/gl/GrGLDefaultInterface_none.cpp",
202 # TODO(benjaminwagner): Figure out how to compile with EGL.
205 "src/ports/**/*.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/SkBlitMask_opts_arm*.cpp",
269 "src/opts/SkBlitRow_opts_arm*.cpp",
271 "src/ports/*FontConfig*",
272 "src/ports/*FreeType*",
274 "src/ports/*android*",
275 "src/ports/*chromium*",
276 "src/ports/*fontconfig*",
277 "src/ports/*mozalloc*",
280 "src/ports/SkFontMgr_custom.cpp",
281 "src/ports/SkFontMgr_custom_directory_factory.cpp",
282 "src/ports/SkFontMgr_custom_embedded_factory.cpp",
283 "src/ports/SkFontMgr_custom_empty_factory.cpp",
284 "src/ports/SkFontMgr_empty_factory.cpp",
285 "src/ports/SkImageGenerator_none.cpp",
286 "src/ports/SkTLS_none.cpp",
290 ################################################################################
291 ## SSSE3/SSE4/AVX/HSW SRCS
292 ################################################################################
296 "src/opts/*SSSE3*.cpp",
297 "src/opts/*ssse3*.cpp",
303 "src/opts/*SSE4*.cpp",
304 "src/opts/*sse4*.cpp",
310 "src/opts/*_avx.cpp",
316 "src/opts/*_hsw.cpp",
320 ################################################################################
322 ################################################################################
328 exclude = PRIVATE_HDRS_INCLUDE_LIST + [
330 "include/views/**/*",
334 ################################################################################
336 ################################################################################
347 BASE_DEPS_ANDROID = []
351 ################################################################################
353 ################################################################################
355 # Includes needed by Skia implementation. Not public includes.
359 "include/client/android",
391 ################################################################################
393 ################################################################################
395 DM_SRCS_ALL = struct(
404 "tools/BigPathBench.inc",
405 "tools/CrashHandler.cpp",
406 "tools/CrashHandler.h",
407 "tools/ProcStats.cpp",
409 "tools/Resources.cpp",
412 "tools/UrlDataManager.cpp",
413 "tools/UrlDataManager.h",
414 "tools/debugger/*.cpp",
415 "tools/debugger/*.h",
418 "tools/gpu/**/*.cpp",
420 "tools/picture_utils.cpp",
421 "tools/picture_utils.h",
422 "tools/random_parse_path.cpp",
423 "tools/random_parse_path.h",
424 "tools/sk_tool_utils.cpp",
425 "tools/sk_tool_utils.h",
426 "tools/sk_tool_utils_flags.h",
427 "tools/sk_tool_utils_font.cpp",
428 "tools/test_font_monospace.inc",
429 "tools/test_font_sans_serif.inc",
430 "tools/test_font_serif.inc",
431 "tools/test_font_index.inc",
436 "tests/FontMgrAndroidParserTest.cpp", # Android-only.
437 "tests/skia_test.cpp", # Old main.
438 "tests/SkpSkGrTest.cpp", # Alternate main.
439 "tests/SVGDeviceTest.cpp",
440 "tools/gpu/gl/angle/*",
441 "tools/gpu/gl/egl/*",
442 "tools/gpu/gl/glx/*",
443 "tools/gpu/gl/iOS/*",
444 "tools/gpu/gl/mac/*",
445 "tools/gpu/gl/mesa/*",
446 "tools/gpu/gl/win/*",
447 "tools/timer/SysTimer_mach.cpp",
448 "tools/timer/SysTimer_windows.cpp",
452 DM_SRCS_UNIX = struct(
454 "tools/gpu/gl/CreatePlatformGLContext_none.cpp",
458 DM_SRCS_ANDROID = struct(
460 "tests/FontMgrAndroidParserTest.cpp",
461 # TODO(benjaminwagner): Figure out how to compile with EGL.
462 "tools/gpu/gl/CreatePlatformGLContext_none.cpp",
466 DM_SRCS_IOS = struct(
468 "tools/gpu/iOS/CreatePlatformGLContext_iOS.cpp",
472 ################################################################################
474 ################################################################################
481 "src/effects/gradients",
495 ################################################################################
497 ################################################################################
500 source = ["tests", "gm", "image"]
501 # TODO(benjaminwagner): f16 and serialize-8888 fail.
502 config = ["565", "8888", "pdf", "srgb", "tiles_rt", "pic"]
503 # TODO(mtklein): maybe investigate why these fail?
511 "~RecordDraw_TextBounds",
517 # The ASAN we use with Bazel has some strict checks, so omit tests that
527 "~PathOpsOpCubicsThreaded",
528 "~PathOpsOpLoopsThreaded",
530 "~PathOpsTightBoundsQuads",
532 "~sk_linear_to_srgb",
535 return ["--src"] + source + ["--config"] + config + ["--match"] + match
537 ################################################################################
539 ################################################################################
542 "-Wno-implicit-fallthrough", # Some intentional fallthrough.
543 "-Wno-deprecated-declarations", # Internal use of deprecated methods. :(
546 COPTS_ANDROID = ["-mfpu=neon"]
552 ################################################################################
554 ################################################################################
557 "PNG_SKIP_SETJMP_CHECK",
561 "SK_CODEC_DECODES_RAW",
562 "SK_HAS_JPEG_LIBRARY",
563 "SK_HAS_PNG_LIBRARY",
564 "SK_HAS_WEBP_LIBRARY",
568 "SK_BUILD_FOR_ANDROID",
569 "SK_CODEC_DECODES_RAW",
570 "SK_HAS_JPEG_LIBRARY",
571 "SK_HAS_PNG_LIBRARY",
572 "SK_HAS_WEBP_LIBRARY",
578 "SK_IGNORE_ETC1_SUPPORT",
585 "SK_USE_FREETYPE_EMBOLDEN",
586 # Turn on a few Google3-specific build fixes.
588 # Staging flags for API changes
589 # Temporarily Disable analytic AA for Google3
591 "SK_SUPPORT_LEGACY_BITMAP_SETPIXELREF",
592 "SK_SUPPORT_LEGACY_CLIPOP_EXOTIC_NAMES",
593 "SK_SUPPORT_LEGACY_CANVAS_GETCLIPSTACK",
596 ################################################################################
598 ################################################################################