Skip to content

Commit

Permalink
master: Extend dev_tools and get_package routines to work on MacOS+Ho…
Browse files Browse the repository at this point in the history
…mebrew.

configure: add --with-verbose-make option, fix the colpack_prefix setting.
  • Loading branch information
bradbell committed Sep 14, 2024
1 parent 70ba0d2 commit 470c769
Show file tree
Hide file tree
Showing 19 changed files with 227 additions and 169 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 12 additions & 0 deletions appendix/whats_new/2024.xrst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
dll
env
iostream
homebrew
isnan
nul
nx
Expand All @@ -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
Expand Down
59 changes: 40 additions & 19 deletions bin/check_all.sh
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
# SPDX-FileContributor: 2003-24 Bradley M. Bell
Expand All @@ -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
Expand Down Expand Up @@ -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`
Expand Down Expand Up @@ -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 \
Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand Down
39 changes: 0 additions & 39 deletions bin/check_automake.sh

This file was deleted.

31 changes: 17 additions & 14 deletions bin/check_example.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
#! /bin/bash -e
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
# SPDX-FileCopyrightText: Bradley M. Bell <[email protected]>
# 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
Expand All @@ -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"
Expand All @@ -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.$$
Expand Down
21 changes: 12 additions & 9 deletions bin/check_include_file.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
#! /bin/bash -e
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
# SPDX-FileCopyrightText: Bradley M. Bell <[email protected]>
# SPDX-FileContributor: 2003-22 Bradley M. Bell
# SPDX-FileContributor: 2003-24 Bradley M. Bell
# ----------------------------------------------------------------------------
if [ ! -e "bin/check_include_file.sh" ]
then
msg="must be executed from its parent directory"
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."
Expand All @@ -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 *<cppad\/cg\//d' \
-e '/^# *include *<cppad\//p' \
>> 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:
Expand All @@ -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'
Expand All @@ -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."
Expand All @@ -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."
Expand Down
4 changes: 2 additions & 2 deletions bin/check_include_xrst.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#! /bin/bash -e
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
# SPDX-FileCopyrightText: Bradley M. Bell <[email protected]>
# SPDX-FileContributor: 2003-22 Bradley M. Bell
# SPDX-FileContributor: 2003-24 Bradley M. Bell
# ----------------------------------------------------------------------------
if [ ! -e "bin/check_include_xrst.sh" ]
then
Expand All @@ -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'
Expand Down
Loading

0 comments on commit 470c769

Please sign in to comment.