Skip to content

Commit b275714

Browse files
committed
add tbb patch for windows cmake issue
1 parent b5e9609 commit b275714

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,10 @@ cd ../../
275275
# build static version of oneTBB
276276
git clone -b $TBB_VERSION --depth 1 https://github.com/oneapi-src/oneTBB.git
277277
cd oneTBB
278+
# patch for "c++.exe: fatal error: input file '/dev/null' is the same as output file" issue on windows due to cmake execute_process quoting command
279+
# instead of calling c++ to get the binutils version we get it from CMAKE_CXX_COMPILER_LINKER_VERSION
280+
# note: this works fine for us as we use binutils for linker and assembler, haven't checked if it also works if a different linker is used.
281+
git apply --ignore-space-change --ignore-whitespace --verbose ../tbb.diff
278282
mkdir build
279283
cd build
280284
cmake -GNinja .. \

tbb.diff

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
diff --git a/cmake/compilers/GNU.cmake b/cmake/compilers/GNU.cmake
2+
index da6b408a..3730919a 100644
3+
--- a/cmake/compilers/GNU.cmake
4+
+++ b/cmake/compilers/GNU.cmake
5+
@@ -47,19 +47,24 @@ endif()
6+
# >=2.31.1). Capturing the output in CMake can be done like below. The version
7+
# information is written to either stdout or stderr. To not make any
8+
# assumptions, both are captured.
9+
-execute_process(
10+
- COMMAND ${CMAKE_COMMAND} -E env "LANG=C" ${CMAKE_CXX_COMPILER} -xc -c /dev/null -Wa,-v -o/dev/null
11+
- OUTPUT_VARIABLE ASSEMBLER_VERSION_LINE_OUT
12+
- ERROR_VARIABLE ASSEMBLER_VERSION_LINE_ERR
13+
- OUTPUT_STRIP_TRAILING_WHITESPACE
14+
- ERROR_STRIP_TRAILING_WHITESPACE
15+
-)
16+
-set(ASSEMBLER_VERSION_LINE ${ASSEMBLER_VERSION_LINE_OUT}${ASSEMBLER_VERSION_LINE_ERR})
17+
-string(REGEX REPLACE ".*GNU assembler version ([0-9]+)\\.([0-9]+).*" "\\1" _tbb_gnu_asm_major_version "${ASSEMBLER_VERSION_LINE}")
18+
-string(REGEX REPLACE ".*GNU assembler version ([0-9]+)\\.([0-9]+).*" "\\2" _tbb_gnu_asm_minor_version "${ASSEMBLER_VERSION_LINE}")
19+
-unset(ASSEMBLER_VERSION_LINE_OUT)
20+
-unset(ASSEMBLER_VERSION_LINE_ERR)
21+
-unset(ASSEMBLER_VERSION_LINE)
22+
+if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.29)
23+
+ string(REGEX REPLACE "^([0-9]+)\\.([0-9]+).*" "\\1" _tbb_gnu_asm_major_version "${CMAKE_CXX_COMPILER_LINKER_VERSION}")
24+
+ string(REGEX REPLACE "^([0-9]+)\\.([0-9]+).*" "\\2" _tbb_gnu_asm_minor_version "${CMAKE_CXX_COMPILER_LINKER_VERSION}")
25+
+else()
26+
+ execute_process(
27+
+ COMMAND ${CMAKE_COMMAND} -E env "LANG=C" ${CMAKE_CXX_COMPILER} -xc -c /dev/null -Wa,-v -o/dev/null
28+
+ OUTPUT_VARIABLE ASSEMBLER_VERSION_LINE_OUT
29+
+ ERROR_VARIABLE ASSEMBLER_VERSION_LINE_ERR
30+
+ OUTPUT_STRIP_TRAILING_WHITESPACE
31+
+ ERROR_STRIP_TRAILING_WHITESPACE
32+
+ )
33+
+ set(ASSEMBLER_VERSION_LINE ${ASSEMBLER_VERSION_LINE_OUT}${ASSEMBLER_VERSION_LINE_ERR})
34+
+ string(REGEX REPLACE ".*GNU assembler version ([0-9]+)\\.([0-9]+).*" "\\1" _tbb_gnu_asm_major_version "${ASSEMBLER_VERSION_LINE}")
35+
+ string(REGEX REPLACE ".*GNU assembler version ([0-9]+)\\.([0-9]+).*" "\\2" _tbb_gnu_asm_minor_version "${ASSEMBLER_VERSION_LINE}")
36+
+ unset(ASSEMBLER_VERSION_LINE_OUT)
37+
+ unset(ASSEMBLER_VERSION_LINE_ERR)
38+
+ unset(ASSEMBLER_VERSION_LINE)
39+
+endif()
40+
message(TRACE "Extracted GNU assembler version: major=${_tbb_gnu_asm_major_version} minor=${_tbb_gnu_asm_minor_version}")
41+
42+
math(EXPR _tbb_gnu_asm_version_number "${_tbb_gnu_asm_major_version} * 1000 + ${_tbb_gnu_asm_minor_version}")

0 commit comments

Comments
 (0)