Drop no longer needed OpenEXR and Imath dependencies

This commit is contained in:
Luya Tshimbalanga 2021-08-01 00:18:41 -07:00
parent 5d0b81101f
commit 764be4a4fd
No known key found for this signature in database
GPG Key ID: 5E528174D8A2609A
2 changed files with 4 additions and 94 deletions

View File

@ -1,84 +0,0 @@
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,15 +6,13 @@
Name: openvdb
Version: 8.1.0
Release: 3%{?dist}
Release: 4%{?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
@ -39,13 +37,6 @@ BuildRequires: pkgconfig(glfw3) >= 2.7
%endif
BuildRequires: pkgconfig(jemalloc)
BuildRequires: pkgconfig(log4cplus) >= 1.0
# 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
@ -160,6 +151,9 @@ find %{buildroot} -name '*.a' -delete
%{_libdir}/lib%{name}.so
%changelog
* Sun Aug 1 2021 Luya Tshimbalanga <luya@fedoraproject.org> - 8.1.0-4
- Drop no longer needed OpenEXR and Imath dependencies
* Fri Jul 23 2021 Richard Shaw <hobbes1069@gmail.com> - 8.1.0-3
- Move to OpenEXR 3.x.