Skip to content

Commit

Permalink
Test install with suffix. (#352)
Browse files Browse the repository at this point in the history
  • Loading branch information
fghoussen authored Apr 24, 2022
1 parent 9331036 commit e7abe8b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
cd build
cmake ..
bash ./tstCMakeInstall.sh
bash ./tstCMakeInstall.sh 64
ubuntu_latest_autotools:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -91,6 +92,7 @@ jobs:
./bootstrap
./configure
bash ./tstAutotoolsInstall.sh
bash ./tstAutotoolsInstall.sh 64
ubuntu_latest_cmake_python:
runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 2 additions & 2 deletions cmake/arpackng-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
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@")
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 ()
8 changes: 5 additions & 3 deletions cmake/tstCMakeInstall.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions pkg-config/tstAutotoolsInstall.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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).
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e7abe8b

Please sign in to comment.