WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,17 @@ include("cmake/Threading.cmake")
2525
2626macro (handle_tbb_target)
2727 if (TBB_FOUND)
28- set_property (TARGET TBB::tbb PROPERTY "MAP_IMPORTED_CONFIG_RELWITHMDD" "DEBUG" )
28+ if (WIN32 )
29+ # On Windows we must link to debug version of TBB library to ensure ABI compatibility
30+ # with MSVC debug runtime.
31+ set_property (TARGET TBB::tbb PROPERTY "MAP_IMPORTED_CONFIG_RELWITHMDD" "DEBUG" )
32+ else ()
33+ # On Linux TBB::tbb target may link to libtbb_debug.so which is not compatible with libtbb.so. Linking
34+ # application to both may result in undefined behavior.
35+ # See https://uxlfoundation.github.io/oneTBB/main/intro/limitations.html#debug-tbb-in-the-sycl-program
36+ set_property (TARGET TBB::tbb PROPERTY "MAP_IMPORTED_CONFIG_RELWITHMDD" "RELEASE" )
37+ set_property (TARGET TBB::tbb PROPERTY "MAP_IMPORTED_CONFIG_DEBUG" "RELEASE" )
38+ endif ()
2939 include_directories_with_host_compiler(${_tbb_include_dirs} )
3040 list (APPEND EXTRA_SHARED_LIBS TBB::tbb)
3141
Original file line number Diff line number Diff line change @@ -39,6 +39,17 @@ if(DNNL_CPU_THREADING_RUNTIME STREQUAL "TBB")
3939 # Reverting the CMAKE_MODULE_PATH to its original state
4040 set (CMAKE_MODULE_PATH ${DNNL_ORIGINAL_CMAKE_MODULE_PATH} )
4141 endif ()
42+ if (WIN32 )
43+ # On Windows we must link to debug version of TBB library to ensure ABI compatibility
44+ # with MSVC debug runtime.
45+ set_property (TARGET TBB::tbb PROPERTY "MAP_IMPORTED_CONFIG_RELWITHMDD" "DEBUG" )
46+ else ()
47+ # On Linux TBB::tbb target may link to libtbb_debug.so which is not compatible with libtbb.so. Linking
48+ # application to both may result in undefined behavior.
49+ # See https://uxlfoundation.github.io/oneTBB/main/intro/limitations.html#debug-tbb-in-the-sycl-program
50+ set_property (TARGET TBB::tbb PROPERTY "MAP_IMPORTED_CONFIG_RELWITHMDD" "RELEASE" )
51+ set_property (TARGET TBB::tbb PROPERTY "MAP_IMPORTED_CONFIG_DEBUG" "RELEASE" )
52+ endif ()
4253endif ()
4354
4455# Use a custom find module for transitive dependencies
You can’t perform that action at this time.
0 commit comments