Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Molenkamp <github@lazydodo.com>2020-10-16 02:14:57 +0300
committerRay Molenkamp <github@lazydodo.com>2020-10-16 02:14:57 +0300
commit00f7b572d9ebce1af0e9b5afc5d53467374ca738 (patch)
tree66fb5b5105222962dde4f804ca0ac47d6b682c5d
parentba8233174cd72ded420ff0668cf8c4a99a813534 (diff)
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.
-rw-r--r--source/blender/blenlib/BLI_task.hh11
1 files changed, 11 insertions, 0 deletions
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"