1 Index: Field3D-1.7.3/export/StdMathLib.h
2 ===================================================================
3 --- Field3D-1.7.3.orig/export/StdMathLib.h
4 +++ Field3D-1.7.3/export/StdMathLib.h
6 #ifndef _INCLUDED_Field3D_StdMathLib_H_
7 #define _INCLUDED_Field3D_StdMathLib_H_
9 -#include <OpenEXR/ImathBox.h>
10 -#include <OpenEXR/ImathBoxAlgo.h>
11 -#include <OpenEXR/ImathColor.h>
12 -#include <OpenEXR/ImathHalfLimits.h>
13 -#include <OpenEXR/ImathMatrix.h>
14 -#include <OpenEXR/ImathMatrixAlgo.h>
15 -#include <OpenEXR/ImathPlane.h>
16 -#include <OpenEXR/ImathRandom.h>
17 -#include <OpenEXR/ImathRoots.h>
18 -#include <OpenEXR/ImathVec.h>
19 -#include <OpenEXR/half.h>
20 +// The version can reliably be found in this header file from OpenEXR,
21 +// for both 2.x and 3.x:
22 +#include <OpenEXR/OpenEXRConfig.h>
23 +#define COMBINED_OPENEXR_VERSION ((10000*OPENEXR_VERSION_MAJOR) + \
24 + (100*OPENEXR_VERSION_MINOR) + \
25 + OPENEXR_VERSION_PATCH)
27 +// There's just no easy way to have an `#include` that works in both
28 +// cases, so we use the version to switch which set of include files we
30 +#if COMBINED_OPENEXR_VERSION >= 20599 /* 2.5.99: pre-3.0 */
31 +# include <Imath/ImathBox.h>
32 +# include <Imath/ImathBoxAlgo.h>
33 +# include <Imath/ImathColor.h>
34 +# include <Imath/ImathMatrix.h>
35 +# include <Imath/ImathMatrixAlgo.h>
36 +# include <Imath/ImathPlane.h>
37 +# include <Imath/ImathRandom.h>
38 +# include <Imath/ImathRoots.h>
39 +# include <Imath/ImathVec.h>
40 +# include <Imath/half.h>
42 + // OpenEXR 2.x, use the old locations
43 +# include <OpenEXR/ImathBox.h>
44 +# include <OpenEXR/ImathBoxAlgo.h>
45 +# include <OpenEXR/ImathColor.h>
46 +# include <OpenEXR/ImathHalfLimits.h>
47 +# include <OpenEXR/ImathMatrix.h>
48 +# include <OpenEXR/ImathMatrixAlgo.h>
49 +# include <OpenEXR/ImathPlane.h>
50 +# include <OpenEXR/ImathRandom.h>
51 +# include <OpenEXR/ImathRoots.h>
52 +# include <OpenEXR/ImathVec.h>
53 +# include <OpenEXR/half.h>
55 //----------------------------------------------------------------------------//
58 Index: Field3D-1.7.3/export/Curve.h
59 ===================================================================
60 --- Field3D-1.7.3.orig/export/Curve.h
61 +++ Field3D-1.7.3/export/Curve.h
64 #include <boost/lexical_cast.hpp>
66 -#include <OpenEXR/ImathFun.h>
67 -#include <OpenEXR/ImathMatrix.h>
68 +// The version can reliably be found in this header file from OpenEXR,
69 +// for both 2.x and 3.x:
70 +#include <OpenEXR/OpenEXRConfig.h>
71 +#define COMBINED_OPENEXR_VERSION ((10000*OPENEXR_VERSION_MAJOR) + \
72 + (100*OPENEXR_VERSION_MINOR) + \
73 + OPENEXR_VERSION_PATCH)
75 +// There's just no easy way to have an `#include` that works in both
76 +// cases, so we use the version to switch which set of include files we
78 +#if COMBINED_OPENEXR_VERSION >= 20599 /* 2.5.99: pre-3.0 */
79 +# include <Imath/ImathFun.h>
80 +# include <Imath/ImathMatrix.h>
82 + // OpenEXR 2.x, use the old locations
83 +# include <OpenEXR/ImathFun.h>
84 +# include <OpenEXR/ImathMatrix.h>
88 //----------------------------------------------------------------------------//
90 Index: Field3D-1.7.3/include/OgUtil.h
91 ===================================================================
92 --- Field3D-1.7.3.orig/include/OgUtil.h
93 +++ Field3D-1.7.3/include/OgUtil.h
98 -#include <OpenEXR/ImathVec.h>
99 +// The version can reliably be found in this header file from OpenEXR,
100 +// for both 2.x and 3.x:
101 +#include <OpenEXR/OpenEXRConfig.h>
102 +#define COMBINED_OPENEXR_VERSION ((10000*OPENEXR_VERSION_MAJOR) + \
103 + (100*OPENEXR_VERSION_MINOR) + \
104 + OPENEXR_VERSION_PATCH)
106 +// There's just no easy way to have an `#include` that works in both
107 +// cases, so we use the version to switch which set of include files we
109 +#if COMBINED_OPENEXR_VERSION >= 20599 /* 2.5.99: pre-3.0 */
110 +# include <Imath/ImathVec.h>
112 + // OpenEXR 2.x, use the old locations
113 +# include <OpenEXR/ImathVec.h>
117 #include "UtilFoundation.h"
118 Index: Field3D-1.7.3/include/UtilFoundation.h
119 ===================================================================
120 --- Field3D-1.7.3.orig/include/UtilFoundation.h
121 +++ Field3D-1.7.3/include/UtilFoundation.h
127 +// The version can reliably be found in this header file from OpenEXR,
128 +// for both 2.x and 3.x:
129 +#include <OpenEXR/OpenEXRConfig.h>
130 +#define COMBINED_OPENEXR_VERSION ((10000*OPENEXR_VERSION_MAJOR) + \
131 + (100*OPENEXR_VERSION_MINOR) + \
132 + OPENEXR_VERSION_PATCH)
134 +// There's just no easy way to have an `#include` that works in both
135 +// cases, so we use the version to switch which set of include files we
137 +#if COMBINED_OPENEXR_VERSION >= 20599 /* 2.5.99: pre-3.0 */
138 +# include <Imath/half.h>
140 + // OpenEXR 2.x, use the old locations
141 +# include <OpenEXR/half.h>
146 Index: Field3D-1.7.3/include/OgIAttribute.h
147 ===================================================================
148 --- Field3D-1.7.3.orig/include/OgIAttribute.h
149 +++ Field3D-1.7.3/include/OgIAttribute.h
154 -#include <OpenEXR/ImathMatrix.h>
155 +// The version can reliably be found in this header file from OpenEXR,
156 +// for both 2.x and 3.x:
157 +#include <OpenEXR/OpenEXRConfig.h>
158 +#define COMBINED_OPENEXR_VERSION ((10000*OPENEXR_VERSION_MAJOR) + \
159 + (100*OPENEXR_VERSION_MINOR) + \
160 + OPENEXR_VERSION_PATCH)
162 +// There's just no easy way to have an `#include` that works in both
163 +// cases, so we use the version to switch which set of include files we
165 +#if COMBINED_OPENEXR_VERSION >= 20599 /* 2.5.99: pre-3.0 */
166 +# include <Imath/ImathMatrix.h>
168 + // OpenEXR 2.x, use the old locations
169 +# include <OpenEXR/ImathMatrix.h>
172 //----------------------------------------------------------------------------//
174 Index: Field3D-1.7.3/CMakeLists.txt
175 ===================================================================
176 --- Field3D-1.7.3.orig/CMakeLists.txt
177 +++ Field3D-1.7.3/CMakeLists.txt
179 set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake )
181 FIND_PACKAGE (Doxygen)
182 -FIND_PACKAGE (HDF5 COMPONENTS C)
183 IF ( CMAKE_HOST_WIN32 )
184 # f3dinfo relies on program_options but don't include it, since
185 # for some reason, unlike all the other boost components, a link is
186 @@ -49,7 +49,14 @@ FIND_PACKAGE (Boost COMPONENTS regex thr
190 -FIND_PACKAGE (ILMBase)
191 +# First, try to find just the right config files
192 +find_package(Imath CONFIG)
193 +if (NOT TARGET Imath::Imath)
194 + # Couldn't find Imath::Imath, maybe it's older and has IlmBase?
195 + find_package(IlmBase CONFIG)
197 +find_package(OpenEXR CONFIG)
198 +find_package(HDF5 COMPONENTS C)
200 # Allow the developer to select if Dynamic or Static libraries are built
201 OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" ON)
202 @@ -146,9 +152,20 @@ IF ( CMAKE_HOST_UNIX )
203 LIST ( APPEND Field3D_Libraries_Shared
206 - LIST ( APPEND Field3D_Libraries_Shared
207 - Iex Half IlmThread Imath
209 + if(TARGET Imath::Imath)
210 + list(APPEND Field3D_Libraries_Shared
211 + # For OpenEXR/Imath 3.x:
212 + $<$<TARGET_EXISTS:OpenEXR::OpenEXR>:OpenEXR::OpenEXR>
213 + $<$<TARGET_EXISTS:Imath::Imath>:Imath::Imath>
214 + $<$<TARGET_EXISTS:Imath::Half>:Imath::Half>
219 + LIST ( APPEND Field3D_Libraries_Shared
220 + Iex Half IlmThread Imath
223 SET ( Field3D_DSO_Libraries ${Field3D_Libraries_Shared} )
224 SET ( Field3D_BIN_Libraries Field3D ${Field3D_Libraries_Shared}
226 Index: Field3D-1.7.3/test/unit_tests/UnitTest.cpp
227 ===================================================================
228 --- Field3D-1.7.3.orig/test/unit_tests/UnitTest.cpp
229 +++ Field3D-1.7.3/test/unit_tests/UnitTest.cpp
231 #include <boost/thread/thread.hpp>
232 #include <boost/thread/mutex.hpp>
234 -#include <OpenEXR/ImathFrustum.h>
235 +// The version can reliably be found in this header file from OpenEXR,
236 +// for both 2.x and 3.x:
237 +#include <OpenEXR/OpenEXRConfig.h>
238 +#define COMBINED_OPENEXR_VERSION ((10000*OPENEXR_VERSION_MAJOR) + \
239 + (100*OPENEXR_VERSION_MINOR) + \
240 + OPENEXR_VERSION_PATCH)
242 +// There's just no easy way to have an `#include` that works in both
243 +// cases, so we use the version to switch which set of include files we
245 +#if COMBINED_OPENEXR_VERSION >= 20599 /* 2.5.99: pre-3.0 */
246 +# include <Imath/ImathFrustum.h>
248 + // OpenEXR 2.x, use the old locations
249 +# include <OpenEXR/ImathFrustum.h>
252 #include "Field3D/DenseField.h"
253 #include "Field3D/EmptyField.h"