From 1b525b649c81b13b5d2e7398d52c54b5d29b7f40 Mon Sep 17 00:00:00 2001 From: Franck HOUSSEN Date: Sat, 12 Aug 2023 13:26:52 +0200 Subject: [PATCH] Fix installation tests: compile and run icb_arpack_c. --- ICB/Makefile.am | 1 + cmake/tstCMakeInstall.sh.in | 26 ++++++++++++++++++++++++-- pkg-config/tstAutotoolsInstall.sh.in | 28 +++++++++++++++++----------- 3 files changed, 42 insertions(+), 13 deletions(-) diff --git a/ICB/Makefile.am b/ICB/Makefile.am index 8587e08a9..bbe6ec72f 100644 --- a/ICB/Makefile.am +++ b/ICB/Makefile.am @@ -1,5 +1,6 @@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) +pkgincludedir = $(includedir)/arpack@ITF64SUFFIX@ pkginclude_HEADERS = debug_c.h debug_c.hpp pkginclude_HEADERS += stat_c.h stat_c.hpp pkginclude_HEADERS += arpack.h arpack.hpp diff --git a/cmake/tstCMakeInstall.sh.in b/cmake/tstCMakeInstall.sh.in index 747b5eee7..c3a80093c 100755 --- a/cmake/tstCMakeInstall.sh.in +++ b/cmake/tstCMakeInstall.sh.in @@ -17,7 +17,7 @@ export LIBSUFFIX="${1%-*}" echo "LIBSUFFIX: $LIBSUFFIX" export ITF64SUFFIX="${1#*-}" echo "ITF64SUFFIX: $ITF64SUFFIX" -cmake -DCMAKE_INSTALL_PREFIX="${TMP_PREFIX}" -DMPI=ON -DLIBSUFFIX="${LIBSUFFIX}" -DITF64SUFFIX="${ITF64SUFFIX}" . +cmake -DCMAKE_INSTALL_PREFIX="${TMP_PREFIX}" -DMPI=ON -DICB=ON -DLIBSUFFIX="${LIBSUFFIX}" -DITF64SUFFIX="${ITF64SUFFIX}" . make all install tree "${TMP_PREFIX}" @@ -34,6 +34,8 @@ arpack_cmake_dir="${arpack_cmake_dir%/*}" # Same as dirname CMAKE_PREFIX_PATH="${arpack_cmake_dir%/*}" # cmake directory # 4. Create new cmake project, in temporary directory, with files from arpack-ng. +# The first targets are compiled with *.cmake files generated by cmake. +# The second targets are compiled with *.pc files generated by cmake. mkdir -p tstCMakeInstall cd tstCMakeInstall @@ -43,10 +45,11 @@ cp "@PROJECT_SOURCE_DIR@/EXAMPLES/BAND/dnbdr1.f" . cp "@PROJECT_SOURCE_DIR@/EXAMPLES/BAND/dnbdr3.f" . cp "@PROJECT_SOURCE_DIR@/PARPACK/EXAMPLES/MPI/pdndrv1.f" . cp "@PROJECT_SOURCE_DIR@/PARPACK/EXAMPLES/MPI/pdndrv3.f" . +cp "@PROJECT_SOURCE_DIR@/TESTS/icb_arpack_c.c" . echo "cmake_minimum_required(VERSION 3.0)" > CMakeLists.txt echo "" >> CMakeLists.txt -echo "project(tstCMakeInstall Fortran)" >> CMakeLists.txt +echo "project(tstCMakeInstall Fortran C)" >> CMakeLists.txt echo "" >> CMakeLists.txt echo "find_package(BLAS REQUIRED)" >> CMakeLists.txt echo "find_package(LAPACK REQUIRED)" >> CMakeLists.txt @@ -60,6 +63,14 @@ echo "target_include_directories(dnbdr1 INTERFACE LAPACK::LAPACK)" >> CMake echo "target_link_libraries(dnbdr1 LAPACK::LAPACK)" >> CMakeLists.txt echo "target_include_directories(dnbdr1 INTERFACE ARPACK::ARPACK)" >> CMakeLists.txt echo "target_link_libraries(dnbdr1 ARPACK::ARPACK)" >> CMakeLists.txt +echo "" >> CMakeLists.txt +echo "add_executable(icb_arpack_c icb_arpack_c.c)" >> CMakeLists.txt +echo "target_include_directories(icb_arpack_c INTERFACE BLAS::BLAS)" >> CMakeLists.txt +echo "target_link_libraries(icb_arpack_c BLAS::BLAS)" >> CMakeLists.txt +echo "target_include_directories(icb_arpack_c INTERFACE LAPACK::LAPACK)" >> CMakeLists.txt +echo "target_link_libraries(icb_arpack_c LAPACK::LAPACK)" >> CMakeLists.txt +echo "target_include_directories(icb_arpack_c INTERFACE ARPACK::ARPACK)" >> CMakeLists.txt +echo "target_link_libraries(icb_arpack_c ARPACK::ARPACK)" >> CMakeLists.txt echo "" >> CMakeLists.txt echo "add_executable(pdndrv1 dnband.f pdndrv1.f)" >> CMakeLists.txt echo "target_include_directories(pdndrv1 INTERFACE BLAS::BLAS)" >> CMakeLists.txt @@ -84,6 +95,14 @@ echo "target_include_directories(dnbdr3 INTERFACE LAPACK::LAPACK)" >> CMake echo "target_link_libraries(dnbdr3 LAPACK::LAPACK)" >> CMakeLists.txt echo "target_include_directories(dnbdr3 INTERFACE PkgConfig::ARPACK)" >> CMakeLists.txt echo "target_link_libraries(dnbdr3 PkgConfig::ARPACK)" >> CMakeLists.txt +echo "" >> CMakeLists.txt +echo "add_executable(icb_arpack_c_pkg icb_arpack_c.c)" >> CMakeLists.txt +echo "target_include_directories(icb_arpack_c_pkg INTERFACE BLAS::BLAS)" >> CMakeLists.txt +echo "target_link_libraries(icb_arpack_c_pkg BLAS::BLAS)" >> CMakeLists.txt +echo "target_include_directories(icb_arpack_c_pkg INTERFACE LAPACK::LAPACK)" >> CMakeLists.txt +echo "target_link_libraries(icb_arpack_c_pkg LAPACK::LAPACK)" >> CMakeLists.txt +echo "target_include_directories(icb_arpack_c_pkg INTERFACE PkgConfig::ARPACK)" >> CMakeLists.txt +echo "target_link_libraries(icb_arpack_c_pkg PkgConfig::ARPACK)" >> CMakeLists.txt echo "" >> CMakeLists.txt echo "add_executable(pdndrv3 dnband.f pdndrv3.f)" >> CMakeLists.txt echo "target_include_directories(pdndrv3 INTERFACE BLAS::BLAS)" >> CMakeLists.txt @@ -106,6 +125,9 @@ cmake .. -DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" || exit 1 make all VERBOSE=1 || exit 1 ./dnbdr1 || exit 1 +./icb_arpack_c || exit 1 mpirun -n 2 ./pdndrv1 || exit 1 + ./dnbdr3 || exit 1 +./icb_arpack_c_pkg || exit 1 mpirun -n 2 ./pdndrv3 || exit 1 diff --git a/pkg-config/tstAutotoolsInstall.sh.in b/pkg-config/tstAutotoolsInstall.sh.in index 544b66358..26eee94d3 100755 --- a/pkg-config/tstAutotoolsInstall.sh.in +++ b/pkg-config/tstAutotoolsInstall.sh.in @@ -1,6 +1,6 @@ #!/bin/bash -eu # Testing that PKG_CHECK_MODULES works. -# Note: this script must not be added to the test suite as it will change cmake options. +# Note: this script must not be added to the test suite as it will change configure options. echo "***************************************************************************************" @@ -10,8 +10,8 @@ export TMP_DIR="/tmp/tstAutotoolsInstall" rm -fr "${TMP_DIR}" # Make sure we restart from scratch. mkdir -p "${TMP_DIR}" -# 2. Rerun cmake with prefix, install arpack-ng. -# Note: this script must not be added to the test suite as it will change cmake options. +# 2. Rerun autotools with prefix, install arpack-ng. +# Note: this script must not be added to the test suite as it will change configure options. make clean make distclean @@ -22,7 +22,7 @@ export LIBSUFFIX="${1%-*}" echo "LIBSUFFIX: $LIBSUFFIX" export ITF64SUFFIX="${1#*-}" echo "ITF64SUFFIX: $ITF64SUFFIX" -LIBSUFFIX="${LIBSUFFIX}" ITF64SUFFIX="${ITF64SUFFIX}" ./configure --prefix="${TMP_PREFIX}" --enable-mpi +LIBSUFFIX="${LIBSUFFIX}" ITF64SUFFIX="${ITF64SUFFIX}" ./configure --prefix="${TMP_PREFIX}" --enable-mpi --enable-icb make all install tree "${TMP_PREFIX}" @@ -33,7 +33,7 @@ export PKG_CONFIG_PATH="$(find ${TMP_PREFIX} -name arpack${LIBSUFFIX}${ITF64SUFF export PKG_CONFIG_PATH="${PKG_CONFIG_PATH%/*}" # Same as dirname. echo "PKG_CONFIG_PATH: $PKG_CONFIG_PATH" -# 4. Create new cmake project, in temporary directory, with files from arpack-ng. +# 4. Create new autotools project, in temporary directory, with files from arpack-ng. mkdir -p tstAutotoolsInstall cd tstAutotoolsInstall @@ -42,6 +42,7 @@ cp "${PROJECT_SOURCE_DIR}/EXAMPLES/BAND/dnband.f" . cp "${PROJECT_SOURCE_DIR}/EXAMPLES/BAND/dnbdr1.f" . cp "${PROJECT_SOURCE_DIR}/PARPACK/EXAMPLES/MPI/pdndrv1.f" . cp -fr "${PROJECT_SOURCE_DIR}/m4" . +cp "${PROJECT_SOURCE_DIR}/TESTS/icb_arpack_c.c" . echo "AC_PREREQ([2.68]) " > configure.ac echo "AC_INIT([tstAutotoolsInstall], 1.0) " >> configure.ac @@ -82,7 +83,7 @@ echo "ACLOCAL_AMFLAGS = -I m4 echo " " >> Makefile.am echo "EXTRA_DIST = debug.h stat.h " >> Makefile.am echo " " >> Makefile.am -echo "bin_PROGRAMS = dnbdr1 pdndrv1 " >> Makefile.am +echo "bin_PROGRAMS = dnbdr1 pdndrv1 icb_arpack_c " >> Makefile.am echo " " >> Makefile.am echo "dnbdr1_SOURCES = dnbdr1.f dnband.f " >> Makefile.am echo "dnbdr1_FFLAGS = \$(ARPACK_CFLAGS) " >> Makefile.am @@ -91,13 +92,18 @@ echo " echo "pdndrv1_SOURCES = pdndrv1.f dnband.f " >> Makefile.am echo "pdndrv1_FFLAGS = \$(PARPACK_CFLAGS) \$(ARPACK_CFLAGS) " >> Makefile.am echo "pdndrv1_LDADD = \$(PARPACK_LIBS) \$(ARPACK_LIBS) \$(LAPACK_LIBS) \$(BLAS_LIBS) \$(MPI_Fortran_LIBS)" >> Makefile.am +echo " " >> Makefile.am +echo "icb_arpack_c_SOURCES = icb_arpack_c.c " >> Makefile.am +echo "icb_arpack_c_CPPFLAGS = \$(ARPACK_CFLAGS) " >> Makefile.am +echo "icb_arpack_c_LDADD = \$(ARPACK_LIBS) \$(LAPACK_LIBS) \$(BLAS_LIBS) " >> Makefile.am -# 5. Build and test this new project with cmake: for this to be possible, PKG_CHECK_MODULES must work. +# 5. Build and test this new project with configure: for this to be possible, PKG_CHECK_MODULES must work. autoreconf --force --verbose --install -./configure -make all +./configure || exit 1 +make all || exit 1 -./dnbdr1 -mpirun -n 2 ./pdndrv1 +./dnbdr1 || exit 1 +./icb_arpack_c || exit 1 +mpirun -n 2 ./pdndrv1 || exit 1