d2cc020
# Force out of source build
d2cc020
%undefine __cmake_in_source_build
d2cc020
fca44dc
# Use soversion
dbb8783
%global soversion 11.0
fca44dc
fde0919
# Set to 1 to enable testsuite. Fails everywhere with GCC 8+.
fde0919
%global with_tests 0
e78e645
b65e867
# Optional supports
b65e867
%global with_openexr 1
b65e867
%global with_ax      0
0a623bb
%global with_nanovdb 1
0a623bb
0a623bb
# ax currently incompatible with newer llvm versions
0a623bb
%if 0%{?fedora} >= 38 || 0%{?rhel} >= 8
0a623bb
%global llvm_compat 15
0a623bb
%endif
630aef3
e78e645
Name:           openvdb
dbb8783
Version:        11.0.0
fca44dc
Release:        %autorelease
e78e645
Summary:        C++ library for sparse volumetric data discretized on three-dimensional grids
b65e867
License:        MPL-2.0
e78e645
URL:            http://www.openvdb.org/
e78e645
19fcdae
Source0:        https://github.com/AcademySoftwareFoundation/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
e78e645
b0daecb
# OpenVDB no longer builds on 32bits with latest TBB due to OOM.
b0daecb
ExcludeArch:    i686
b0daecb
2d19ad2
BuildRequires:  boost-devel >= 1.61
8c2ca4d
# boost-python3-devel merged in boost-devel for Fedora 33+
8c2ca4d
# https://src.fedoraproject.org/rpms/boost/c/1f2e448e099a867f9da62b9da009d3dec5e1ad64?branch=master
630aef3
%if 0%{?rhel}
fde0919
BuildRequires:  boost-python3-devel
798ba80
%endif
e78e645
BuildRequires:  cmake >= 2.8
e78e645
BuildRequires:  doxygen >= 1.8.11
3fc4e0c
#BuildRequires:  epydoc
ee76930
BuildRequires:  gcc-c++
e78e645
BuildRequires:  ghostscript >= 8.70
ee76930
BuildRequires:  libstdc++-devel
b65e867
%if 0%{?with_ax}
0a623bb
BuildRequires:  llvm%{?llvm_compat}-devel
b65e867
BuildRequires:	pkgconfig(libffi)
b65e867
%endif
b43ae63
BuildRequires:  pkgconfig(blosc) >= 1.5.0
b43ae63
BuildRequires:  pkgconfig(cppunit) >= 1.10
630aef3
# RHEL and CentOS only have that build requirement for x86_64
315b01b
%if 0%{?rhel}
315b01b
%ifarch x86_64
315b01b
BuildRequires:  glfw-devel >= 2.7
315b01b
%endif
315b01b
%else
b43ae63
BuildRequires:  pkgconfig(glfw3) >= 2.7
315b01b
%endif
b43ae63
BuildRequires:  pkgconfig(jemalloc)
b43ae63
BuildRequires:  pkgconfig(log4cplus) >= 1.0
19fcdae
BuildRequires:  cmake(pybind11)
630aef3
%if 0%{?with_openexr}
630aef3
BuildRequires:  pkgconfig(OpenEXR) >= 3.0
630aef3
%endif
25e00bf
BuildRequires:  cmake(tbb)
b43ae63
BuildRequires:  pkgconfig(xi)
b43ae63
BuildRequires:  pkgconfig(zlib) > 1.2.7
e78e645
e78e645
%description
e78e645
OpenVDB is an Academy Award-winning open-source C++ library comprising a novel
e78e645
hierarchical data structure and a suite of tools for the efficient storage and
e78e645
manipulation of sparse volumetric data discretized on three-dimensional grids.
ee76930
It is developed and maintained by Academy Software Foundation for use in
ee76930
volumetric applications typically encountered in feature film production.
e78e645
e78e645
This package contains some graphical tools.
e78e645
e78e645
%package        libs
e78e645
Summary:        Core OpenVDB libraries
e78e645
e78e645
%description    libs
e78e645
OpenVDB is an Academy Award-winning open-source C++ library comprising a novel
e78e645
hierarchical data structure and a suite of tools for the efficient storage and
e78e645
manipulation of sparse volumetric data discretized on three-dimensional grids.
ee76930
It is developed and maintained by Academy Software Foundation for use in
ee76930
volumetric applications typically encountered in feature film production.
e78e645
e78e645
%package        devel
e78e645
Summary:        Development files for %{name}
0f5b374
BuildRequires:  texlive-latex
3d699f4
Requires:       %{name}-libs%{?_isa} = %{version}-%{release}
25e00bf
Requires:       cmake(tbb)
cb96973
Requires:       pkgconfig(zlib) > 1.2.7
ee76930
Obsoletes:      %{name}-doc < 6.1.0-1
ee76930
Provides:       %{name}-doc = %{version}-%{release}
e78e645
e78e645
%description    devel
e78e645
The %{name}-devel package contains libraries and header files for developing
e78e645
applications that use %{name}.
e78e645
b43ae63
%if 0%{?fedora}
21f4f5b
%package        -n python3-%{name}
e78e645
Summary:        OpenVDB Python module
3fc4e0c
BuildRequires:  pkgconfig(python3)
0f5b374
BuildRequires:  python3dist(numpy)
3d699f4
Requires:       %{name}-libs%{?_isa} = %{version}-%{release}
21f4f5b
Obsoletes:      %{name}-python3 < 6.2.0
fde0919
Obsoletes:      %{name}-python2 < 5.1.0-1
fde0919
Provides:       %{name}-python2 = %{version}-%{release}
3fc4e0c
%{?python_provide:%python_provide python3-%{name}}
21f4f5b
21f4f5b
%description    -n python3-%{name}
3fc4e0c
%{description}
e78e645
e78e645
This package contains the Python module.
b43ae63
%endif
b43ae63
e78e645
e78e645
%prep
5d0b811
%autosetup -p1
e78e645
ee76930
# Hardcoded values
543410d
sed -i \
ee76930
    -e 's|lib$|%{_lib}|g' \
