Move to OpenEXR 3.x.

This commit is contained in:
Richard Shaw 2021-07-23 06:54:40 -05:00
parent 229019515c
commit 5d0b81101f
2 changed files with 98 additions and 4 deletions

84
openvdb-openexr3.patch Normal file
View File

@ -0,0 +1,84 @@
Index: openvdb-8.1.0/openvdb/openvdb/cmd/CMakeLists.txt
===================================================================
--- openvdb-8.1.0.orig/openvdb/openvdb/cmd/CMakeLists.txt
+++ openvdb-8.1.0/openvdb/openvdb/cmd/CMakeLists.txt
@@ -116,27 +116,36 @@ endif()
#### vdb_render
if(OPENVDB_BUILD_VDB_RENDER)
- find_package(IlmBase ${MINIMUM_ILMBASE_VERSION} REQUIRED COMPONENTS Half Iex IlmThread Imath)
- find_package(OpenEXR ${MINIMUM_OPENEXR_VERSION} REQUIRED COMPONENTS IlmImf)
+ find_package(Imath CONFIG)
+ if(TARGET Imath::IMath)
+ find_package(OpenEXR CONFIG REQUIRED)
+ else()
+ find_package(IlmBase ${MINIMUM_ILMBASE_VERSION} REQUIRED COMPONENTS Half Iex IlmThread Imath)
+ find_package(OpenEXR ${MINIMUM_OPENEXR_VERSION} REQUIRED COMPONENTS IlmImf)
- set(VDB_RENDER_SOURCE_FILES openvdb_render.cc)
- add_executable(vdb_render ${VDB_RENDER_SOURCE_FILES})
+ set(VDB_RENDER_SOURCE_FILES openvdb_render.cc)
+ add_executable(vdb_render ${VDB_RENDER_SOURCE_FILES})
- # Set deps. Note that the order here is important. If we're building against
- # Houdini 17.5 we must include OpenEXR and IlmBase deps first to ensure the
- # users chosen namespaced headers are correctly prioritized. Otherwise other
- # include paths from shared installs (including houdini) may pull in the wrong
- # headers
+ # Set deps. Note that the order here is important. If we're building against
+ # Houdini 17.5 we must include OpenEXR and IlmBase deps first to ensure the
+ # users chosen namespaced headers are correctly prioritized. Otherwise other
+ # include paths from shared installs (including houdini) may pull in the wrong
+ # headers
target_link_libraries(vdb_render
- IlmBase::Half
- OpenEXR::IlmImf
- IlmBase::IlmThread
- IlmBase::Iex
- IlmBase::Imath
+ # For OpenEXR/Imath 3.x:
+ $<$<TARGET_EXISTS:OpenEXR::OpenEXR>:OpenEXR::OpenEXR>
+ $<$<TARGET_EXISTS:Imath::Imath>:Imath::Imath>
+ $<$<TARGET_EXISTS:Imath::Half>:Imath::Half>
+ # For OpenEXR 2.4/2.5:
+ $<$<TARGET_EXISTS:OpenEXR::IlmImf>:OpenEXR::IlmImf>
+ $<$<TARGET_EXISTS:IlmBase::Imath>:IlmBase::Imath>
+ $<$<TARGET_EXISTS:IlmBase::Half>:IlmBase::Half>
+ $<$<TARGET_EXISTS:IlmBase::IlmThread>:IlmBase::IlmThread>
+ $<$<TARGET_EXISTS:IlmBase::Iex>:IlmBase::Iex>
${OPENVDB_BINARIES_DEPENDENT_LIBS}
)
-
+ endif()
if(WIN32)
# @note OPENVDB_OPENEXR_STATICLIB is old functionality and should be removed
get_target_property(ILMBASE_LIB_TYPE IlmBase::Half TYPE)
Index: openvdb-8.1.0/openvdb/openvdb/Types.h
===================================================================
--- openvdb-8.1.0.orig/openvdb/openvdb/Types.h
+++ openvdb-8.1.0/openvdb/openvdb/Types.h
@@ -9,7 +9,22 @@
#include "TypeList.h" // backwards compat
#ifdef OPENVDB_USE_IMATH_HALF
-#include <OpenEXR/half.h>
+// The version can reliably be found in this header file from OpenEXR,
+// for both 2.x and 3.x:
+#include <OpenEXR/OpenEXRConfig.h>
+#define COMBINED_OPENEXR_VERSION ((10000*OPENEXR_VERSION_MAJOR) + \
+ (100*OPENEXR_VERSION_MINOR) + \
+ OPENEXR_VERSION_PATCH)
+
+// There's just no easy way to have an `#include` that works in both
+// cases, so we use the version to switch which set of include files we
+// use.
+#if COMBINED_OPENEXR_VERSION >= 20599 /* 2.5.99: pre-3.0 */
+# include <Imath/half.h>
+#else
+ // OpenEXR 2.x, use the old locations
+# include <OpenEXR/half.h>
+#endif
namespace openvdb {
OPENVDB_USE_VERSION_NAMESPACE
namespace OPENVDB_VERSION_NAME {

View File

@ -6,13 +6,15 @@
Name: openvdb
Version: 8.1.0
Release: 2%{?dist}
Release: 3%{?dist}
Summary: C++ library for sparse volumetric data discretized on three-dimensional grids
License: MPLv2.0
URL: http://www.openvdb.org/
Source0: https://github.com/AcademySoftwareFoundation/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Patch0: openvdb-openexr3.patch
BuildRequires: boost-devel >= 1.61
# boost-python3-devel merged in boost-devel for Fedora 33+
# https://src.fedoraproject.org/rpms/boost/c/1f2e448e099a867f9da62b9da009d3dec5e1ad64?branch=master
@ -35,10 +37,15 @@ BuildRequires: glfw-devel >= 2.7
%else
BuildRequires: pkgconfig(glfw3) >= 2.7
%endif
BuildRequires: pkgconfig(IlmBase)
BuildRequires: pkgconfig(jemalloc)
BuildRequires: pkgconfig(log4cplus) >= 1.0
BuildRequires: pkgconfig(OpenEXR) >= 2.2
# IlmBase is built in as of OpenEXR 2.5, available starting in f34.
%if 0%{?fedora} > 33
BuildRequires: cmake(OpenEXR)
%else
BuildRequires: pkgconfig(OpenEXR) < 3
BuildRequires: pkgconfig(IlmBase)
%endif
BuildRequires: pkgconfig(tbb) >= 3.0
BuildRequires: pkgconfig(xi)
BuildRequires: pkgconfig(zlib) > 1.2.7
@ -92,7 +99,7 @@ This package contains the Python module.
%prep
%autosetup
%autosetup -p1
# Hardcoded values
sed -i \
@ -153,6 +160,9 @@ find %{buildroot} -name '*.a' -delete
%{_libdir}/lib%{name}.so
%changelog
* Fri Jul 23 2021 Richard Shaw <hobbes1069@gmail.com> - 8.1.0-3
- Move to OpenEXR 3.x.
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 8.1.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild