-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tbb] Fix build for macOS with GCC (#43742)
- Loading branch information
Showing
5 changed files
with
65 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
diff --git a/cmake/compilers/GNU.cmake b/cmake/compilers/GNU.cmake | ||
index da6b408..b18fbf6 100644 | ||
--- a/cmake/compilers/GNU.cmake | ||
+++ b/cmake/compilers/GNU.cmake | ||
@@ -55,6 +55,7 @@ execute_process( | ||
ERROR_STRIP_TRAILING_WHITESPACE | ||
) | ||
set(ASSEMBLER_VERSION_LINE ${ASSEMBLER_VERSION_LINE_OUT}${ASSEMBLER_VERSION_LINE_ERR}) | ||
+if ("${ASSEMBLER_VERSION_LINE}" MATCHES "GNU assembler version") | ||
string(REGEX REPLACE ".*GNU assembler version ([0-9]+)\\.([0-9]+).*" "\\1" _tbb_gnu_asm_major_version "${ASSEMBLER_VERSION_LINE}") | ||
string(REGEX REPLACE ".*GNU assembler version ([0-9]+)\\.([0-9]+).*" "\\2" _tbb_gnu_asm_minor_version "${ASSEMBLER_VERSION_LINE}") | ||
unset(ASSEMBLER_VERSION_LINE_OUT) | ||
@@ -65,6 +66,7 @@ message(TRACE "Extracted GNU assembler version: major=${_tbb_gnu_asm_major_versi | ||
math(EXPR _tbb_gnu_asm_version_number "${_tbb_gnu_asm_major_version} * 1000 + ${_tbb_gnu_asm_minor_version}") | ||
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} "-D__TBB_GNU_ASM_VERSION=${_tbb_gnu_asm_version_number}") | ||
message(STATUS "GNU Assembler version: ${_tbb_gnu_asm_major_version}.${_tbb_gnu_asm_minor_version} (${_tbb_gnu_asm_version_number})") | ||
+endif() | ||
|
||
# Enable Intel(R) Transactional Synchronization Extensions (-mrtm) and WAITPKG instructions support (-mwaitpkg) on relevant processors | ||
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(AMD64|amd64|i.86|x86)" AND NOT EMSCRIPTEN) | ||
diff --git a/include/oneapi/tbb/detail/_config.h b/include/oneapi/tbb/detail/_config.h | ||
index e676b15..e144a16 100644 | ||
--- a/include/oneapi/tbb/detail/_config.h | ||
+++ b/include/oneapi/tbb/detail/_config.h | ||
@@ -335,7 +335,7 @@ | ||
|
||
#define __TBB_TSX_INTRINSICS_PRESENT (__RTM__ || __INTEL_COMPILER || (_MSC_VER>=1700 && (__TBB_x86_64 || __TBB_x86_32))) | ||
|
||
-#define __TBB_WAITPKG_INTRINSICS_PRESENT ((__INTEL_COMPILER >= 1900 || (__TBB_GCC_VERSION >= 110000 && __TBB_GNU_ASM_VERSION >= 2032) || __TBB_CLANG_VERSION >= 120000) \ | ||
+#define __TBB_WAITPKG_INTRINSICS_PRESENT ((__INTEL_COMPILER >= 1900 || (__TBB_GCC_VERSION >= 110000 && (__APPLE__ || __TBB_GNU_ASM_VERSION >= 2032)) || __TBB_CLANG_VERSION >= 120000) \ | ||
&& (_WIN32 || _WIN64 || __unix__ || __APPLE__) && (__TBB_x86_32 || __TBB_x86_64) && !__ANDROID__) | ||
|
||
/** Internal TBB features & modes **/ | ||
diff --git a/src/tbb/co_context.h b/src/tbb/co_context.h | ||
index 60d5437..3a25b0f 100644 | ||
--- a/src/tbb/co_context.h | ||
+++ b/src/tbb/co_context.h | ||
@@ -46,6 +46,9 @@ | ||
#elif __clang__ | ||
#pragma clang diagnostic push | ||
#pragma clang diagnostic ignored "-Wdeprecated-declarations" | ||
+ #elif __GNUC__ | ||
+ #pragma GCC diagnostic push | ||
+ #pragma GCC diagnostic ignored "-Wdeprecated-declarations" | ||
#endif | ||
#endif // __APPLE__ | ||
|
||
@@ -364,6 +367,8 @@ inline void destroy_coroutine(coroutine_type& c) { | ||
#pragma warning(pop) // 1478 warning | ||
#elif __clang__ | ||
#pragma clang diagnostic pop // "-Wdeprecated-declarations" | ||
+ #elif __GNUC__ | ||
+ #pragma GCC diagnostic pop | ||
#endif | ||
#endif | ||
|
||
-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters