forked from KhronosGroup/SyclParallelSTL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·100 lines (76 loc) · 1.89 KB
/
build.sh
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#! /bin/bash
function display_help() {
cat <<EOT
To use build.sh to compile SyclParallelSTL with ComputeCpp:
./build.sh [--no-download] "path/to/ComputeCpp"
(the path to ComputeCpp can be relative)
For example:
./build.sh /home/user/ComputeCpp
To use build.sh to compile SyclParallelSTL with triSYCL:
./build.sh [--no-download] --trisycl [-DTRISYCL_INCLUDE_DIR=path/to/triSYCL/include] [-DBOOST_COMPUTE_INCLUDE_DIR=path/to/boost/compute/include]
For example (Ubuntu 16.04):
./build.sh --trisycl -DTRISYCL_INCLUDE_DIR=~/triSYCL/include -DBOOST_COMPUTE_INCLUDE_DIR=~/compute/include
The "--no-download" option is used to skip the cloning or pulling of
the GoogleTest git repository.
EOT
}
# Useless to go on when an error occurs
set -o errexit
# Minimal emergency case to display the help message whatever happens
trap display_help ERR
if [ $1 == "--no-download" ]; then
NO_DOWNLOAD="echo Skipping"
shift
else
NO_DOWNLOAD=
fi
if [ $1 == "--trisycl" ]
then
shift
echo "build.sh entering mode: triSYCL"
# Pass all the remaining arguments to CMake
CMAKE_ARGS="$CMAKE_ARGS -DUSE_COMPUTECPP=OFF $@"
else
echo "build.sh entering mode: ComputeCpp"
CMAKE_ARGS="$CMAKE_ARGS -DCOMPUTECPP_PACKAGE_ROOT_DIR=$(readlink -f $1)"
shift
fi
NPROC=$(nproc)
function install_gmock {(
REPO="https://github.com/google/googletest.git"
mkdir -p external
cd external
if [ -d googletest ]
then
cd googletest
$NO_DOWNLOAD git pull
else
$NO_DOWNLOAD git clone $REPO
cd googletest
fi
cd googlemock/make
make -j$NPROC
)}
function configure {
mkdir -p build && pushd build
cmake .. $CMAKE_ARGS -DPARALLEL_STL_BENCHMARKS=ON
popd
}
function mak {
pushd build && make -j$NPROC
popd
}
function tst {
pushd build/tests
ctest -j$NPROC
popd
}
function main {
install_gmock
configure
# Do not exit when an error occurs
set +o errexit
mak
tst
}
main