diff --git a/.gitignore b/.gitignore index 804773ae5..d54dbd470 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ # create by bin/test_one.sh /test_one.cpp /test_one.exe +/test_one.exe.dSYM/ # # git commit script /git_commit.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index a009a1eb3..09e5ebe8b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ IF( POLICY CMP0054 ) ENDIF( POLICY CMP0054 ) # # cppad_version is used by version.sh to get the version number. -SET(cppad_version "20240911") +SET(cppad_version "20240913") SET(cppad_url "https://coin-or.github.io/CppAD" ) SET(cppad_description "Differentiation of C++ Algorithms" ) IF( NOT DEFINED CMAKE_BUILD_TYPE) diff --git a/appendix/whats_new/2024.xrst b/appendix/whats_new/2024.xrst index 0218106e1..712cc5c1e 100644 --- a/appendix/whats_new/2024.xrst +++ b/appendix/whats_new/2024.xrst @@ -13,6 +13,7 @@ dll env iostream + homebrew isnan nul nx @@ -31,6 +32,17 @@ Release Notes for 2024 mm-dd ***** +09-13 +===== +#. Make all of the get_optional.sh routines now works on MacOS with homebrew, + see :ref:`get_optional.sh@MacOS with Homebrew` . + Do not test :ref:`colpack_prefix-name` on MacOS + (there seems to be a problem with the ColPack install on that system). +#. The :ref:`configure@--with-verbose-make` option was added to the + configure script. In addition, :ref:`configure-name` was mistakenly + requiring that ColPack was installed; see :ref:`colpack_prefix-name`. + This has been fixed. + 09-11 ===== #. The :ref:`get_ipopt.sh@Source Directory` was changed from diff --git a/bin/check_all.sh b/bin/check_all.sh index a8594317f..d28735617 100755 --- a/bin/check_all.sh +++ b/bin/check_all.sh @@ -1,4 +1,5 @@ -#! /bin/bash -e +#! /usr/bin/env bash +set -e -u # SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later # SPDX-FileCopyrightText: Bradley M. Bell # SPDX-FileContributor: 2003-24 Bradley M. Bell @@ -8,22 +9,27 @@ then echo "bin/check_all.sh: must be executed from its parent directory" exit 1 fi -if [ "$1" != 'mixed' ] && [ "$1" != 'debug' ] && [ "$1" != 'release' ] +if [ "$#" != 1 ] && [ "$#" != 2 ] then echo 'bin/check_all.sh: (mixed|debug|release) [verbose_make]' exit 1 fi -if [ "$2" != '' ] && [ "$2" != 'verbose_make' ] +if [ "$1" != 'mixed' ] && [ "$1" != 'debug' ] && [ "$1" != 'release' ] then echo 'bin/check_all.sh: (mixed|debug|release) [verbose_make]' exit 1 fi build_type="$1" -if [ "$2" == 'verbose_make' ] +verbose_make='no' +if [ "$#" == 2 ] then - verbose_make='--verbose_make' -else - verbose_make='' + if [ "$2" != '' ] && [ "$2" != 'verbose_make' ] + then + echo 'bin/check_all.sh: (mixed|debug|release) [verbose_make]' + exit 1 + else + verbose_make='yes' + fi fi # ----------------------------------------------------------------------------- # bash function that echos and executes a command @@ -184,6 +190,10 @@ then else exclude_package='--no_eigen --no_sacado' fi +if [ "$(uname)" == 'Darwin' ] +then + exclude_package+=' --no_colpack' +fi # --------------------------------------------------------------------------- # absoute prefix where optional packages are installed eval `grep '^prefix=' bin/get_optional.sh` @@ -245,21 +255,27 @@ echo_log_eval cp -r ../prefix build/prefix if [ "$use_configure" == 'yes' ] then builder='make' + configure_cmd="bin/run_configure.sh $standard" if [ "$compiler" == 'clang' ] then - echo_log_eval bin/run_configure.sh $standard --with_clang - else - echo_log_eval bin/run_configure.sh $standard + configure_cmd+=' --with-clang' fi + if [ "verbose_make" == 'yes' ] + then + conigure_cmd+=' --with-verbose-make' + fi + echo_log_eval $configure_cmd else - if [ "$verbose_name" != '' ] + if [ "$verbose_make" == 'yes' ] then builder='make' + verbose_flag='--verbose' else builder='ninja' + verbose_flag='' fi echo_log_eval bin/run_cmake.sh \ - $verbose_make \ + $verbose_flag \ --profile_speed \ $compiler \ $standard \ @@ -270,7 +286,12 @@ fi echo_log_eval cd build # # n_job -n_job=$(nproc) +if which nproc >& /dev/null +then + n_job=$(nproc) +else + n_job=$(sysctl -n hw.ncpu) +fi # ----------------------------------------------------------------------------- # # build: example_jit @@ -317,16 +338,16 @@ fi # # bin/test_install.sh echo_log_eval cd .. -echo_log_eval bin/test_install.sh $builder +if [ "$standard" == '' ] +then + echo_log_eval bin/test_install.sh $builder --c++17 +else + echo_log_eval bin/test_install.sh $builder $standard +fi # # echo "date >> check_all.log" date | sed -e 's|^|date: |' >> $top_srcdir/check_all.log -if [ "$skip" != '' ] -then - echo_log_eval echo "check_all.sh: skip = $skip" - exit 1 -fi # ---------------------------------------------------------------------------- echo "$0: OK" >> $top_srcdir/check_all.log echo "$0: OK" diff --git a/bin/check_automake.sh b/bin/check_automake.sh deleted file mode 100755 index dbee2f4d3..000000000 --- a/bin/check_automake.sh +++ /dev/null @@ -1,39 +0,0 @@ -#! /bin/bash -e -# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later -# SPDX-FileCopyrightText: Bradley M. Bell -# SPDX-FileContributor: 2003-22 Bradley M. Bell -# ---------------------------------------------------------------------------- -if [ "$0" != 'bin/check_automake.sh' ] -then - echo "bin/check_automake: must be executed from its parent directory" - exit 1 -fi -dir=$(ls /usr/share | grep automake) -dir="/usr/share/$dir" -ok='yes' -for name in $(ls) -do - if [ -e $dir/$name ] - then - if [ -L $name ] - then - echo "$name should be a file not a link" - exit 1 - fi - if [ $name != 'COPYING' ] - then - if ! diff $dir/$name $name > /dev/null - then - ok='no' - echo "cp $dir/$name $name" - fi - fi - fi -done -if [ "$ok" == 'no' ] -then - echo 'check_automake.sh: commands above will update automake files' - exit 1 -fi -echo 'check_sutomake.sh: OK' -exit 0 diff --git a/bin/check_example.sh b/bin/check_example.sh index 522b16a65..6971f572c 100755 --- a/bin/check_example.sh +++ b/bin/check_example.sh @@ -1,25 +1,28 @@ #! /bin/bash -e # SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later # SPDX-FileCopyrightText: Bradley M. Bell -# SPDX-FileContributor: 2003-22 Bradley M. Bell +# SPDX-FileContributor: 2003-24 Bradley M. Bell # ---------------------------------------------------------------------------- if [ ! -e "bin/check_example.sh" ] then echo "bin/check_example.sh: must be executed from its parent directory" exit 1 fi +# +# grep, sed +source bin/grep_and_sed.sh # ----------------------------------------------------------------------------- echo "Checking that all examples are in xrst/example_list.xrst" echo "-------------------------------------------------------" -file_list=`git ls-files | sed -n \ +file_list=`git ls-files | $sed -n \ -e '/^example\/deprecated\//d' \ -e '/^example\//p'` # -sed < xrst/example_list.xrst > check_example.$$ \ +$sed < xrst/example_list.xrst > check_example.$$ \ -n -e '/[$]begin list_all_examples\$\$/,/\$end/p' # # Make sure all example names are of the form *.cpp or *.hpp -check=`sed -n -e '/$rref [0-9a-zA-Z_]*\.[hc]pp/d' \ +check=`$sed -n -e '/$rref [0-9a-zA-Z_]*\.[hc]pp/d' \ -e '/$rref/p' check_example.$$` if [ "$check" != '' ] then @@ -32,11 +35,11 @@ for file in $file_list do # only files in example directory with [$]begin *.cpp or *.hpp # e.g., example/multi_thread/harmonic.xrst has [$]begin harmonic.cpp$$ in it - name=`grep '[$]begin *[0-9a-zA-Z_]*\.[hc]pp' $file | - sed -e 's/.*[$]begin *//' -e 's/ *$$.*//'` + name=`$grep '[$]begin *[0-9a-zA-Z_]*\.[hc]pp' $file | + $sed -e 's/.*[$]begin *//' -e 's/ *$$.*//'` if [ "$name" != "" ] then - if ! grep "$name" check_example.$$ > /dev/null + if ! $grep "$name" check_example.$$ > /dev/null then echo "$name is missing from xrst/example_list.xrst" ok="no" @@ -63,22 +66,22 @@ dir_list=' for dir in $dir_list do echo "Checking $dir file versus example names" - name=`echo $dir | sed -e 's|.*/||'` + name=`echo $dir | $sed -e 's|.*/||'` # - ls $dir/*.cpp | sed \ + ls $dir/*.cpp | $sed \ -e "s|$dir/||" -e "/^$name\\.cpp/d" -e 's|\.cpp||' > check_example.1.$$ if [ "$name" == 'general' ] then list=`ls $dir/*.hpp \ - | sed -e "s|$dir/||" -e 's|\.hpp$||' -e '/^general$/d'` + | $sed -e "s|$dir/||" -e 's|\.hpp$||' -e '/^general$/d'` for file in $list do - sed -i check_example.1.$$ -e "/^$file\$/d" + $sed -i check_example.1.$$ -e "/^$file\$/d" done fi - sed -n -e '/^extern bool [a-z0-9A-Z_]*(void);/p' $dir/$name.cpp \ - | sed -e 's/extern bool \([a-z0-9A-Z_]*\)(void);/\1/' \ - | sed -e 's/\([a-z]\)\([A-Z]\)/\1_\2/g' \ + $sed -n -e '/^extern bool [a-z0-9A-Z_]*(void);/p' $dir/$name.cpp \ + | $sed -e 's/extern bool \([a-z0-9A-Z_]*\)(void);/\1/' \ + | $sed -e 's/\([a-z]\)\([A-Z]\)/\1_\2/g' \ | tr '[A-Z]' '[a-z]' \ | sort > check_example.2.$$ if ! diff check_example.1.$$ check_example.2.$$ diff --git a/bin/check_include_file.sh b/bin/check_include_file.sh index e6b3e155f..c7b7cc65e 100755 --- a/bin/check_include_file.sh +++ b/bin/check_include_file.sh @@ -1,7 +1,7 @@ #! /bin/bash -e # SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later # SPDX-FileCopyrightText: Bradley M. Bell -# SPDX-FileContributor: 2003-22 Bradley M. Bell +# SPDX-FileContributor: 2003-24 Bradley M. Bell # ---------------------------------------------------------------------------- if [ ! -e "bin/check_include_file.sh" ] then @@ -9,6 +9,9 @@ then echo "bin/check_include_file.sh: $msg" exit 1 fi +# +# $grep, sed +source bin/grep_and_sed.sh # ----------------------------------------------------------------------------- # echo "Checking difference between C++ include directives and file names." @@ -18,19 +21,19 @@ then echo "bin/check_include_file.sh: unexpected check_include_file.1.$$" exit 1 fi -list=`git ls-files | sed -n \ +list=`git ls-files | $sed -n \ -e '/\.cpp$/p' \ -e '/\.hpp$/p'` for file in $list do - sed -n $file \ + $sed -n $file \ -e '/^# *include *> check_include_file.1.$$ done # cat check_include_file.1.$$ | \ - sed -e 's%[^<]*<%%' -e 's%>.*$%%' | \ + $sed -e 's%[^<]*<%%' -e 's%>.*$%%' | \ sort -u > check_include_file.2.$$ # # The following files should never be included: @@ -40,13 +43,13 @@ cat check_include_file.1.$$ | \ # # The files cppad/configure.hpp and cppad/local/is_pod.hpp # are not in git repository (they are built during configuration) -git ls-files | sed -n -e '/include\/cppad\/.*\.hpp$/p' | \ - sed \ +git ls-files | $sed -n -e '/include\/cppad\/.*\.hpp$/p' | \ + $sed \ -e '1,1s|^|include/cppad/configure.hpp\n|' \ -e '1,1s|^|include/cppad/local/is_pod.hpp\n|' \ -e '/include\/cppad\/local\/op\/prototype_op.hpp/d' \ -e '/include\/cppad\/example\/eigen_plugin.hpp/d' | \ - sed -e 's|^include/||' | \ + $sed -e 's|^include/||' | \ sort -u > check_include_file.3.$$ # different='no' @@ -56,7 +59,7 @@ then different='yes' for file in `cat check_include_file.2.$$` do - if ! grep "$file" check_include_file.3.$$ > /dev/null + if ! $grep "$file" check_include_file.3.$$ > /dev/null then found='yes' echo "The file include/$file is unknown to git." @@ -66,7 +69,7 @@ then done for file in `cat check_include_file.3.$$` do - if ! grep "$file" check_include_file.2.$$ > /dev/null + if ! $grep "$file" check_include_file.2.$$ > /dev/null then found='yes' echo "The included $file is no longer included." diff --git a/bin/check_include_xrst.sh b/bin/check_include_xrst.sh index 367b2db2b..ccde10b51 100755 --- a/bin/check_include_xrst.sh +++ b/bin/check_include_xrst.sh @@ -1,7 +1,7 @@ #! /bin/bash -e # SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later # SPDX-FileCopyrightText: Bradley M. Bell -# SPDX-FileContributor: 2003-22 Bradley M. Bell +# SPDX-FileContributor: 2003-24 Bradley M. Bell # ---------------------------------------------------------------------------- if [ ! -e "bin/check_include_xrst.sh" ] then @@ -10,7 +10,7 @@ then fi # ----------------------------------------------------------------------------- count=`git ls-files include/cppad | grep '/xrst/.*\.hpp' | wc -l` -if [ "$count" != '0' ] +if [ $count != '0' ] then git ls-files include/cppad | grep '/xrst/.*\.hpp' echo 'Cannot put *.hpp files below xrst in include directory' diff --git a/bin/check_version.sh b/bin/check_version.sh index 9bc4a5a2d..449ca4091 100755 --- a/bin/check_version.sh +++ b/bin/check_version.sh @@ -19,11 +19,14 @@ then echo 'bin/check_version.sh: cannot find ./.git' exit 1 fi +# +# grep, sed +source bin/grep_and_sed.sh # ----------------------------------------------------------------------------- # # check_version("$1", temp.sed, version_ok) check_version() { - sed "$1" -f temp.sed > temp.out + $sed "$1" -f temp.sed > temp.out if ! diff "$1" temp.out > /dev/null then version_ok='no' @@ -42,12 +45,12 @@ check_version() { # # this_version this_version=$( - sed -n -e '/^SET( *cppad_version *"[0-9.]*")/p' CMakeLists.txt | \ - sed -e 's|.*"\([^"]*\)".*|\1|' + $sed -n -e '/^SET( *cppad_version *"[0-9.]*")/p' CMakeLists.txt | \ + $sed -e 's|.*"\([^"]*\)".*|\1|' ) # # branch -branch=$(git branch | sed -n -e '/^[*]/p' | sed -e 's|^[*] *||') +branch=$(git branch | $sed -n -e '/^[*]/p' | $sed -e 's|^[*] *||') # # this_version if [ "$branch" == 'master' ] @@ -56,18 +59,18 @@ then fi # # stable_version, release_version -if echo $branch | grep '^stable/' > /dev/null +if echo $branch | $grep '^stable/' > /dev/null then - if ! echo $this_version | grep '^[0-9]\{4\}0000[.]' > /dev/null + if ! echo $this_version | $grep '^[0-9]\{4\}0000[.]' > /dev/null then echo 'check_version.sh: Stable version does not begin with yyyy0000.' exit 1 fi release_version="$this_version" - stable_version=$(echo $release_version | sed -e 's|[.][0-9]*$||') + stable_version=$(echo $release_version | $sed -e 's|[.][0-9]*$||') else - eval $(grep '^stable_version=' bin/new_release.sh) - eval $(grep '^release=' bin/new_release.sh) + eval $($grep '^stable_version=' bin/new_release.sh) + eval $($grep '^release=' bin/new_release.sh) release_version="$stable_version.$release" fi # diff --git a/bin/get_colpack.sh b/bin/get_colpack.sh index f0f8cb091..8b8c357e4 100755 --- a/bin/get_colpack.sh +++ b/bin/get_colpack.sh @@ -1,7 +1,7 @@ #! /bin/bash -e # SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later # SPDX-FileCopyrightText: Bradley M. Bell -# SPDX-FileContributor: 2003-23 Bradley M. Bell +# SPDX-FileContributor: 2003-24 Bradley M. Bell # ---------------------------------------------------------------------------- # {xrst_begin get_colpack.sh} # {xrst_comment_ch #} @@ -120,21 +120,25 @@ echo_eval git checkout --quiet v$version # ----------------------------------------------------------------------------- if which autoconf >& /dev/null then - echo_eval libtoolize + if which libtoolize >& /dev/null + then + echo_eval libtoolize + else + echo_eval glibtoolize + fi echo_eval autoreconf --install --force else echo "Error: autoconf and libtool required for this script" exit 1 fi # ----------------------------------------------------------------------------- -system_name=`uname | sed -e 's|\(......\).*|\1|'` -if [ "$system_name" == 'CYGWIN' ] +if [[ "$(uname)" == CYGWIN* ]] || [ "$(uname)" == Darwin ] then lib_type='--enable-static --disable-shared' echo_eval ls -l ./configure echo_eval chmod +x ./configure else - lib_type='--enable-static --enable-shared' + lib_type='--disable-static --enable-shared' fi echo_eval ./configure \ --prefix=$prefix \ diff --git a/bin/get_cppadcg.sh b/bin/get_cppadcg.sh index 02b74ac0e..1dd64b88a 100755 --- a/bin/get_cppadcg.sh +++ b/bin/get_cppadcg.sh @@ -47,10 +47,10 @@ # This will install the commit of Cppadcg with the following git hash # {xrst_spell_off} # {xrst_code sh} -git_hash='fde3752' +git_hash='e15c57207ea42a9572e9ed44df1894e09f7ce67e' # {xrst_code} # {xrst_spell_on} -# The date corresponding to this commit was 2022-08-14. +# The date corresponding to this commit was 2024-06-16. # # Configuration # ************* @@ -80,11 +80,14 @@ then exit 1 fi # ----------------------------------------------------------------------------- -# bash function that echos and executes a command +# echo_eval echo_eval() { echo $* eval $* } +# +# grep, sed +source bin/grep_and_sed.sh # ----------------------------------------------------------------------------- web_page='https://github.com/joaoleal/CppADCodeGen' cppad_repo=$(pwd) @@ -98,7 +101,7 @@ else fi # ---------------------------------------------------------------------------- # prefix -eval `grep '^prefix=' bin/get_optional.sh` +eval `$grep '^prefix=' bin/get_optional.sh` if [[ "$prefix" =~ ^[^/] ]] then prefix="$cppad_repo/$prefix" @@ -190,39 +193,7 @@ s|IF *( *DEFINED *CPPAD_HOME *)|IF (DEFINED CPPAD_GIT_REPO)\\ ELSEIF (DEFINED CPPAD_HOME)| EOF echo_eval git checkout cmake/FindCppAD.cmake -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)| -# -: 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)| -# -: skip -EOF -echo_eval sed -i include/cppad/cg/base_double.hpp -f temp.sed +echo_eval $sed -i -f temp.sed cmake/FindCppAD.cmake # ----------------------------------------------------------------------------- # make install if [ ! -e build ] diff --git a/bin/get_optional.sh b/bin/get_optional.sh index e72191fe8..4eabfa293 100755 --- a/bin/get_optional.sh +++ b/bin/get_optional.sh @@ -1,11 +1,18 @@ #! /bin/bash -e # SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later # SPDX-FileCopyrightText: Bradley M. Bell -# SPDX-FileContributor: 2003-22 Bradley M. Bell +# SPDX-FileContributor: 2003-24 Bradley M. Bell # ---------------------------------------------------------------------------- # # {xrst_begin get_optional.sh} # {xrst_comment_ch #} +# {xrst_spell +# ggrep +# grep +# gsed +# homebrew +# sed +# } # # Download and Install The CppAD Optional Packages # ################################################ @@ -60,6 +67,11 @@ prefix="build/prefix" # # ``ls external/`` * . ``configured`` # +# MacOS with Homebrew +# ******************* +# If you are using MacOS with homebrew, get_optional requires +# the gnu versions of grep and sed; i.e., ``ggrep`` and ``gsed`` . +# # get_optional.log # **************** # This file contains the standard out output for each of the optional scripts diff --git a/bin/get_sacado.sh b/bin/get_sacado.sh index 95d4c1c47..1889b2ac5 100755 --- a/bin/get_sacado.sh +++ b/bin/get_sacado.sh @@ -1,7 +1,7 @@ #! /bin/bash -e # SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later # SPDX-FileCopyrightText: Bradley M. Bell -# SPDX-FileContributor: 2003-23 Bradley M. Bell +# SPDX-FileContributor: 2003-24 Bradley M. Bell # ---------------------------------------------------------------------------- # {xrst_begin get_sacado.sh} # {xrst_spell @@ -64,6 +64,9 @@ then echo "bin/get_$package.sh: must be executed from its parent directory" exit 1 fi +# +# grep, sed +source bin/grep_and_sed.sh # ----------------------------------------------------------------------------- # bash function that echos and executes a command echo_eval() { @@ -84,7 +87,7 @@ else fi # ---------------------------------------------------------------------------- # prefix -eval `grep '^prefix=' bin/get_optional.sh` +eval `$grep '^prefix=' bin/get_optional.sh` if [[ "$prefix" =~ ^[^/] ]] then prefix="$cppad_dir/$prefix" @@ -126,9 +129,9 @@ then # # see https://github.com/trilinos/Trilinos/issues/11923 file="$release_name/packages/teuchos/core/src/Teuchos_BigUIntDecl.hpp" - if ! grep '^#include ' $file > /dev/null + if ! $grep '^#include ' $file > /dev/null then - sed -i $file -e 's|#include |&\n#include |' + $sed -i $file -e 's|#include |&\n#include |' fi fi echo_eval cd $release_name diff --git a/bin/package.sh b/bin/package.sh index f209bafcf..7f9e1aa9d 100755 --- a/bin/package.sh +++ b/bin/package.sh @@ -1,7 +1,7 @@ #! /bin/bash -e # SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later # SPDX-FileCopyrightText: Bradley M. Bell -# SPDX-FileContributor: 2003-23 Bradley M. Bell +# SPDX-FileContributor: 2003-24 Bradley M. Bell # ---------------------------------------------------------------------------- if [ "$0" != "bin/package.sh" ] then @@ -12,16 +12,25 @@ echo_eval() { echo $* eval $* } +# grep, sed +source bin/grep_and_sed.sh # ----------------------------------------------------------------------------- # index_page_name index_page_name=$(\ - sed -n -e '/^ *--index_page_name*/p' .readthedocs.yaml | \ - sed -e 's|^ *--index_page_name *||' \ + $sed -n -e '/^ *--index_page_name*/p' .readthedocs.yaml | \ + $sed -e 's|^ *--index_page_name *||' \ ) # # version -version=`sed -n -e '/^SET( *cppad_version *"[0-9.]*"/p' CMakeLists.txt | \ - sed -e 's|.*"\([^"]*\)".*|\1|'` +version=`$sed -n -e '/^SET( *cppad_version *"[0-9.]*"/p' CMakeLists.txt | \ + $sed -e 's|.*"\([^"]*\)".*|\1|'` +# +# prefix +eval $($grep '^prefix' bin/get_optional.sh) +if echo $prefix | $grep '^[^/]' > /dev/null +then + prefix="$(pwd)/$prefix" +fi # # build if [ ! -e 'build' ] @@ -40,6 +49,9 @@ cd build/cppad-$version tar -xzf tar.tgz rm tar.tgz # +# bin/get_optional +$sed -i -e "s|^prefix=.*|prefix=$prefix|" bin/get_optional.sh +# # build/cppad-version/build/html bin/run_xrst.sh -dev # diff --git a/bin/run_cmake.sh b/bin/run_cmake.sh index ae6c6f4d6..c041c3634 100755 --- a/bin/run_cmake.sh +++ b/bin/run_cmake.sh @@ -25,8 +25,11 @@ fi echo "prefix=$prefix" # ----------------------------------------------------------------------------- # PKG_CONFIG_PATH -PKG_CONFIG_PATH="$prefix/lib64/pkgconfig:$prefix/lib/pkgconfig" -PKG_CONFIG_PATH="$prefix/share/pkgconfig:$PKG_CONFIG_PATH" +PKG_CONFIG_PATH="$prefix/share/pkgconfig" +for libdir in lib lib64 +do + PKG_CONFIG_PATH+=":$prefix/$libdir/pkgconfig" +done export PKG_CONFIG_PATH # ----------------------------------------------------------------------------- verbose_make='no' @@ -364,16 +367,18 @@ then # This is a quote from the Callgrind manual: # 'As with Cachegrind, you probably want to compile with debugging info # (the -g option) and with optimization turned on.' - cmake_args="$cmake_args -g" + cppad_cxx_flags+=" -g" fi -# -# cppad_cxx_flags -# clang++ 14.05 is warnings on bitwise operations with logical operands. -# These are used for speed, but maybe they do not help much ? -if [ "$clang" == 'yes' ] +if [ "$(uname)" == 'Darwin' ] then - cppad_cxx_flags="$cppad_cxx_flags -Wno-bitwise-instead-of-logical" + if which brew > /dev/null + then + cppad_cxx_flags+=" -I $(brew --prefix)/include" + fi fi +# 2DO: clang++ 14.05 is generating a lot of warnings (we should fix these) +cppad_cxx_flags+=" -Wno-bitwise-instead-of-logical" +cppad_cxx_flags+=" -Wno-sign-conversion" # # cmake_args cmake_args="$cmake_args -D cppad_cxx_flags='$cppad_cxx_flags'" diff --git a/bin/run_configure.sh b/bin/run_configure.sh index a3b152686..8a5d007bb 100755 --- a/bin/run_configure.sh +++ b/bin/run_configure.sh @@ -11,6 +11,7 @@ then fi # ----------------------------------------------------------------------------- with_clang='' +with_verbose_make='' cpp_standard='c++17' while [ "$#" != '0' ] do @@ -20,6 +21,7 @@ do usage: bin/run_configure.sh \\ [--help] \\ [--with-clang] \\ + [--with-verbose_make] \\ [--c++yy] EOF exit 0 @@ -30,6 +32,10 @@ EOF with_clang='--with-clang' ;; + --with-verbose-make) + with_verbose_make='--with-verbose-make' + ;; + --c++*) cpp_standard=$(echo "$1" | sed -e 's|^--||') ;; @@ -67,7 +73,17 @@ testvector='cppad' # # cppad_cxx_flags cppad_cxx_flags="-std=$cpp_standard -Wall -pedantic-errors -Wshadow" -cppad_cxx_flags="$cppad_cxx_flags -Wfloat-conversion -Wconversion" +cppad_cxx_flags+=" -Wfloat-conversion -Wconversion" +if [ "$(uname)" == 'Darwin' ] +then + if which brew > /dev/null + then + cppad_cxx_flags+=" -I $(brew --prefix)/include" + fi +fi +# 2DO: clang++ 14.05 is generating a lot of warnings (we should fix these) +cppad_cxx_flags+=" -Wno-bitwise-instead-of-logical" +cppad_cxx_flags+=" -Wno-sign-conversion" # # eigen_prefix, scaado_prefix cxx_standard_year=$(echo $cpp_standard | sed -e 's|c++||') @@ -94,6 +110,7 @@ echo_eval cd build ../configure \ --prefix=$prefix \ $with_clang \ + $with_verbose_make \ --with-stdvector \ MAX_NUM_THREADS=32 \ CXX_FLAGS="'$cppad_cxx_flags'" \ diff --git a/bin/test_install.sh b/bin/test_install.sh index d5685012c..e7ec5e1cf 100755 --- a/bin/test_install.sh +++ b/bin/test_install.sh @@ -1,8 +1,8 @@ #! /usr/bin/env bash +set -e -u # SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later # SPDX-FileCopyrightText: Bradley M. Bell # SPDX-FileContributor: 2003-24 Bradley M. Bell -set -e -u # ---------------------------------------------------------------------------- # This sript name is 'test_*' instead of 'check_*' because it requires # that cmake has already cerated build/bukld.ninja or Makefile. @@ -12,17 +12,18 @@ then echo "$program: must be executed from its parent directory" exit 1 fi -if [ "$#" != 1 ] +if [ "$#" != 2 ] then - echo "usage: $program builder" - echo 'where builder is ninja or make' + echo "usage: $program builder standard" + echo 'builder: is ninja or make' + echo 'standard: is --c++yy where yy is the year for the C++ standard' exit 1 fi builder="$1" +standard="$2" if [ "$1" != 'ninja' ] && [ "$1" != 'make' ] then - echo "usage: $program builder" - echo 'where builder is ninja or make' + echo "$program: builder is not ninja or make" exit 1 fi if [ "$builder" == 'ninja' ] && [ ! -e build/build.ninja ] @@ -35,6 +36,11 @@ then echo "$program: builder is make and connot file build/Makefile" exit 1 fi +if ! echo "$standard" | grep '^--c++[0-9][0-9]' > /dev/null +then + echo "$program: standard is not --c++yy where ecxh y is a deciman digit" + eiit 1 +fi # ----------------------------------------------------------------------------- # bash function that echos and executes a command echo_eval() { @@ -64,9 +70,23 @@ cd build $builder install # ----------------------------------------------------------------------------- # +# rpath +rpath=$(find $prefix -name 'libcppad_lib.*' | head -1 ) +rpath=$(echo $rpath | sed -e 's|/[^/]*$||') +# # cflags +cflags="$(echo $standard | sed -e 's|^--c++|-std=c++|')" +if [ "$(uname)" == Darwin ] +then + if which brew > /dev/null + then + # 2DO: This flag should be added automatically by pkg-config + cflags+=" -I $(brew --prefix)/include" + fi +fi +cflags+=" $(pkg-config cppad --cflags)" +# # libs -cflags=$(pkg-config cppad --cflags) libs=$(pkg-config cppad --libs) # # test_install @@ -78,7 +98,7 @@ cd test_install # # CppAD get_started cp ../../example/get_started/get_started.cpp get_started.cpp -echo_eval g++ $cflags $libs get_started.cpp -o get_started +echo_eval g++ $cflags $libs -Wl,-rpath $rpath get_started.cpp -o get_started echo 'CppAD: ./get_started' if ! ./get_started then @@ -95,7 +115,7 @@ int main(void) return 0; } EOF -echo_eval g++ $cflags $libs get_started.cpp -o get_started +echo_eval g++ $cflags $libs -Wl,-rpath $rpath get_started.cpp -o get_started echo 'ipopt_solve: ./get_started' if ! ./get_started then diff --git a/configure b/configure index 51e33b89c..4a7974f33 100755 --- a/configure +++ b/configure @@ -61,6 +61,7 @@ set -e -u # | |tab| ``--with-`` *test* ``vector`` \\ # | |tab| ``--enable-msvc`` \\ # | |tab| ``--with-clang`` \\ +# | |tab| ``--with-verbose-make`` \\ # | |tab| ``MAX_NUM_THREADS`` = *max_num_threads* \\ # | |tab| ``CXX_FLAGS`` = *cxx_flags* \\ # | |tab| ``POSTFIX_DIR`` = *postfix_dir* \\ @@ -153,6 +154,10 @@ set -e -u # will be used for the C++ (C) compiler. # This option cannot appear when the --enable-msvc option appears. # +# --with-verbose-make +# ******************* +# This will create verbose output during the make commands. +# # max_num_threads # *************** # this specifies the value for the preprocessor symbol @@ -449,8 +454,9 @@ echo $0 $* # prefix="$HOME" testvector='' -enable_msvc='' -with_clang='' +enable_msvc='no' +with_clang='n0' +with_verbose_make='no' max_num_threads='64' cxx_flags='' postfix_dir='NOTFOUND' @@ -487,6 +493,10 @@ do with_clang='yes' ;; + --with-verbose-make) + with_verbose_make='yes' + ;; + CXX_FLAGS=*) cxx_flags=$( echo $1 | sed -e 's|CXX_FLAGS=||' ) ;; @@ -700,7 +710,7 @@ echo cmake \ -S "$source_dir" \ -B . \ \ - -D CMAKE_VERBOSE_MAKEFILE=0 \ + -D CMAKE_VERBOSE_MAKEFILE=$with_verbose_make \ -G "'$type_makefile'" \ \ $cmake_cxx_compiler \ @@ -756,7 +766,7 @@ cmake \ -D include_ipopt=$include_adolc \ -D include_cppadcg=false \ \ - -D colpack_prefix="$adolc_dir" \ + -D colpack_prefix='NOTFOUND' \ -D fadbad_prefix="$fadbad_dir" \ -D sacado_prefix="$sacado_dir" \ \ diff --git a/user_guide.xrst b/user_guide.xrst index 518b0f2c8..70d38ff9c 100644 --- a/user_guide.xrst +++ b/user_guide.xrst @@ -13,7 +13,7 @@ {xrst_comment BEGIN: Before changing see new_release.sh and check_version.sh} -cppad-20240911: CppAD User's Manual +cppad-20240913: CppAD User's Manual ################################### {xrst_comment The scripts bin/check_version.sh and bin/new_release.sh edit version numbers in tables below.}