From 4846f8c211515546d441d3305a50138614987b72 Mon Sep 17 00:00:00 2001
From: Robert Schiele <rschiele@gmail.com>
Date: Fri, 5 May 2023 20:39:46 +0200
Subject: [PATCH] add missing includes of <cstdint> (PR #10499)

---
 deps/OpenEXR/OpenEXR.cmake      |  3 ++-
 deps/OpenEXR/OpenEXR.patch      | 36 +++++++++++++++++++++++++++++++++
 src/libslic3r/PNGReadWrite.hpp  |  1 +
 4 files changed, 40 insertions(+), 1 deletion(-)
 create mode 100644 deps/OpenEXR/OpenEXR.patch

diff --git a/deps/OpenEXR/OpenEXR.cmake b/deps/OpenEXR/OpenEXR.cmake
index 046223fed9e..094965d0421 100644
--- a/deps/OpenEXR/OpenEXR.cmake
+++ b/deps/OpenEXR/OpenEXR.cmake
@@ -4,6 +4,7 @@ prusaslicer_add_cmake_project(OpenEXR
     URL_HASH SHA256=0307a3d7e1fa1e77e9d84d7e9a8694583fbbbfd50bdc6884e2c96b8ef6b902de
     DEPENDS ${ZLIB_PKG}
     GIT_TAG v2.5.5
+    PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_LIST_DIR}/OpenEXR.patch
     CMAKE_ARGS
         -DCMAKE_POSITION_INDEPENDENT_CODE=ON
         -DBUILD_TESTING=OFF 
@@ -14,4 +15,4 @@ prusaslicer_add_cmake_project(OpenEXR
 
 if (MSVC)
     add_debug_dep(dep_OpenEXR)
-endif ()
\ No newline at end of file
+endif ()
diff --git a/deps/OpenEXR/OpenEXR.patch b/deps/OpenEXR/OpenEXR.patch
new file mode 100644
index 00000000000..22adbd27784
--- /dev/null
+++ b/deps/OpenEXR/OpenEXR.patch
@@ -0,0 +1,36 @@
+diff --git a/OpenEXR/IlmImf/ImfDwaCompressor.cpp b/OpenEXR/IlmImf/ImfDwaCompressor.cpp
+index 59d1d5d1..585a3e65 100644
+--- a/OpenEXR/IlmImf/ImfDwaCompressor.cpp
++++ b/OpenEXR/IlmImf/ImfDwaCompressor.cpp
+@@ -159,6 +159,7 @@
+ #include <limits>
+ 
+ #include <cstddef>
++#include <cstdint>
+ 
+ 
+ // Windows specific addition to prevent the indirect import of the redefined min/max macros
+diff --git a/OpenEXR/IlmImf/ImfHuf.cpp b/OpenEXR/IlmImf/ImfHuf.cpp
+index 271849b7..165fac58 100644
+--- a/OpenEXR/IlmImf/ImfHuf.cpp
++++ b/OpenEXR/IlmImf/ImfHuf.cpp
+@@ -53,6 +53,7 @@
+ #include <cstring>
+ #include <cassert>
+ #include <algorithm>
++#include <cstdint>
+ 
+ 
+ using namespace std;
+diff --git a/OpenEXR/IlmImf/ImfMisc.cpp b/OpenEXR/IlmImf/ImfMisc.cpp
+index d2c84787..4b487940 100644
+--- a/OpenEXR/IlmImf/ImfMisc.cpp
++++ b/OpenEXR/IlmImf/ImfMisc.cpp
+@@ -40,6 +40,7 @@
+ //
+ //-----------------------------------------------------------------------------
+ 
++#include <cstdint>
+ #include <ImfMisc.h>
+ #include <ImfHeader.h>
+ #include <ImfAttribute.h>
diff --git a/src/libslic3r/PNGReadWrite.hpp b/src/libslic3r/PNGReadWrite.hpp
index 01e1f474500..399c6224382 100644
--- a/src/libslic3r/PNGReadWrite.hpp
+++ b/src/libslic3r/PNGReadWrite.hpp
@@ -4,6 +4,7 @@
 #include <vector>
 #include <string>
 #include <istream>
+#include <cstdint>
 
 namespace Slic3r { namespace png {
 
