forked from RobotLocomotion/drake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ipopt_build_with_autotools.sh
executable file
·52 lines (40 loc) · 1.61 KB
/
ipopt_build_with_autotools.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
#!/bin/bash
set -e
me=$(basename "$0")
function die() {
set +x
echo "$@" 1>&2
find -L . -name config.log | xargs -n1 --verbose cat 1>&2
exit 1
}
# Log the current environment varibles.
echo "*******************************************************************" 1>&2
echo "$me: Initial environment is ..." 1>&2
env | sort 1>&2
echo "... end of environment." 1>&2
echo "*******************************************************************" 1>&2
# Check if everything we need exists.
[ -x "$cdexec" ] || die 'Missing $cdexec'
[ -n "$top_builddir" ] || die 'Missing $top_builddir'
configure="$PWD"/external/ipopt/configure
[ -x "$configure" ] || die 'Missing configure'
# How many cores to use while building. This is a compromise in order to not
# totally bog down the machine, while still achieving some parallelism.
half_the_cores="$[($(getconf _NPROCESSORS_ONLN)+1)/2]"
# Set these to match --with-pic below.
export ADD_CFLAGS=-fPIC
export ADD_CXXFLAGS=-fPIC
# Log the current environment varibles.
echo "*******************************************************************" 1>&2
echo "$me: Final environment is ..." 1>&2
env | sort 1>&2
echo "... end of environment." 1>&2
echo "*******************************************************************" 1>&2
# From now on, echo commands before running them.
set -x
"$cdexec" "$top_builddir" "$configure" --disable-shared --with-pic \
|| die "*** IPOPT configure step failed ***"
"$cdexec" "$top_builddir" make -j "$half_the_cores" V=1 \
|| die "*** IPOPT make step failed ***"
"$cdexec" "$top_builddir" make install \
|| die "*** IPOPT install step failed ***"