-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathconfigure.win
77 lines (69 loc) · 1.98 KB
/
configure.win
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
if test -z "$OCL"; then
echo ''
echo 'ERROR: OCL not set!'
echo ''
echo 'You will need a working OpenCL SDK with headers'
echo 'and libraries for both i386 and x64'
echo ''
echo 'Set OCL to the root of the SDK'
echo ''
echo 'You can also set individial variables OCLINC,'
echo 'OCL32LIB and OCL64LIB. Note that they are expected'
echo 'to be valid compiler flags. If they are not set,'
echo 'the default SDK layout ($SDK/include, $SDK/lib/x64)'
echo 'will be assumed.'
echo ''
exit 1
fi
DARCH=$(echo $R_ARCH | tr -d /)
if test -z "$DARCH"; then
# R without R_ARCH is assumed to be x86_64 native
DARCH=x64
# if OCLLIB is set we pass it to OCL64LIB downstream
if test -n "$OCLLIB"; then
OCL64LIB="$OCLLIB"
fi
fi
echo ''
echo " === configurig OpenCL for $DARCH =="
echo ''
echo " OCL=$OCL"
echo ''
if test -z "$OCL64LIB"; then
# some SDKs are single-arch
if test -e "$OCL/lib/OpenCL.lib" -a ! -e "$OCL/lib/x64/OpenCL.lib"; then
echo SDK appears to include only one architecture, assuming it is 64-bit
OCL64LIB="$OCL/lib/OpenCL.lib"
else
OCL64LIB="$OCL/lib/x64/OpenCL.lib"
fi
echo OCL64LIB not set, assuming $OCL64LIB
if test "$DARCH" = x64 -a ! -e "$OCL64LIB"; then
echo "WARNING: $OCL64LIB not found! Check your OCL and OCL64LIB settings!" >&2
fi
fi
if test -z "$OCL32LIB"; then
OCL32LIB="$OCL/lib/x86/OpenCL.lib"
echo OCL32LIB not set, assuming $OCL32LIB
fi
if test -z "$OCLINC"; then
OCLINC="-I$OCL/include"
echo OCLINC not set, assuming $OCLINC
fi
echo ''
if test "$R_ARCH" = i386; then
echo ' --- Compiling 32-bit ---'
OCLLIB="$OCL32LIB"
else
echo ' --- Compiling 64-bit ---'
OCLLIB="$OCL64LIB"
fi
echo OCL=$OCL
echo PKG_CPPFLAGS=$OCLINC
echo PKG_LIBS=$OCLLIB
echo ''
echo "PKG_CPPFLAGS='$OCLINC'" > src/Makevars.win
echo "PKG_LIBS='$OCLLIB'" >> src/Makevars.win
# see src/Makevars for explanation:
echo 'all: $(SHLIB)' >> src/Makevars.win
echo ' mv $< R_OpenCL$(SHLIB_EXT)' >> src/Makevars.win