From 7ce3297cf11a589e7e49deb4bce3142802007803 Mon Sep 17 00:00:00 2001 From: Richard Shaw Date: Sat, 31 Jul 2021 09:22:29 -0500 Subject: [PATCH] Add minimal patch for OpenEXR/Imath 3. --- Field3D-openexr.patch | 244 ++++++++++++++++++++++++++++++++++++++++++ Field3D.spec | 12 ++- 2 files changed, 255 insertions(+), 1 deletion(-) create mode 100644 Field3D-openexr.patch diff --git a/Field3D-openexr.patch b/Field3D-openexr.patch new file mode 100644 index 0000000..02e96fd --- /dev/null +++ b/Field3D-openexr.patch @@ -0,0 +1,244 @@ +Index: Field3D-1.7.3/export/StdMathLib.h +=================================================================== +--- Field3D-1.7.3.orig/export/StdMathLib.h ++++ Field3D-1.7.3/export/StdMathLib.h +@@ -38,18 +38,41 @@ + #ifndef _INCLUDED_Field3D_StdMathLib_H_ + #define _INCLUDED_Field3D_StdMathLib_H_ + +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include ++// The version can reliably be found in this header file from OpenEXR, ++// for both 2.x and 3.x: ++#include ++#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 ++# include ++# include ++# include ++# include ++# include ++# include ++# include ++# include ++# include ++#else ++ // OpenEXR 2.x, use the old locations ++# include ++# include ++# include ++# include ++# include ++# include ++# include ++# include ++# include ++# include ++# include ++#endif + //----------------------------------------------------------------------------// + + #include "ns.h" +Index: Field3D-1.7.3/export/Curve.h +=================================================================== +--- Field3D-1.7.3.orig/export/Curve.h ++++ Field3D-1.7.3/export/Curve.h +@@ -53,8 +53,25 @@ + + #include + +-#include +-#include ++// The version can reliably be found in this header file from OpenEXR, ++// for both 2.x and 3.x: ++#include ++#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 ++# include ++#else ++ // OpenEXR 2.x, use the old locations ++# include ++# include ++#endif ++ + + //----------------------------------------------------------------------------// + +Index: Field3D-1.7.3/include/OgUtil.h +=================================================================== +--- Field3D-1.7.3.orig/include/OgUtil.h ++++ Field3D-1.7.3/include/OgUtil.h +@@ -10,7 +10,22 @@ + #include + #include + +-#include ++// The version can reliably be found in this header file from OpenEXR, ++// for both 2.x and 3.x: ++#include ++#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 ++#else ++ // OpenEXR 2.x, use the old locations ++# include ++#endif + + #include "All.h" + #include "UtilFoundation.h" +Index: Field3D-1.7.3/include/UtilFoundation.h +=================================================================== +--- Field3D-1.7.3.orig/include/UtilFoundation.h ++++ Field3D-1.7.3/include/UtilFoundation.h +@@ -68,7 +68,22 @@ + + #include + +-#include ++// The version can reliably be found in this header file from OpenEXR, ++// for both 2.x and 3.x: ++#include ++#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 ++#else ++ // OpenEXR 2.x, use the old locations ++# include ++#endif + + #include + #include +Index: Field3D-1.7.3/include/OgIAttribute.h +=================================================================== +--- Field3D-1.7.3.orig/include/OgIAttribute.h ++++ Field3D-1.7.3/include/OgIAttribute.h +@@ -9,7 +9,22 @@ + + #include "OgUtil.h" + +-#include ++// The version can reliably be found in this header file from OpenEXR, ++// for both 2.x and 3.x: ++#include ++#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 ++#else ++ // OpenEXR 2.x, use the old locations ++# include ++#endif + + //----------------------------------------------------------------------------// + +Index: Field3D-1.7.3/CMakeLists.txt +=================================================================== +--- Field3D-1.7.3.orig/CMakeLists.txt ++++ Field3D-1.7.3/CMakeLists.txt +@@ -49,7 +49,13 @@ FIND_PACKAGE (Boost COMPONENTS regex thr + FIND_PACKAGE (MPI) + ENDIF () + +-FIND_PACKAGE (ILMBase) ++# First, try to find just the right config files ++find_package(Imath CONFIG) ++if (NOT TARGET Imath::Imath) ++ # Couldn't find Imath::Imath, maybe it's older and has IlmBase? ++ find_package(IlmBase CONFIG) ++endif () ++find_package(OpenEXR CONFIG) + + # Allow the developer to select if Dynamic or Static libraries are built + OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" ON) +@@ -146,9 +152,20 @@ IF ( CMAKE_HOST_UNIX ) + LIST ( APPEND Field3D_Libraries_Shared + ${MPI_LIBRARIES} ) + ENDIF ( MPI_FOUND ) +- LIST ( APPEND Field3D_Libraries_Shared +- Iex Half IlmThread Imath +- pthread dl z ) ++ if(TARGET Imath::Imath) ++ list(APPEND Field3D_Libraries_Shared ++ # For OpenEXR/Imath 3.x: ++ $<$:OpenEXR::OpenEXR> ++ $<$:Imath::Imath> ++ $<$:Imath::Half> ++ pthread ++ dl ++ z) ++ else() ++ LIST ( APPEND Field3D_Libraries_Shared ++ Iex Half IlmThread Imath ++ pthread dl z ) ++ endif() + SET ( Field3D_DSO_Libraries ${Field3D_Libraries_Shared} ) + SET ( Field3D_BIN_Libraries Field3D ${Field3D_Libraries_Shared} + ${Boost_LIBRARIES} ) +Index: Field3D-1.7.3/test/unit_tests/UnitTest.cpp +=================================================================== +--- Field3D-1.7.3.orig/test/unit_tests/UnitTest.cpp ++++ Field3D-1.7.3/test/unit_tests/UnitTest.cpp +@@ -44,7 +44,22 @@ + #include + #include + +-#include ++// The version can reliably be found in this header file from OpenEXR, ++// for both 2.x and 3.x: ++#include ++#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 ++#else ++ // OpenEXR 2.x, use the old locations ++# include ++#endif + + #include "Field3D/DenseField.h" + #include "Field3D/EmptyField.h" diff --git a/Field3D.spec b/Field3D.spec index e2c0dad..0667cd3 100644 --- a/Field3D.spec +++ b/Field3D.spec @@ -1,6 +1,6 @@ Name: Field3D Version: 1.7.3 -Release: 11%{?dist} +Release: 12%{?dist} Summary: Library for storing voxel data License: BSD @@ -8,11 +8,18 @@ URL: https://sites.google.com/site/field3d/ Source0: https://github.com/imageworks/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz +Patch0: Field3D-openexr.patch + BuildRequires: cmake gcc-c++ doxygen BuildRequires: hdf5-devel BuildRequires: boost-devel +%if 0%{?fedora} > 34 +BuildRequires: cmake(OpenEXR) +BuildRequires: cmake(Imath) +%else BuildRequires: ilmbase-devel BuildRequires: openexr-devel +%endif Requires: hdf5 = %{_hdf5_version} @@ -67,6 +74,9 @@ pushd %{_vpath_builddir} %changelog +* Sat Jul 31 2021 Richard Shaw - 1.7.3-12 +- Add minimal patch for OpenEXR/Imath 3. + * Wed Jul 21 2021 Fedora Release Engineering - 1.7.3-11 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild