source: trunk/bin/run_cmake.sh @ 3938

Last change on this file since 3938 was 3938, checked in by bradbell, 2 years ago

merge to branch: trunk
from repository: https://github.com/coin-or/CppAD
start hash code: 78ba7f801a6fec0dbdaa887c01ea58a9ccb59817
end hash code: bd9a72f2ccec67a9773cd2ecd536df8fe09860da

commit bd9a72f2ccec67a9773cd2ecd536df8fe09860da
Author: Brad Bell <bradbell@…>
Date: Mon May 22 06:14:34 2017 -0700

  1. Add the cppad_extra_debug option to cmake command.
  2. Advance to cppad-20170522.

commit 8f832650db029dd1df2f302b3e6a7f39cb83078f
Author: Brad Bell <bradbell@…>
Date: Sun May 21 07:16:35 2017 -0700

CMakeLists.txt: change type of cppad_deprecated to BOOL (must be NO).
configure.hpp.in: fix comment about CPPAD_DEPRECATED.
ad_ctor.hpp: remove comment about old use of cppad_deprecated.
cmake.omh: remove description of old deprecated case.

commit 9a0a0705f7c44e5a93c136c3bd1e56ab39bb809f
Author: Brad Bell <bradbell@…>
Date: Sun May 21 06:34:38 2017 -0700

Add test that fails when release.cpp is compiled for release.
CMakeLists.txt: improve command line argument comments.

commit bfbc481d68256d71217a1d9a439bc2b2e07f90c2
Author: Brad Bell <bradbell@…>
Date: Sun May 21 04:15:26 2017 -0700

Advance to cppad-20170521.
check_example.sh: simplify.

commit 163044ceea186505229e59770b263fe00b12726d
Author: Brad Bell <bradbell@…>
Date: Sat May 20 09:07:15 2017 -0700

Create test_more/debug_rel (Under construction).

commit 9d90a176a0fc75faff28c0cb2034218d8a3b2f6a
Author: Brad Bell <bradbell@…>
Date: Sat May 20 07:04:52 2017 -0700

