summaryrefslogtreecommitdiffstats
path: root/graphics/Blender/blender-3.0.1-openexr.patch
blob: 435498cd8a3d0649e9e7af23d4b37f1df23dd380 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
https://src.fedoraproject.org/rpms/blender/blob/rawhide/f/blender-openexr.patch

--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -32,30 +32,31 @@
 #include <stdexcept>
 #include <string>
 
-#include <Iex.h>
+#include <OpenEXR/Iex.h>
 #include <ImathBox.h>
-#include <ImfArray.h>
-#include <ImfChannelList.h>
-#include <ImfCompression.h>
-#include <ImfCompressionAttribute.h>
-#include <ImfIO.h>
-#include <ImfInputFile.h>
-#include <ImfOutputFile.h>
-#include <ImfPixelType.h>
-#include <ImfStandardAttributes.h>
-#include <ImfStringAttribute.h>
-#include <ImfVersion.h>
-#include <half.h>
+#include <OpenEXR/ImfArray.h>
+#include <OpenEXR/ImfFrameBuffer.h>
+#include <OpenEXR/ImfChannelList.h>
+#include <OpenEXR/ImfCompression.h>
+#include <OpenEXR/ImfCompressionAttribute.h>
+#include <OpenEXR/ImfIO.h>
+#include <OpenEXR/ImfInputFile.h>
+#include <OpenEXR/ImfOutputFile.h>
+#include <OpenEXR/ImfPixelType.h>
+#include <OpenEXR/ImfStandardAttributes.h>
+#include <OpenEXR/ImfStringAttribute.h>
+#include <OpenEXR/ImfVersion.h>
+#include <Imath/half.h>
 
 /* multiview/multipart */
-#include <ImfInputPart.h>
-#include <ImfMultiPartInputFile.h>
-#include <ImfMultiPartOutputFile.h>
-#include <ImfMultiView.h>
-#include <ImfOutputPart.h>
-#include <ImfPartHelper.h>
-#include <ImfPartType.h>
-#include <ImfTiledOutputPart.h>
+#include <OpenEXR/ImfInputPart.h>
+#include <OpenEXR/ImfMultiPartInputFile.h>
+#include <OpenEXR/ImfMultiPartOutputFile.h>
+#include <OpenEXR/ImfMultiView.h>
+#include <OpenEXR/ImfOutputPart.h>
+#include <OpenEXR/ImfPartHelper.h>
+#include <OpenEXR/ImfPartType.h>
+#include <OpenEXR/ImfTiledOutputPart.h>
 
 #include "DNA_scene_types.h" /* For OpenEXR compression constants */
 
@@ -131,12 +132,12 @@ class IMemStream : public Imf::IStream {
     return false;
   }
 
-  Int64 tellg() override
+  uint64_t tellg() override
   {
     return _exrpos;
   }
 
-  void seekg(Int64 pos) override
+  void seekg(uint64_t pos) override
   {
     _exrpos = pos;
   }
@@ -146,8 +147,8 @@ class IMemStream : public Imf::IStream {
   }
 
  private:
-  Int64 _exrpos;
-  Int64 _exrsize;
+  uint64_t _exrpos;
+  uint64_t _exrsize;
   unsigned char *_exrbuf;
 };
 
@@ -182,12 +183,12 @@ class IFileStream : public Imf::IStream
     return check_error();
   }
 
-  Int64 tellg() override
+  uint64_t tellg() override
   {
     return std::streamoff(ifs.tellg());
   }
 
-  void seekg(Int64 pos) override
+  void seekg(uint64_t pos) override
   {
     ifs.seekg(pos);
     check_error();
@@ -231,19 +232,19 @@ class OMemStream : public OStream {
     ibuf->encodedsize += n;
   }
 
-  Int64 tellp() override
+  uint64_t tellp() override
   {
     return offset;
   }
 
-  void seekp(Int64 pos) override
+  void seekp(uint64_t pos) override
   {
     offset = pos;
     ensure_size(offset);
   }
 
  private:
-  void ensure_size(Int64 size)
+  void ensure_size(uint64_t size)
   {
     /* if buffer is too small increase it. */
     while (size > ibuf->encodedbuffersize) {
@@ -254,7 +255,7 @@ class OMemStream : public OStream {
   }
 
   ImBuf *ibuf;
-  Int64 offset;
+  uint64_t offset;
 };
 
 /* File Output Stream */
@@ -284,12 +285,12 @@ class OFileStream : public OStream {
     check_error();
   }
 
-  Int64 tellp() override
+  uint64_t tellp() override
   {
     return std::streamoff(ofs.tellp());
   }
 
-  void seekp(Int64 pos) override
+  void seekp(uint64_t pos) override
   {
     ofs.seekp(pos);
     check_error();
--- a/build_files/cmake/Modules/FindOpenEXR.cmake
+++ b/build_files/cmake/Modules/FindOpenEXR.cmake
@@ -25,6 +25,7 @@
 # see accompanying file BSD-3-Clause-license.txt for details.
 #=============================================================================
 
+
 # If OPENEXR_ROOT_DIR was defined in the environment, use it.
 IF(NOT OPENEXR_ROOT_DIR AND NOT $ENV{OPENEXR_ROOT_DIR} STREQUAL "")
   SET(OPENEXR_ROOT_DIR $ENV{OPENEXR_ROOT_DIR})
@@ -33,6 +34,16 @@ ENDIF()
 # Old versions (before 2.0?) do not have any version string, just assuming this should be fine though.
 SET(_openexr_libs_ver_init "2.0")
 
+find_package(Imath CONFIG QUIET)
+if(TARGET Imath::Imath)
+SET(_openexr_FIND_COMPONENTS
+  Imath
+  Iex
+  OpenEXR
+  IlmThread
+)
+
+else()
 SET(_openexr_FIND_COMPONENTS
   Half
   Iex
@@ -40,6 +51,7 @@ SET(_openexr_FIND_COMPONENTS
   IlmThread
   Imath
 )
+endif()
 
 SET(_openexr_SEARCH_DIRS
   ${OPENEXR_ROOT_DIR}
@@ -121,6 +133,9 @@ IF(OPENEXR_FOUND)
   SET(OPENEXR_LIBRARIES ${_openexr_LIBRARIES})
   # Both include paths are needed because of dummy OSL headers mixing #include <OpenEXR/foo.h> and #include <foo.h> :(
   SET(OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR} ${OPENEXR_INCLUDE_DIR}/OpenEXR)
+  if(TARGET Imath::Imath)
+	  list(APPEND OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR}/Imath)
+  endif()
 ENDIF()
 
 MARK_AS_ADVANCED(