Use g++ get_started.cpp to test the installed version of CppAD.

This commit is contained in:
Brad Bell 2025-01-19 08:41:01 -07:00
commit 21f1afc53f

View file

@ -10,11 +10,6 @@
# a changelog or other information that is better placed in the main package
# instead of a -doc subpackage.'
#
# fedpkg lint: W: files-duplicate:
# the files user_guide.html index.html in directory /usr/share/doc/cppad
# are the same. This is because a redirect from index.hml to user_guide.html
# will not reload when user_guide.html changes.
#
# year
# The year corresponding to this version
%define year 2025
@ -54,8 +49,7 @@ BuildRequires: python-furo
%description
C++ Algorithmic Differentiation (AD) library file libcppad_lib.so;
see %{name}-devel and %{name}-doc.
C++ Algorithmic Differentiation (AD) include and library files.
# ---------------------------------------------------------------------------
%package devel
@ -135,13 +129,12 @@ s|^| SET(CMAKE_REQUIRED_DEFINITIONS "" )\\
EOF
sed -i.bak CppAD-%{version}/cmake/compile_source_test.cmake -f temp.sed
#
# ----------------------------------------------------------------------------
# cppad_lib/CMakeLists.txt
# cppad_lib: replace soversion number and ensure build type is release
sed -i.bak CppAD-%{version}/cppad_lib/CMakeLists.txt \
-e "s|print_variable(soversion)|SET(soversion %{soversion} )\n&|" \
-e "s|\${cppad_debug_which}|debug_none|"
#
# ----------------------------------------------------------------------------
# Print machine epsilon before any other testing
cat << EOF > temp.cpp
# include <iostream>
@ -161,26 +154,14 @@ g++ -std=c++11 temp.cpp -o temp
./temp > temp.out
cat temp.out
# ----------------------------------------------------------------------------
# Comment out test of to_string long double on ppc64le arch. Understanding why
# it is failing will have to wait until there is a fedora 36 ppc64le test machine.
### if [ "%{_arch}" == 'ppc64le' ]
### then
### sed -i.bak CppAD-%{version}/example/utility/to_string.cpp \
### -e 's|ok *&= *floating<long double>();|// &|'
### fi
# ----------------------------------------------------------------------------
# build
# -----------------------------------------------------------------------------
%build
#
# 1. Cannot use %%{_includedir}, %%{_libdir}, %%{_datadir}, %%{_docdir}
# because they are absolute paths. Relative values would be more flexible
# because they can be combined with %%{_prefix} to get absolute values.
#
# 2. The debug_all is overridden for cppad_lib by the edit of
# 1. The debug_all is overridden for cppad_lib by the edit of
# cppad_lib/CMakeLists.txt above
#
# 3. The gnu c++ compiler seems to be generating an incorrect warning about
# 2. The gnu c++ compiler seems to be generating an incorrect warning about
# array bounds in thread_alloc.hpp. Use -Wno-array-bounds to suppress it.
#
# cppad_cxx_flags
@ -214,10 +195,10 @@ cppad_cxx_flags=\
-D cmake_install_libdirs=%{_lib} \
\
-D cmake_install_datadir=share \
-D cmake_install_docdir=share/doc \
-D cmake_install_docdir='NOTFOUND' \
\
-D include_doc=true \
-D cmake_defined_ok=false \
-D include_doc=false \
-D cppad_static_lib=false \
-D cppad_debug_and_release=true \
\
@ -265,19 +246,38 @@ cppad_cxx_flags=\
# -----------------------------------------------------------------------------
# Check
# -----------------------------------------------------------------------------
# use the installed include files to compile and run the tests
#
%check
#
# Test installed version of CppAD
g++ CppAD-%{version}/example/get_started/get_started.cpp \
-I %{buildroot}/%{_includedir} \
-Wl,-rpath,%{buildroot}/%{_libdir} \
%{buildroot}/%{_libdir}/libcppad_lib.so \
-o get_started
./get_started
#
# Test building documentation
make %{?_smp_mflags} doc_user
#
# Run the all the standard CppAD tests.
make %{?_smp_mflags} check
# ----------------------------------------------------------------------------
# %%clean
#
# Use %%clean with no arguments to surpress the cleanup of BUILDROOT
# This enables one to check that the necessary files are installed.
%%clean
# ----------------------------------------------------------------------------
%changelog
* Sat Jan 19 2025 Brad Bell <bradbell at seanet dot com> - 20250000.0-3
* Sun Jan 19 2025 Brad Bell <bradbell at seanet dot com> - 20250000.0-3
- 1. Add the year macro and use it to define soversion and Version.
- 2. Remove the cppad-doc subpackage because documantion for this stable
version is not available at https://cppad.readthedocs.io/stable-2025/ .
- 3. Change include_doc=true, cmake_install_docdir=NOTFOUND, and add
make doc_user to test building, but not installing, user documentation.
- 4. The ppc64le arch has been fixed and now the CppAD to_string test pass
for long double (so we do not need to skip that test).
- 5. Use get_started.cpp to test the installed version of CppAD.
* Sat Jan 18 2025 Brad Bell <bradbell at seanet dot com> - 20250000.0-2
- This fixes two bugs and will not be necessary