Skip to content

Commit

Permalink
Pull over other GEOSgcm updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mathomp4 committed Feb 21, 2024
1 parent 52aa461 commit dfc9c26
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 17 deletions.
1 change: 1 addition & 0 deletions .github/workflows/enforce-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ jobs:
labels: "Contingent - DNA,Needs Lead Approval,Contingent -- Do Not Approve"
add_comment: true
message: "This PR is being prevented from merging because you have added one of our blocking labels: {{ provided }}. You'll need to remove it before this PR can be merged."

1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Updates for WMMA
- FVdycoreCubed_GridComp v2.10.0 → v2.11.0
- Updates to `fv3_setup` to use CMake detection of MPI stack (requires ESMA_cmake v3.41.0)
- Pulled over other CMake changes from GEOSgcm (mainly developer related)

## [2.13.0] - 2024-01-26

Expand Down
62 changes: 62 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,68 @@ foreach (dir cmake @cmake cmake@)
endforeach ()
include (esma)

# Add CMake for when not using Baselibs
if (NOT Baselibs_FOUND)
set(MPI_DETERMINE_LIBRARY_VERSION TRUE)
find_package(MPI)

find_package(NetCDF REQUIRED C Fortran)
add_definitions(-DHAS_NETCDF4)
add_definitions(-DHAS_NETCDF3)
add_definitions(-DNETCDF_NEED_NF_MPIIO)
add_definitions(-DHAS_NETCDF3)

find_package(HDF5 REQUIRED)
if(HDF5_IS_PARALLEL)
add_definitions(-DH5_HAVE_PARALLEL)
endif()

if (NOT TARGET esmf)
if (DEFINED ENV{esmf_ROOT})
message (STATUS "Found esmf_ROOT in environment: $ENV{esmf_ROOT}")
find_path(ESMF_CMAKE_PATH FindESMF.cmake HINTS "$ENV{esmf_ROOT}/cmake")
message (STATUS "Found FindESMF.cmake in: ${ESMF_CMAKE_PATH}")
if (ESMF_CMAKE_PATH)
message (STATUS "Appending to CMAKE_PREFIX_PATH: ${ESMF_CMAKE_PATH}")
list (APPEND CMAKE_MODULE_PATH ${ESMF_CMAKE_PATH})
endif ()
endif ()

find_package(ESMF MODULE REQUIRED)

# ESMF as used in MAPL requires MPI
# NOTE: This looks odd because some versions of FindESMF.cmake out in the
# world provide an "esmf" target while others provide "ESMF". So we
# need this ugliness to support both.
if (TARGET esmf)
target_link_libraries(esmf INTERFACE MPI::MPI_Fortran)
else()
target_link_libraries(ESMF INTERFACE MPI::MPI_Fortran)
# MAPL and GEOS use lowercase target due to historical reasons but
# the latest FindESMF.cmake file from ESMF produces an ESMF target.
add_library(esmf ALIAS ESMF)
endif()
endif ()

find_package(GFTL_SHARED REQUIRED)

find_package(ZLIB REQUIRED)
# Another issue with historical reasons, old/wrong zlib target used in GEOS
add_library(ZLIB::zlib ALIAS ZLIB::ZLIB)

# Using FMS from spack requires updates to fvdycore due to interface changes
# in FMS 2022. This is commented for now until this transition can occur.
#################################################
# find_package(FMS QUIET COMPONENTS R4 R8) #
# if (FMS_FOUND) #
# # We need aliases due to historical reasons #
# add_library(fms_r4 ALIAS FMS::fms_r4) #
# add_library(fms_r8 ALIAS FMS::fms_r8) #
# endif () #
#################################################

endif ()

ecbuild_declare_project()

# Generic DFLAGS
Expand Down
18 changes: 5 additions & 13 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
{
"version": 3,
"version": 7,
"cmakeMinimumRequired": {
"major": 3,
"minor": 21,
"minor": 27,
"patch": 0
},
"include": [
"presets/CMake$penv{CMAKE_PRESET_NAME}Presets.json"
],
"configurePresets": [
{
"name": "base-configure",
"hidden": true,
"displayName": "Base Configure Settings",
"description": "Sets build and install directories",
"binaryDir": "${sourceDir}/build-${presetName}",
"cacheVariables": {
"BASEDIR": "$env{BASEDIR}",
"CMAKE_INSTALL_PREFIX": "${sourceDir}/install-${presetName}"
}
},
{
"name": "base-gnu",
"hidden": true,
Expand Down
8 changes: 4 additions & 4 deletions parallel_build.csh
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ end

if (-d ${ESMADIR}/@env || -d ${ESMADIR}/env@ || -d ${ESMADIR}/env) then
if ( "$DEVELOP" == "TRUE" ) then
echo "Checking out development branch of GMAO_Shared"
mepo develop GMAO_Shared
echo "Checking out development branch of GMAO_Shared and GEOS_Util"
mepo develop GMAO_Shared GEOS_Util
endif
else
if ($?PBS_JOBID || $?SLURM_JOBID) then
Expand All @@ -46,8 +46,8 @@ else
mepo init
mepo clone
if ( "$DEVELOP" == "TRUE" ) then
echo "Checking out development branch of GMAO_Shared"
mepo develop GMAO_Shared
echo "Checking out development branch of GMAO_Shared and GEOS_Util"
mepo develop GMAO_Shared GEOS_Util
endif
endif
endif
Expand Down
13 changes: 13 additions & 0 deletions presets/CMakeDefaultPresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"configurePresets": [
{
"name": "base-configure",
"hidden": true,
"displayName": "Base Configure Settings",
"description": "Sets build and install directories",
"binaryDir": "${sourceDir}/build-${presetName}",
"installDir": "${sourceDir}/install-${presetName}"
}
],
"version": 7
}
13 changes: 13 additions & 0 deletions presets/CMakeNCCSPresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"configurePresets": [
{
"name": "base-configure",
"hidden": true,
"displayName": "Base Configure Settings",
"description": "Sets build and install directories",
"binaryDir": "$penv{CMAKE_BUILD_LOCATION}/${sourceDirName}/build-${presetName}",
"installDir": "$penv{CMAKE_INSTALL_LOCATION}/${sourceDirName}/install-${presetName}"
}
],
"version": 7
}

0 comments on commit dfc9c26

Please sign in to comment.