blob: e4a1ec855cc3dc0717b734b81fba82e6a0bb04bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
DESCRIPTION = "TensorFlow's lightweight solution for mobile and embedded devices"
AUTHOR = "Google Inc. and Yuan Tang"
HOMEPAGE = "https://www.tensorflow.org/lite"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=64a34301f8e355f57ec992c2af3e5157"
MD5SUM_EIGEN = "a28a728acb3298471b11132ab5c0c3cb"
SHA256SUM_EIGEN = "7e7a57e33c59280a17a66e521396cd8b1a55d0676c9f807078522fda52114b5c"
MD5SUM_FFT = "4255dd8a74949d123216b1ab91520469"
SHA256SUM_FFT = "52bb637c70b971958ec79c9c8752b1df5ff0218a4db4510e60826e0cb79b5296"
SRC_URI = "git://github.com/tensorflow/tensorflow.git;branch=r${PV};rev=590d6eef7e91a6a7392c8ffffb7b58f2e0c8bc6b;protocol=https \
https://bitbucket.org/eigen/eigen/get/8071cda5714d.tar.gz;md5sum=${MD5SUM_EIGEN};sha256sum=${SHA256SUM_EIGEN} \
git://github.com/google/gemmlowp;destsuffix=gemmlowp/;branch=master;rev=12fed0cd7cfcd9e169bf1925bc3a7a58725fdcc3;protocol=https \
git://github.com/google/googletest;destsuffix=googletest/;branch=master;rev=release-1.8.0;protocol=https \
git://github.com/abseil/abseil-cpp;destsuffix=abseil-cpp/;branch=master;rev=43ef2148c0936ebf7cb4be6b19927a9d9d145b8f;nobranch=1;protocol=https \
git://github.com/intel/ARM_NEON_2_x86_SSE;destsuffix=neon_2_sse/;branch=master;rev=3057bb91b99bae9c7fbdf8710c032d462ca10051;protocol=https \
git://github.com/google/farmhash;destsuffix=farmhash/;branch=master;rev=816a4ae622e964763ca0862d9dbd19324a1eaf45;protocol=https \
git://github.com/google/flatbuffers;destsuffix=flatbuffers/;branch=master;rev=v1.11.0;protocol=https \
https://mirror.bazel.build/www.kurims.kyoto-u.ac.jp/~ooura/fft.tgz;md5sum=${MD5SUM_FFT};sha256sum=${SHA256SUM_FFT} \
http://download.tensorflow.org/models/mobilenet_v1_2018_08_02/mobilenet_v1_1.0_224_quant.tgz;name=mobilenet_v1_quant;subdir=${WORKDIR}/model;destsuffix=model \
file://apply-modification-for-tflite-${PV}-to-eigen.patch \
file://0001-Makefile-add-label_image-example-${PV}.patch \
file://tflite-benchmark.sh \
file://tensorflow-lite.pc.in"
SRCREV_FORMAT="tensorflow_gemmlowp_googletest_abseil-cpp_ARM_NEON_2_x86_SSE_farmhash_flatbuffers"
SRC_URI[mobilenet_v1_quant.md5sum] = "36af340c00e60291931cb30ce32d4e86"
SRC_URI[mobilenet_v1_quant.sha256sum] = "d32432d28673a936b2d6281ab0600c71cf7226dfe4cdcef3012555f691744166"
PR = "r5"
S = "${WORKDIR}/git"
DEPENDS = "zlib"
TARGET_CFLAGS:remove = "-O2"
TARGET_CPPFLAGS:remove = "-O2"
TARGET_CXXFLAGS:remove = "-O2"
CFLAGS:append = " -O3 -DNDEBUG -fPIC -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK \
-I${STAGING_INCDIR}"
CPPFLAGS:append = " -O3 -DNDEBUG -fPIC -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK \
-I${STAGING_INCDIR}"
LDFLAGS:remove = "-Wl,-O1"
CXXFLAGS:append = " -O3 -DNDEBUG -fPIC -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK \
-I${STAGING_INCDIR}"
LIBS = "-lstdc++ -lpthread -lm -lz -ldl -lrt"
BUILD_DEPS_DOWNLOAD_DIR_PREFIX = "${S}/tensorflow/lite/tools/make/downloads/"
do_cp_downloaded_build_deps() {
mkdir -p ${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}eigen
mkdir -p ${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}gemmlowp
mkdir -p ${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}googletest
mkdir -p ${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}absl
mkdir -p ${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}farmhash
mkdir -p ${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}neon_2_sse
mkdir -p ${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}flatbuffers
mkdir -p ${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}fft2d
cp -rf ${WORKDIR}/eigen-eigen-8071cda5714d/* "${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}eigen"
cp -rf ${WORKDIR}/gemmlowp/* "${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}gemmlowp/"
cp -rf ${WORKDIR}/googletest/* "${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}googletest/"
cp -rf ${WORKDIR}/abseil-cpp/* "${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}absl/"
cp -rf ${WORKDIR}/farmhash/* "${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}farmhash/"
cp -rf ${WORKDIR}/neon_2_sse/* "${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}neon_2_sse/"
cp -rf ${WORKDIR}/flatbuffers/* "${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}flatbuffers/"
cp -rf ${WORKDIR}/fft/* "${BUILD_DEPS_DOWNLOAD_DIR_PREFIX}fft2d"
}
addtask do_cp_downloaded_build_deps after do_unpack before do_patch
EXTRA_OEMAKE = "\
'CC=${CC}' \
'CXX=${CXX}' \
'CPP=${CPP}' \
'CFLAGS=${CFLAGS}' \
'CPPFLAGS=${CPPFLAGS}' \
'CXXFLAGS=${CXXFLAGS}' \
'AR=${AR}' \
'LD=${LD}' \
'LDFLAGS=${LDFLAGS}' \
'LIBS=${LIBS}' \
'TARGET=${TARGET_OS}' \
'TARGET_ARCH=${TUNE_ARCH}'"
do_compile() {
oe_runmake -f tensorflow/lite/tools/make/Makefile
}
do_install() {
install -d ${D}${libdir}
install -m 0644 ${S}/tensorflow/lite/tools/make/gen/${TARGET_OS}_${TUNE_ARCH}/lib/*.a ${D}${libdir}/
install -d ${D}${includedir}/tensorflow/lite
install -m 0644 ${S}/tensorflow/lite/*.h ${D}${includedir}/tensorflow/lite/
install -d ${D}${includedir}/tensorflow/lite/c
install -m 0644 ${S}/tensorflow/lite/c/*.h ${D}${includedir}/tensorflow/lite/c/
install -d ${D}${includedir}/tensorflow/lite/core/
install -m 0644 ${S}/tensorflow/lite/core/*.h ${D}${includedir}/tensorflow/lite/core/
install -d ${D}${includedir}/tensorflow/lite/core/api/
install -m 0644 ${S}/tensorflow/lite/core/api/*.h ${D}${includedir}/tensorflow/lite/core/api/
install -d ${D}${includedir}/tensorflow/lite/kernels
install -m 0644 ${S}/tensorflow/lite/kernels/*.h ${D}${includedir}/tensorflow/lite/kernels/
install -d ${D}${includedir}/tensorflow/lite/profiling/
install -m 0644 ${S}/tensorflow/lite/profiling/*.h ${D}${includedir}/tensorflow/lite/profiling/
install -d ${D}${includedir}/tensorflow/lite/schema/
install -m 0644 ${S}/tensorflow/lite/schema/*.h ${D}${includedir}/tensorflow/lite/schema/
install -m 0644 ${S}/tensorflow/lite/schema/schema.fbs ${D}${includedir}/tensorflow/lite/schema/
install -d ${D}${includedir}/tensorflow/lite/tools/
install -m 0644 ${S}/tensorflow/lite/tools/*.h ${D}${includedir}/tensorflow/lite/tools/
install -d ${D}${includedir}/tensorflow/lite/delegates/nnapi/
install -m 0644 ${S}/tensorflow/lite/delegates/nnapi/*.h ${D}${includedir}/tensorflow/lite/delegates/nnapi/
install -d ${D}${includedir}/tensorflow/lite/experimental/resource_variable/
install -m 0644 ${S}/tensorflow/lite/experimental/resource_variable/*.h ${D}${includedir}/tensorflow/lite/experimental/resource_variable/
install -d ${D}${includedir}/tensorflow/lite/kernels/internal/
install -m 0644 ${S}/tensorflow/lite/kernels/internal/*.h ${D}${includedir}/tensorflow/lite/kernels/internal/
install -d ${D}${libdir}/pkgconfig
install -m 0644 ${WORKDIR}/tensorflow-lite.pc.in ${D}${libdir}/pkgconfig/tensorflow-lite.pc
sed -i 's:@version@:${PV}:g
s:@libdir@:${libdir}:g
s:@includedir@:${includedir}:g' ${D}${libdir}/pkgconfig/tensorflow-lite.pc
# install examples
install -d ${D}${datadir}/${BPN}/examples
install -m 0755 ${S}/tensorflow/lite/tools/make/gen/${TARGET_OS}_${TUNE_ARCH}/bin/minimal ${D}${datadir}/${BPN}/examples
install -m 0755 ${S}/tensorflow/lite/tools/make/gen/${TARGET_OS}_${TUNE_ARCH}/bin/benchmark_model ${D}${datadir}/${BPN}/examples
install -m 0755 ${S}/tensorflow/lite/tools/make/gen/${TARGET_OS}_${TUNE_ARCH}/bin/label_image ${D}${datadir}/${BPN}/examples
install -m 0644 ${S}/tensorflow/lite/examples/label_image/testdata/grace_hopper.bmp ${D}${datadir}/${BPN}/examples
install -m 0644 ${S}/tensorflow/lite/java/ovic/src/testdata/labels.txt ${D}${datadir}/${BPN}/examples
install -m 0644 ${WORKDIR}/model/mobilenet_v1_1.0_224_quant.tflite ${D}${datadir}/${BPN}/examples
# install scripts for benchmarking
install -m 0755 ${WORKDIR}/tflite-benchmark.sh ${D}${datadir}/${BPN}/examples
}
BBCLASSEXTEND = "native nativesdk"
|