From 56bd7bf8c8bd38f672fe24a094894efc2738c9ce Mon Sep 17 00:00:00 2001 From: Kainan Cha Date: Fri, 14 May 2021 18:31:08 +0800 Subject: [PATCH] Add prebuild support for VIPLite Signed-off-by: Kainan Cha --- .bazelrc | 8 ++++++++ BUILD | 2 +- WORKSPACE | 10 ++++++++++ prebuilt-sdk/BUILD | 11 +++++++++++ prebuilt-sdk/VIPLite/BUILD | 20 ++++++++++++++++++++ 5 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 prebuilt-sdk/VIPLite/BUILD diff --git a/.bazelrc b/.bazelrc index 7c09220..d790666 100644 --- a/.bazelrc +++ b/.bazelrc @@ -30,3 +30,11 @@ build:S905D3 --copt -Wno-unused-function build:S905D3 --copt -Wno-sequence-point build:S905D3 --copt -Wno-implicit-fallthrough build:S905D3 --define target_device=aarch64_S905D3 + +build:Lite_A311D --define linux=true +build:Lite_A311D --spawn_strategy=standalone +build:Lite_A311D --crosstool_top=@TOOLCHAINS//gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu:toolchain +build:Lite_A311D --host_crosstool_top=@bazel_tools//tools/cpp:toolchain +build:Lite_A311D --cpu=aarch64 +build:Lite_A311D --compiler=gcc +build:Lite_A311D --define target_device=VIPLite_aarch64_A311D diff --git a/BUILD b/BUILD index 967c001..79e910f 100644 --- a/BUILD +++ b/BUILD @@ -72,7 +72,7 @@ cc_library( "src/tim/lite/handle.cc", ], deps = [ - "//viplite:VIP_LITE_LIB", + "//prebuilt-sdk:VIP_LITE_LIB", ], linkstatic = True, strip_include_prefix = "include", diff --git a/WORKSPACE b/WORKSPACE index 3f2855f..694bbc3 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -25,6 +25,16 @@ http_archive( ], ) +http_archive( + name = "VIPLite_aarch64_A311D", + build_file = "@//prebuilt-sdk/VIPLite:BUILD", + sha256 = "63fafc2b6d4a92389298af42a60d82bc2767abed330a8c09f7428fc3828ca31f", + strip_prefix = "viplite", + urls = [ + "https://github.com/VeriSilicon/TIM-VX/releases/download/v1.1.28/VIPLite_aarch64_A311D_1.3.5.tgz", + ], +) + local_repository( name = 'TOOLCHAINS', path = 'toolchains', diff --git a/prebuilt-sdk/BUILD b/prebuilt-sdk/BUILD index 4f19646..6b70ced 100644 --- a/prebuilt-sdk/BUILD +++ b/prebuilt-sdk/BUILD @@ -29,3 +29,14 @@ cc_library( "//conditions:default": ["//prebuilt-sdk/x86_64_linux:VIV_SDK_LIB"], }), ) +config_setting( + name = "VIPLite_aarch64_A311D", + values = {"define": "target_device=VIPLite_aarch64_A311D"}, +) + +cc_library( + name = "VIP_LITE_LIB", + deps = select({ + "VIPLite_aarch64_A311D": ["@VIPLite_aarch64_A311D//:VIP_LITE_LIB"], + }), +) diff --git a/prebuilt-sdk/VIPLite/BUILD b/prebuilt-sdk/VIPLite/BUILD new file mode 100644 index 0000000..7dd4c5b --- /dev/null +++ b/prebuilt-sdk/VIPLite/BUILD @@ -0,0 +1,20 @@ +package(default_visibility = ["//visibility:public"]) + +filegroup( + name = "libs", + srcs = glob([ + "drivers/*.so", + ]), +) + +cc_library( + name = "VIP_LITE_LIB", + hdrs = glob([ + "include/*.h" + ]), + srcs = select({ + "//conditions:default": [":libs"], + }), + strip_include_prefix = "include", +) +