forked from nest/nest-simulator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
148 lines (123 loc) · 3.3 KB
/
build.sh
File metadata and controls
148 lines (123 loc) · 3.3 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/bin/sh
set -e
set -x
mkdir -p $HOME/.matplotlib
cat > $HOME/.matplotlib/matplotlibrc <<EOF
# ZYV
backend : svg
EOF
if [ "$xMPI" = "1" ] ; then
#openmpi
export LD_LIBRARY_PATH="/usr/lib/openmpi/lib:$LD_LIBRARY_PATH"
export CPATH="/usr/lib/openmpi/include:$CPATH"
export PATH="/usr/include/mpi:$PATH"
cat > $HOME/.nestrc <<EOF
% ZYV: NEST MPI configuration
/mpirun
[/integertype /stringtype]
[/numproc /slifile]
{
() [
(mpirun -np ) numproc cvs ( ) statusdict/prefix :: (/bin/nest ) slifile
] {join} Fold
} Function def
EOF
CONFIGURE_MPI="--with-mpi"
else
CONFIGURE_MPI="--without-mpi"
fi
if [ "$xPYTHON" = "1" ] ; then
CONFIGURE_PYTHON="--with-python"
else
CONFIGURE_PYTHON="--without-python"
fi
if [ "$xGSL" = "1" ] ; then
CONFIGURE_GSL="--with-gsl"
else
CONFIGURE_GSL="--without-gsl"
fi
./bootstrap.sh
NEST_VPATH=build
NEST_RESULT=result
mkdir "$NEST_VPATH" "$NEST_RESULT"
NEST_RESULT=$(readlink -f $NEST_RESULT)
cd "$NEST_VPATH"
../configure \
--prefix="$NEST_RESULT" CC=mpicc CXX=mpic++ \
$CONFIGURE_MPI \
$CONFIGURE_PYTHON \
$CONFIGURE_GSL \
export PYTHONPATH=$NEST_RESULT/lib/python2.7/site-packages:$PYTHONPATH
export PYTHONPATH=/usr/local/bin:$NEST_RESULT/lib64/python2.7/site-packages:$PYTHONPATH
export PATH=~/.local/bin:/usr/local/bin:$NEST_RESULT/bin:$PATH
make
make install
make installcheck
# static code analysis
cd .. # go back to source dir
# initialize vera++
mkdir -p vera_home
# on ubuntu vera++ is installed to /usr/
# copy all scripts/rules/ ... into ./vera_home
cp -r /usr/lib/vera++/* ./vera_home
# create the nest-profile for vera++
cat > ./vera_home/profiles/nest <<EOF
#!/usr/bin/tclsh
# This profile includes all the rules for checking NEST
set rules {
F001
F002
L001
L002
L003
L005
L006
T001
T002
T004
T005
T006
T007
T010
T011
T012
T013
T017
T018
T019
}
EOF
# Extracting changed files between two commits
file_names=`git diff --name-only $TRAVIS_COMMIT_RANGE`
for f in $file_names; do
# filter files
case $f in
*.h | *.c | *.cc | *.hpp | *.cpp )
echo "Static analysis on file $f:"
f_base=`basename $f`
# Vera++ checks the specified list of rules given in the profile
# nest which is placed in the <vera++ home>/lib/vera++/profile
vera++ --root ./vera_home --profile nest $f > ${f_base}_vera.txt
echo "\n - vera++ for $f:"
cat ${f_base}_vera.txt
cppcheck --enable=all --inconclusive --std=c++03 $f > ${f_base}_cppcheck.txt
echo "\n - cppcheck for $f:"
cat ${f_base}_cppcheck.txt
# clang format creates tempory formatted file
clang-format-3.6 $f > ${f_base}_formatted_$TRAVIS_COMMIT.txt
# compare the committed file and formatted file and
# writes the differences to a temp file
echo "\n - clang-format for $f:"
diff $f ${f_base}_formatted_$TRAVIS_COMMIT.txt | tee ${f_base}_clang_format.txt
# remove temporary files
rm ${f_base}_formatted_$TRAVIS_COMMIT.txt
# TODO: instead of rm these files, they should be used for code review
rm ${f_base}_vera.txt
rm ${f_base}_cppcheck.txt
rm ${f_base}_clang_format.txt
;;
*)
echo "$f : not a C/CPP file. Do not do static analysis / formatting checking."
continue
esac
done