# Feature toggles: Python bindings enabled by default %bcond_without python %global soversion 3 %global forgeurl https://github.com/elalish/manifold %global pypiname manifold3d Version: 3.2.1 %forgemeta Name: manifold Release: %autorelease Summary: Geometry library for topological robustness # svd.h is under MIT license # https://github.com/elalish/manifold/blob/master/src/svd.h # disjoint_sets.h is under Zlib license # https://github.com/elalish/manifold/blob/master/src/disjoint_sets.h License: Apache-2.0 AND MIT AND Zlib URL: %{forgeurl} Source: %{forgesource} # Build dependencies # Manifold requires static files BuildRequires: polyclipping2-static BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: openvdb-devel >= 11 BuildRequires: pkgconfig(assimp) BuildRequires: pkgconfig(gtest) BuildRequires: pkgconfig(tbb) %if %{with python} BuildRequires: python3-devel BuildRequires: python3-nanobind-devel BuildRequires: python3-pip BuildRequires: python3-scikit-build-core # tests BuildRequires: python3-pytest BuildRequires: python3-trimesh %endif # Documentation BuildRequires: doxygen # Only 64 bit architectures ExcludeArch: i686 %description Manifold provides robust operations on watertight triangle meshes with guaranteed manifold output. Features include parallelized algorithms, support for arbitrary vertex attributes, and material mapping for rendering applications. %package devel Summary: Development files for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} %description devel Development files for %{name}, including headers, CMake config, and pkg-config files. %if %{with python} %package -n python3-%{pypiname} Summary: Python bindings for %{name} Requires: %{name}%{?_isa}=%{version}-%{release} %description -n python3-%{pypiname} Python interface for %{name} geometry library %endif %package doc Summary: Documentation for %{name} %description doc Docbook documentation for %{name}. %prep %forgeautosetup # Ensure Python executable macro usage sed -i "s|python|%{python3}|" \ bindings/python/CMakeLists.txt # Switch Doxygen to DocBook output sed -i "s|GENERATE_HTML = YES|GENERATE_HTML = NO|" \ Doxyfile sed -i "s|GENERATE_DOCBOOK = NO|GENERATE_DOCBOOK = YES|" \ Doxyfile # Adjust Python build options to use shared libs sed -i 's|"-DMANIFOLD_PYBIND=ON", "-DMANIFOLD_CBIND=OFF", "-DMANIFOLD_PAR=ON", "-DMANIFOLD_TEST=OFF", "-DBUILD_SHARED_LIBS=OFF"|"-DMANIFOLD_PYBIND=ON", "-DMANIFOLD_CBIND=ON", "-DMANIFOLD_PAR=ON", "-DMANIFOLD_TEST=ON", "-DBUILD_SHARED_LIBS=ON", "-DBUILD_SHARED_LIBS=ON", "-DCMAKE_SKIP_BUILD_RPATH=ON", "-DCMAKE_SKIP_INSTALL_RPATH=ON", "-DMANIFOLD_EXPORT=ON"|' pyproject.toml %generate_buildrequires %pyproject_buildrequires %build %if %{with python} %pyproject_wheel %endif %cmake \ -DBUILD_SHARED_LIBS=ON \ -DCMAKE_SKIP_BUILD_RPATH=ON \ -DCMAKE_SKIP_INSTALL_RPATH=ON \ -DMANIFOLD_EXPORT=ON \ -DMANIFOLD_PAR=ON \ -DMANIFOLD_PYBIND=%{?with_python:ON}%{!?with_python:OFF} \ -DMANIFOLD_CBIND=ON %cmake_build doxygen %install %cmake_install %if %{with python} %pyproject_install %pyproject_save_files -L %{pypiname} %endif find docs/docbook/ -type f -exec install -pDm0644 "{}" \ "%{buildroot}%{_datadir}/help/en/%{name}/{}" \; # Disable test for s390x architectures due to # python failure # https://koji.fedoraproject.org/koji/taskinfo?taskID=136040274 # https://github.com/elalish/manifold/issues/1335 %ifnarch s390x %check %ctest --test-dir %{_vpath_builddir} %if %{with python} LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{py3_test_envvars} %{python3} bindings/python/examples/run_all.py -e LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{pytest} %endif %endif %files %license LICENSE %doc README.md CONTRIBUTING.md %{_libdir}/libmanifold.so.%{soversion}* %{_libdir}/libmanifoldc.so.%{soversion}* %files devel %doc README.md CONTRIBUTING.md %{_includedir}/%{name}/ %{_libdir}/libmanifold.so %{_libdir}/libmanifoldc.so %{_libdir}/pkgconfig/%{name}.pc %{_libdir}/cmake/%{name}/ %if %{with python} %files -n python3-%{pypiname} -f %{pyproject_files} %license LICENSE %{python3_sitearch}/%{pypiname}.pyi %endif %files doc %license LICENSE %dir %{_datadir}/help/en %lang(en) %{_datadir}/help/en/%{name} %changelog %autochangelog