Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37850203
en ru br
ALT Linux repos
S:20230816-alt1

Group :: Engineering
RPM: ncnn

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

%define llvm_ver 15
%define ncnn_ver 1

%def_disable clang
%def_without python

Name: ncnn
Version: 20230517
Release: alt1

Summary: Mobile neural network inference framework

License: BSD-3-Clause
Group: Engineering
Url: https://github.com/Tencent/ncnn

Source: %url/archive/%version/%name-%version.tar.gz

BuildRequires(pre): rpm-build-ninja
%if_enabled clang
#BuildRequires(pre): rpm-macros-llvm-common
BuildRequires: clang%llvm_ver.0-devel
BuildRequires: lld%llvm_ver.0-devel
BuildRequires: llvm%llvm_ver.0-devel
%else
BuildRequires: gcc-c++
%endif
BuildRequires: cmake
BuildRequires: libgomp-devel python3-devel protobuf-compiler glslang-devel libprotobuf-devel libvulkan-devel
%if_with python
BuildRequires: pybind11-devel python3-module-pybind11 python3-module-opencv
%endif

%description
High-performance neural network inference framework
optimized for the mobile platform.

%package tools
Summary: %summary
Group: Engineering

%description tools
High-performance neural network inference framework
optimized for the mobile platform.

The package provides tools for %name.

%package -n libncnn%ncnn_ver
Summary: Development package for %name
Group: System/Libraries

%description -n libncnn%ncnn_ver
The package provides development files for %name.

%package -n libncnn-devel
Summary: Development package for %name
Group: Development/C++

%description -n libncnn-devel
The package provides development files for %name.

%if_with python
%package -n python3-module-%name
Summary: Python3 module for %name
Group: Development/Python3

%description -n python3-module-%name
The package provides python3 module for %name.
%endif

%prep
%setup
%if_with python
# use system pybind11
sed -i '24a include(pybind11_add_module)' \
 python/CMakeLists.txt
sed -i '/add_subdirectory(pybind11)/d' \
 python/CMakeLists.txt
%endif

%build
%if_enabled clang
%define optflags_lto -flto=thin
export CC=clang-%llvm_ver
export CXX=clang++-%llvm_ver
export LDFLAGS="-fuse-ld=lld-%llvm_ver $LDFLAGS"
%endif

%cmake \
 -GNinja \
 -DCMAKE_BUILD_TYPE='RelWithDebInfo' \
 -DCMAKE_INSTALL_PREFIX=%_prefix \
 -DNCNN_SHARED_LIB=ON \
 -DNCNN_ENABLE_LTO=ON \
 -DNCNN_VULKAN=ON \
 %if_with python
 -DNCNN_PYTHON=ON \
 -Dpybind11_INCLUDE_DIR=%_includedir/pybind11 \
 %endif
 -DNCNN_SYSTEM_GLSLANG=ON \
 -DNCNN_BUILD_EXAMPLES=OFF \
 -DGLSLANG_TARGET_DIR=%_libdir/cmake \
%nil
cmake --build "%_cmake__builddir" -j%__nprocs

%install
%cmake_install

%files tools
%_bindir/*

%files -n libncnn%ncnn_ver
%_libdir/libncnn.so.%{ncnn_ver}*

%files -n libncnn-devel
%dir %_includedir/ncnn/
%_includedir/ncnn/*.h
%dir %_libdir/cmake/ncnn/
%_libdir/cmake/ncnn/*.cmake
%_libdir/libncnn.so
%_pkgconfigdir/ncnn.pc

%if_with python
%files -n python3-module-%name
%python3_sitelibdir/%name-*.egg-info
%python3_sitelibdir/%name/
%endif

%changelog

Full changelog you can see here

 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin