Skip to content

Commit

Permalink
Merge pull request #1726 from jedwards4b/reduce_search_netcdf
Browse files Browse the repository at this point in the history
Reduce search netcdf
  • Loading branch information
edwardhartnett authored Aug 19, 2020
2 parents f1a83f3 + 43f1315 commit 23c5c50
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 37 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
38 changes: 21 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
#==============================================================================
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -425,6 +432,3 @@ configure_file (
"${PROJECT_SOURCE_DIR}/cmake_config.h.in"
"${PROJECT_BINARY_DIR}/config.h"
)



5 changes: 0 additions & 5 deletions src/clib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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})
Expand All @@ -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})
Expand Down
10 changes: 0 additions & 10 deletions src/flib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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})
Expand All @@ -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})
Expand Down
4 changes: 1 addition & 3 deletions src/gptl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 23c5c50

Please sign in to comment.