source: trunk/bin/get_eigen.sh @ 2922

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

get_eigen.sh: Attempt to get new version of eigen to build on jenkins master.

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 3.6 KB
Line 
1#! /bin/bash -e
2# $Id: get_eigen.sh 2922 2013-10-11 14:44:41Z 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 |  sed \
65                -e 's|[^0-9.]*||g' \
66                -e 's|\([0-9]*\)\.\([0-9]*\)\..*|\1 * 10 + \2|' \
67        | bc > get_sacado.$$
68cmake_version=`cat get_sacado.$$`
69rm get_sacado.$$
70echo "cmake_version=$cmake_version"
71#
72cmake_program=''
73if [ "$cmake_version" -ge '28' ]
74then
75        cmake_program='cmake'
76else
77        for cmake_version in 28 29
78        do
79                if which cmake$cmake_version >& /dev/null
80                then
81                        cmake_program="cmake$cmake_version"
82                fi
83        done
84fi
85if [ "$cmake_program" == '' ]
86then
87        echo 'cannot find a verison of cmake that is 2.8 or higher'
88        exit 1
89fi
90# -----------------------------------------------------------------------------
91if [ ! -d build/external ]
92then
93        echo_eval mkdir -p build/external
94fi
95echo_eval cd build/external
96# -----------------------------------------------------------------------------
97if [ ! -e "eigen-$version.tar.gz" ]
98then
99        echo_eval wget --no-check-certificate $web_page/$version.tar.gz
100        echo_eval mv $version.tar.gz eigen-$version.tar.gz
101fi
102if [ -e eigen-eigen-* ]
103then
104        echo_eval rm -r eigen-eigen-*
105fi
106if [ -e "eigen-$version" ]
107then
108        echo_eval rm -r eigen-$version
109fi
110if [ -e "$prefix/include/Eigen" ]
111then
112        echo_eval rm "$prefix/include/Eigen"
113fi
114echo_eval tar -xzf eigen-$version.tar.gz
115#
116git_name=`ls | grep eigen-eigen`
117echo_eval mv $git_name eigen-$version
118#
119echo_eval cd eigen-$version
120echo_eval mkdir build
121echo_eval cd build
122echo_eval cmake .. -DCMAKE_INSTALL_PREFIX=$prefix
123echo_eval make install
124echo_eval ln -s $prefix/include/eigen3/Eigen $prefix/include/Eigen
125#
126echo "get_eigen.sh: OK"
Note: See TracBrowser for help on using the repository browser.