Blame luxcorerender-openexr3.patch

afb2113
Index: LuxCore-luxcorerender_v2.5/cmake/Dependencies.cmake
afb2113
===================================================================
afb2113
--- LuxCore-luxcorerender_v2.5.orig/cmake/Dependencies.cmake
afb2113
+++ LuxCore-luxcorerender_v2.5/cmake/Dependencies.cmake
6869276
@@ -30,7 +30,14 @@ find_package(Threads REQUIRED)
afb2113
 
afb2113
 find_package(OpenImageIO REQUIRED)
afb2113
 include_directories(BEFORE SYSTEM ${OPENIMAGEIO_INCLUDE_DIR})
afb2113
-find_package(OpenEXR REQUIRED)
afb2113
+
afb2113
+# Try to use CMake targets first for OpenEXR 3.x
afb2113
+find_package(Imath QUIET CONFIG)
afb2113
+if(NOT TARGET Imath::Imath)
afb2113
+    find_package(OpenEXR REQUIRED)
afb2113
+else()
6869276
+    set(OPENEXR_LIBRARIES Imath::Imath)
afb2113
+endif()
afb2113
 
afb2113
 if(NOT APPLE)
afb2113
     # Apple has these available hardcoded and matched in macos repo, see Config_OSX.cmake
afb2113
Index: LuxCore-luxcorerender_v2.5/deps/openvdb-7.0.0/openvdb/Types.h
afb2113
===================================================================
afb2113
--- LuxCore-luxcorerender_v2.5.orig/deps/openvdb-7.0.0/openvdb/Types.h
afb2113
+++ LuxCore-luxcorerender_v2.5/deps/openvdb-7.0.0/openvdb/Types.h
afb2113
@@ -6,7 +6,22 @@
afb2113
 
afb2113
 #include "version.h"
afb2113
 #include "Platform.h"
afb2113
-#include <OpenEXR/half.h>
afb2113
+#include <OpenEXR/OpenEXRConfig.h>
afb2113
+#define COMBINED_OPENEXR_VERSION ((10000*OPENEXR_VERSION_MAJOR) + \
afb2113
+                                  (100*OPENEXR_VERSION_MINOR) + \
afb2113
+                                  OPENEXR_VERSION_PATCH)
afb2113
+
afb2113
+// There's just no easy way to have an `#include` that works in both
afb2113
+// cases, so we use the version to switch which set of include files we
afb2113
+// use.
afb2113
+#if COMBINED_OPENEXR_VERSION >= 20599 /* 2.5.99: pre-3.0 */
afb2113
+#   include <Imath/ImathVec.h>
afb2113
+#   include <Imath/half.h>
afb2113
+#else
afb2113
+    // OpenEXR 2.x, use the old locations
afb2113
+#   include <OpenEXR/ImathVec.h>
afb2113
+#   include <OpenEXR/half.h>
afb2113
+#endif
afb2113
 #include <openvdb/math/Math.h>
afb2113
 #include <openvdb/math/BBox.h>
afb2113
 #include <openvdb/math/Quat.h>
afb2113
Index: LuxCore-luxcorerender_v2.5/include/slg/imagemap/imagemap.h
afb2113
===================================================================
afb2113
--- LuxCore-luxcorerender_v2.5.orig/include/slg/imagemap/imagemap.h
afb2113
+++ LuxCore-luxcorerender_v2.5/include/slg/imagemap/imagemap.h
afb2113
@@ -19,7 +19,22 @@
afb2113
 #ifndef _SLG_IMAGEMAP_H
afb2113
 #define	_SLG_IMAGEMAP_H
afb2113
 
afb2113
-#include <OpenEXR/half.h>
afb2113
+#include <OpenEXR/OpenEXRConfig.h>
afb2113
+#define COMBINED_OPENEXR_VERSION ((10000*OPENEXR_VERSION_MAJOR) + \
afb2113
+                                  (100*OPENEXR_VERSION_MINOR) + \
afb2113
+                                  OPENEXR_VERSION_PATCH)
afb2113
+
afb2113
+// There's just no easy way to have an `#include` that works in both
afb2113
+// cases, so we use the version to switch which set of include files we
afb2113
+// use.
afb2113
+#if COMBINED_OPENEXR_VERSION >= 20599 /* 2.5.99: pre-3.0 */
afb2113
+#   include <Imath/ImathVec.h>
afb2113
+#   include <Imath/half.h>
afb2113
+#else
afb2113
+    // OpenEXR 2.x, use the old locations
afb2113
+#   include <OpenEXR/ImathVec.h>
afb2113
+#   include <OpenEXR/half.h>
afb2113
+#endif
afb2113
 
afb2113
 #include <string>
afb2113
 #include <limits>
afb2113
Index: LuxCore-luxcorerender_v2.5/include/slg/utils/halfserialization.h
afb2113
===================================================================
afb2113
--- LuxCore-luxcorerender_v2.5.orig/include/slg/utils/halfserialization.h
afb2113
+++ LuxCore-luxcorerender_v2.5/include/slg/utils/halfserialization.h
afb2113
@@ -19,7 +19,22 @@
afb2113
 #ifndef _SLG_HALFSERIALIZATION_H
afb2113
 #define	_SLG_HALFSERIALIZATION_H
afb2113
 
afb2113
-#include <OpenEXR/half.h>
afb2113
+#include <OpenEXR/OpenEXRConfig.h>
afb2113
+#define COMBINED_OPENEXR_VERSION ((10000*OPENEXR_VERSION_MAJOR) + \
afb2113
+                                  (100*OPENEXR_VERSION_MINOR) + \
afb2113
+                                  OPENEXR_VERSION_PATCH)
afb2113
+
afb2113
+// There's just no easy way to have an `#include` that works in both
afb2113
+// cases, so we use the version to switch which set of include files we
afb2113
+// use.
afb2113
+#if COMBINED_OPENEXR_VERSION >= 20599 /* 2.5.99: pre-3.0 */
afb2113
+#   include <Imath/ImathVec.h>
afb2113
+#   include <Imath/half.h>
afb2113
+#else
afb2113
+    // OpenEXR 2.x, use the old locations
afb2113
+#   include <OpenEXR/ImathVec.h>
afb2113
+#   include <OpenEXR/half.h>
afb2113
+#endif
afb2113
 
afb2113
 #include "luxrays/utils/utils.h"
afb2113
 #include "luxrays/utils/serializationutils.h"