![]() |
Prev | Next | check_install.sh |
bin/check_install.sh
cmd=`grep '^build_type=' bin/run_cmake.sh`
eval $cmd
cmd=`grep '^cmake_install_prefix=' bin/run_cmake.sh`
eval $cmd
eigen_prefix="$cmake_install_prefix/eigen"
ipopt_prefix="$cmake_install_prefix"
cmd=`grep '^cmake_libdir=' bin/run_cmake.sh`
eval $cmd
cppad_mixed
:
example_file='example/user/no_random.cpp'
if [ "$PKG_CONFIG_PATH" == '' ]
then
export PKG_CONFIG_PATH="$ipopt_prefix/$cmake_libdir/pkgconfig"
else
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$ipopt_prefix/$cmake_libdir/pkgconfig"
fi
export LD_LIBRARY_PATH=''
mkdir -p build/tmp
cp $example_file build/tmp/example.cpp
cd build/tmp
.cpp
at the end replaced by _xam
:
example_name=`echo $example_file | sed -e 's|.*/||' -e 's|\.cpp|_xam|'`
example.cpp
file) that runs the example
and reports the result of its return bool
value:
cat << EOF >> example.cpp
int main(void)
{ if( ! $example_name() )
{ std::cout << "$example_name: Error" << std::endl;
std::exit(1);
}
std::cout << "$example_name: OK" << std::endl;
exit(0);
}
EOF
ipopt
on this system:
gsl_libs=`pkg-config --libs gsl`
ipopt
on this system:
ipopt_libs=`pkg-config --libs ipopt`
SuiteSparse
on this system:
suitesparse_libs='-lcholmod -lamd -lcamd -lcolamd -lccolamd -lsuitesparseconfig'
eigen
include files have installed in a
different directory and treated like system files because
they otherwise generate lots of warnings.
if [ "$build_type" == 'debug' ]
then
flags='-g -O0 -std=c++11 -Wall'
else
flags='-O3 -DNDEBUG -std=c++11 -Wall'
fi
cat << EOF
g++ example.cpp \\
$flags \\
-I $cmake_install_prefix/include \\
-isystem $eigen_prefix/include \\
-L $cmake_install_prefix/$cmake_libdir -lcppad_mixed \\
$gsl_libs \\
$suitesparse_libs \\
$ipopt_libs \\
-o example
EOF
g++ example.cpp \
$flags \
-I $cmake_install_prefix/include \
-isystem $eigen_prefix/include \
-L $cmake_install_prefix/$cmake_libdir -lcppad_mixed \
-Wl,-rpath=$cmake_install_prefix/$cmake_libdir \
$gsl_libs \
$suitesparse_libs \
$ipopt_libs \
-o example
if ! ./example
then
echo 'check_install.sh: Error'
exit 1
fi
echo 'check_install.sh: OK'
exit 0