forked from thelfer/tfel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_all.sh
executable file
·213 lines (201 loc) · 7.88 KB
/
check_all.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
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
#! /usr/bin/env bash
#
# Usage: check_all.sh [options]
#
# The following options are available:
#
# - `-b` (short for broken-lib-math): shall be specified if the libmath does
# not support changing the rounding mode
# - `-d` (short for documentation, requires an argument): specify if the
# documentation must be built. The default value is ON.
# Valid options are ON and OFF.
# - `-f` (short of fast-check): if specified, builds in debug mode are skipped
# - `-j` (short of parallel-build, requires an argument): if specified, builds
# in parallel. The arguments is the number of thread allowed.
# - `-m` (short of march=native, requires an argument): specify if processor specific
# instructions must be used. Valid options are ON and OFF. The default value
# is ON.
# - `-p` (short of python-bindings): if specified, builds in debug mode are skipped
# - `-r` (short for random-tests, requires an argument): specify if
# tests where the rounding modes changes randomly shall be executed.
# Valid options are ON and OFF. The default value is ON.
# - `-w` (short for win-build): if specified, try to cross-compile TFEL
# with mingw32
# Exit if any error detected
set -e
# parallel build
pbuild=no
# reference documentation
rdoc=ON
# random tests
rtests=ON
# fast check
fcheck=no
# cross compilation using mingw
wbuild=no
# broken_libmath
broken_libmath=OFF
# python-bindings
python_configure_arg=""
python_bindings_configure_arg=""
python_cmake_arg=""
python_bindings_cmake_arg=""
# portable-build
march_native=ON
while getopts "fwbd:r:j:pm:" opt;
do
case $opt in
f) fcheck=yes
;;
b) broken_libmath=ON
;;
w) wbuild=yes
;;
d) rdoc="$OPTARG";
;;
r) rtests="$OPTARG";
;;
j) pbuild=yes;
nbproc="$OPTARG";
;;
m) march_native="$OPTARG";
;;
p)
python_configure_arg="--enable-python"
python_bindings_configure_arg="--enable-python-bindings"
python_cmake_arg="-Denable-python=ON"
python_bindings_cmake_arg="-Denable-python-bindings=ON"
;;
\?)
echo "$0 : invalid option '$OPTARG'" >&2
echo "bailing out." >&2
exit 1
;;
:)
echo "$0 : option '-$OPTARG' requires an argument." >&2
echo "bailing out." >&2
exit 1
;;
esac
done
make_exec=make
if test "x$pbuild" == "xyes" ;
then
make_exec="$make_exec -j $nbproc"
fi
if test "x$march_native" == "xOFF" ;
then
portable_build="ON"
else
portable_build="OFF"
fi
# remove previous temporary
if [ -d build-check ];
then
chmod +w -R build-check
rm -fr build-check
fi
# source directory
src=$(cd $(dirname $0) && pwd)
# current directory
build=$(pwd)
mkdir build-check
pushd build-check
mkdir install-cmake
mkdir build-cmake
if test "x$fcheck" == "xno" ;
then
mkdir install-cmake-release
mkdir build-cmake-release
mkdir install-cmake-debug
mkdir build-cmake-debug
mkdir install-cmake-release-static
mkdir build-cmake-release-static
fi
pushd build-cmake
cmake ${src} -DTFEL_BROKEN_LIBMATH=$broken_libmath -Dlocal-castem-header=ON -Denable-fortran=ON ${python_cmake_arg} ${python_bindings_cmake_arg} -Denable-aster=ON -Denable-abaqus=ON -Denable-calculix=ON -Denable-comsol=ON -Denable-diana-fea=ON -Denable-ansys=ON -Denable-europlexus=ON -Denable-zmat=ON -Denable-cyrano=ON -Denable-lsdyna=ON -Denable-random-tests=${rtests} -Denable-reference-doc=${rdoc} -Denable-portable-build=${portable_build} -DCMAKE_INSTALL_PREFIX=$build/build-check/cmake/install-cmake
$make_exec
if [ test "x$pbuild" == "xyes" ];
then
make check ARGS="-j $nbproc"
else
$make_exec check
fi
$make_exec install
popd #from build-cmake
if test "x$fcheck" == "xno" ;
then
pushd build-cmake-release
cmake ${src} -DCMAKE_BUILD_TYPE=Release -DTFEL_BROKEN_LIBMATH=$broken_libmath -Dlocal-castem-header=ON -Denable-fortran=ON ${python_cmake_arg} ${python_bindings_cmake_arg} -Denable-aster=ON -Denable-abaqus=ON -Denable-calculix=ON -Denable-comsol=ON -Denable-diana-fea=ON -Denable-ansys=ON -Denable-europlexus=ON -Denable-zmat=ON -Denable-cyrano=ON -Denable-lsdyna=ON -Denable-random-tests=${rtests} -Denable-reference-doc=${rdoc} -Denable-portable-build=${portable_build} -DCMAKE_INSTALL_PREFIX=$build/build-check/cmake/install-cmake-release
$make_exec
if [ test "x$pbuild" == "xyes" ];
then
make check ARGS="-j $nbproc"
else
$make_exec check
fi
$make_exec install
popd #from build-cmake-release
pushd build-cmake-debug
cmake ${src} -DCMAKE_BUILD_TYPE=Debug -DTFEL_BROKEN_LIBMATH=$broken_libmath -Dlocal-castem-header=ON -Denable-fortran=ON ${python_cmake_arg} ${python_bindings_cmake_arg} -Denable-aster=ON -Denable-abaqus=ON -Denable-calculix=ON -Denable-comsol=ON -Denable-diana-fea=ON -Denable-ansys=ON -Denable-europlexus=ON -Denable-zmat=ON -Denable-cyrano=ON -Denable-lsdyna=ON -Denable-random-tests=${rtests} -Denable-reference-doc=${rdoc} -Denable-portable-build=${portable_build} -DCMAKE_INSTALL_PREFIX=$build/build-check/cmake/install-cmake-debug
$make_exec
if [ test "x$pbuild" == "xyes" ];
then
make check ARGS="-j $nbproc"
else
$make_exec check
fi
$make_exec install
popd #from build-cmake-debug
pushd build-cmake-release-static
cmake ${src} -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DTFEL_BROKEN_LIBMATH=$broken_libmath -Dlocal-castem-header=ON -Denable-fortran=ON ${python_cmake_arg} ${python_bindings_cmake_arg} -Denable-aster=ON -Denable-abaqus=ON -Denable-calculix=ON -Denable-comsol=ON -Denable-diana-fea=ON -Denable-ansys=ON -Denable-europlexus=ON -Denable-zmat=ON -Denable-cyrano=ON -Denable-lsdyna=ON -Denable-random-tests=${rtests} -Denable-reference-doc=${rdoc} -Denable-portable-build=${portable_build} -DCMAKE_INSTALL_PREFIX=$build/build-check/cmake/install-cmake-release-static
$make_exec
if [ test "x$pbuild" == "xyes" ];
then
make check ARGS="-j $nbproc"
else
$make_exec check
fi
$make_exec install
popd #from build-cmake-release-static
fi
if test "x$wbuild" == "xyes" ;
then
if [ "x$(which i686-w64-mingw32-gcc)" != "x" ];
then
mkdir build-cmake-i686-w64-mingw32
pushd build-cmake-i686-w64-mingw32
cmake ${src} -DTFEL_BROKEN_LIBMATH=$broken_libmath -Dlocal-castem-header=ON -Denable-fortran=ON -Denable-python=OFF -Denable-python-bindings=OFF -Denable-aster=ON -Denable-abaqus=ON -Denable-calculix=ON -Denable-comsol=ON -Denable-diana-fea=ON -Denable-ansys=ON -Denable-europlexus=ON -Denable-zmat=ON -Denable-cyrano=ON -Denable-lsdyna=ON -Denable-random-tests=${rtests} -Denable-reference-doc=${rdoc} -Denable-portable-build=${portable_build} -DCMAKE_INSTALL_PREFIX=$build/build-check/cmake/install-cmake-i686-w64-mingw32 -DCMAKE_TOOLCHAIN_FILE=${src}cmake/ToolChain-i686-w64-mingw32.cmake
$make_exec
if [ "x$(which wine)" != "x" ];
then
if [ test "x$pbuild" == "xyes" ];
then
make check ARGS="-j $nbproc"
else
$make_exec check
fi
fi
$make_exec install
popd #from build-cmake-i686-w64-mingw32
fi
if [ "x$(which i586-mingw32msvc-gcc)" != "x" ];
then
mkdir build-cmake-i586-mingw32msvc
pushd build-cmake-i586-mingw32msvc
cmake ${src} -DTFEL_BROKEN_LIBMATH=$broken_libmath -Dlocal-castem-header=ON -Denable-fortran=ON -Denable-python=OFF -Denable-python-bindings=OFF -Denable-aster=ON -Denable-abaqus=ON -Denable-calculix=ON -Denable-comsol=ON -Denable-diana-fea=ON -Denable-ansys=ON -Denable-europlexus=ON -Denable-zmat=ON -Denable-cyrano=ON -Denable-lsdyna=ON -Denable-random-tests=${rtests} -Denable-reference-doc=${rdoc} -Denable-portable-build=${portable_build} -DCMAKE_INSTALL_PREFIX=$build/build-check/cmake/install-cmake-i586-mingw32msvc -DCMAKE_TOOLCHAIN_FILE=${src}/cmake/ToolChain-i586-mingw32msvc.cmake
$make_exec
if [ "x$(which wine)" != "x" ];
then
if [ test "x$pbuild" == "xyes" ];
then
make check ARGS="-j $nbproc"
else
$make_exec check
fi
fi
$make_exec install
popd #from build-cmake-i586-mingw32msvc
fi
fi
popd #from build-check