%global pkgvers 0 %global scdate0 20241022 %global schash0 6077adc6bc08ae89d3f41c817cec5e9cd6882117 %global branch0 master %global source0 https://github.com/Tencent/ncnn.git %global sshort0 %{expand:%%{lua:print(('%{schash0}'):sub(1,8))}} Name: ncnn Version: 20240820 Release: %{scdate0}.%{pkgvers}.git%{sshort0}%{?dist} Summary: Neural network inference computing framework optimized for mobile License: BSD URL: https://github.com/Tencent/ncnn BuildRequires: git doxygen cmake ocl-icd-devel BuildRequires: python3-setuptools python3-devel BuildRequires: opencv-devel protobuf-devel pybind11-devel %if 0%{?fedora} BuildRequires: glslang-devel gcc-c++ %endif %undefine _annotated_build %global _lto_cflags %{nil} %global __cmake_in_source_build 1 %global have_cuda 1 %global vcu_maj 12 %global vcu_min 6 %global gpu_target_arch "3.5+PTX;5.2;6.1;7.5;8.6" %bcond_without cuda %if %{without cuda} %global have_cuda 0 %endif %if %{have_cuda} BuildRequires: cuda-nvcc-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-nvtx-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-cudart-devel-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-nvml-devel-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-nvrtc-devel-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-driver-devel-%{vcu_maj}-%{vcu_min} BuildRequires: cuda-profiler-api-%{vcu_maj}-%{vcu_min} BuildRequires: libnccl-devel %endif %description High-performance neural network inference computing framework optimized for mobile platforms. %package devel Summary: Development files for %{name} Requires: %{name} = %{version}-%{release} %description devel This package contains development files for %{name}. %package python3 Summary: Python files for %{name} Requires: %{name} = %{version}-%{release} Requires: python3-numpy python3-tqdm python3-requests python3-portalocker opencv-python3 %description python3 This package contains python files for %{name}. %prep %setup -T -c -n %{name} git clone --depth 1 -n -b %{branch0} %{source0} . git fetch --depth 1 origin %{schash0} git reset --hard %{schash0} #git submodule update --init git log --format=fuller %build rm -rf glslang sed -i 's|ncnn STATIC|ncnn SHARED|' src/CMakeLists.txt sed -i '/PRIVATE -fvisibility=hidden/d' src/CMakeLists.txt sed -i 's|DESTINATION lib|DESTINATION %{_lib}|g' src/CMakeLists.txt sed -i 's|ncnn PROPERTIES|ncnn PROPERTIES SOVERSION 1 VERSION 1.0|' src/CMakeLists.txt sed -i 's|add_subdirectory(pybind11)|find_package(pybind11 REQUIRED)|' python/CMakeLists.txt sed -i '1i #include ' tools/darknet/darknet2ncnn.cpp mkdir build pushd build %global optflags %(echo %{optflags} | sed 's|-fno-exceptions||') %cmake .. -Wno-dev \ -DCMAKE_SKIP_RPATH=ON \ -DCMAKE_VERBOSE_MAKEFILE=OFF \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_INSTALL_LIBDIR=%{_lib} \ -DCMAKE_CXX_FLAGS="%{optflags} -fpermissive" \ -DCUDA_TOOLKIT_ROOT_DIR="/usr/local/cuda-%{vcu_maj}.%{vcu_min}/" \ %if 0%{?fedora} -DNCNN_SYSTEM_GLSLANG=ON \ %else -DNCNN_SYSTEM_GLSLANG=OFF \ %endif %if 0%{?rhel} || (0%{?fedora} == 36) -DNCNN_AVXVNNI=OFF \ -DNCNN_AVX512FP16=OFF \ -DNCNN_AVX512BF16=OFF \ %endif -DNCNN_SHARED_LIB=ON \ %if "%{_lto_cflags}" == "%{nil}" -DNCNN_ENABLE_LTO=OFF \ %else -DNCNN_ENABLE_LTO=ON \ %endif -DNCNN_DISABLE_EXCEPTION=OFF \ -DNCNN_PYTHON=ON make %{?_smp_mflags} popd %install rm -rf %{buildroot} pushd build make install DESTDIR=%{buildroot} popd pushd python %{__python3} setup.py install --root %{buildroot} popd rm -rf %{buildroot}/%{python3_sitelib}/*.egg-info %files %doc README.md CONTRIBUTING.md %{_bindir}/* %license LICENSE.txt %{_libdir}/lib*.so* %files devel %{_includedir}/* %{_libdir}/cmake/* %{_libdir}/pkgconfig/* %files python3 %{python3_sitelib}/* %changelog * Fri Mar 29 2019 Balint Cristian - github upstream releases