diff options
author | Ray Molenkamp <github@lazydodo.com> | 2022-02-23 22:27:02 +0300 |
---|---|---|
committer | Ray Molenkamp <github@lazydodo.com> | 2022-02-23 22:27:02 +0300 |
commit | 6ca85a8cf1f30ea36eaebe28484ae183d836811d (patch) | |
tree | 018dbb5ceb37a4335e64a4100c306aab61a44865 /source/blender/blenlib | |
parent | 572acba5d1060bb63a5b95ae2e2529798d5dac5a (diff) |
Fix: Build issue on windows
tbb/enumerable_thread_specific.h drags in windows.h
which will define min/max macro's unless you politely
ask it not to.
it's bit of an eyesore, but it is what it is
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_enumerable_thread_specific.hh | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/source/blender/blenlib/BLI_enumerable_thread_specific.hh b/source/blender/blenlib/BLI_enumerable_thread_specific.hh index 339f02dce0f..51bf8d06cf1 100644 --- a/source/blender/blenlib/BLI_enumerable_thread_specific.hh +++ b/source/blender/blenlib/BLI_enumerable_thread_specific.hh @@ -3,7 +3,25 @@ #pragma once #ifdef WITH_TBB -# include <tbb/enumerable_thread_specific.h> + +# ifdef WITH_TBB +/* Quiet top level deprecation message, unrelated to API usage here. */ +# if defined(WIN32) && !defined(NOMINMAX) +/* 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 +# define TBB_MIN_MAX_CLEANUP +# endif +# include <tbb/enumerable_thread_specific.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 un-define this, however we can only undefine this if we + * were the ones that made the definition earlier. */ +# ifdef TBB_MIN_MAX_CLEANUP +# undef NOMINMAX +# endif +# endif +# endif #endif #include <atomic> |