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
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
%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
#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
%files devel
%manifest %{name}.manifest
+%{_libdir}/pkgconfig/armnn.pc
%{_includedir}/*
%files tools