Source1002: nnapi_test_generated.tar.gz
Source2001: nnfw.pc.in
-BuildRequires: cmake
-BuildRequires: boost-devel
-BuildRequires: gmock-devel
-BuildRequires: tensorflow-lite-devel
-BuildRequires: hdf5-devel
-BuildRequires: libaec-devel
-BuildRequires: zlib-devel
+BuildRequires: cmake
+BuildRequires: boost-devel
+BuildRequires: gmock-devel
+BuildRequires: tensorflow-lite-devel
+BuildRequires: hdf5-devel
+BuildRequires: libaec-devel
+BuildRequires: zlib-devel
%ifarch %{arm} aarch64
# Require python for acl-ex library build pre-process
-BuildRequires: python
-BuildRequires: libarmcl-devel
+BuildRequires: python
+BuildRequires: libarmcl-devel
+Requires: libarmcl-release
%endif
Requires(post): /sbin/ldconfig
%{!?test_build: %define test_build 0}
%{!?build_type: %define build_type Release}
%{!?coverage_build: %define coverage_build 0}
+%{!?extra_option: %define extra_option %{nil}}
%description
nnfw is a high-performance, on-device neural network framework for Tizen
%package test
Summary: NNFW Test
-Requires: nnfw
+Requires: libarmcl-release
+Requires: libhdf5-101
+Requires: libhdf5_cpp101
%description test
NNFW test rpm. It does not depends on nnfw rpm since it contains nnfw runtime.
%define target_arch aarch64
%endif
-%define test_install_prefix /opt/usr/nnfw-test
-%define coverage_option COVERAGE_BUILD=0
-%define install_path INSTALL_PATH=%{buildroot}%{_prefix}
-%define extra_option OPTIONS=-DENVVAR_NEURUN_CONFIG=OFF
-%if %{test_build} == 1
-%define extra_option OPTIONS=-DENVVAR_NEURUN_CONFIG=ON
-%endif
+%define install_dir %{_prefix}
+%define install_path %{buildroot}%{install_dir}
+%define build_env NNFW_WORKSPACE=build
+%define build_options -DCMAKE_BUILD_TYPE=%{build_type} -DTARGET_ARCH=%{target_arch} -DTARGET_OS=tizen
+
+# Set option for test build (and coverage test build)
+%define test_install_home /opt/usr/nnfw-test
+%define test_install_dir %{test_install_home}/Product/out
+%define test_install_path %{buildroot}%{test_install_dir}
+%define coverage_option %{nil}
+%define test_suite_list infra/scripts tests/scripts tests/framework
%if %{coverage_build} == 1
-%define coverage_option COVERAGE_BUILD=1
-%define install_path %{nil}
+%define coverage_option -DENABLE_COVERAGE=ON
%define build_type Debug
-%define extra_option OPTIONS=-DENVVAR_NEURUN_CONFIG=ON
%endif
-
-# TODO Set install path for public header
-# Current build assume that %{_includedir} == %{_prefix}/include
-%define build_options %{coverage_option} BUILD_TYPE=%{build_type} %{install_path} TARGET_ARCH=%{target_arch} TARGET_OS=tizen %{extra_option}
+%define test_build_env NNFW_INSTALL_PREFIX=%{test_install_path} NNFW_WORKSPACE=build_for_test
+%define test_build_options %{coverage_option} -DCMAKE_BUILD_TYPE=%{build_type} -DTARGET_ARCH=%{target_arch} -DTARGET_OS=tizen -DENVVAR_NEURUN_CONFIG=ON
%prep
%setup -q
%build
%ifarch arm armv7l aarch64
-cp -v Makefile.template Makefile
-%{build_options} make %{?jobs:-j%jobs} all
+# runtime build
+%{build_env} ./nnfw configure %{build_options} %{extra_option}
+%{build_env} ./nnfw build
+# install in workspace
+# TODO Set install path
+%{build_env} ./nnfw install
+
+# test runtime
+# TODO remove duplicated build process
+%{test_build_env} ./nnfw configure %{test_build_options} %{extra_option}
+%{test_build_env} ./nnfw build
+%if %{coverage_build} == 1
+pwd | grep -o '/' | wc -l > tests/scripts/build_path_depth.txt
+%endif
+tar -zcf test-suite.tar.gz infra/scripts tests/scripts tests/framework
%endif
%install
%ifarch arm armv7l aarch64
-%{build_options} make install
-
-%if %{coverage_build} == 0
-# nnfw-test rpm(like test-suite on cross build)
-## install Product
-mkdir -p %{buildroot}%{test_install_prefix}/Product/out
-mv %{buildroot}%{_prefix}/unittest %{buildroot}%{test_install_prefix}/Product/out
-mv %{buildroot}%{_prefix}/bin %{buildroot}%{test_install_prefix}/Product/out
-cp -rf %{buildroot}%{_libdir} %{buildroot}%{test_install_prefix}/Product/out
-## install tests
-mkdir -p %{buildroot}%{test_install_prefix}/tests
-cp -rf ./tests/framework %{buildroot}%{test_install_prefix}/tests
-## install tools
-mkdir -p %{buildroot}%{test_install_prefix}/tools
-cp -rf ./tests/scripts %{buildroot}%{test_install_prefix}/tests
-## install infra
-mkdir -p %{buildroot}%{test_install_prefix}/infra
-cp -rf ./infra/scripts/ %{buildroot}%{test_install_prefix}/infra
-%else
-%{build_options} make build_coverage_suite
-mkdir -p %{buildroot}%{test_install_prefix}
-cp -rf Product/out/coverage-suite.tar.gz %{buildroot}%{test_install_prefix}/.
-tar -zxf %{buildroot}%{test_install_prefix}/coverage-suite.tar.gz -C %{buildroot}%{test_install_prefix}
-rm -rf %{buildroot}%{test_install_prefix}/coverage-suite.tar.gz
-%endif
+mkdir -p %{buildroot}%{_libdir}
+mkdir -p %{buildroot}%{_includedir}
+install -m 644 build/out/lib/*.so %{buildroot}%{_libdir}
+cp -r build/out/include/* %{buildroot}%{_includedir}/
+
+# For developer
cp %{SOURCE2001} .
sed -i 's:@libdir@:%{_libdir}:g
s:@includedir@:%{_includedir}:g' ./nnfw.pc.in
mkdir -p %{buildroot}%{_libdir}/pkgconfig
install -m 0644 ./nnfw.pc.in %{buildroot}%{_libdir}/pkgconfig/nnfw.pc
+%{test_build_env} ./nnfw install
+tar -zxf test-suite.tar.gz -C %{buildroot}%{test_install_home}
+
%endif
%post -p /sbin/ldconfig
%manifest %{name}.manifest
%defattr(-,root,root,-)
%ifarch arm armv7l aarch64
-%{_includedir}/*
+%dir %{_includedir}/nnfw
+%{_includedir}/nnfw/*
%{_libdir}/pkgconfig/nnfw.pc
%endif
%manifest %{name}.manifest
%defattr(-,root,root,-)
%ifarch arm armv7l aarch64
-%{test_install_prefix}/*
+%dir %{test_install_home}
+%{test_install_home}/*
%exclude %{_libdir}/debug
%endif