Skip to content

Commit 92a4f48

Browse files
committed
Use __has_include to decide on tbb/version.h
Signed-off-by: Nick Avramoussis <4256455+Idclip@users.noreply.github.com>
1 parent 1ca9bb0 commit 92a4f48

2 files changed

Lines changed: 19 additions & 10 deletions

File tree

openvdb/openvdb/thread/Threading.h

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,24 @@
1313
#define OPENVDB_THREAD_THREADING_RESTORE_DEPRECATION_MESSAGE_TASK
1414
#endif
1515

16+
/// @warning the below changes what includes are available from this header
17+
/// depending on whether version.h is available
18+
#if __has_include(<tbb/version.h>)
19+
#include <tbb/version.h>
20+
#else
21+
/// @note tbb/task_arena.h is the ONLY include that persists from TBB 2020
22+
/// to TBB 2021 to TBB 2023 that itself includes the TBB specific version
23+
/// header files.
24+
/// In TBB 2020, the version header was called tbb/stddef.h. In 2021+, it's
25+
/// called tbb/version.h. We include tbb/task_arena.h here to indirectly
26+
/// access the version defines in a consistent way so that downstream
27+
/// software doesn't need to provide compile time defines.
28+
#include <tbb/task_arena.h>
29+
#endif
1630

31+
#include <tbb/task_group.h>
1732
#include <tbb/blocked_range.h>
1833
#include <tbb/task.h>
19-
/// @note tbb/task_arena.h is the ONLY include that persists from TBB 2020
20-
/// to TBB 2021 to TBB 2023 that itself includes the TBB specific version
21-
/// header files.
22-
/// In TBB 2020, the version header was called tbb/stddef.h. In 2021+, it's
23-
/// called tbb/version.h. We include tbb/task_arena.h here to indirectly
24-
/// access the version defines in a consistent way so that downstream
25-
/// software doesn't need to provide compile time defines.
26-
#include <tbb/task_arena.h>
27-
#include <tbb/task_group.h>
28-
#include <tbb/version.h>
2934

3035
namespace openvdb {
3136
OPENVDB_USE_VERSION_NAMESPACE

pendingchanges/tbb_version_fix.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
OpenVDB:
2+
Build:
3+
- Fixed a build issue with newer TBB versions where tbb/version.h was not being indirectly included
4+
[Contributed by Maciej Małecki]

0 commit comments

Comments
 (0)