source: trunk/bin/get_eigen.sh @ 2923

Last change on this file since 2923 was 2923, checked in by bradbell, 7 years ago

Print output of cmake command to see why jenkins not working.
get_eigen.sh: fix name of temporary file.

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 3.7 KB
Line 
1#! /bin/bash -e
2# $Id: get_eigen.sh 2923 2013-10-11 14:52:49Z bradbell $
3# -----------------------------------------------------------------------------
4# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-13 Bradley M. Bell
5#
6# CppAD is distributed under multiple licenses. This distribution is under
7# the terms of the
8#                     Eclipse Public License Version 1.0.
9#
10# A copy of this license is included in the COPYING file of this distribution.
11# Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
12# -----------------------------------------------------------------------------
13# $begin get_eigen.sh$$ $newlinech #$$
14# $spell
15#       Eigen
16#       CppAD
17# $$
18#
19# $section Download and Install Eigen in Build Directory$$
20# $index eigen, download and install$$
21# $index download, install eigen$$
22# $index install, eigen$$
23#
24# $head Syntax$$
25# $code bin/get_eigen.sh$$
26#
27# $head Purpose$$
28# If you are using Unix, this command will download and install
29# $href%http://eigen.tuxfamily.org%Eigen%$$ in the
30# CppAD $code build$$ directory.
31#
32# $head Distribution Directory$$
33# This command must be executed in the
34# $cref/distribution directory/download/Distribution Directory/$$.
35#
36# $head External Directory$$
37# The Eigen source code is downloaded into the sub-directory
38# $code build/external$$ below the distribution directory.
39#
40# $head Prefix Directory$$
41# The Eigen include files are installed in the sub-directory
42# $code build/prefix/include/EIGEN$$ below the distribution directory.
43#
44# $end
45# -----------------------------------------------------------------------------
46if [ $0 != "bin/get_eigen.sh" ]
47then
48        echo "bin/get_eigen.sh: must be executed from its parent directory"
49        exit 1
50fi
51# -----------------------------------------------------------------------------
52# bash function that echos and executes a command
53echo_eval() {
54        echo $*
55        eval $*
56}
57# -----------------------------------------------------------------------------
58echo 'Download eigen to build/external and install it to build/prefix'
59version='3.2.0'
60web_page='https://bitbucket.org/eigen/eigen/get'
61prefix=`pwd`'/build/prefix'
62# -----------------------------------------------------------------------------
63# determine which version of cmake to use
64cmake --version
65cmake --version |  sed \
66                -e 's|[^0-9]*||g' \
67                -e 's|\([0-9]*\)\.\([0-9]*\)\..*|\1 * 10 + \2|' \
68        | bc > get_ipopt.$$
69cmake_version=`cat get_ipopt.$$`
70rm get_ipopt.$$
71echo "cmake_version=$cmake_version"
72#
73cmake_program=''
74if [ "$cmake_version" -ge '28' ]
75then
76        cmake_program='cmake'
77else
78        for cmake_version in 28 29
79        do
80                if which cmake$cmake_version >& /dev/null
81                then
82                        cmake_program="cmake$cmake_version"
83                fi
84        done
85fi
86if [ "$cmake_program" == '' ]
87then
88        echo 'cannot find a verison of cmake that is 2.8 or higher'
89        exit 1
90fi
91# -----------------------------------------------------------------------------
92if [ ! -d build/external ]
93then
94        echo_eval mkdir -p build/external
95fi
96echo_eval cd build/external
97# -----------------------------------------------------------------------------
98if [ ! -e "eigen-$version.tar.gz" ]
99then
100        echo_eval wget --no-check-certificate $web_page/$version.tar.gz
101        echo_eval mv $version.tar.gz eigen-$version.tar.gz
102fi
103if [ -e eigen-eigen-* ]
104then
105        echo_eval rm -r eigen-eigen-*
106fi
107if [ -e "eigen-$version" ]
108then
109        echo_eval rm -r eigen-$version
110fi
111if [ -e "$prefix/include/Eigen" ]
112then
113        echo_eval rm "$prefix/include/Eigen"
114fi
115echo_eval tar -xzf eigen-$version.tar.gz
116#
117git_name=`ls | grep eigen-eigen`
118echo_eval mv $git_name eigen-$version
119#
120echo_eval cd eigen-$version
121echo_eval mkdir build
122echo_eval cd build
123echo_eval cmake .. -DCMAKE_INSTALL_PREFIX=$prefix
124echo_eval make install
125echo_eval ln -s $prefix/include/eigen3/Eigen $prefix/include/Eigen
126#
127echo "get_eigen.sh: OK"
Note: See TracBrowser for help on using the repository browser.