Commit cbb2e83a authored by Linshizhi's avatar Linshizhi

Add skia.

parent d0c3154b
......@@ -4,3 +4,6 @@
[submodule "external/googletest"]
path = external/googletest
url = https://github.com/google/googletest.git
[submodule "external/skia"]
path = external/skia
url = https://skia.googlesource.com/skia.git
cc_import(
name = "skia_public",
hdrs = glob(["include/**/*.h"]),
shared_library = "lib/libskia.so",
visibility = ["//visibility:public"],
)
workspace(name = "IMGRender")
local_repository(
name = "skia",
path = "./external/skia"
)
# Google test for unittest purposes
local_repository(
name = "gtest",
......@@ -18,4 +13,9 @@ new_local_repository(
build_file = "BUILDS/BUILD.theft"
)
# Skia library
new_local_repository(
name = "skia",
path = "./external/build/skia",
build_file = "BUILDS/BUILD.skia"
)
skia @ f905f5fd
Subproject commit f905f5fd8a0634968ed2cf148366cb4f9d47d187
......@@ -3,9 +3,39 @@
set -euxo pipefail
WORKPATH=$(cd $(dirname $0); pwd)
EXTERNAL_DIR=${WORKPATH}/external
SKIA_PATH=${WORKPATH}/external/skia
SKIA_PATH=${EXTERNAL_DIR}/skia
EXTERNAL_BUILD_DIR=${EXTERNAL_DIR}/build
if [ ! -d "${EXTERNAL_BUILD_DIR}" ]; then
mkdir ${EXTERNAL_BUILD_DIR}
fi
# Build skia
SKIA_BUILD_DIR=${EXTERNAL_BUILD_DIR}/skia
cd $SKIA_PATH
bazel build //:skia_public
python3 tools/git-sync-deps
bin/gn gen out/Shared --args='is_official_build=true is_component_build=true skia_use_system_harfbuzz=false'
ninja -C out/Shared
if [ ! -d "${SKIA_BUILD_DIR}" ]; then
mkdir ${SKIA_BUILD_DIR}
mkdir ${SKIA_BUILD_DIR}/include
mkdir ${SKIA_BUILD_DIR}/lib
else
rm -rf ${SKIA_BUILD_DIR}/include/*
rm -rf ${SKIA_BUILD_DIR}/lib/*
fi
cp out/Shared/*.so ${SKIA_BUILD_DIR}/lib
cp -r include ${SKIA_BUILD_DIR}/
cd $SKIA_BUILD_DIR
builds=$(find . | grep bazel | xargs)
if [ ! -z "$builds" ]; then
rm $builds
fi
......@@ -3,7 +3,8 @@ cc_library(
name = "render",
srcs = ["canvas.cc"],
hdrs = ["canvas.h"],
#deps = ["@skia//:skia_public"],
deps = ["@skia//:skia_public"],
copts = ["-I./external/build/skia/", "-std=c++2a"],
visibility = [
"//app:__pkg__",
"//tests:__pkg__"
......
#include <stdio.h>
#include "include/core/SkCanvas.h"
int say(void) {
printf("Hello,World\n");
SkCanvas canvas = SkCanvas();
return 0;
}
......@@ -5,6 +5,7 @@ cc_test(
name = "check",
srcs = ["check.cc"],
args = ["/home"],
copts = ["-I./src"],
deps = [
"//src:render",
"@theft//:theft",
......
......@@ -6,14 +6,6 @@ extern "C" {
}
// Tests factorial of 0.
TEST(FactorialTest, HandlesZeroInput) {
EXPECT_EQ(1, 1);
}
// Tests factorial of positive numbers.
TEST(FactorialTest, HandlesPositiveInput) {
EXPECT_EQ(1, 1);
EXPECT_EQ(2, 2);
EXPECT_EQ(6, 6);
EXPECT_EQ(40320, 40320);
TEST(Say, SayNothing) {
EXPECT_EQ(say(), 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