@@ -21,16 +21,28 @@ ifeq ($(OS), Windows_NT)
21
21
USE_TBB=Windows
22
22
TBB_COPY_PATTERN=tbb*.dll
23
23
24
+ ARCH=$(shell "${R_HOME}/bin/R" --vanilla -s -e 'cat(R.version$$arch)')
25
+ TBB_CXXFLAGS = @CXX11FLAGS@ -DTBB_NO_LEGACY=1
26
+ ifeq "$(ARCH)" "aarch64"
27
+ PKG_CPPFLAGS += -DTBB_USE_GCC_BUILTINS
28
+ TBB_CXXFLAGS += -DTBB_USE_GCC_BUILTINS
29
+ CLANG_CHECK := $(shell echo | $(CC) -E -dM - | findstr __clang__)
30
+ ifneq ($(CLANG_CHECK), )
31
+ WINARM64_CLANG=true
32
+ endif
33
+ endif
34
+
24
35
MAKE = make
25
36
MAKEFLAGS = -e -j1
26
37
MAKE_CMD = \
27
38
MSYS2_ARG_CONV_EXCL="*" \
28
39
CYGWIN=nodosfilewarning \
29
40
CONLY="@WINDOWS_CC@" \
30
41
CPLUS="@WINDOWS_CXX11@" \
31
- CXXFLAGS="@CXX11FLAGS@ -DTBB_NO_LEGACY=1" \
42
+ CXXFLAGS="$(TBB_CXXFLAGS)" \
32
43
PIC_KEY="@CXX11PICFLAGS@" \
33
44
WARNING_SUPPRESS="" \
45
+ WINARM64_CLANG="$(WINARM64_CLANG)" \
34
46
$(MAKE)
35
47
36
48
else
@@ -77,26 +89,21 @@ ifeq ($(USE_TBB), Windows)
77
89
# rtools: turn on hacks to compensate for make and shell differences rtools<=>MinGW
78
90
# compiler: overwrite default (which is cl = MS compiler)
79
91
MAKE_ARGS += rtools=true compiler=gcc
80
- ifeq ($(WIN), 64)
81
- MAKE_ARGS += arch=intel64 runtime=mingw
82
- ARCH_DIR=x64/
83
- else
84
- MAKE_ARGS += arch=ia32 runtime=mingw
85
- ARCH_DIR=i386/
92
+ # TBB configure will detect mingw runtime with unknown arch on WINARM64_CLANG but not an
93
+ # issue as we are using compiler built-ins instead of arch-specific code
94
+ ifneq ($(WINARM64_CLANG), true)
95
+ ifeq ($(WIN), 64)
96
+ MAKE_ARGS += arch=intel64 runtime=mingw
97
+ ARCH_DIR=x64/
98
+ else
99
+ MAKE_ARGS += arch=ia32 runtime=mingw
100
+ ARCH_DIR=i386/
101
+ endif
86
102
endif
87
103
88
104
# Linker needs access to the tbb dll; otherwise you get errors such as:
89
105
# "undefined reference to `tbb::task_scheduler_init::terminate()'"
90
106
PKG_LIBS += -Ltbb/build/lib_release -ltbb -ltbbmalloc
91
-
92
- # override for aarch64 (experimental) to use Rtools TBB
93
- ARCH=$(shell "${R_HOME}/bin/R" --vanilla -s -e 'cat(R.version$$arch)')
94
- ifeq "$(ARCH)" "aarch64"
95
- TBB_LIB = ${R_TOOLS_SOFT}
96
- TBB_INC = ${R_TOOLS_SOFT}
97
- PKG_LIBS = -ltbb12 -ltbbmalloc
98
- endif
99
-
100
107
endif
101
108
102
109
# write compiler if set
0 commit comments