0f5b374
    %{name}/%{name}/CMakeLists.txt %{name}/%{name}/python/CMakeLists.txt
e78e645
2d19ad2
e78e645
%build
1072aa4
%ifarch %{arm}
1072aa4
# https://bugzilla.redhat.com/show_bug.cgi?id=2021376
1072aa4
%global optflags %(echo %{optflags} | sed 's/-g /-g1 /')
1072aa4
%endif
b65e867
%ifarch ppc64le
e0e5b2f
%undefine _smp_mflags
b65e867
%endif 
1072aa4
export CXXFLAGS="%{build_cxxflags} -Wl,--as-needed"
dd35663
ee76930
# Ignore versions (python 3, etc.)
0a623bb
# Set ABI version to address blender compatibility for
0a623bb
# Fedora 40 and onward
e78e645
%cmake \
ee76930
    -DCMAKE_NO_SYSTEM_FROM_IMPORTED=TRUE \
a7c3c2a
    -DDISABLE_DEPENDENCY_VERSION_CHECKS=ON \
ee76930
    -DOPENVDB_BUILD_DOCS=ON \
b43ae63
%if 0%{?fedora}
3fc4e0c
    -DOPENVDB_BUILD_PYTHON_MODULE=ON \
b43ae63
%endif
f972080
%if 0%{?rhel}
f972080
    -DCONCURRENT_MALLOC=None \
f972080
%endif
c601478
    -DOPENVDB_BUILD_UNITTESTS=OFF \
ee76930
    -DOPENVDB_ENABLE_RPATH=OFF \
630aef3
    -DPYOPENVDB_INSTALL_DIRECTORY=%{python3_sitearch} \
b65e867
%if 0%{?with_ax}
b65e867
    -DHAVE_FFI_CALL=ON \
b65e867
    -DUSE_AX=ON \
0a623bb
    -DLLVM_STATIC=0 \
0a623bb
    -DLLVM_CONFIG=$(which llvm-config%{?llvm_compat:-%{llvm_compat}}) \
0a623bb
    -DLLVM=%{_bindir} \
b65e867
%endif
630aef3
%if 0%{?with_openexr}
630aef3
    -DUSE_EXR=ON \
630aef3
%endif
0a623bb
%if 0%{?with_nanovdb}
0a623bb
    -DUSE_NANOVDB=ON \
0a623bb
    -DOPENVDB_BUILD_NANOVDB=ON \
0a623bb
    -DNANOVDB_USE_OPENVDB=ON
0a623bb
%endif
b0daecb
# Increase memory reserve to 12GB per build thread for a successful build on
b0daecb
# ppc64le and s390x.
b0daecb
%cmake_build %limit_build -m 12288
e78e645
fde0919
%if 0%{?with_tests}
fde0919
%check
d2cc020
%ctest test
fde0919
%endif
e78e645
e78e645
%install
d2cc020
%cmake_install
e78e645
b4346ff
# Let RPM pick up html documents in the files section
b4346ff
mv %{buildroot}%{_docdir}/OpenVDB/html .
21f4f5b
rm -fr %{buildroot}%{_datadir}/doc
e78e645
e78e645
find %{buildroot} -name '*.a' -delete
e78e645
e78e645
%files
e78e645
%{_bindir}/vdb_print
0a623bb
%{_bindir}/nanovdb_{convert,print,validate}
e78e645
e78e645
%files libs
0f5b374
%license LICENSE
21f4f5b
%doc README.md CHANGES
4792088
%{_libdir}/lib%{name}.so.%{version}
fca44dc
%{_libdir}/lib%{name}.so.%{soversion}
e78e645
b43ae63
%if 0%{?fedora}
21f4f5b
%files -n python3-%{name}
19fcdae
%{python3_sitearch}/py%{name}.cpython-*.so
b43ae63
%endif
e78e645
e78e645
%files devel
ee76930
%doc html
e78e645
%{_includedir}/*
4792088
%{_libdir}/lib%{name}.so
c1f482a
%{_libdir}/cmake/OpenVDB/
e78e645
e78e645
%changelog
fca44dc
%autochangelog