From c0466f9ac9b8c42f687964ce926ab930a91820a3 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Wed, 26 Aug 2020 04:14:32 -0600 Subject: [PATCH] more work on cmake build --- .github/workflows/a3.yml | 2 +- CMakeLists.txt | 8 ++++++-- configure.ac | 6 +++--- examples/c/run_tests.sh.in | 4 ++-- tests/cunit/run_tests.sh.in | 4 ++-- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/a3.yml b/.github/workflows/a3.yml index 52de63cc3ec..df3364bf9d4 100644 --- a/.github/workflows/a3.yml +++ b/.github/workflows/a3.yml @@ -125,7 +125,7 @@ jobs: export CC=mpicc mkdir build cd build - cmake -Wno-dev -DMPIEXEC='mpiexec --oversubscribe' -DNetCDF_C_LIBRARY=/home/runner/netcdf-c/lib/libnetcdf.so -DNetCDF_C_INCLUDE_DIR=/home/runner/netcdf-c/include -DPnetCDF_PATH='/home/runner/pnetcdf' -DPIO_ENABLE_FORTRAN=Off -DPIO_HDF5_LOGGING=On -DPIO_USE_MALLOC=On -DPIO_ENABLE_LOGGING=On -DPIO_ENABLE_TIMING=Off .. || (cat CMakeFiles/CMakeOutput.log && cat CMakeFiles/CMakeError.log) + cmake -Wno-dev -DWITH_MPIEXEC='mpiexec --oversubscribe' -DNetCDF_C_LIBRARY=/home/runner/netcdf-c/lib/libnetcdf.so -DNetCDF_C_INCLUDE_DIR=/home/runner/netcdf-c/include -DPnetCDF_PATH='/home/runner/pnetcdf' -DPIO_ENABLE_FORTRAN=Off -DPIO_HDF5_LOGGING=On -DPIO_USE_MALLOC=On -DPIO_ENABLE_LOGGING=On -DPIO_ENABLE_TIMING=Off .. || (cat CMakeFiles/CMakeOutput.log && cat CMakeFiles/CMakeError.log) ls -l tests/cunit cat tests/cunit/run_tests.sh make VERBOSE=1 diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c78c80eff6..a9bb043f73a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,9 @@ set(PIO_VERSION_PATCH ${VERSION_PATCH}) # This is needed for the libpio.settings file. SET(PACKAGE_VERSION ${PIO_VERSION_MAJOR}.${PIO_VERSION_MINOR}.${PIO_VERSION_PATCH}) +# This provides cmake_print_variables() function for debugging. +include(CMakePrintHelpers) + # Determine the configure date. IF(DEFINED ENV{SOURCE_DATE_EPOCH}) EXECUTE_PROCESS( @@ -444,8 +447,9 @@ configure_file ( ) # Configure test scripts. -if (NOT MPIEXEC) - set(MPIEXEC mpiexec) +cmake_print_variables(WITH_MPIEXEC) +if (NOT WITH_MPIEXEC) + set(WITH_MPIEXEC mpiexec) endif() configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/tests/cunit/run_tests.sh.in diff --git a/configure.ac b/configure.ac index 63ed63e6309..1d8b48470d6 100644 --- a/configure.ac +++ b/configure.ac @@ -207,9 +207,9 @@ AC_MSG_CHECKING([whether a user specified program to run mpi programs]) AC_ARG_WITH([mpiexec], [AS_HELP_STRING([--with-mpiexec=], [Specify command to launch MPI parallel tests.])], - [MPIEXEC=$with_mpiexec], [MPIEXEC=mpiexec]) -AC_MSG_RESULT([$MPIEXEC]) -AC_SUBST([MPIEXEC], [$MPIEXEC]) + [WITH_MPIEXEC=$with_mpiexec], [WITH_MPIEXEC=mpiexec]) +AC_MSG_RESULT([$WITH_MPIEXEC]) +AC_SUBST([WITH_MPIEXEC], [$WITH_MPIEXEC]) # Is doxygen installed? AC_CHECK_PROGS([DOXYGEN], [doxygen]) diff --git a/examples/c/run_tests.sh.in b/examples/c/run_tests.sh.in index 1caefa7585d..7651c835624 100755 --- a/examples/c/run_tests.sh.in +++ b/examples/c/run_tests.sh.in @@ -19,7 +19,7 @@ for EXAMPLE in $PIO_EXAMPLES do success1=false echo "running ${EXAMPLE}" - @MPIEXEC@ -n 4 ./${EXAMPLE} && success1=true + @WITH_MPIEXEC@ -n 4 ./${EXAMPLE} && success1=true if test $success1 = false; then break fi @@ -29,7 +29,7 @@ for EXAMPLE in $PIO_EXAMPLES_16 do success2=false echo "running ${EXAMPLE}" - @MPIEXEC@ -n 16 ./${EXAMPLE} && success2=true + @WITH_MPIEXEC@ -n 16 ./${EXAMPLE} && success2=true if test $success2 = false; then break fi diff --git a/tests/cunit/run_tests.sh.in b/tests/cunit/run_tests.sh.in index bd6e4f29215..0d322960da6 100644 --- a/tests/cunit/run_tests.sh.in +++ b/tests/cunit/run_tests.sh.in @@ -26,7 +26,7 @@ for TEST in $PIO_TESTS do success1=false echo "running ${TEST}" - @MPIEXEC@ -n 4 ./${TEST} && success1=true + @WITH_MPIEXEC@ -n 4 ./${TEST} && success1=true if test $success1 = false; then break fi @@ -38,7 +38,7 @@ for TEST in $PIO_TESTS_8 do success2=false echo "running ${TEST}" - @MPIEXEC@ -n 8 ./${TEST} && success2=true + @WITH_MPIEXEC@ -n 8 ./${TEST} && success2=true if test $success2 = false; then break fi