[Bf-blender-cvs] [00f7b572d9e] master: Windows: Fix build issue on windows
Ray Molenkamp
noreply at git.blender.org
Fri Oct 16 01:15:02 CEST 2020
Commit: 00f7b572d9ebce1af0e9b5afc5d53467374ca738
Author: Ray Molenkamp
Date: Thu Oct 15 17:14:57 2020 -0600
Branches: master
https://developer.blender.org/rB00f7b572d9ebce1af0e9b5afc5d53467374ca738
Windows: Fix build issue on windows
TBB includes Windows.h which defines a min/max macro
leading to issues when you want to use std::min and
std::max.
This change prevents Windows.h from defining them
sidestepping the issue.
===================================================================
M source/blender/blenlib/BLI_task.hh
===================================================================
diff --git a/source/blender/blenlib/BLI_task.hh b/source/blender/blenlib/BLI_task.hh
index 7e60f271e9d..a3679bfbc0d 100644
--- a/source/blender/blenlib/BLI_task.hh
+++ b/source/blender/blenlib/BLI_task.hh
@@ -23,7 +23,18 @@
#ifdef WITH_TBB
/* Quiet top level deprecation message, unrelated to API usage here. */
# define TBB_SUPPRESS_DEPRECATED_MESSAGES 1
+
+# ifdef WIN32
+/* TBB includes Windows.h which will define min/max macros causing issues
+ * when we try to use std::min and std::max later on. */
+# define NOMINMAX
+# endif
# include <tbb/tbb.h>
+# ifdef WIN32
+/* We cannot keep this defined, since other parts of the code deal with this on their own leading
+ * to multiple define warnings unless we undefine this. */
+# undef NOMINMAX
+# endif
#endif
#include "BLI_index_range.hh"
More information about the Bf-blender-cvs
mailing list