Skip to content

Commit

Permalink
master: The configure and cmake scripts better detect when eigen or s…
Browse files Browse the repository at this point in the history
…acado not supported.
  • Loading branch information
bradbell committed Apr 25, 2024
1 parent 12f6a3f commit 000a996
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 38 deletions.
45 changes: 26 additions & 19 deletions 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 "20240424")
SET(cppad_version "20240425")
SET(cppad_url "https://coin-or.github.io/CppAD" )
SET(cppad_description "Differentiation of C++ Algorithms" )
IF( NOT DEFINED CMAKE_BUILD_TYPE)
Expand Down Expand Up @@ -319,37 +319,44 @@ SET(CMAKE_INSTALL_PREFIX "${cppad_prefix}"
)
# -----------------------------------------------------------------------------
# Optional package information
# cppad_has_{package}, {package}_LINK_LIBRARIES, package INCLUDE_DIRECTORIES
#
# system_include
SET(system_include TRUE)
#
# eigen
IF( ${include_eigen} )
IF( NOT ${use_cplusplus_2014_ok} )
MESSAGE(FATAL_ERROR "include eigen is true but c++14 not supported")
ENDIF( )
pkgconfig_info(eigen ${system_include})
IF( DEFINED eigen_prefix )
MESSAGE(FATAL_ERROR "include_eigen is true and eigen_prefix is defined")
ENDIF( )
ELSE( )
prefix_info(eigen ${system_include} )
ENDIF( )
# package = eigen
pkgconfig_info(eigen ${system_include})
#
# adolc
# package = adolc
pkgconfig_info(adolc ${system_include})
#
# ipopt
# package = ipopt
pkgconfig_info(ipopt ${system_include})
#
# colpack_prefix
# package = colpack
prefix_info(colpack ${system_include} )
#
# sacado_prefix
# package = sacado
prefix_info(sacado ${system_include} )
#
# fadbad_prefix
# package = fadbad
prefix_info(fadbad ${system_include} )
#
# include_cpapdcg
# check eigen
IF( ${cppad_has_eigen} )
IF( NOT ${use_cplusplus_2014_ok} )
MESSAGE(FATAL_ERROR "include_eigen is true but c++14 not supported")
ENDIF( )
ENDIF( )
#
# check sacado
IF( ${cppad_has_sacado} )
IF( NOT ${use_cplusplus_2017_ok} )
MESSAGE(FATAL_ERROR "sacado_prefix is defined but c++17 not supported")
ENDIF( )
ENDIF( )
#
# package = cppadcg
SET( include_cppadcg FALSE CACHE BOOL "include cppadcg" )
IF( include_cppadcg )
#
Expand Down
8 changes: 8 additions & 0 deletions appendix/whats_new/2024.xrst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ Release Notes for 2024
mm-dd
*****

04-25
=====
The :ref:`configure-name` script was changed to detect when
the eigen package is requested and the compiler is not c++14 or greater.
The :ref:`configure-name` and :ref:`cmake-name` scripts
were changed to detect when
the sacado package is requested and the compiler is not c++17 or greater.

04-20
=====
The ``# include`` commands were missing at the top of
Expand Down
32 changes: 21 additions & 11 deletions bin/run_configure.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#! /bin/bash -e
#! /usr/bin/env bash
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
# SPDX-FileCopyrightText: Bradley M. Bell <[email protected]>
# SPDX-FileContributor: 2003-23 Bradley M. Bell
# SPDX-FileContributor: 2003-24 Bradley M. Bell
# ----------------------------------------------------------------------------
set -e -u
if [ ! -e "bin/run_configure.sh" ]
then
echo "bin/run_configure.sh: must be executed from its parent directory"
Expand All @@ -11,7 +12,7 @@ fi
# -----------------------------------------------------------------------------
with_clang=''
cpp_standard='c++17'
while [ "$1" != '' ]
while [ "$#" != '0' ]
do
if [ "$1" == '--help' ]
then
Expand Down Expand Up @@ -68,20 +69,27 @@ testvector='cppad'
cppad_cxx_flags="-std=$cpp_standard -Wall -pedantic-errors -Wshadow"
cppad_cxx_flags="$cppad_cxx_flags -Wfloat-conversion -Wconversion"
#
# ---------------------------------------------------------------------------
if [ ! -e build ]
# eigen_prefix, scaado_prefix
cxx_standard_year=$(echo $cpp_standard | sed -e 's|c++||')
if [ "$cxx_standard_year" -lt 14 ]
then
echo_eval mkdir build
eigen_prefix=''
else
eigen_prefix="EIGEN_DIR=$prefix"
fi
echo_eval cd build
if [ -e CMakeCache.txt ]
if [ "$cxx_standard_year" -lt 17 ]
then
echo_eval rm CMakeCache.txt
scaado_prefix=''
else
scaado_prefix="SACADO_DIR=$prefix"
fi
if [ -e CMakeFiles ]
#
# ---------------------------------------------------------------------------
if [ ! -e build ]
then
echo_eval rm -r CMakeFiles
echo_eval mkdir build
fi
echo_eval cd build
# -----------------------------------------------------------------------------
../configure \
--prefix=$prefix \
Expand All @@ -95,6 +103,8 @@ fi
FADBAD_DIR=$prefix \
SACADO_DIR=$prefix \
IPOPT_DIR=$prefix \
$eigen_prefix \
$scaado_prefix \
TAPE_ADDR_TYPE=size_t \
TAPE_ID_TYPE=size_t
# ----------------------------------------------------------------------------
Expand Down
46 changes: 39 additions & 7 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,10 @@ set -e -u
#
# {xrst_end configure}
# ----------------------------------------------------------------------------
function print_variable {
echo "$1 = ${!1}"
}
# ----------------------------------------------------------------------------
#
# --help
if echo " $* " | grep ' --help ' > /dev/null
Expand Down Expand Up @@ -557,6 +561,29 @@ else
fi
fi
#
# cxx_standard_year
if echo $cxx_flags | grep 'std=c++' > /dev/null
then
cxx_standard_year=$(echo $cxx_flags | sed -e 's|.*std=c++\([0-9]*\).*|\1|')
print_variable cxx_standard_year
if [ "$cxx_standard_year" -lt 14 ]
then
if [ "$eigen_dir" != 'NOTFOUND' ]
then
echo 'Eigen requires c++14 or greater'
exit 1
fi
fi
if [ "$cxx_standard_year" -lt 17 ]
then
if [ "$sacado_dir" != 'NOTFOUND' ]
then
echo 'Sacado requires c++17 or greater'
exit 1
fi
fi
fi
#
# cmake_cxx_compiler
cmake_cxx_compiler=''
if [ "$enable_msvc" == 'yes' ]
Expand Down Expand Up @@ -634,13 +661,18 @@ if [ -d '/usr/lib64' ]
then
cmake_install_libdirs='lib64;lib'
fi
#
# CMakeCache.txt
if [ -e CMakeCache.txt ]
then
rm CMakeCache.txt
fi
echo
list='
build.ninja
CMakeCache.txt
CMakeFiles
'
for name in $list
do
if [ -e "$name" ]
then
echo_eval rm -r $name
fi
done
echo cmake \
-U .+ \
-S "$source_dir" \
Expand Down
2 changes: 1 addition & 1 deletion user_guide.xrst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

{xrst_comment BEGIN: Before changing see new_release.sh and check_version.sh}

cppad-20240424: CppAD User's Manual
cppad-20240425: CppAD User's Manual
###################################

.. image:: {xrst_dir coin.png}
Expand Down

0 comments on commit 000a996

Please sign in to comment.