Skip to content

Commit

Permalink
master: get_cppadcg.sh: patch base_float.hpp and base_double.hpp.
Browse files Browse the repository at this point in the history
  • Loading branch information
bradbell committed Jan 4, 2024
1 parent ffcd340 commit f4a9918
Showing 1 changed file with 39 additions and 7 deletions.
46 changes: 39 additions & 7 deletions bin/get_cppadcg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-FileCopyrightText: Bradley M. Bell <[email protected]>
# SPDX-FileContributor: 2003-22 Bradley M. Bell
# ----------------------------------------------------------------------------
# {xrst_begin get_cppadcg.sh}
# {xrst_begin get_cppadcg.sh}
# {xrst_spell
# doxygen
# }
Expand Down Expand Up @@ -142,10 +142,13 @@ then
echo_eval git clone $web_page $package.git
fi
echo_eval cd $package.git
# -----------------------------------------------------------------------------
echo_eval git reset --hard
echo_eval git checkout --quiet $git_hash
#
# cmake/FindCppAD.cmake
# Modify FindCppAD.cmake so can use git repository
# version of CppAD (not yet installed).
cat << EOF > get_cppadcg.sed
cat << EOF > temp.sed
s|IF *( *DEFINED *CPPAD_HOME *)|IF (DEFINED CPPAD_GIT_REPO)\\
# This setting is used for testing before installing CppAD.\\
# CPPAD_GIT_REPO is the a CppAD git repository. It is assumed that\\
Expand Down Expand Up @@ -185,11 +188,40 @@ s|IF *( *DEFINED *CPPAD_HOME *)|IF (DEFINED CPPAD_GIT_REPO)\\
\\
ELSEIF (DEFINED CPPAD_HOME)|
EOF
echo_eval git reset --hard
echo_eval git checkout --quiet $git_hash
echo_eval git checkout cmake/FindCppAD.cmake
echo_eval sed -i cmake/FindCppAD.cmake -f get_cppadcg.sed
echo_eval rm get_cppadcg.sed
echo_eval sed -i cmake/FindCppAD.cmake -f temp.sed
#
# include/cppad/cg/base_float.hpp
cat << EOF > temp.sed
/template *<> *\$/! b skip
: loop1
N
/\\n};\$/! b loop1
#
: loop2
N
/\\n}\$/! b loop2
s|.*|CPPAD_NUMERIC_LIMITS(float, cg::CG<float>)|
#
: skip
EOF
echo_eval sed -i include/cppad/cg/base_float.hpp -f temp.sed
#
# include/cppad/cg/base_double.hpp
cat << EOF > temp.sed
/template *<> *\$/! b skip
: loop1
N
/\\n};* *\$/! b loop1
#
: loop2
N
/\\n};* *\$/! b loop2
s|.*|CPPAD_NUMERIC_LIMITS(double, cg::CG<double>)|
#
: skip
EOF
echo_eval sed -i include/cppad/cg/base_double.hpp -f temp.sed
# -----------------------------------------------------------------------------
# make install
if [ ! -e build ]
Expand Down

0 comments on commit f4a9918

Please sign in to comment.