readme.md: add link to new directory structure page.

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 6.1 KB
Line 
1#! /bin/bash -e
2# -----------------------------------------------------------------------------
3# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-17 Bradley M. Bell
4#
5# CppAD is distributed under multiple licenses. This distribution is under
6# the terms of the
7#                     Eclipse Public License Version 1.0.
8#
9# A copy of this license is included in the COPYING file of this distribution.
10# Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
11# -----------------------------------------------------------------------------
12if [ ! -e "bin/run_cmake.sh" ]
13then
14        echo "bin/run_cmake.sh: must be executed from its parent directory"
15        exit 1
16fi
17# -----------------------------------------------
18# bash function that echos and executes a command
19echo_eval() {
20        echo $*
21        eval $*
22}
23# -----------------------------------------------
24verbose='no'
25standard='c++11'
26debug_speed='no'
27debug_cppad_ipopt='no'
28release_example='no'
29profile_speed='no'
30clang='no'
31extra_debug='no'
32no_colpack='no'
33no_eigen='no'
34no_ipopt='no'
35no_documentation='no'
36testvector='boost'
37while [ "$1" != "" ]
38do
39        if [ "$1" == '--help' ]
40        then
41                cat << EOF
42usage: bin/run_cmake.sh: \\
43        [--help] \\
44        [--verbose] \\
45        [--c++98] \\
46        [--debug_speed] \\
47        [--debug_cppad_ipopt] \\
48        [--release_example] \\
49        [--profile_speed] \\
50        [--clang ] \\
51        [--extra_debug] \\
52        [--no_colpack] \\
53        [--no_eigen] \\
54        [--no_ipopt] \\
55        [--no_documentation] \\
56        [--<package>_vector]
57The --help option just prints this message and exits.
58The value <package> above must be one of: cppad, boost, or eigen.
59
60EOF
61                exit 0
62        elif [ "$1" == '--verbose' ]
63        then
64                verbose='yes'
65        elif [ "$1" == '--c++98' ]
66        then
67                standard='c++98'
68        elif [ "$1" == '--debug_speed' ]
69        then
70                debug_speed='yes'
71                profile_speed='no'
72        elif [ "$1" == '--debug_cppad_ipopt' ]
73        then
74                debug_cppad_ipopt='yes'
75        elif [ "$1" == '--release_example' ]
76        then
77                release_example='yes'
78        elif [ "$1" == '--profile_speed' ]
79        then
80                profile_speed='yes'
81                debug_speed='no'
82        elif [ "$1" == '--clang' ]
83        then
84                clang='yes'
85        elif [ "$1" == '--extra_debug' ]
86        then
87                extra_debug='yes'
88        elif [ "$1" == '--no_colpack' ]
89        then
90                no_colpack='yes'
91        elif [ "$1" == '--no_eigen' ]
92        then
93                no_eigen='yes'
94        elif [ "$1" == '--no_ipopt' ]
95        then
96                no_ipopt='yes'
97        elif [ "$1" == '--no_documentation' ]
98        then
99                no_documentation='yes'
100        elif [ "$1" == '--cppad_vector' ]
101        then
102                testvector='cppad'
103        elif [ "$1" == '--boost_vector' ]
104        then
105                testvector='boost'
106        elif [ "$1" == '--eigen_vector' ]
107        then
108                testvector='eigen'
109        else
110                echo "$1 is an invalid option, try bin/run_cmake.sh --help"
111                exit 1
112        fi
113        shift
114done
115# ---------------------------------------------------------------------------
116if [ "$debug_speed" == 'yes' ]
117then
118        sed -e 's|^SET(CMAKE_BUILD_TYPE .*|SET(CMAKE_BUILD_TYPE DEBUG)|' \
119                -i  speed/CMakeLists.txt
120else
121        sed -e 's|^SET(CMAKE_BUILD_TYPE .*|SET(CMAKE_BUILD_TYPE RELEASE)|' \
122                -i speed/CMakeLists.txt
123fi
124# ---------------------------------------------------------------------------
125if [ "$debug_cppad_ipopt" == 'yes' ]
126then
127        sed -e 's|^SET(CMAKE_BUILD_TYPE .*|SET(CMAKE_BUILD_TYPE DEBUG)|' \
128                -i  cppad_ipopt/CMakeLists.txt
129else
130        sed -e 's|^SET(CMAKE_BUILD_TYPE .*|SET(CMAKE_BUILD_TYPE RELEASE)|' \
131                -i  cppad_ipopt/CMakeLists.txt
132fi
133# ---------------------------------------------------------------------------
134if [ "$release_example" == 'yes' ]
135then
136        sed -e 's|^SET(CMAKE_BUILD_TYPE .*|SET(CMAKE_BUILD_TYPE RELEASE)|' \
137                -i  example/CMakeLists.txt
138else
139        sed -e 's|^SET(CMAKE_BUILD_TYPE .*|SET(CMAKE_BUILD_TYPE DEBUG)|' \
140                -i example/CMakeLists.txt
141fi
142# ---------------------------------------------------------------------------
143if [ ! -e build ]
144then
145        echo_eval mkdir build
146fi
147echo_eval cd build
148if [ -e CMakeCache.txt ]
149then
150        echo_eval rm CMakeCache.txt
151fi
152if [ -e CMakeFiles ]
153then
154        echo_eval rm -r CMakeFiles
155fi
156# ---------------------------------------------------------------------------
157# clean all variables in cmake cache
158cmake_args='-U .+'
159#
160if [ "$verbose" == 'yes' ]
161then
162        # echo each command that make executes
163        cmake_args="$cmake_args  -D CMAKE_VERBOSE_MAKEFILE=YES"
164fi
165# -----------------------------------------------------------------------------
166# cppad_prefix
167cmake_args="$cmake_args  -D cppad_prefix=$HOME/prefix/cppad"
168#
169# cmake_install_includedirs
170if [ -d '/usr/include' ]
171then
172        cmake_args="$cmake_args -D cmake_install_includedirs=include"
173fi
174#
175# cmake_install_datadir
176if [ -d '/usr/share' ]
177then
178        cmake_args="$cmake_args -D cmake_install_datadir=share"
179fi
180#
181# cmake_install_docdir
182if [ -d '/usr/share' ] && [ "$no_documentation" == 'no' ]
183then
184        cmake_args="$cmake_args -D cmake_install_docdir=share/doc"
185fi
186#
187# cmake_install_libdirs
188if [ -d '/usr/lib64' ]
189then
190        cmake_args="$cmake_args -D cmake_install_libdirs='lib64;lib'"
191elif [ -d '/usr/lib' ]
192then
193        cmake_args="$cmake_args -D cmake_install_libdirs='lib;lib64'"
194fi
195#
196# {package}_prefix
197package_list='fadbad adolc sacado'
198if [ "$no_colpack" == 'no' ]
199then
200        package_list="$package_list colpack"
201fi
202if [ "$no_eigen" == 'no' ]
203then
204        package_list="$package_list eigen"
205fi
206if [ "$no_ipopt" == 'no' ]
207then
208        package_list="$package_list ipopt"
209fi
210for package in $package_list
211do
212        dir=$HOME/prefix/$package
213        if [ -d "$dir" ]
214        then
215                cmake_args="$cmake_args  -D ${package}_prefix=$dir"
216        fi
217done
218#
219# cppad_cxx_flags
220cppad_cxx_flags="-Wall -pedantic-errors -std=$standard"
221if [ "$testvector" != 'eigen' ]
222then
223        cppad_cxx_flags="$cppad_cxx_flags -Wshadow"
224fi
225cmake_args="$cmake_args -D cppad_cxx_flags='$cppad_cxx_flags'"
226#
227# clang
228if [ "$clang" == 'yes' ]
229then
230        cmake_args="$cmake_args -D CMAKE_C_COMPILER=clang"
231        cmake_args="$cmake_args -D CMAKE_CXX_COMPILER=clang++"
232fi
233#
234# profile
235if [ "$profile_speed" == 'yes' ]
236then
237        cmake_args="$cmake_args -D cppad_profile_flag=-pg"
238fi
239#
240# simple options
241cmake_args="$cmake_args -D cppad_testvector=$testvector"
242cmake_args="$cmake_args -D cppad_tape_id_type='int32_t'"
243cmake_args="$cmake_args -D cppad_tape_addr_type=int32_t"
244cmake_args="$cmake_args -D cppad_max_num_threads=48"
245cmake_args="$cmake_args -D cppad_extra_debug=$extra_debug"
246#
247echo_eval cmake $cmake_args ..
248#
249# ----------------------------------------------------------------------------
250echo "$0: OK"
251exit 0
Note: See TracBrowser for help on using the repository browser.