Prev Next run_cmake.sh

@(@\newcommand{\B}[1]{{\bf #1}} \newcommand{\R}[1]{{\rm #1}}@)@
Run CMake to Configure Implicit AD

Syntax
bin/run_cmake.sh

Purpose
This is a bash script that configures implicit_ad by running CMake . If you do not have bash on your system, this script can be considered documentation for the cmake command.

Correctness Testing
After this script is run, the following commands will run the tests for correctness:
 
     cd build
     make check

Speed Testing
After this script is run, the following commands will run the speed tests:
 
     cd build
     make time
     ./time

Exit on Error
The following command instructs bash to terminate, with a non-zero exit status, when an error occurs:

set -e

Check Working Directory
Check that the current working directory is the top level source directory.
if [ "$0" != 'bin/run_cmake.sh' ]
then
     echo 'bin/run_cmake.sh: must be run from its parent directory'
     exit 1
fi

cppad_pkg_config_path
This is the directory where the file cppad.pc file is located

cppad_pkg_config_path="$HOME/prefix/cppad/share/pkgconfig"

eigen_pkg_config_path
This is the directory where the file eigen3.pc file is located. It is often desirable to install eigen its own special prefix so warnings can be suppressed for its include files without suppressing warnings for other include files.

eigen_pkg_config_path="$HOME/prefix/eigen/share/pkgconfig"

ipopt_pkg_config_path
The install of cppad may be done in a way that uses the ipopt libraries. If this is the case, you must change the following setting to the directory where the file ipopt.pc is located (otherwise, the cmake command will report the error message 'ipopt' required by 'cppad').

ipopt_pkg_config_path=""

PKG_CONFIG_PATH
Set the directories that are searched by pkg-config .
PKG_CONFIG_PATH="${cppad_pkg_config_path}:${eigen_pkg_config_path}"
if [ "$ipopt_pkg_config_path" != "" ]
then
     PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${ipopt_pkg_config_path}"
fi

cmake_verbose_makefile
If this is true, make will display the compile and link commands that it uses to build the tests.

cmake_verbose_makefile='false'

cmake_build_type
You should use debug for correctness testing and release for speed testing.

cmake_build_type='debug'

extra_cxx_flags
Extra C++ flags, besides the debug and release flags, used during compile commands.

extra_cxx_flags='-Wall -pedantic-errors -std=c++11 -Wshadow'

Check Usage
Make sure that run_cmake.sh is run from its parent directory.
if [ "$0" != 'bin/run_cmake.sh' ]
then
     echo 'bin/run_cmake.sh: must be run from its parent directory'
     exit 1
fi

build Directory
If necessary, create the build directory, then make it the current working directory.
if [ ! -e 'build' ]
then
     mkdir build
fi
cd build

CMake Command
source_dir='..'
cmake \
     -D CMAKE_VERBOSE_MAKEFILE="${cmake_verbose_makefile}" \
     -D CMAKE_BUILD_TYPE="${cmake_build_type}" \
     -D extra_cxx_flags="${extra_cxx_flags}" \
     ${source_dir}

Exit
This script runs with

echo 'run_cmake.sh: OK'
exit 0

Input File: bin/run_cmake.sh