[bazel] Add option for SkSVGCanvas (and expat third_party DEP)
Our SVG code depends on our XML code which depends on expat. See also cl/457481999 Change-Id: I83b61f5d73570d0aa7e851a01ccd019b4b1019e4 Bug: skia:12541 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553376 Reviewed-by: Florin Malita <fmalita@google.com>
This commit is contained in:
parent
a10e6c1025
commit
86678ed625
2
.bazelrc
2
.bazelrc
@ -54,6 +54,8 @@ build --flag_alias=disable_skslc=no//bazel/common_config_settings:enable_skslc
|
|||||||
build --flag_alias=enable_skslc=//bazel/common_config_settings:enable_skslc
|
build --flag_alias=enable_skslc=//bazel/common_config_settings:enable_skslc
|
||||||
build --flag_alias=disable_sksl_tracing=no//bazel/common_config_settings:enable_sksl_tracing
|
build --flag_alias=disable_sksl_tracing=no//bazel/common_config_settings:enable_sksl_tracing
|
||||||
build --flag_alias=enable_sksl_tracing=//bazel/common_config_settings:enable_sksl_tracing
|
build --flag_alias=enable_sksl_tracing=//bazel/common_config_settings:enable_sksl_tracing
|
||||||
|
build --flag_alias=disable_svg_canvas=no//bazel/common_config_settings:enable_svg_canvas
|
||||||
|
build --flag_alias=enable_svg_canvas=//bazel/common_config_settings:enable_svg_canvas
|
||||||
build --flag_alias=disable_tracing=no//bazel/common_config_settings:enable_tracing
|
build --flag_alias=disable_tracing=no//bazel/common_config_settings:enable_tracing
|
||||||
build --flag_alias=enable_tracing=//bazel/common_config_settings:enable_tracing
|
build --flag_alias=enable_tracing=//bazel/common_config_settings:enable_tracing
|
||||||
build --flag_alias=disable_vma=no//bazel/common_config_settings:use_vulkan_memory_allocator
|
build --flag_alias=disable_vma=no//bazel/common_config_settings:use_vulkan_memory_allocator
|
||||||
|
@ -217,6 +217,13 @@ new_local_repository(
|
|||||||
workspace_file_content = "",
|
workspace_file_content = "",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
new_local_repository(
|
||||||
|
name = "expat",
|
||||||
|
build_file = "bazel/external/expat/BUILD.bazel",
|
||||||
|
path = "third_party/externals/expat",
|
||||||
|
workspace_file_content = "",
|
||||||
|
)
|
||||||
|
|
||||||
new_local_repository(
|
new_local_repository(
|
||||||
name = "libjpeg_turbo",
|
name = "libjpeg_turbo",
|
||||||
build_file = "bazel/external/libjpeg_turbo/BUILD.bazel",
|
build_file = "bazel/external/libjpeg_turbo/BUILD.bazel",
|
||||||
|
@ -227,6 +227,11 @@ bool_flag(
|
|||||||
flag_name = "enable_tracing",
|
flag_name = "enable_tracing",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
bool_flag(
|
||||||
|
default = False,
|
||||||
|
flag_name = "enable_svg_canvas",
|
||||||
|
)
|
||||||
|
|
||||||
bool_flag(
|
bool_flag(
|
||||||
default = False,
|
default = False,
|
||||||
flag_name = "is_skia_dev_build",
|
flag_name = "is_skia_dev_build",
|
||||||
|
68
bazel/external/expat/BUILD.bazel
vendored
Normal file
68
bazel/external/expat/BUILD.bazel
vendored
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
# This file will be copied into //third_party/externals/libjpeg-turbo via the new_local_repository
|
||||||
|
# rule in WORKSPACE.bazel, so all files should be relative to that path.
|
||||||
|
|
||||||
|
genrule(
|
||||||
|
name = "create_expat_config_file",
|
||||||
|
srcs = [],
|
||||||
|
outs = ["include/expat_config.h"],
|
||||||
|
cmd = """cat > $@ << 'EOF'
|
||||||
|
#define HAVE_INTTYPES_H 1
|
||||||
|
#define HAVE_MEMORY_H 1
|
||||||
|
#define HAVE_STDINT_H 1
|
||||||
|
#define HAVE_STDLIB_H 1
|
||||||
|
#define HAVE_STRING_H 1
|
||||||
|
#define STDC_HEADERS 1
|
||||||
|
#define XML_CONTEXT_BYTES 1024
|
||||||
|
#define XML_DTD 1
|
||||||
|
#define XML_NS 1
|
||||||
|
EOF""",
|
||||||
|
)
|
||||||
|
|
||||||
|
EXPAT_HDRS = [
|
||||||
|
"expat/lib/expat.h",
|
||||||
|
]
|
||||||
|
|
||||||
|
EXPAT_SRCS = [
|
||||||
|
"expat/lib/ascii.h",
|
||||||
|
"expat/lib/asciitab.h",
|
||||||
|
"expat/lib/expat.h",
|
||||||
|
"expat/lib/expat_external.h",
|
||||||
|
"expat/lib/iasciitab.h",
|
||||||
|
"expat/lib/internal.h",
|
||||||
|
"expat/lib/latin1tab.h",
|
||||||
|
"expat/lib/nametab.h",
|
||||||
|
"expat/lib/siphash.h",
|
||||||
|
"expat/lib/utf8tab.h",
|
||||||
|
"expat/lib/winconfig.h",
|
||||||
|
"expat/lib/xmlparse.c",
|
||||||
|
"expat/lib/xmlrole.c",
|
||||||
|
"expat/lib/xmlrole.h",
|
||||||
|
"expat/lib/xmltok.c",
|
||||||
|
"expat/lib/xmltok.h",
|
||||||
|
"expat/lib/xmltok_impl.h",
|
||||||
|
# Our generated configuration file
|
||||||
|
"include/expat_config.h",
|
||||||
|
]
|
||||||
|
|
||||||
|
TEXTUAL_HDRS = [
|
||||||
|
"expat/lib/xmltok_impl.c",
|
||||||
|
"expat/lib/xmltok_ns.c",
|
||||||
|
]
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "expat",
|
||||||
|
srcs = EXPAT_SRCS,
|
||||||
|
hdrs = EXPAT_HDRS,
|
||||||
|
defines = [
|
||||||
|
"HAVE_MEMMOVE",
|
||||||
|
"XML_DEV_URANDOM",
|
||||||
|
"XML_STATIC",
|
||||||
|
],
|
||||||
|
includes = [
|
||||||
|
"expat/lib",
|
||||||
|
"include",
|
||||||
|
],
|
||||||
|
# strip_include_prefix = "expat/lib",
|
||||||
|
textual_hdrs = TEXTUAL_HDRS,
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
1
bazel/external/libjpeg_turbo/BUILD.bazel
vendored
1
bazel/external/libjpeg_turbo/BUILD.bazel
vendored
@ -120,7 +120,6 @@ cc_library(
|
|||||||
"jpeglibmangler.h",
|
"jpeglibmangler.h",
|
||||||
],
|
],
|
||||||
local_defines = JPEGTURBO_DEFINES,
|
local_defines = JPEGTURBO_DEFINES,
|
||||||
strip_include_prefix = "",
|
|
||||||
textual_hdrs = [
|
textual_hdrs = [
|
||||||
"jccolext.c",
|
"jccolext.c",
|
||||||
"jdmrgext.c",
|
"jdmrgext.c",
|
||||||
|
@ -8,13 +8,16 @@ load("@rules_python//python:defs.bzl", _py_binary = "py_binary")
|
|||||||
load("@py_deps//:requirements.bzl", _requirement = "requirement")
|
load("@py_deps//:requirements.bzl", _requirement = "requirement")
|
||||||
load("@bazel_gazelle//:def.bzl", _gazelle = "gazelle")
|
load("@bazel_gazelle//:def.bzl", _gazelle = "gazelle")
|
||||||
load("@emsdk//emscripten_toolchain:wasm_rules.bzl", _wasm_cc_binary = "wasm_cc_binary")
|
load("@emsdk//emscripten_toolchain:wasm_rules.bzl", _wasm_cc_binary = "wasm_cc_binary")
|
||||||
|
load("@io_bazel_rules_go//go:def.bzl", _go_binary = "go_binary", _go_library = "go_library")
|
||||||
|
|
||||||
# re-export symbols that are commonly used or that are not supported in G3
|
# re-export symbols that are commonly used or that are not supported in G3
|
||||||
# (and thus we need to stub out)
|
# (and thus we need to stub out)
|
||||||
selects = _selects
|
gazelle = _gazelle
|
||||||
|
go_binary = _go_binary
|
||||||
|
go_library = _go_library
|
||||||
py_binary = _py_binary
|
py_binary = _py_binary
|
||||||
requirement = _requirement
|
requirement = _requirement
|
||||||
gazelle = _gazelle
|
selects = _selects
|
||||||
wasm_cc_binary = _wasm_cc_binary
|
wasm_cc_binary = _wasm_cc_binary
|
||||||
|
|
||||||
def select_multi(values_map, default):
|
def select_multi(values_map, default):
|
||||||
@ -64,6 +67,11 @@ def select_multi(values_map, default):
|
|||||||
})
|
})
|
||||||
return rv
|
return rv
|
||||||
|
|
||||||
|
# buildifier: disable=unnamed-macro
|
||||||
|
def cc_binary(**kwargs):
|
||||||
|
"""A shim around cc_binary that lets us tweak settings for G3 if necessary."""
|
||||||
|
native.cc_binary(**kwargs)
|
||||||
|
|
||||||
# buildifier: disable=unnamed-macro
|
# buildifier: disable=unnamed-macro
|
||||||
def cc_library(**kwargs):
|
def cc_library(**kwargs):
|
||||||
"""A shim around cc_library that lets us tweak settings for G3 if necessary."""
|
"""A shim around cc_library that lets us tweak settings for G3 if necessary."""
|
||||||
|
@ -16,7 +16,6 @@ filegroup(
|
|||||||
"//include/encode:public_hdrs",
|
"//include/encode:public_hdrs",
|
||||||
"//include/pathops:public_hdrs",
|
"//include/pathops:public_hdrs",
|
||||||
"//include/ports:public_hdrs",
|
"//include/ports:public_hdrs",
|
||||||
"//include/svg:public_hdrs",
|
|
||||||
"//include/third_party/skcms:public_hdrs",
|
"//include/third_party/skcms:public_hdrs",
|
||||||
"//include/utils:public_hdrs",
|
"//include/utils:public_hdrs",
|
||||||
] + select({
|
] + select({
|
||||||
@ -25,6 +24,9 @@ filegroup(
|
|||||||
}) + select({
|
}) + select({
|
||||||
"//bazel/common_config_settings:has_gpu_backend": ["//include/gpu:public_hdrs"],
|
"//bazel/common_config_settings:has_gpu_backend": ["//include/gpu:public_hdrs"],
|
||||||
"//conditions:default": [],
|
"//conditions:default": [],
|
||||||
|
}) + select({
|
||||||
|
"//bazel/common_config_settings:enable_svg_canvas_true": ["//include/svg:public_hdrs"],
|
||||||
|
"//conditions:default": [],
|
||||||
}),
|
}),
|
||||||
visibility = ["//:__pkg__"],
|
visibility = ["//:__pkg__"],
|
||||||
)
|
)
|
||||||
|
@ -29,6 +29,12 @@ filegroup(
|
|||||||
}) + select({
|
}) + select({
|
||||||
"//bazel/common_config_settings:needs_sksl": ["//src/sksl:srcs"],
|
"//bazel/common_config_settings:needs_sksl": ["//src/sksl:srcs"],
|
||||||
"//conditions:default": [],
|
"//conditions:default": [],
|
||||||
|
}) + select({
|
||||||
|
"//bazel/common_config_settings:enable_svg_canvas_true": [
|
||||||
|
"//src/svg:srcs",
|
||||||
|
"//src/xml:srcs",
|
||||||
|
],
|
||||||
|
"//conditions:default": [],
|
||||||
}),
|
}),
|
||||||
visibility = ["//:__pkg__"],
|
visibility = ["//:__pkg__"],
|
||||||
)
|
)
|
||||||
@ -57,6 +63,12 @@ filegroup(
|
|||||||
}) + select({
|
}) + select({
|
||||||
"//bazel/common_config_settings:needs_sksl": ["//src/sksl:private_hdrs"],
|
"//bazel/common_config_settings:needs_sksl": ["//src/sksl:private_hdrs"],
|
||||||
"//conditions:default": [],
|
"//conditions:default": [],
|
||||||
|
}) + select({
|
||||||
|
"//bazel/common_config_settings:enable_svg_canvas_true": [
|
||||||
|
"//src/svg:private_hdrs",
|
||||||
|
"//src/xml:private_hdrs",
|
||||||
|
],
|
||||||
|
"//conditions:default": [],
|
||||||
}),
|
}),
|
||||||
visibility = ["//:__pkg__"],
|
visibility = ["//:__pkg__"],
|
||||||
)
|
)
|
||||||
@ -75,5 +87,10 @@ cc_library(
|
|||||||
}) + select({
|
}) + select({
|
||||||
"//bazel/common_config_settings:needs_sksl": ["//src/sksl:deps"],
|
"//bazel/common_config_settings:needs_sksl": ["//src/sksl:deps"],
|
||||||
"//conditions:default": [],
|
"//conditions:default": [],
|
||||||
|
}) + select({
|
||||||
|
"//bazel/common_config_settings:enable_svg_canvas_true": [
|
||||||
|
"//src/xml:deps",
|
||||||
|
],
|
||||||
|
"//conditions:default": [],
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
22
src/svg/BUILD.bazel
Normal file
22
src/svg/BUILD.bazel
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
load("//bazel:macros.bzl", "exports_files_legacy")
|
||||||
|
|
||||||
|
licenses(["notice"])
|
||||||
|
|
||||||
|
exports_files_legacy()
|
||||||
|
|
||||||
|
filegroup(
|
||||||
|
name = "srcs",
|
||||||
|
srcs = [
|
||||||
|
"SkSVGCanvas.cpp",
|
||||||
|
"SkSVGDevice.cpp",
|
||||||
|
],
|
||||||
|
visibility = ["//src:__pkg__"],
|
||||||
|
)
|
||||||
|
|
||||||
|
filegroup(
|
||||||
|
name = "private_hdrs",
|
||||||
|
srcs = [
|
||||||
|
"SkSVGDevice.h",
|
||||||
|
],
|
||||||
|
visibility = ["//src:__pkg__"],
|
||||||
|
)
|
@ -1,5 +1,37 @@
|
|||||||
load("//bazel:macros.bzl", "exports_files_legacy")
|
load("//bazel:macros.bzl", "cc_library", "exports_files_legacy", "split_srcs_and_hdrs")
|
||||||
|
|
||||||
licenses(["notice"])
|
licenses(["notice"])
|
||||||
|
|
||||||
exports_files_legacy()
|
exports_files_legacy()
|
||||||
|
|
||||||
|
XML_FILES = [
|
||||||
|
"SkDOM.cpp",
|
||||||
|
"SkDOM.h",
|
||||||
|
"SkXMLParser.cpp",
|
||||||
|
"SkXMLParser.h",
|
||||||
|
"SkXMLWriter.cpp",
|
||||||
|
"SkXMLWriter.h",
|
||||||
|
]
|
||||||
|
|
||||||
|
split_srcs_and_hdrs(
|
||||||
|
name = "xml",
|
||||||
|
files = XML_FILES,
|
||||||
|
)
|
||||||
|
|
||||||
|
filegroup(
|
||||||
|
name = "srcs",
|
||||||
|
srcs = [":xml_srcs"],
|
||||||
|
visibility = ["//src:__pkg__"],
|
||||||
|
)
|
||||||
|
|
||||||
|
filegroup(
|
||||||
|
name = "private_hdrs",
|
||||||
|
srcs = [":xml_hdrs"],
|
||||||
|
visibility = ["//src:__pkg__"],
|
||||||
|
)
|
||||||
|
|
||||||
|
cc_library(
|
||||||
|
name = "deps",
|
||||||
|
visibility = ["//src:__pkg__"],
|
||||||
|
deps = ["@expat"],
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user