2016-01-13 18:45:19 +00:00
|
|
|
################################################################################
|
|
|
|
# Skylark macros
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
is_bazel = not hasattr(native, "genmpm")
|
|
|
|
|
|
|
|
def portable_select(select_dict, bazel_condition, default_condition):
|
|
|
|
"""Replaces select() with a Bazel-friendly wrapper.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
select_dict: Dictionary in the same format as select().
|
|
|
|
Returns:
|
|
|
|
If Blaze platform, returns select() using select_dict.
|
|
|
|
If Bazel platform, returns dependencies for condition
|
|
|
|
bazel_condition, or empty list if none specified.
|
|
|
|
"""
|
|
|
|
if is_bazel:
|
|
|
|
return select_dict.get(bazel_condition, select_dict[default_condition])
|
|
|
|
else:
|
|
|
|
return select(select_dict)
|
|
|
|
|
|
|
|
def skia_select(conditions, results):
|
|
|
|
"""Replaces select() for conditions [UNIX, ANDROID, IOS]
|
|
|
|
|
|
|
|
Args:
|
|
|
|
conditions: [CONDITION_UNIX, CONDITION_ANDROID, CONDITION_IOS]
|
|
|
|
results: [RESULT_UNIX, RESULT_ANDROID, RESULT_IOS]
|
|
|
|
Returns:
|
|
|
|
The result matching the platform condition.
|
|
|
|
"""
|
|
|
|
if len(conditions) != 3 or len(results) != 3:
|
|
|
|
fail("Must provide exactly 3 conditions and 3 results")
|
|
|
|
|
|
|
|
selector = {}
|
|
|
|
for i in range(3):
|
|
|
|
selector[conditions[i]] = results[i]
|
|
|
|
return portable_select(selector, conditions[2], conditions[0])
|
|
|
|
|
|
|
|
def skia_glob(srcs):
|
|
|
|
"""Replaces glob() with a version that accepts a struct.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
srcs: struct(include=[], exclude=[])
|
|
|
|
Returns:
|
|
|
|
Equivalent of glob(srcs.include, exclude=srcs.exclude)
|
|
|
|
"""
|
|
|
|
if hasattr(srcs, 'include'):
|
|
|
|
if hasattr(srcs, 'exclude'):
|
|
|
|
return native.glob(srcs.include, exclude=srcs.exclude)
|
|
|
|
else:
|
|
|
|
return native.glob(srcs.include)
|
|
|
|
return []
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
## BASE_SRCS
|
|
|
|
################################################################################
|
2015-08-17 19:58:10 +00:00
|
|
|
|
2015-11-18 21:26:10 +00:00
|
|
|
# All platform-independent SRCS.
|
2016-01-13 18:45:19 +00:00
|
|
|
BASE_SRCS_ALL = struct(
|
|
|
|
include = [
|
2017-03-16 23:15:09 +00:00
|
|
|
"include/private/**/*.h",
|
2015-10-15 15:09:44 +00:00
|
|
|
"src/**/*.h",
|
|
|
|
"src/**/*.cpp",
|
2017-03-16 23:15:09 +00:00
|
|
|
"src/**/*.inc",
|
2017-03-29 21:32:50 +00:00
|
|
|
"src/jumper/SkJumper_generated.S",
|
2015-08-17 19:58:10 +00:00
|
|
|
|
2015-08-18 15:51:49 +00:00
|
|
|
# Third Party
|
2015-08-17 19:58:10 +00:00
|
|
|
"third_party/etc1/*.cpp",
|
2015-10-15 15:09:44 +00:00
|
|
|
"third_party/etc1/*.h",
|
2016-10-24 18:11:12 +00:00
|
|
|
"third_party/gif/*.cpp",
|
|
|
|
"third_party/gif/*.h",
|
2015-08-17 19:58:10 +00:00
|
|
|
],
|
2017-03-16 23:15:09 +00:00
|
|
|
exclude = [
|
2015-10-15 15:09:44 +00:00
|
|
|
# Exclude platform-dependent files.
|
2016-01-25 19:24:57 +00:00
|
|
|
"src/android/*",
|
2016-01-07 15:11:39 +00:00
|
|
|
"src/codec/*",
|
2015-10-15 15:09:44 +00:00
|
|
|
"src/device/xps/*", # Windows-only. Move to ports?
|
|
|
|
"src/doc/*_XPS.cpp", # Windows-only. Move to ports?
|
|
|
|
"src/gpu/gl/android/*",
|
2015-10-26 17:46:25 +00:00
|
|
|
"src/gpu/gl/egl/*",
|
2016-03-28 20:27:28 +00:00
|
|
|
"src/gpu/gl/glfw/*",
|
2015-10-26 17:46:25 +00:00
|
|
|
"src/gpu/gl/glx/*",
|
2015-10-15 15:09:44 +00:00
|
|
|
"src/gpu/gl/iOS/*",
|
|
|
|
"src/gpu/gl/mac/*",
|
|
|
|
"src/gpu/gl/win/*",
|
|
|
|
"src/opts/**/*",
|
|
|
|
"src/ports/**/*",
|
|
|
|
"src/utils/android/**/*",
|
|
|
|
"src/utils/mac/**/*",
|
|
|
|
"src/utils/SkThreadUtils_win.cpp", # Windows-only. Move to ports?
|
|
|
|
"src/utils/win/**/*",
|
|
|
|
"src/views/sdl/*",
|
|
|
|
"src/views/win/*",
|
|
|
|
"src/views/unix/*",
|
|
|
|
|
|
|
|
# Exclude multiple definitions.
|
|
|
|
# TODO(mtklein): Move to opts?
|
2016-03-14 22:21:12 +00:00
|
|
|
"src/pdf/SkDocument_PDF_None.cpp", # We use src/pdf/SkPDFDocument.cpp.
|
2015-10-26 17:46:25 +00:00
|
|
|
"src/gpu/gl/GrGLCreateNativeInterface_none.cpp",
|
|
|
|
"src/gpu/gl/GrGLDefaultInterface_native.cpp",
|
2016-02-17 20:47:27 +00:00
|
|
|
"src/gpu/gl/GrGLDefaultInterface_none.cpp",
|
2015-10-15 15:09:44 +00:00
|
|
|
|
|
|
|
# Exclude files that don't compile with the current DEFINES.
|
|
|
|
"src/gpu/gl/mesa/*", # Requires SK_MESA define.
|
2016-07-15 18:27:27 +00:00
|
|
|
"src/svg/**/*", # Depends on XML.
|
|
|
|
"src/xml/**/*",
|
2015-10-15 15:09:44 +00:00
|
|
|
|
2015-11-18 21:26:10 +00:00
|
|
|
# Conflicting dependencies among Lua versions. See cl/107087297.
|
|
|
|
"src/utils/SkLua*",
|
|
|
|
|
2015-10-15 15:09:44 +00:00
|
|
|
# Not used.
|
|
|
|
"src/views/**/*",
|
2016-02-22 18:07:54 +00:00
|
|
|
|
|
|
|
# Currently exclude all vulkan specific files
|
|
|
|
"src/gpu/vk/*",
|
2016-09-30 19:06:27 +00:00
|
|
|
|
|
|
|
# Defines main.
|
|
|
|
"src/sksl/SkSLMain.cpp",
|
2017-09-07 15:07:42 +00:00
|
|
|
|
|
|
|
# Only used to regenerate the lexer
|
|
|
|
"src/sksl/lex/*",
|
2015-10-15 15:09:44 +00:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
# Platform-dependent SRCS for google3-default platform.
|
2016-01-13 18:45:19 +00:00
|
|
|
BASE_SRCS_UNIX = struct(
|
|
|
|
include = [
|
2016-01-25 19:24:57 +00:00
|
|
|
"src/android/*",
|
2016-01-07 15:11:39 +00:00
|
|
|
"src/codec/*",
|
2016-02-17 20:47:27 +00:00
|
|
|
"src/gpu/gl/GrGLDefaultInterface_none.cpp",
|
2015-10-15 15:09:44 +00:00
|
|
|
"src/opts/**/*.cpp",
|
|
|
|
"src/opts/**/*.h",
|
|
|
|
"src/ports/**/*.cpp",
|
|
|
|
"src/ports/**/*.h",
|
|
|
|
],
|
|
|
|
exclude = [
|
2017-03-16 23:15:09 +00:00
|
|
|
"src/opts/opts_check_x86.cpp",
|
2015-10-15 15:09:44 +00:00
|
|
|
"src/opts/*arm*",
|
|
|
|
"src/opts/*mips*",
|
|
|
|
"src/opts/*NEON*",
|
|
|
|
"src/opts/*neon*",
|
2017-03-16 23:15:09 +00:00
|
|
|
# Included in :opts_sse2 library.
|
|
|
|
"src/opts/*SSE2*",
|
|
|
|
"src/opts/*sse2*",
|
2015-10-26 17:46:25 +00:00
|
|
|
# Included in :opts_ssse3 library.
|
2015-10-15 15:09:44 +00:00
|
|
|
"src/opts/*SSSE3*",
|
|
|
|
"src/opts/*ssse3*",
|
2015-10-26 17:46:25 +00:00
|
|
|
# Included in :opts_sse4 library.
|
2015-10-15 15:09:44 +00:00
|
|
|
"src/opts/*SSE4*",
|
|
|
|
"src/opts/*sse4*",
|
2016-09-30 15:34:54 +00:00
|
|
|
# Included in :opts_avx or :opts_hsw
|
2015-12-17 18:18:04 +00:00
|
|
|
"src/opts/*avx*",
|
2016-09-30 15:34:54 +00:00
|
|
|
"src/opts/*hsw*",
|
2015-10-15 15:09:44 +00:00
|
|
|
"src/opts/SkBitmapProcState_opts_none.cpp",
|
2015-10-26 17:46:25 +00:00
|
|
|
"src/opts/SkBlitMask_opts_none.cpp",
|
2015-10-15 15:09:44 +00:00
|
|
|
"src/opts/SkBlitRow_opts_none.cpp",
|
2016-03-10 15:15:59 +00:00
|
|
|
"src/ports/*CG*",
|
2016-03-17 20:50:17 +00:00
|
|
|
"src/ports/*WIC*",
|
2016-03-10 16:52:05 +00:00
|
|
|
"src/ports/*android*",
|
2015-10-15 15:09:44 +00:00
|
|
|
"src/ports/*chromium*",
|
|
|
|
"src/ports/*mac*",
|
|
|
|
"src/ports/*mozalloc*",
|
|
|
|
"src/ports/*nacl*",
|
|
|
|
"src/ports/*win*",
|
2015-12-01 19:12:05 +00:00
|
|
|
"src/ports/SkFontMgr_custom_directory_factory.cpp",
|
2015-10-15 15:09:44 +00:00
|
|
|
"src/ports/SkFontMgr_custom_embedded_factory.cpp",
|
2016-03-21 17:45:01 +00:00
|
|
|
"src/ports/SkFontMgr_custom_empty_factory.cpp",
|
2015-10-15 15:09:44 +00:00
|
|
|
"src/ports/SkFontMgr_empty_factory.cpp",
|
2015-12-03 13:04:03 +00:00
|
|
|
"src/ports/SkFontMgr_fontconfig.cpp",
|
2015-12-01 19:12:05 +00:00
|
|
|
"src/ports/SkFontMgr_fontconfig_factory.cpp",
|
2017-02-09 20:28:53 +00:00
|
|
|
"src/ports/SkGlobalInitialization_none.cpp",
|
2015-10-15 15:09:44 +00:00
|
|
|
"src/ports/SkImageGenerator_none.cpp",
|
|
|
|
"src/ports/SkTLS_none.cpp",
|
2015-08-18 15:51:49 +00:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2015-10-26 17:46:25 +00:00
|
|
|
# Platform-dependent SRCS for google3-default Android.
|
2016-01-13 18:45:19 +00:00
|
|
|
BASE_SRCS_ANDROID = struct(
|
|
|
|
include = [
|
2016-01-25 19:24:57 +00:00
|
|
|
"src/android/*",
|
2016-01-07 15:11:39 +00:00
|
|
|
"src/codec/*",
|
2016-02-17 20:47:27 +00:00
|
|
|
"src/gpu/gl/GrGLDefaultInterface_none.cpp",
|
2015-10-26 17:46:25 +00:00
|
|
|
# TODO(benjaminwagner): Figure out how to compile with EGL.
|
|
|
|
"src/opts/**/*.cpp",
|
|
|
|
"src/opts/**/*.h",
|
|
|
|
"src/ports/**/*.cpp",
|
|
|
|
"src/ports/**/*.h",
|
|
|
|
],
|
|
|
|
exclude = [
|
|
|
|
"src/opts/*mips*",
|
|
|
|
"src/opts/*SSE2*",
|
|
|
|
"src/opts/*SSSE3*",
|
|
|
|
"src/opts/*ssse3*",
|
|
|
|
"src/opts/*SSE4*",
|
|
|
|
"src/opts/*sse4*",
|
2015-12-17 18:18:04 +00:00
|
|
|
"src/opts/*avx*",
|
2017-01-26 19:40:53 +00:00
|
|
|
"src/opts/*hsw*",
|
2015-10-26 17:46:25 +00:00
|
|
|
"src/opts/*x86*",
|
|
|
|
"src/opts/SkBlitMask_opts_none.cpp",
|
|
|
|
"src/opts/SkBlitRow_opts_none.cpp",
|
2016-03-10 15:15:59 +00:00
|
|
|
"src/ports/*CG*",
|
2016-03-10 16:52:05 +00:00
|
|
|
"src/ports/*FontConfig*",
|
2016-03-17 20:50:17 +00:00
|
|
|
"src/ports/*WIC*",
|
2015-10-26 17:46:25 +00:00
|
|
|
"src/ports/*chromium*",
|
|
|
|
"src/ports/*fontconfig*",
|
|
|
|
"src/ports/*mac*",
|
|
|
|
"src/ports/*mozalloc*",
|
|
|
|
"src/ports/*nacl*",
|
|
|
|
"src/ports/*win*",
|
|
|
|
"src/ports/SkDebug_stdio.cpp",
|
|
|
|
"src/ports/SkFontMgr_custom_directory_factory.cpp",
|
|
|
|
"src/ports/SkFontMgr_custom_embedded_factory.cpp",
|
2016-03-21 17:45:01 +00:00
|
|
|
"src/ports/SkFontMgr_custom_empty_factory.cpp",
|
2015-10-26 17:46:25 +00:00
|
|
|
"src/ports/SkFontMgr_empty_factory.cpp",
|
2017-02-09 20:28:53 +00:00
|
|
|
"src/ports/SkGlobalInitialization_none.cpp",
|
2015-10-26 17:46:25 +00:00
|
|
|
"src/ports/SkImageGenerator_none.cpp",
|
|
|
|
"src/ports/SkTLS_none.cpp",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2015-11-02 19:11:21 +00:00
|
|
|
# Platform-dependent SRCS for google3-default iOS.
|
2016-01-13 18:45:19 +00:00
|
|
|
BASE_SRCS_IOS = struct(
|
|
|
|
include = [
|
2016-02-17 22:14:25 +00:00
|
|
|
"src/android/*",
|
|
|
|
"src/codec/*",
|
2016-02-17 20:47:27 +00:00
|
|
|
"src/gpu/gl/GrGLDefaultInterface_native.cpp",
|
|
|
|
"src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp",
|
2015-11-02 19:11:21 +00:00
|
|
|
"src/opts/**/*.cpp",
|
|
|
|
"src/opts/**/*.h",
|
|
|
|
"src/ports/**/*.cpp",
|
|
|
|
"src/ports/**/*.h",
|
2016-02-17 03:17:01 +00:00
|
|
|
"src/utils/mac/*.cpp",
|
2015-11-02 19:11:21 +00:00
|
|
|
],
|
|
|
|
exclude = [
|
2016-02-17 22:14:25 +00:00
|
|
|
"src/codec/*Ico*.cpp",
|
|
|
|
"src/codec/*Webp*.cpp",
|
|
|
|
"src/codec/*Png*",
|
|
|
|
"src/codec/*Raw*.cpp",
|
2015-11-02 19:11:21 +00:00
|
|
|
"src/opts/*mips*",
|
|
|
|
"src/opts/*NEON*",
|
|
|
|
"src/opts/*neon*",
|
|
|
|
"src/opts/*SSE2*",
|
|
|
|
"src/opts/*SSSE3*",
|
|
|
|
"src/opts/*ssse3*",
|
|
|
|
"src/opts/*SSE4*",
|
|
|
|
"src/opts/*sse4*",
|
2015-12-17 18:18:04 +00:00
|
|
|
"src/opts/*avx*",
|
2017-01-26 19:40:53 +00:00
|
|
|
"src/opts/*hsw*",
|
2015-11-02 19:11:21 +00:00
|
|
|
"src/opts/*x86*",
|
2016-01-25 19:24:57 +00:00
|
|
|
"src/opts/SkBlitMask_opts_arm*.cpp",
|
|
|
|
"src/opts/SkBlitRow_opts_arm*.cpp",
|
2016-03-10 16:52:05 +00:00
|
|
|
"src/ports/*FontConfig*",
|
|
|
|
"src/ports/*FreeType*",
|
2016-03-17 20:50:17 +00:00
|
|
|
"src/ports/*WIC*",
|
2015-11-02 19:11:21 +00:00
|
|
|
"src/ports/*android*",
|
|
|
|
"src/ports/*chromium*",
|
|
|
|
"src/ports/*fontconfig*",
|
|
|
|
"src/ports/*mozalloc*",
|
|
|
|
"src/ports/*nacl*",
|
|
|
|
"src/ports/*win*",
|
|
|
|
"src/ports/SkFontMgr_custom.cpp",
|
2017-02-08 22:29:33 +00:00
|
|
|
"src/ports/SkFontMgr_custom_directory.cpp",
|
|
|
|
"src/ports/SkFontMgr_custom_embedded.cpp",
|
|
|
|
"src/ports/SkFontMgr_custom_empty.cpp",
|
2015-11-02 19:11:21 +00:00
|
|
|
"src/ports/SkFontMgr_custom_directory_factory.cpp",
|
|
|
|
"src/ports/SkFontMgr_custom_embedded_factory.cpp",
|
2016-03-21 17:45:01 +00:00
|
|
|
"src/ports/SkFontMgr_custom_empty_factory.cpp",
|
2015-11-02 19:11:21 +00:00
|
|
|
"src/ports/SkFontMgr_empty_factory.cpp",
|
2017-02-09 20:28:53 +00:00
|
|
|
"src/ports/SkGlobalInitialization_none.cpp",
|
2015-11-02 19:11:21 +00:00
|
|
|
"src/ports/SkImageGenerator_none.cpp",
|
|
|
|
"src/ports/SkTLS_none.cpp",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2016-01-13 18:45:19 +00:00
|
|
|
################################################################################
|
2017-03-16 23:15:09 +00:00
|
|
|
## skia_{all,public}_hdrs()
|
2016-01-13 18:45:19 +00:00
|
|
|
################################################################################
|
2017-03-16 23:15:09 +00:00
|
|
|
def skia_all_hdrs():
|
|
|
|
return native.glob(["src/**/*.h", "include/**/*.h"])
|
2015-10-26 17:46:25 +00:00
|
|
|
|
2017-03-16 23:15:09 +00:00
|
|
|
def skia_public_hdrs():
|
|
|
|
return native.glob(["include/**/*.h"],
|
|
|
|
exclude=[
|
|
|
|
"include/private/**/*.h",
|
|
|
|
"include/views/**/*", # Not used.
|
|
|
|
])
|
2015-08-18 15:51:49 +00:00
|
|
|
|
2017-03-16 23:15:09 +00:00
|
|
|
################################################################################
|
|
|
|
## skia_opts_srcs()
|
|
|
|
################################################################################
|
|
|
|
# Intel
|
|
|
|
SKIA_OPTS_SSE2 = "SSE2"
|
2015-08-17 19:58:10 +00:00
|
|
|
|
2017-03-16 23:15:09 +00:00
|
|
|
SKIA_OPTS_SSSE3 = "SSSE3"
|
2015-12-17 18:18:04 +00:00
|
|
|
|
2017-03-16 23:15:09 +00:00
|
|
|
SKIA_OPTS_SSE4 = "SSE4"
|
2016-09-30 14:48:01 +00:00
|
|
|
|
2017-03-16 23:15:09 +00:00
|
|
|
SKIA_OPTS_AVX = "AVX"
|
2015-12-17 18:18:04 +00:00
|
|
|
|
2017-03-16 23:15:09 +00:00
|
|
|
SKIA_OPTS_HSW = "HSW"
|
2016-01-13 18:45:19 +00:00
|
|
|
|
2017-03-16 23:15:09 +00:00
|
|
|
# Arm
|
|
|
|
SKIA_OPTS_ARMV7 = "ARMV7"
|
2016-01-13 18:45:19 +00:00
|
|
|
|
2017-03-16 23:15:09 +00:00
|
|
|
SKIA_OPTS_NEON = "NEON"
|
2015-08-17 19:58:10 +00:00
|
|
|
|
2017-03-16 23:15:09 +00:00
|
|
|
SKIA_OPTS_ARM64 = "ARM64"
|
|
|
|
|
|
|
|
SKIA_OPTS_CRC32 = "CRC32" # arm64
|
|
|
|
|
|
|
|
# Other
|
|
|
|
SKIA_OPTS_NONE = "NONE" # not x86, arm, or arm64
|
2015-11-18 21:26:10 +00:00
|
|
|
|
2017-03-16 23:15:09 +00:00
|
|
|
def skia_opts_srcs(opts):
|
|
|
|
if opts == SKIA_OPTS_SSE2:
|
|
|
|
return native.glob([
|
|
|
|
"src/opts/*SSE2*.cpp",
|
|
|
|
"src/opts/*sse2*.cpp",
|
|
|
|
])
|
|
|
|
elif opts == SKIA_OPTS_SSSE3:
|
|
|
|
return native.glob([
|
|
|
|
"src/opts/*SSSE3*.cpp",
|
|
|
|
"src/opts/*ssse3*.cpp",
|
|
|
|
])
|
|
|
|
elif opts == SKIA_OPTS_SSE4:
|
|
|
|
return native.glob([
|
|
|
|
"src/opts/*SSE4*.cpp",
|
|
|
|
"src/opts/*sse4*.cpp",
|
|
|
|
])
|
|
|
|
elif opts == SKIA_OPTS_AVX:
|
|
|
|
return native.glob([
|
|
|
|
"src/opts/*_avx.cpp",
|
|
|
|
])
|
|
|
|
elif opts == SKIA_OPTS_HSW:
|
|
|
|
return native.glob([
|
|
|
|
"src/opts/*_hsw.cpp",
|
|
|
|
])
|
|
|
|
elif opts == SKIA_OPTS_ARMV7:
|
|
|
|
return native.glob([
|
|
|
|
"src/opts/*_arm.cpp",
|
|
|
|
])
|
|
|
|
elif opts == SKIA_OPTS_NEON:
|
|
|
|
return native.glob([
|
|
|
|
"src/opts/*_neon.cpp",
|
|
|
|
])
|
|
|
|
elif opts == SKIA_OPTS_CRC32:
|
|
|
|
return native.glob([
|
|
|
|
"src/opts/*_crc32.cpp",
|
|
|
|
])
|
|
|
|
elif opts == SKIA_OPTS_NONE:
|
|
|
|
return native.glob([
|
|
|
|
"src/opts/*_none.cpp",
|
|
|
|
])
|
|
|
|
else:
|
|
|
|
fail("skia_opts_srcs parameter 'opts' must be one of SKIA_OPTS_*.")
|
|
|
|
|
|
|
|
def skia_opts_cflags(opts):
|
|
|
|
if opts == SKIA_OPTS_SSE2:
|
|
|
|
return ["-msse2"]
|
|
|
|
elif opts == SKIA_OPTS_SSSE3:
|
|
|
|
return ["-mssse3"]
|
|
|
|
elif opts == SKIA_OPTS_SSE4:
|
|
|
|
return ["-msse4"]
|
|
|
|
elif opts == SKIA_OPTS_AVX:
|
|
|
|
return ["-mavx"]
|
|
|
|
elif opts == SKIA_OPTS_HSW:
|
|
|
|
return ["-mavx2", "-mbmi", "-mbmi2", "-mf16c", "-mfma"]
|
|
|
|
elif opts == SKIA_OPTS_CRC32:
|
|
|
|
return ["-march=armv8-a+crc"]
|
|
|
|
else:
|
|
|
|
return []
|
2015-11-18 21:26:10 +00:00
|
|
|
|
2017-03-16 23:15:09 +00:00
|
|
|
################################################################################
|
|
|
|
## skia_srcs()
|
|
|
|
################################################################################
|
|
|
|
SKIA_OS_UNIX = "UNIX"
|
|
|
|
|
|
|
|
SKIA_OS_ANDROID = "ANDROID"
|
|
|
|
|
|
|
|
SKIA_OS_IOS = "IOS"
|
|
|
|
|
|
|
|
SKIA_CPU_UNSPECIFIED = "UNSPECIFIED"
|
|
|
|
|
2017-06-06 17:01:43 +00:00
|
|
|
SKIA_CPU_ARM = "ARM"
|
|
|
|
|
2017-03-16 23:15:09 +00:00
|
|
|
SKIA_CPU_PPC = "PPC"
|
|
|
|
|
|
|
|
def skia_srcs(os=SKIA_OS_UNIX, cpu=SKIA_CPU_UNSPECIFIED):
|
|
|
|
"""Sources to be compiled into the skia library."""
|
|
|
|
srcs = skia_glob(BASE_SRCS_ALL)
|
|
|
|
if os == SKIA_OS_IOS:
|
|
|
|
if cpu != SKIA_CPU_UNSPECIFIED:
|
|
|
|
fail("Do not specify IOS and a cpu.")
|
|
|
|
srcs = srcs + skia_glob(BASE_SRCS_IOS)
|
|
|
|
elif os == SKIA_OS_ANDROID:
|
|
|
|
if cpu != SKIA_CPU_UNSPECIFIED:
|
|
|
|
fail("Do not specify ANDROID and a cpu.")
|
|
|
|
srcs = srcs + skia_glob(BASE_SRCS_ANDROID)
|
|
|
|
elif os == SKIA_OS_UNIX:
|
|
|
|
if cpu == SKIA_CPU_UNSPECIFIED:
|
|
|
|
srcs = srcs + ["src/opts/opts_check_x86.cpp"] + skia_glob(BASE_SRCS_UNIX)
|
2017-06-06 17:01:43 +00:00
|
|
|
elif cpu == SKIA_CPU_PPC or cpu == SKIA_CPU_ARM:
|
2017-03-16 23:15:09 +00:00
|
|
|
srcs = srcs + skia_glob(BASE_SRCS_UNIX)
|
|
|
|
else:
|
|
|
|
fail("cpu must be one of SKIA_CPU_*")
|
|
|
|
else:
|
|
|
|
fail("skia_srcs parameter 'os' must be one of SKIA_OS_{UNIX,ANDROID,IOS}.")
|
|
|
|
return srcs
|
2015-11-18 21:26:10 +00:00
|
|
|
|
2016-01-13 18:45:19 +00:00
|
|
|
################################################################################
|
|
|
|
## INCLUDES
|
|
|
|
################################################################################
|
2015-11-18 21:26:10 +00:00
|
|
|
|
2015-08-17 19:58:10 +00:00
|
|
|
# Includes needed by Skia implementation. Not public includes.
|
|
|
|
INCLUDES = [
|
2015-11-13 20:27:08 +00:00
|
|
|
"include/android",
|
2015-08-17 19:58:10 +00:00
|
|
|
"include/c",
|
2016-02-01 12:54:14 +00:00
|
|
|
"include/client/android",
|
2015-08-17 19:58:10 +00:00
|
|
|
"include/codec",
|
|
|
|
"include/config",
|
|
|
|
"include/core",
|
|
|
|
"include/effects",
|
2017-05-09 19:28:32 +00:00
|
|
|
"include/encode",
|
2015-08-17 19:58:10 +00:00
|
|
|
"include/gpu",
|
|
|
|
"include/images",
|
|
|
|
"include/pathops",
|
|
|
|
"include/pipe",
|
|
|
|
"include/ports",
|
|
|
|
"include/private",
|
|
|
|
"include/utils",
|
2015-11-02 19:11:21 +00:00
|
|
|
"include/utils/mac",
|
|
|
|
"include/utils/win",
|
2015-10-15 15:09:44 +00:00
|
|
|
"include/svg",
|
2015-08-17 19:58:10 +00:00
|
|
|
"include/xml",
|
2015-11-13 20:27:08 +00:00
|
|
|
"src/codec",
|
2015-08-17 19:58:10 +00:00
|
|
|
"src/core",
|
|
|
|
"src/gpu",
|
|
|
|
"src/image",
|
2017-08-15 17:13:59 +00:00
|
|
|
"src/images",
|
2015-08-17 19:58:10 +00:00
|
|
|
"src/lazy",
|
|
|
|
"src/opts",
|
2015-12-01 19:12:05 +00:00
|
|
|
"src/ports",
|
2015-08-17 19:58:10 +00:00
|
|
|
"src/pdf",
|
|
|
|
"src/sfnt",
|
2017-05-30 20:39:47 +00:00
|
|
|
"src/shaders",
|
2016-09-30 19:06:27 +00:00
|
|
|
"src/sksl",
|
2015-08-17 19:58:10 +00:00
|
|
|
"src/utils",
|
|
|
|
"third_party/etc1",
|
2016-10-24 18:11:12 +00:00
|
|
|
"third_party/gif",
|
2016-01-13 18:45:19 +00:00
|
|
|
]
|
2015-08-17 19:58:10 +00:00
|
|
|
|
2016-01-13 18:45:19 +00:00
|
|
|
################################################################################
|
|
|
|
## DM_SRCS
|
|
|
|
################################################################################
|
2015-10-26 17:46:25 +00:00
|
|
|
|
2016-01-13 18:45:19 +00:00
|
|
|
DM_SRCS_ALL = struct(
|
|
|
|
include = [
|
2015-10-15 15:09:44 +00:00
|
|
|
"dm/*.cpp",
|
|
|
|
"dm/*.h",
|
|
|
|
"gm/*.c",
|
|
|
|
"gm/*.cpp",
|
|
|
|
"gm/*.h",
|
|
|
|
"tests/*.cpp",
|
|
|
|
"tests/*.h",
|
2016-07-28 22:12:21 +00:00
|
|
|
"tools/BigPathBench.inc",
|
2015-10-15 15:09:44 +00:00
|
|
|
"tools/CrashHandler.cpp",
|
|
|
|
"tools/CrashHandler.h",
|
|
|
|
"tools/ProcStats.cpp",
|
|
|
|
"tools/ProcStats.h",
|
|
|
|
"tools/Resources.cpp",
|
|
|
|
"tools/Resources.h",
|
2016-07-28 22:12:21 +00:00
|
|
|
"tools/SkJSONCPP.h",
|
|
|
|
"tools/UrlDataManager.cpp",
|
|
|
|
"tools/UrlDataManager.h",
|
|
|
|
"tools/debugger/*.cpp",
|
|
|
|
"tools/debugger/*.h",
|
2015-10-15 15:09:44 +00:00
|
|
|
"tools/flags/*.cpp",
|
|
|
|
"tools/flags/*.h",
|
2016-04-01 12:00:51 +00:00
|
|
|
"tools/gpu/**/*.cpp",
|
|
|
|
"tools/gpu/**/*.h",
|
2016-04-20 02:41:54 +00:00
|
|
|
"tools/picture_utils.cpp",
|
2016-07-28 22:12:21 +00:00
|
|
|
"tools/picture_utils.h",
|
2016-02-09 20:32:52 +00:00
|
|
|
"tools/random_parse_path.cpp",
|
|
|
|
"tools/random_parse_path.h",
|
2015-10-15 15:09:44 +00:00
|
|
|
"tools/sk_tool_utils.cpp",
|
|
|
|
"tools/sk_tool_utils.h",
|
2016-07-28 22:12:21 +00:00
|
|
|
"tools/sk_tool_utils_flags.h",
|
2015-10-24 14:55:31 +00:00
|
|
|
"tools/sk_tool_utils_font.cpp",
|
2016-07-28 22:12:21 +00:00
|
|
|
"tools/test_font_monospace.inc",
|
|
|
|
"tools/test_font_sans_serif.inc",
|
|
|
|
"tools/test_font_serif.inc",
|
|
|
|
"tools/test_font_index.inc",
|
2015-10-24 14:55:31 +00:00
|
|
|
"tools/timer/*.cpp",
|
|
|
|
"tools/timer/*.h",
|
2017-07-19 17:05:11 +00:00
|
|
|
"tools/trace/*.cpp",
|
|
|
|
"tools/trace/*.h",
|
2015-10-15 15:09:44 +00:00
|
|
|
],
|
|
|
|
exclude = [
|
2015-10-26 17:46:25 +00:00
|
|
|
"tests/FontMgrAndroidParserTest.cpp", # Android-only.
|
2015-10-15 15:09:44 +00:00
|
|
|
"tests/skia_test.cpp", # Old main.
|
|
|
|
"tests/SkpSkGrTest.cpp", # Alternate main.
|
2016-07-15 18:27:27 +00:00
|
|
|
"tests/SVGDeviceTest.cpp",
|
2016-04-01 12:00:51 +00:00
|
|
|
"tools/gpu/gl/angle/*",
|
|
|
|
"tools/gpu/gl/egl/*",
|
|
|
|
"tools/gpu/gl/glx/*",
|
|
|
|
"tools/gpu/gl/iOS/*",
|
|
|
|
"tools/gpu/gl/mac/*",
|
|
|
|
"tools/gpu/gl/mesa/*",
|
|
|
|
"tools/gpu/gl/win/*",
|
2015-10-15 15:09:44 +00:00
|
|
|
"tools/timer/SysTimer_mach.cpp",
|
2015-10-26 17:46:25 +00:00
|
|
|
"tools/timer/SysTimer_windows.cpp",
|
2015-10-15 15:09:44 +00:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2017-03-16 23:15:09 +00:00
|
|
|
################################################################################
|
|
|
|
## dm_srcs()
|
|
|
|
################################################################################
|
|
|
|
# SKIA_OS_* definitions can be found above.
|
|
|
|
|
|
|
|
def dm_srcs(os):
|
|
|
|
"""Sources for the dm binary for the specified os."""
|
|
|
|
srcs = skia_glob(DM_SRCS_ALL)
|
|
|
|
# TODO(benjaminwagner): None of the CreatePlatformGLContext_*.cpp files exist.
|
|
|
|
# TODO(jwg): Remove the globs if possible, they only select single files.
|
|
|
|
if os == SKIA_OS_IOS:
|
|
|
|
srcs = srcs + native.glob(["tools/gpu/iOS/CreatePlatformGLContext_iOS.cpp"])
|
|
|
|
elif os == SKIA_OS_ANDROID:
|
|
|
|
srcs = srcs + native.glob([
|
2015-10-26 17:46:25 +00:00
|
|
|
"tests/FontMgrAndroidParserTest.cpp",
|
2016-04-01 12:00:51 +00:00
|
|
|
# TODO(benjaminwagner): Figure out how to compile with EGL.
|
|
|
|
"tools/gpu/gl/CreatePlatformGLContext_none.cpp",
|
2017-03-16 23:15:09 +00:00
|
|
|
])
|
|
|
|
elif os == SKIA_OS_UNIX:
|
|
|
|
srcs = srcs + native.glob(["tools/gpu/gl/CreatePlatformGLContext_none.cpp"])
|
|
|
|
else:
|
|
|
|
fail("dm_srcs parameter 'os' must be one of SKIA_OS_{UNIX,ANDROID,IOS}.")
|
|
|
|
return srcs
|
2016-01-13 18:45:19 +00:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
## DM_INCLUDES
|
|
|
|
################################################################################
|
2015-10-26 17:46:25 +00:00
|
|
|
|
2015-10-15 15:09:44 +00:00
|
|
|
DM_INCLUDES = [
|
2016-02-01 17:05:08 +00:00
|
|
|
"dm",
|
2015-10-15 15:09:44 +00:00
|
|
|
"gm",
|
2017-02-18 19:12:08 +00:00
|
|
|
"experimental/svg/model",
|
2015-10-15 15:09:44 +00:00
|
|
|
"src/codec",
|
2017-02-18 17:57:09 +00:00
|
|
|
"src/core",
|
2015-10-15 15:09:44 +00:00
|
|
|
"src/effects",
|
|
|
|
"src/fonts",
|
2016-11-23 15:55:18 +00:00
|
|
|
"src/images",
|
2015-10-15 15:09:44 +00:00
|
|
|
"src/pathops",
|
|
|
|
"src/pipe/utils",
|
2015-10-26 17:46:25 +00:00
|
|
|
"src/ports",
|
2017-05-30 20:39:47 +00:00
|
|
|
"src/shaders",
|
|
|
|
"src/shaders/gradients",
|
2017-02-18 14:51:33 +00:00
|
|
|
"src/xml",
|
2015-10-15 15:09:44 +00:00
|
|
|
"tests",
|
|
|
|
"tools",
|
2016-07-28 22:12:21 +00:00
|
|
|
"tools/debugger",
|
2015-10-15 15:09:44 +00:00
|
|
|
"tools/flags",
|
2016-04-01 12:00:51 +00:00
|
|
|
"tools/gpu",
|
2015-10-15 15:09:44 +00:00
|
|
|
"tools/timer",
|
2017-07-19 17:05:11 +00:00
|
|
|
"tools/trace",
|
2015-10-15 15:09:44 +00:00
|
|
|
]
|
|
|
|
|
2016-01-13 18:45:19 +00:00
|
|
|
################################################################################
|
|
|
|
## DM_ARGS
|
|
|
|
################################################################################
|
2016-01-12 20:00:49 +00:00
|
|
|
|
2016-11-28 20:30:37 +00:00
|
|
|
def DM_ARGS(asan):
|
2016-05-01 22:02:25 +00:00
|
|
|
source = ["tests", "gm", "image"]
|
2017-08-11 13:39:04 +00:00
|
|
|
# TODO(benjaminwagner): f16, pic-8888, serialize-8888, and tiles_rt-8888 fail.
|
|
|
|
config = ["565", "8888", "pdf", "srgb"]
|
2016-05-01 22:02:25 +00:00
|
|
|
# TODO(mtklein): maybe investigate why these fail?
|
|
|
|
match = [
|
|
|
|
"~Canvas",
|
|
|
|
"~Codec",
|
|
|
|
"~Codec_Dimensions",
|
|
|
|
"~Codec_stripes",
|
|
|
|
"~FontMgr",
|
|
|
|
"~PaintBreakText",
|
|
|
|
"~RecordDraw_TextBounds",
|
|
|
|
"~Scalar",
|
|
|
|
"~skps",
|
|
|
|
"~Stream",
|
|
|
|
]
|
|
|
|
if asan:
|
2016-11-28 20:30:37 +00:00
|
|
|
# The ASAN we use with Bazel has some strict checks, so omit tests that
|
|
|
|
# trigger them.
|
2016-05-01 22:02:25 +00:00
|
|
|
match += [
|
2017-05-08 15:40:29 +00:00
|
|
|
"~bigrect",
|
2016-05-01 22:02:25 +00:00
|
|
|
"~clippedcubic2",
|
|
|
|
"~conicpaths",
|
2016-11-28 20:30:37 +00:00
|
|
|
"~^gradients",
|
2016-05-01 22:02:25 +00:00
|
|
|
"~Math",
|
|
|
|
"~Matrix",
|
2017-01-30 02:50:51 +00:00
|
|
|
"~PathBigCubic",
|
2016-05-01 22:02:25 +00:00
|
|
|
"~PathOpsCubic",
|
2016-06-29 17:26:44 +00:00
|
|
|
"~PathOpsFailOp",
|
2016-07-19 19:27:32 +00:00
|
|
|
"~PathOpsOpCubicsThreaded",
|
2016-05-01 22:02:25 +00:00
|
|
|
"~PathOpsOpLoopsThreaded",
|
|
|
|
"~PathOpsSimplify",
|
|
|
|
"~PathOpsTightBoundsQuads",
|
|
|
|
"~Point",
|
2016-07-25 13:32:13 +00:00
|
|
|
"~sk_linear_to_srgb",
|
2016-11-28 20:30:37 +00:00
|
|
|
"~small_color_stop",
|
2016-01-13 18:45:19 +00:00
|
|
|
]
|
2016-11-28 20:30:37 +00:00
|
|
|
return ["--src"] + source + ["--config"] + config + ["--match"] + match
|
2016-01-13 18:45:19 +00:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
## COPTS
|
|
|
|
################################################################################
|
2015-11-02 19:11:21 +00:00
|
|
|
|
2015-10-26 17:46:25 +00:00
|
|
|
COPTS_UNIX = [
|
2015-08-17 19:58:10 +00:00
|
|
|
"-Wno-implicit-fallthrough", # Some intentional fallthrough.
|
2015-10-19 20:55:55 +00:00
|
|
|
"-Wno-deprecated-declarations", # Internal use of deprecated methods. :(
|
2015-08-17 19:58:10 +00:00
|
|
|
]
|
|
|
|
|
2017-05-05 13:16:00 +00:00
|
|
|
COPTS_ANDROID = [
|
|
|
|
"-mfpu=neon",
|
|
|
|
"-Wno-error=attributes", # 'GrResourceCache' declared with greater visibility than the
|
|
|
|
# type of its field 'GrResourceCache::fPurgeableQueue'... bogus.
|
|
|
|
]
|
2016-01-13 18:45:19 +00:00
|
|
|
|
|
|
|
COPTS_IOS = []
|
|
|
|
|
|
|
|
COPTS_ALL = []
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
## DEFINES
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
DEFINES_UNIX = [
|
2016-06-22 14:25:16 +00:00
|
|
|
"PNG_SKIP_SETJMP_CHECK",
|
2016-01-13 18:45:19 +00:00
|
|
|
"SK_BUILD_FOR_UNIX",
|
|
|
|
"SK_SAMPLES_FOR_X",
|
2016-08-25 16:07:02 +00:00
|
|
|
"SK_PDF_USE_SFNTLY",
|
2016-02-12 00:00:24 +00:00
|
|
|
"SK_CODEC_DECODES_RAW",
|
2016-05-06 14:21:26 +00:00
|
|
|
"SK_HAS_JPEG_LIBRARY",
|
2016-06-21 21:13:40 +00:00
|
|
|
"SK_HAS_PNG_LIBRARY",
|
2016-06-22 14:25:16 +00:00
|
|
|
"SK_HAS_WEBP_LIBRARY",
|
2016-01-13 18:45:19 +00:00
|
|
|
]
|
2015-10-26 17:46:25 +00:00
|
|
|
|
|
|
|
DEFINES_ANDROID = [
|
|
|
|
"SK_BUILD_FOR_ANDROID",
|
2016-02-12 00:00:24 +00:00
|
|
|
"SK_CODEC_DECODES_RAW",
|
2016-05-06 14:21:26 +00:00
|
|
|
"SK_HAS_JPEG_LIBRARY",
|
2016-06-21 21:13:40 +00:00
|
|
|
"SK_HAS_PNG_LIBRARY",
|
2016-06-22 14:25:16 +00:00
|
|
|
"SK_HAS_WEBP_LIBRARY",
|
2015-10-26 17:46:25 +00:00
|
|
|
]
|
|
|
|
|
2015-11-02 19:11:21 +00:00
|
|
|
DEFINES_IOS = [
|
|
|
|
"SK_BUILD_FOR_IOS",
|
2016-06-01 14:08:56 +00:00
|
|
|
"SK_BUILD_NO_OPTS",
|
2017-02-10 14:42:54 +00:00
|
|
|
"SK_HAS_JPEG_LIBRARY",
|
2016-01-25 19:24:57 +00:00
|
|
|
"SKNX_NO_SIMD",
|
2015-11-02 19:11:21 +00:00
|
|
|
]
|
|
|
|
|
2015-10-26 17:46:25 +00:00
|
|
|
DEFINES_ALL = [
|
2015-08-17 19:58:10 +00:00
|
|
|
# Chrome DEFINES.
|
|
|
|
"SK_USE_FREETYPE_EMBOLDEN",
|
|
|
|
# Turn on a few Google3-specific build fixes.
|
|
|
|
"GOOGLE3",
|
2017-07-10 18:47:09 +00:00
|
|
|
# Required for building dm.
|
|
|
|
"GR_TEST_UTILS",
|
2016-03-22 17:17:23 +00:00
|
|
|
# Staging flags for API changes
|
2017-05-19 16:57:03 +00:00
|
|
|
# Should remove after we update golden images
|
|
|
|
"SK_WEBP_ENCODER_USE_DEFAULT_METHOD",
|
2017-06-08 18:16:03 +00:00
|
|
|
# Experiment to diagnose image diffs in Google3
|
2017-08-15 13:01:22 +00:00
|
|
|
"SK_JUMPER_DISABLE_8BIT",
|
2015-08-17 19:58:10 +00:00
|
|
|
]
|
|
|
|
|
2016-01-13 18:45:19 +00:00
|
|
|
################################################################################
|
|
|
|
## LINKOPTS
|
|
|
|
################################################################################
|
2015-10-26 17:46:25 +00:00
|
|
|
|
2016-01-13 18:45:19 +00:00
|
|
|
LINKOPTS_UNIX = []
|
2015-12-17 18:18:04 +00:00
|
|
|
|
2016-01-13 18:45:19 +00:00
|
|
|
LINKOPTS_ANDROID = [
|
|
|
|
"-lEGL",
|
|
|
|
]
|
2015-10-15 15:09:44 +00:00
|
|
|
|
2017-08-15 17:13:59 +00:00
|
|
|
LINKOPTS_IOS = [
|
|
|
|
"-framework CoreFoundation",
|
|
|
|
"-framework CoreGraphics",
|
|
|
|
"-framework CoreText",
|
|
|
|
"-framework ImageIO",
|
|
|
|
"-framework MobileCoreServices",
|
|
|
|
]
|
2015-10-15 15:09:44 +00:00
|
|
|
|
2016-01-13 18:45:19 +00:00
|
|
|
LINKOPTS_ALL = [
|
|
|
|
"-ldl",
|
|
|
|
]
|