TBB: fix deprecation warnings with newer TBB versions

* USD and OpenVDB headers use deprecated TBB headers, suppress all deprecation
  warnings there since we have no control over them.
* For our own TBB includes, use the individual headers rather than the tbb.h that
  includes everything to avoid warnings, rather than suppressing all.

This is in anticipation of the TBB 2020 upgrade in D10359. Ref D10361.
This commit is contained in:
Brecht Van Lommel 2021-02-10 18:17:23 +01:00 committed by Brecht Van Lommel
parent 69c7ffff8b
commit 677e63d518
9 changed files with 26 additions and 17 deletions

View File

@ -1026,6 +1026,9 @@ if(WITH_OPENVDB)
list(APPEND OPENVDB_DEFINITIONS -DOPENVDB_3_ABI_COMPATIBLE)
endif()
# OpenVDB headers use deprecated TBB headers, silence warning.
list(APPEND OPENVDB_DEFINITIONS -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1)
list(APPEND OPENVDB_INCLUDE_DIRS
${BOOST_INCLUDE_DIR}
${TBB_INCLUDE_DIRS}

View File

@ -75,6 +75,8 @@ endif()
if(WITH_OPENVDB)
add_definitions(-DOPENVDB=1)
# OpenVDB headers use deprecated TBB headers, silence warning.
add_definitions(-DTBB_SUPPRESS_DEPRECATED_MESSAGES=1)
endif()
if(WITH_OPENVDB_BLOSC)

View File

@ -21,11 +21,14 @@
* WIN32_LEAN_AND_MEAN and similar are defined beforehand. */
#include "util_windows.h"
#define TBB_SUPPRESS_DEPRECATED_MESSAGES 1
#include <tbb/tbb.h>
#include <tbb/enumerable_thread_specific.h>
#include <tbb/parallel_for.h>
#include <tbb/task_arena.h>
#include <tbb/task_group.h>
#if TBB_INTERFACE_VERSION_MAJOR >= 10
# define WITH_TBB_GLOBAL_CONTROL
# include <tbb/global_control.h>
#endif
CCL_NAMESPACE_BEGIN

View File

@ -22,15 +22,15 @@
#ifdef WITH_TBB
/* Quiet top level deprecation message, unrelated to API usage here. */
# define TBB_SUPPRESS_DEPRECATED_MESSAGES 1
# 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/tbb.h>
# include <tbb/blocked_range.h>
# include <tbb/parallel_for.h>
# include <tbb/parallel_for_each.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

View File

@ -28,10 +28,7 @@
#include <vector>
#ifdef WITH_TBB
/* Quiet top level deprecation message, unrelated to API usage here. */
# define TBB_SUPPRESS_DEPRECATED_MESSAGES 1
# include <tbb/flow_graph.h>
# include <tbb/tbb.h>
#endif
/* Task Graph */

View File

@ -34,9 +34,9 @@
#include "BLI_threads.h"
#ifdef WITH_TBB
/* Quiet top level deprecation message, unrelated to API usage here. */
# define TBB_SUPPRESS_DEPRECATED_MESSAGES 1
# include <tbb/tbb.h>
# include <tbb/blocked_range.h>
# include <tbb/task_arena.h>
# include <tbb/task_group.h>
#endif
/* Task

View File

@ -32,9 +32,10 @@
#include "atomic_ops.h"
#ifdef WITH_TBB
/* Quiet top level deprecation message, unrelated to API usage here. */
# define TBB_SUPPRESS_DEPRECATED_MESSAGES 1
# include <tbb/tbb.h>
# include <tbb/blocked_range.h>
# include <tbb/enumerable_thread_specific.h>
# include <tbb/parallel_for.h>
# include <tbb/parallel_reduce.h>
#endif
#ifdef WITH_TBB

View File

@ -26,10 +26,10 @@
#include "BLI_threads.h"
#ifdef WITH_TBB
/* Quiet top level deprecation message, unrelated to API usage here. */
# define TBB_SUPPRESS_DEPRECATED_MESSAGES 1
# include <tbb/tbb.h>
/* Need to include at least one header to get the version define. */
# include <tbb/blocked_range.h>
# if TBB_INTERFACE_VERSION_MAJOR >= 10
# include <tbb/global_control.h>
# define WITH_TBB_GLOBAL_CONTROL
# endif
#endif

View File

@ -30,6 +30,9 @@ if(WIN32)
endif()
add_definitions(-DPXR_STATIC)
# USD headers use deprecated TBB headers, silence warning.
add_definitions(-DTBB_SUPPRESS_DEPRECATED_MESSAGES=1)
set(INC
.
../common