%global forgeurl https://github.com/nmslib/hnswlib Version: 0.8.0 %forgemeta Name: hnswlib Release: %autorelease Summary: Header-only C++/python library for fast approximate nearest neighbors License: Apache-2.0 URL: %{forgeurl} Source0: %{forgesource} Patch0: hnswlib.patch BuildRequires: gcc-c++ BuildRequires: cmake BuildRequires: ninja-build BuildRequires: python3-devel BuildRequires: python3-pytest %description %{summary}. %package devel Summary: Development files for %{name} Requires: %{name}-static%{?_isa} = %{version}-%{release} %description devel The %{name}-devel package contains development files for %{name}. %package -n python3-%{name} Summary: Python3 bindings for %{name} Requires: %{name}-devel%{?_isa} = %{version}-%{release} %description -n python3-%{name} The python3-%{name} package contains Python3 bindings for %{name}. %prep %forgeautosetup -p1 %generate_buildrequires %pyproject_buildrequires # Use distro's optimization flags, not the -march=native sed -i 's/\(-march=native\)//' setup.py sed -i '/-march=native/d' CMakeLists.txt %build %cmake \ -GNinja \ -DCMAKE_BUILD_TYPE=Release \ %cmake_build %pyproject_wheel %install %cmake_install %pyproject_install %pyproject_save_files hnswlib %check pushd tests/cpp %{python3} update_gen_data.py popd %ctest %{py3_test_envvars} %{python3} -m unittest discover -v --start-directory tests/python --pattern "bindings_test*.py" %files %license LICENSE %doc README.md %{_includedir}/hnswlib/ %{_libdir}/cmake/hnswlib/ %files -n python3-%{name} -f %{pyproject_files} %changelog %autochangelog