From e7abe8b42bb941f1f0d6e1026c7d98c888393e04 Mon Sep 17 00:00:00 2001 From: Franck HOUSSEN Date: Sun, 24 Apr 2022 22:14:28 +0200 Subject: [PATCH] Test install with suffix. (#352) --- .github/workflows/jobs.yml | 2 ++ cmake/arpackng-config.cmake.in | 4 ++-- cmake/tstCMakeInstall.sh.in | 8 +++++--- pkg-config/tstAutotoolsInstall.sh.in | 8 +++++--- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/jobs.yml b/.github/workflows/jobs.yml index 8b3780125..a78c4a43a 100644 --- a/.github/workflows/jobs.yml +++ b/.github/workflows/jobs.yml @@ -47,6 +47,7 @@ jobs: cd build cmake .. bash ./tstCMakeInstall.sh + bash ./tstCMakeInstall.sh 64 ubuntu_latest_autotools: runs-on: ubuntu-latest steps: @@ -91,6 +92,7 @@ jobs: ./bootstrap ./configure bash ./tstAutotoolsInstall.sh + bash ./tstAutotoolsInstall.sh 64 ubuntu_latest_cmake_python: runs-on: ubuntu-latest steps: diff --git a/cmake/arpackng-config.cmake.in b/cmake/arpackng-config.cmake.in index bf78a7861..e54f8b807 100644 --- a/cmake/arpackng-config.cmake.in +++ b/cmake/arpackng-config.cmake.in @@ -16,7 +16,7 @@ add_library(ARPACK::ARPACK INTERFACE IMPORTED) set_target_properties(ARPACK::ARPACK PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@/arpack-ng") set_target_properties(ARPACK::ARPACK PROPERTIES INTERFACE_LINK_DIRECTORIES "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@") -set_target_properties(ARPACK::ARPACK PROPERTIES INTERFACE_LINK_LIBRARIES "arpack") +set_target_properties(ARPACK::ARPACK PROPERTIES INTERFACE_LINK_LIBRARIES "arpack@LIBSUFFIX@") # Create parpack targets. set(MPI "@MPI@") @@ -24,5 +24,5 @@ if (MPI) add_library(PARPACK::PARPACK INTERFACE IMPORTED) set_target_properties(PARPACK::PARPACK PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@/arpack-ng") set_target_properties(PARPACK::PARPACK PROPERTIES INTERFACE_LINK_DIRECTORIES "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@") - set_target_properties(PARPACK::PARPACK PROPERTIES INTERFACE_LINK_LIBRARIES "parpack") + set_target_properties(PARPACK::PARPACK PROPERTIES INTERFACE_LINK_LIBRARIES "parpack@LIBSUFFIX@") endif () diff --git a/cmake/tstCMakeInstall.sh.in b/cmake/tstCMakeInstall.sh.in index 945ef2e89..bc118559f 100755 --- a/cmake/tstCMakeInstall.sh.in +++ b/cmake/tstCMakeInstall.sh.in @@ -5,13 +5,15 @@ # 1. Define temporary directory. export TMP_DIR="/tmp/tstCMakeInstall" +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. export TMP_PREFIX="${TMP_DIR}/local" -cmake -DCMAKE_INSTALL_PREFIX="${TMP_PREFIX}" -DMPI=ON . +export LIBSUFFIX="$1" +cmake -DCMAKE_INSTALL_PREFIX="${TMP_PREFIX}" -DMPI=ON -DLIBSUFFIX="${LIBSUFFIX}" . make all install # 3. Setup environment for find_package to work (what you typically in module-environment files). @@ -62,8 +64,8 @@ echo "target_include_directories(pdndrv1 INTERFACE PARPACK::PARPACK)" >> CMake echo "target_link_libraries(pdndrv1 PARPACK::PARPACK)" >> CMakeLists.txt echo "" >> CMakeLists.txt echo "find_package(PkgConfig REQUIRED)" >> CMakeLists.txt -echo "pkg_check_modules(ARPACK IMPORTED_TARGET REQUIRED arpack)" >> CMakeLists.txt -echo "pkg_check_modules(PARPACK IMPORTED_TARGET REQUIRED parpack)" >> CMakeLists.txt +echo "pkg_check_modules(ARPACK IMPORTED_TARGET REQUIRED arpack${LIBSUFFIX})" >> CMakeLists.txt +echo "pkg_check_modules(PARPACK IMPORTED_TARGET REQUIRED parpack${LIBSUFFIX})" >> CMakeLists.txt echo "" >> CMakeLists.txt echo "add_executable(dnbdr3 dnband.f dnbdr3.f)" >> CMakeLists.txt echo "target_include_directories(dnbdr3 INTERFACE BLAS::BLAS)" >> CMakeLists.txt diff --git a/pkg-config/tstAutotoolsInstall.sh.in b/pkg-config/tstAutotoolsInstall.sh.in index 30c3041d4..ba0d0ade2 100755 --- a/pkg-config/tstAutotoolsInstall.sh.in +++ b/pkg-config/tstAutotoolsInstall.sh.in @@ -5,6 +5,7 @@ # 1. Define temporary directory. 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. @@ -15,7 +16,8 @@ make distclean export PROJECT_SOURCE_DIR="$(pwd)" export TMP_PREFIX="${TMP_DIR}/local" -./configure --prefix="${TMP_PREFIX}" --enable-mpi +export LIBSUFFIX="$1" +LIBSUFFIX="${LIBSUFFIX}" ./configure --prefix="${TMP_PREFIX}" --enable-mpi make all install # 3. Setup environment for PKG_CHECK_MODULES to work (what you typically in module-environment files). @@ -54,11 +56,11 @@ echo "AX_MPI([], AC_MSG_ERROR([could not compile a Fortran MPI test program]))" echo "F77=\$MPIF77 " >> configure.ac echo "AC_SUBST([MPI_Fortran_LIBS]) " >> configure.ac echo " " >> configure.ac -echo "PKG_CHECK_MODULES([ARPACK], [arpack]) " >> configure.ac +echo "PKG_CHECK_MODULES([ARPACK], [arpack${LIBSUFFIX}]) " >> configure.ac echo "AC_SUBST([ARPACK_CFLAGS]) " >> configure.ac echo "AC_SUBST([ARPACK_LIBS]) " >> configure.ac echo " " >> configure.ac -echo "PKG_CHECK_MODULES([PARPACK], [parpack]) " >> configure.ac +echo "PKG_CHECK_MODULES([PARPACK], [parpack${LIBSUFFIX}]) " >> configure.ac echo "AC_SUBST([PARPACK_CFLAGS]) " >> configure.ac echo "AC_SUBST([PARPACK_LIBS]) " >> configure.ac echo " " >> configure.ac