summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorParichay Kapoor <pk.kapoor@samsung.com>2019-12-31 19:29:38 +0900
committerInki Dae <inki.dae@samsung.com>2021-03-04 14:20:38 +0900
commit78a06acffe7d10d646fd95815c42f48cd8ee92b2 (patch)
treed4664d931412ad0dd2a4ea99822e71c05b5f2ec3
parent66f42b91423a02eee28b581da7cde6cdf2f76d4a (diff)
downloadarmnn-78a06acffe7d10d646fd95815c42f48cd8ee92b2.tar.gz
armnn-78a06acffe7d10d646fd95815c42f48cd8ee92b2.tar.bz2
armnn-78a06acffe7d10d646fd95815c42f48cd8ee92b2.zip
Dist/Tizen: support selective framework and pkgconfig
Add package config for armnn package Add selective enabling of framework in build Add flatc while building with flatbuffers Add tflite header files Change-Id: I77eecd22cf80eb4c5ccfb2a83399354869dac39b Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
-rw-r--r--armnn.pc13
-rw-r--r--packaging/armnn.spec66
2 files changed, 70 insertions, 9 deletions
diff --git a/armnn.pc b/armnn.pc
new file mode 100644
index 000000000..8274a98b6
--- /dev/null
+++ b/armnn.pc
@@ -0,0 +1,13 @@
+# Package Information for pkg-config
+
+prefix=/usr
+exec_prefix=${prefix}
+includedir=${prefix}/include
+libdir=${exec_prefix}/lib
+sharedlibdir=${prefix}/share
+
+Name: armnn
+Description: Arm Neural Network Library
+Version: 19.11
+Libs: -L${libdir} -larmnn CAFFE_SUPPORT TF_LITE_SUPPORT -lpthread
+Cflags: -I${includedir}
diff --git a/packaging/armnn.spec b/packaging/armnn.spec
index 8807601e5..57659f513 100644
--- a/packaging/armnn.spec
+++ b/packaging/armnn.spec
@@ -5,9 +5,17 @@ License: MIT License
Summary: Arm Neural Networks library
Group: Machine Learning / ML Framework
Source0: %{name}-%{version}.tar.gz
-Source1001: %name.manifest
+Source1001: %{name}.manifest
ExclusiveArch: %arm aarch64
+%define OPEN_CL_SUPPORT 1
+%define CAFFE_SUPPORT 1
+%define TF_LITE_SUPPORT 1
+
+%if 0%{?OPEN_CL_SUPPORT} != 1
+ %define CAFFE_SUPPORT 0
+%endif
+
BuildRequires: curl
BuildRequires: cmake
BuildRequires: libarmcl-devel
@@ -38,22 +46,27 @@ BuildRequires: boost-signals
BuildRequires: boost-system
BuildRequires: boost-test
BuildRequires: boost-devel
+%if 0%{?TF_LITE_SUPPORT} == 1
BuildRequires: tensorflow-lite-devel
-BuildRequires:libcaffeonacl-devel
+%endif
+%if 0%{?CAFFE_SUPPORT} == 1
+BuildRequires: libcaffeonacl-devel
+%endif
%description
Arm Neural Networks Library
%package devel
-Summary: Userspace interface to ARM Neural Network Library
-Requires: armnn = %{version}-%{release}
+Summary: Userspace interface to ARM Neural Network Library
+Provides: pkgconfig(rpm)
+Requires: %{name} = %{version}-%{release}
%description devel
Summary: Userspace interface to ARM Neural Network Library
%package tools
Summary: Sample application and benchmark binaries to test ARM Neural Network Library
-Requires: armnn = %{version}-%{release}
+Requires: %{name} = %{version}-%{release}
%description tools
Summary: Sample application and benchmark binaries to test ARM Neural Network Library
@@ -62,6 +75,18 @@ Summary: Sample application and benchmark binaries to test ARM Neural Network Li
%setup -q
cp %{SOURCE1001} .
+%if 0%{?CAFFE_SUPPORT} == 1
+sed -i 's/CAFFE_SUPPORT /-larmnnCaffeParser /g' armnn.pc
+%else # CAFFE_SUPPORT
+sed -i 's/CAFFE_SUPPORT //g' armnn.pc
+%endif # CAFFE_SUPPORT
+
+%if 0%{?TF_LITE_SUPPORT} == 1
+sed -i 's/TF_LITE_SUPPORT /-larmnnTfLiteParser /g' armnn.pc
+%else # TF_LITE_SUPPORT
+sed -i 's/TF_LITE_SUPPORT //g' armnn.pc
+%endif # TF_LITE_SUPPORT
+
%build
#compile proto files
@@ -75,38 +100,60 @@ cp %{SOURCE1001} .
#build ArmNN
cmake -DARMCOMPUTENEON=1 \
+%if 0%{?OPEN_CL_SUPPORT} == 1
-DARMCOMPUTECL=1 \
+%endif # TF_LITE_SUPPORT
-DSHARED_BOOST=1 \
-DCMAKE_SKIP_RPATH=1 \
+%if 0%{?CAFFE_SUPPORT} == 1
-DBUILD_CAFFE_PARSER=1 \
-DCAFFE_GENERATED_SOURCES=/usr/include \
+%endif # CAFFE_SUPPORT
+%if 0%{?TF_LITE_SUPPORT} == 1
-DBUILD_TF_LITE_PARSER=1 \
-DTF_LITE_GENERATED_PATH=./tensorflow/contrib/lite/schema \
+%endif # TF_LITE_SUPPORT
-DFLATBUFFERS_INCLUDE_PATH=/usr/include/ \
+ -DFLATC=/usr/bin/flatc \
-DBUILD_TESTS=1 \
-make
+make -j8
%install
mkdir -p %{buildroot}%{_libdir}
+mkdir -p %{buildroot}%{_libdir}/pkgconfig
mkdir -p %{buildroot}%{_bindir}/armnn
mkdir -p %{buildroot}%{_includedir}/armnn
-mkdir -p %{buildroot}%{_includedir}/armnnCaffeParser
+%if 0%{?CAFFE_SUPPORT} == 1
+ mkdir -p %{buildroot}%{_includedir}/armnnCaffeParser
+%endif # CAFFE_SUPPORT
mkdir -p %{buildroot}%{_includedir}/armnnTfParser
+%if 0%{?TF_LITE_SUPPORT} == 1
+ mkdir -p %{buildroot}%{_includedir}/armnnTfLiteParser
+%endif # TF_LITE_SUPPORT
#prepare stb
mkdir -p %{buildroot}%{_includedir}
cp -ar external/stb %{buildroot}%{_includedir}
+install armnn.pc %{buildroot}%{_libdir}/pkgconfig/
+
install -m 0755 bin/*-Armnn %{buildroot}%{_bindir}/armnn/
install -m 0755 bin/ExecuteNetwork %{buildroot}%{_bindir}/armnn/
-install -m 0755 bin/MultipleNetworksCifar10 %{buildroot}%{_bindir}/armnn/
+%if 0%{?CAFFE_SUPPORT} == 1
+ install -m 0755 bin/MultipleNetworksCifar10 %{buildroot}%{_bindir}/armnn/
+%endif # CAFFE_SUPPORT
install -m 0755 UnitTests %{buildroot}%{_bindir}/armnn/
install -m 0644 lib*.so %{buildroot}%{_libdir}/
install -m 0644 include/armnn/* %{buildroot}%{_includedir}/armnn/
-install -m 0644 include/armnnCaffeParser/* %{buildroot}%{_includedir}/armnnCaffeParser/
+%if 0%{?CAFFE_SUPPORT} == 1
+ install -m 0644 include/armnnCaffeParser/* %{buildroot}%{_includedir}/armnnCaffeParser/
+%endif # CAFFE_SUPPORT
install -m 0644 include/armnnTfParser/* %{buildroot}%{_includedir}/armnnTfParser/
+%if 0%{?TF_LITE_SUPPORT} == 1
+ install -m 0644 include/armnnTfLiteParser/* %{buildroot}%{_includedir}/armnnTfLiteParser/
+%endif # TF_LITE_SUPPORT
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
@@ -117,6 +164,7 @@ install -m 0644 include/armnnTfParser/* %{buildroot}%{_includedir}/armnnTfParser
%files devel
%manifest %{name}.manifest
+%{_libdir}/pkgconfig/armnn.pc
%{_includedir}/*
%files tools