diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index ab0ccc9883b..d129c69c97d 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -22,7 +22,7 @@ jobs: - uses: actions/checkout@v2 - name: Installs run: | - sudo apt-get install netcdf-bin libnetcdf-dev doxygen graphviz wget gfortran libjpeg-dev libz-dev openmpi-bin libopenmpi-dev + sudo apt-get install netcdf-bin libnetcdf-dev doxygen graphviz wget gfortran libjpeg-dev libz-dev openmpi-bin libopenmpi-dev - name: cache-pnetcdf id: cache-pnetcdf @@ -48,7 +48,7 @@ jobs: set -x mkdir build cd build - cmake -Wno-dev -DNetCDF_C_LIBRARY=/usr/lib/x86_64-linux-gnu/libnetcdf.so -DNetCDF_C_INCLUDE_DIR=/usr/include -DPnetCDF_PATH='/home/runner/pnetcdf' -DPIO_HDF5_LOGGING=On -DPIO_USE_MALLOC=On -DPIO_ENABLE_LOGGING=On -DPIO_ENABLE_TIMING=Off .. + cmake -Wno-dev -DNetCDF_C_LIBRARY=/usr/lib/x86_64-linux-gnu/libnetcdf.so -DNetCDF_C_INCLUDE_DIR=/usr/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 .. make VERBOSE=1 make tests VERBOSE=1 ctest -VV diff --git a/CMakeLists.txt b/CMakeLists.txt index 03082b35be1..00816692f4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,18 +18,18 @@ SET(PACKAGE_VERSION ${PIO_VERSION_MAJOR}.${PIO_VERSION_MINOR}.${PIO_VERSION_PATC # Determine the configure date. IF(DEFINED ENV{SOURCE_DATE_EPOCH}) - EXECUTE_PROCESS( - COMMAND "date" "-u" "-d" "@$ENV{SOURCE_DATE_EPOCH}" - OUTPUT_VARIABLE CONFIG_DATE - ) + EXECUTE_PROCESS( + COMMAND "date" "-u" "-d" "@$ENV{SOURCE_DATE_EPOCH}" + OUTPUT_VARIABLE CONFIG_DATE + ) ELSE() - EXECUTE_PROCESS( - COMMAND date - OUTPUT_VARIABLE CONFIG_DATE - ) + EXECUTE_PROCESS( + COMMAND date + OUTPUT_VARIABLE CONFIG_DATE + ) ENDIF() IF(CONFIG_DATE) - string(STRIP ${CONFIG_DATE} CONFIG_DATE) + string(STRIP ${CONFIG_DATE} CONFIG_DATE) ENDIF() # A function used to create autotools-style 'yes/no' definitions. @@ -231,6 +231,18 @@ if (PIO_ENABLE_COVERAGE) endif () endif () +# Include this so we can check values in netcdf_meta.h. +INCLUDE(CheckCSourceCompiles) +INCLUDE(FindNetCDF) +message("Fortran Library build is ${PIO_ENABLE_FORTRAN}") +if (PIO_ENABLE_FORTRAN) + find_package (NetCDF REQUIRED COMPONENTS C Fortran) + find_package (PnetCDF COMPONENTS C Fortran) +else() + find_package (NetCDF REQUIRED COMPONENTS C) + find_package (PnetCDF COMPONENTS C) +endif() + #============================================================================== # INCLUDE SOURCE DIRECTORIES #============================================================================== @@ -265,11 +277,6 @@ if (PIO_ENABLE_DOC) add_subdirectory (doc) endif () -# Include this so we can check values in netcdf_meta.h. -INCLUDE(CheckCSourceCompiles) -INCLUDE(FindNetCDF) -find_package (NetCDF REQUIRED) -find_package (PnetCDF) SET(STATUS_PNETCDF PnetCDF_C_FOUND) @@ -435,6 +442,3 @@ configure_file ( "${PROJECT_SOURCE_DIR}/cmake_config.h.in" "${PROJECT_BINARY_DIR}/config.h" ) - - - diff --git a/src/clib/CMakeLists.txt b/src/clib/CMakeLists.txt index 49f772ba371..8d37fc812f3 100644 --- a/src/clib/CMakeLists.txt +++ b/src/clib/CMakeLists.txt @@ -75,7 +75,6 @@ endif () #===== GPTL ===== if (PIO_ENABLE_TIMING) - find_package (GPTL COMPONENTS C QUIET) if (GPTL_C_FOUND) message (STATUS "Found GPTL C: ${GPTL_C_LIBRARIES}") target_include_directories (pioc @@ -92,7 +91,6 @@ if (PIO_ENABLE_TIMING) endif () #===== NetCDF-C ===== -find_package (NetCDF "4.3.3" COMPONENTS C) if (NetCDF_C_FOUND) target_include_directories (pioc PUBLIC ${NetCDF_C_INCLUDE_DIRS}) @@ -117,9 +115,6 @@ else () endif () #===== PnetCDF-C ===== -if (WITH_PNETCDF) - find_package (PnetCDF "1.7.0" COMPONENTS C) -endif () if (PnetCDF_C_FOUND) target_include_directories (pioc PUBLIC ${PnetCDF_C_INCLUDE_DIRS}) diff --git a/src/flib/CMakeLists.txt b/src/flib/CMakeLists.txt index 2f4f54feacc..8ee65c77ad6 100644 --- a/src/flib/CMakeLists.txt +++ b/src/flib/CMakeLists.txt @@ -142,7 +142,6 @@ endforeach () #===== MPI ===== if (PIO_USE_MPISERIAL) - find_package (MPISERIAL COMPONENTS Fortran REQUIRED) if (MPISERIAL_Fortran_FOUND) target_compile_definitions (piof PRIVATE _MPISERIAL) @@ -154,8 +153,6 @@ if (PIO_USE_MPISERIAL) set (WITH_PNETCDF FALSE) set (MPI_Fortran_INCLUDE_PATH ${MPISERIAL_Fortran_INCLUDE_DIRS}) endif () -else () - find_package (MPI REQUIRED) endif () # Check MPI I/O capabilities @@ -184,9 +181,6 @@ endif () find_path(MPIMOD_PATH NAMES mpi.mod MPI.mod HINTS ${MPI_Fortran_INCLUDE_PATH}) -if (PIO_ENABLE_TIMING) - find_package (GPTL COMPONENTS Fortran_Perf QUIET) -endif () check_macro (MPI_HAS_Fortran_MOD NAME TryMPIMod.f90 @@ -219,7 +213,6 @@ if (PIO_ENABLE_TIMING) endif () #===== NetCDF-Fortran ===== -find_package (NetCDF "4.3.3" COMPONENTS Fortran) if (NetCDF_Fortran_FOUND) target_include_directories (piof PUBLIC ${NetCDF_Fortran_INCLUDE_DIRS}) @@ -237,9 +230,6 @@ else () endif () #===== PnetCDF ===== -if (WITH_PNETCDF) - find_package (PnetCDF "1.6" COMPONENTS Fortran REQUIRED) -endif () if (PnetCDF_Fortran_FOUND) target_include_directories (piof PUBLIC ${PnetCDF_Fortran_INCLUDE_DIRS}) diff --git a/src/gptl/CMakeLists.txt b/src/gptl/CMakeLists.txt index 5f73687f23d..7b5e977f63a 100644 --- a/src/gptl/CMakeLists.txt +++ b/src/gptl/CMakeLists.txt @@ -95,7 +95,6 @@ endif () #===== MPI ===== if (PIO_USE_MPISERIAL) - find_package (MPISERIAL COMPONENTS C Fortran REQUIRED) if (MPISERIAL_C_FOUND AND MPISERIAL_Fortran_FOUND) target_compile_definitions (gptl PRIVATE HAVE_MPI) @@ -109,8 +108,7 @@ if (PIO_USE_MPISERIAL) set (MPI_C_LIBRARIES ${MPISERIAL_C_LIBRARIES}) set (MPI_Fortran_INCLUDE_PATH ${MPISERIAL_Fortran_INCLUDE_DIRS}) endif () -else () - find_package (MPI REQUIRED) +else() if (MPI_C_FOUND AND MPI_Fortran_FOUND) target_compile_definitions (gptl PUBLIC HAVE_MPI)