Skip to content

Commit

Permalink
Fixed FreeImage build under MSVC
Browse files Browse the repository at this point in the history
This fixes build error `Error C2039 'binary_function': is not a member of 'std' ` in FreeImage/OpenEXR under latest Visual Studio 2022
See https://learn.microsoft.com/en-us/answers/questions/1348183/std-binary-function-is-missing-in-msvc-14-37-32822

I tried upgrading FreeImage to latest but it has the same issue (July 31st, 2018: FreeImage 3.18.0 released).
Note ours is pretty old (March 17th, 2012: FreeImage 3.15.3 released).

I ended up just deleting the offending code because it turned out to be deadcode (a `std::map` compare func has nothing to do with `binary_function`).
  • Loading branch information
ohlidalp committed Nov 4, 2024
1 parent 2199e06 commit a5a421b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions ogre/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ ExternalProject_Add(
ogredeps
URL https://github.com/AnotherFoxGuy/ogredeps/archive/17f4c583c82559074a96f1436670a4f10961b9d9.tar.gz
URL_MD5 d5425da9f4ffa9f24dd021e32a8665ad
PATCH_COMMAND ${PATCH_TOOL_SCRIPT} ${CMAKE_CURRENT_SOURCE_DIR}/ogredeps-freeimage-binaryfunction.patch
CMAKE_ARGS
-DOGREDEPS_BUILD_AMD_QBS=OFF
-DOGREDEPS_BUILD_NVIDIA_NVAPI=OFF
Expand Down
13 changes: 13 additions & 0 deletions ogre/ogredeps-freeimage-binaryfunction.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/src/FreeImage/Source/OpenEXR/IlmImf/ImfAttribute.cpp b/src/FreeImage/Source/OpenEXR/IlmImf/ImfAttribute.cpp
index feb5f83..5cb036e 100644
--- a/src/FreeImage/Source/OpenEXR/IlmImf/ImfAttribute.cpp
+++ b/src/FreeImage/Source/OpenEXR/IlmImf/ImfAttribute.cpp
@@ -61,7 +61,7 @@ Attribute::~Attribute () {}

namespace {

-struct NameCompare: std::binary_function <const char *, const char *, bool>
+struct NameCompare
{
bool
operator () (const char *x, const char *y) const

0 comments on commit a5a421b

Please sign in to comment.