Skip to content

Commit 65aa796

Browse files
committed
[tbb] Fix build for macOS with GCC
1 parent 74ec888 commit 65aa796

File tree

5 files changed

+65
-2
lines changed

5 files changed

+65
-2
lines changed

ports/tbb/fix-gcc-without-gas.patch

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
diff --git a/cmake/compilers/GNU.cmake b/cmake/compilers/GNU.cmake
2+
index da6b408..b18fbf6 100644
3+
--- a/cmake/compilers/GNU.cmake
4+
+++ b/cmake/compilers/GNU.cmake
5+
@@ -55,6 +55,7 @@ execute_process(
6+
ERROR_STRIP_TRAILING_WHITESPACE
7+
)
8+
set(ASSEMBLER_VERSION_LINE ${ASSEMBLER_VERSION_LINE_OUT}${ASSEMBLER_VERSION_LINE_ERR})
9+
+if ("${ASSEMBLER_VERSION_LINE}" MATCHES "GNU assembler version")
10+
string(REGEX REPLACE ".*GNU assembler version ([0-9]+)\\.([0-9]+).*" "\\1" _tbb_gnu_asm_major_version "${ASSEMBLER_VERSION_LINE}")
11+
string(REGEX REPLACE ".*GNU assembler version ([0-9]+)\\.([0-9]+).*" "\\2" _tbb_gnu_asm_minor_version "${ASSEMBLER_VERSION_LINE}")
12+
unset(ASSEMBLER_VERSION_LINE_OUT)
13+
@@ -65,6 +66,7 @@ message(TRACE "Extracted GNU assembler version: major=${_tbb_gnu_asm_major_versi
14+
math(EXPR _tbb_gnu_asm_version_number "${_tbb_gnu_asm_major_version} * 1000 + ${_tbb_gnu_asm_minor_version}")
15+
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} "-D__TBB_GNU_ASM_VERSION=${_tbb_gnu_asm_version_number}")
16+
message(STATUS "GNU Assembler version: ${_tbb_gnu_asm_major_version}.${_tbb_gnu_asm_minor_version} (${_tbb_gnu_asm_version_number})")
17+
+endif()
18+
19+
# Enable Intel(R) Transactional Synchronization Extensions (-mrtm) and WAITPKG instructions support (-mwaitpkg) on relevant processors
20+
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(AMD64|amd64|i.86|x86)" AND NOT EMSCRIPTEN)
21+
diff --git a/include/oneapi/tbb/detail/_config.h b/include/oneapi/tbb/detail/_config.h
22+
index e676b15..e144a16 100644
23+
--- a/include/oneapi/tbb/detail/_config.h
24+
+++ b/include/oneapi/tbb/detail/_config.h
25+
@@ -335,7 +335,7 @@
26+
27+
#define __TBB_TSX_INTRINSICS_PRESENT (__RTM__ || __INTEL_COMPILER || (_MSC_VER>=1700 && (__TBB_x86_64 || __TBB_x86_32)))
28+
29+
-#define __TBB_WAITPKG_INTRINSICS_PRESENT ((__INTEL_COMPILER >= 1900 || (__TBB_GCC_VERSION >= 110000 && __TBB_GNU_ASM_VERSION >= 2032) || __TBB_CLANG_VERSION >= 120000) \
30+
+#define __TBB_WAITPKG_INTRINSICS_PRESENT ((__INTEL_COMPILER >= 1900 || (__TBB_GCC_VERSION >= 110000 && (__APPLE__ || __TBB_GNU_ASM_VERSION >= 2032)) || __TBB_CLANG_VERSION >= 120000) \
31+
&& (_WIN32 || _WIN64 || __unix__ || __APPLE__) && (__TBB_x86_32 || __TBB_x86_64) && !__ANDROID__)
32+
33+
/** Internal TBB features & modes **/
34+
diff --git a/src/tbb/co_context.h b/src/tbb/co_context.h
35+
index 60d5437..3a25b0f 100644
36+
--- a/src/tbb/co_context.h
37+
+++ b/src/tbb/co_context.h
38+
@@ -46,6 +46,9 @@
39+
#elif __clang__
40+
#pragma clang diagnostic push
41+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
42+
+ #elif __GNUC__
43+
+ #pragma GCC diagnostic push
44+
+ #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
45+
#endif
46+
#endif // __APPLE__
47+
48+
@@ -364,6 +367,8 @@ inline void destroy_coroutine(coroutine_type& c) {
49+
#pragma warning(pop) // 1478 warning
50+
#elif __clang__
51+
#pragma clang diagnostic pop // "-Wdeprecated-declarations"
52+
+ #elif __GNUC__
53+
+ #pragma GCC diagnostic pop
54+
#endif
55+
#endif
56+
57+
--

ports/tbb/portfile.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ vcpkg_from_github(
99
HEAD_REF master
1010
PATCHES
1111
fix-lang.patch # https://github.com/uxlfoundation/oneTBB/pull/1606
12+
fix-gcc-without-gas.patch # https://github.com/uxlfoundation/oneTBB/pull/1603
1213
)
1314

1415
vcpkg_check_features(

ports/tbb/vcpkg.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
33
"name": "tbb",
44
"version": "2022.0.0",
5-
"port-version": 1,
5+
"port-version": 2,
66
"description": "Intel's Threading Building Blocks.",
77
"homepage": "https://github.com/oneapi-src/oneTBB",
88
"license": "Apache-2.0",

versions/baseline.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8954,7 +8954,7 @@
89548954
},
89558955
"tbb": {
89568956
"baseline": "2022.0.0",
8957-
"port-version": 1
8957+
"port-version": 2
89588958
},
89598959
"tcb-span": {
89608960
"baseline": "2022-06-15",

versions/t-/tbb.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
22
"versions": [
3+
{
4+
"git-tree": "7ba5ca689237e53e47f3c9375736ebf901e919ef",
5+
"version": "2022.0.0",
6+
"port-version": 2
7+
},
38
{
49
"git-tree": "e8eb4f6f5f53c1b56598b26a951b8d49cf349d0d",
510
"version": "2022.0.0",

0 commit comments

Comments
 (0)