Commit c1c62133 authored by Linshizhi's avatar Linshizhi

Add skia svg module.

parent 817dd25e
cc_import( cc_import(
name = "skia_public", name = "skia",
hdrs = glob(["**/*.h"]), hdrs = glob(["**/*.h"]),
shared_library = "out/Shared/libskia.so", static_library = "out/Static/libskia.a",
visibility = ["//visibility:public"],
)
cc_import(
name = "skia_svg",
hdrs = glob(["**/*.h"]),
static_library = "out/Static/libsvg.a",
deps = [
":skia",
":skia_skshaper",
],
visibility = ["//visibility:public"],
)
cc_import(
name = "skia_skottie",
hdrs = glob(["**/*.h"]),
static_library = "out/Static/libskottie.a",
visibility = ["//visibility:public"],
)
cc_import(
name = "skia_skparagraph",
hdrs = glob(["**/*.h"]),
static_library = "out/Static/libskparagraph.a",
visibility = ["//visibility:public"],
)
cc_import(
name = "skia_sksg",
hdrs = glob(["**/*.h"]),
static_library = "out/Static/libsksg.a",
visibility = ["//visibility:public"],
)
cc_import(
name = "skia_skshaper",
hdrs = glob(["**/*.h"]),
static_library = "out/Static/libskshaper.a",
deps = [
":skia_skunicode",
],
visibility = ["//visibility:public"],
)
cc_import(
name = "skia_sktext",
hdrs = glob(["**/*.h"]),
static_library = "out/Static/libsktext.a",
visibility = ["//visibility:public"],
)
cc_import(
name = "skia_skunicode",
hdrs = glob(["**/*.h"]),
deps = [":skia"],
static_library = "out/Static/libskunicode.a",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )
...@@ -28,10 +28,18 @@ if [ -f "WORKSPACE.bazel" ]; then ...@@ -28,10 +28,18 @@ if [ -f "WORKSPACE.bazel" ]; then
fi fi
fi fi
COMPILE_ARGS=(
is_official_build=true
skia_use_system_harfbuzz=false
skia_enable_svg=true
skia_use_system_libwebp=false
skia_use_system_icu=false
)
printf -v COMPILE_ARGS_STR '%s ' "${COMPILE_ARGS[@]}"
python3 tools/git-sync-deps python3 tools/git-sync-deps
bin/gn gen out/Shared --args='is_official_build=true is_component_build=true skia_use_system_harfbuzz=false skia_enable_svg=true' bin/gn gen out/Static --args="$COMPILE_ARGS_STR"
ninja -C out/Shared ninja -C out/Static
# if [ ! -d "${SKIA_BUILD_DIR}" ]; then # if [ ! -d "${SKIA_BUILD_DIR}" ]; then
......
...@@ -4,14 +4,8 @@ cc_library( ...@@ -4,14 +4,8 @@ cc_library(
srcs = ["canvas.cc"], srcs = ["canvas.cc"],
hdrs = ["canvas.h"], hdrs = ["canvas.h"],
deps = [ deps = [
"@ffmpeg//:avformat", "@skia//:skia_svg",
"@skia//:skia_public", "@skia//:skia",
"@ffmpeg//:avcodec",
"@ffmpeg//:avdevice",
"@ffmpeg//:avfilter",
"@ffmpeg//:avutil",
"@ffmpeg//:swresample",
"@ffmpeg//:swscale",
], ],
copts = [ copts = [
"-I./external/ffmpeg/include", "-I./external/ffmpeg/include",
...@@ -20,5 +14,6 @@ cc_library( ...@@ -20,5 +14,6 @@ cc_library(
visibility = [ visibility = [
"//app:__pkg__", "//app:__pkg__",
"//tests:__pkg__" "//tests:__pkg__"
] ],
linkstatic = True
) )
#include <stdio.h> #include <stdio.h>
#include "core/SkCanvas.h" #include "include/core/SkCanvas.h"
#include "include/core/SkStream.h"
#include "include/core/SkRefCnt.h"
#include "modules/svg/include/SkSVGDOM.h"
extern "C" { int example(void) {
#include "libavformat/avformat.h"
}
int say(void) {
SkCanvas canvas = SkCanvas(); SkCanvas canvas = SkCanvas();
AVFormatContext *ctx = avformat_alloc_context(); SkFILEStream svgStream("./example");
sk_sp<SkSVGDOM> fDom = SkSVGDOM::MakeFromStream(svgStream);
return 0; return 0;
} }
int say(); int example();
...@@ -6,11 +6,13 @@ cc_test( ...@@ -6,11 +6,13 @@ cc_test(
srcs = ["check.cc"], srcs = ["check.cc"],
args = ["/home"], args = ["/home"],
copts = ["-I./src"], copts = ["-I./src"],
linkopts = ["-lz", "-llzma"], linkopts = [
"-lz", "-llzma", "-ljpeg", "-lfreetype",
"-lpng", "-lfontconfig", "-lGLX", "-lexpat -lm"],
deps = [ deps = [
"//src:render", "//src:render",
"@theft//:theft", "@theft//:theft",
"@gtest//:gtest", "@gtest//:gtest",
"@gtest//:gtest_main" "@gtest//:gtest_main",
] ]
) )
...@@ -7,5 +7,5 @@ extern "C" { ...@@ -7,5 +7,5 @@ extern "C" {
// Tests factorial of 0. // Tests factorial of 0.
TEST(Say, SayNothing) { TEST(Say, SayNothing) {
EXPECT_EQ(say(), 0); EXPECT_EQ(example(), 0);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment