Skip to content

v4: External library refactoring and configurable ESMF versioning

Choose a tag to compare

@mathomp4 mathomp4 released this 10 Aug 14:03
· 9 commits to release/v4 since this release
5cc5feb

This release refactors external library configuration and improves build system stability across multi-package environments. Target creation for NetCDF, HDF5, ESMF, and FMS is now modularized into ConfigureBaselibs.cmake and ConfigureExternalLibraries.cmake, which esma.cmake includes automatically based on Baselibs_FOUND to eliminate redundant find_package boilerplate in downstream projects. Additionally, ESMF minimum version gating is now configurable via ESMA_ESMF_MIN_VERSION (default 8.6.1), allowing projects like MAPL3 to easily specify higher ESMF requirements before include(esma) while maintaining consistent version enforcement across Baselibs and Spack builds.

Toolchain and build stability fixes include suppressing compiler -save-temps in Ninja Debug builds to prevent parallel compile collisions, guarding ZLIB::zlib target aliases against duplicate declarations (e.g. from zlib-ng), and gating FMS lookups on FV_PRECISION so non-FMS libraries like MAPL can configure without requiring FMS. Finally, this release introduces the copy_restarts() helper function in esma_regression_run_helpers.cmake for regression testing and updates GitHub Actions workflow dependencies to current major versions.


From CHANGELOG.md

Fixed

  • Suppress compiler -save-temps in Debug builds generated with Ninja, because Intel and GNU Fortran compilers write these intermediates in the shared build working directory using the source basename, allowing parallel compile rules for files such as API.F90 to overwrite one another
  • In external_libraries/FindESMF.cmake, keep ESMF wrapper link options in INTERFACE_LINK_OPTIONS rather than treating them as libraries, allowing CMake to de-duplicate shared linker flags while preserving ESMF's link setup
  • In ConfigureExternalLibraries.cmake, guard the historical ZLIB::zlib alias creation with if(NOT TARGET ZLIB::zlib); some ZLIB providers (e.g. zlib-ng's CMake config package) already export a target with that exact name
  • In ConfigureExternalLibraries.cmake, only look for FMS via find_package when FV_PRECISION is defined. Library projects like MAPL don't use FMS and don't set FV_PRECISION, so they no longer require it; this mirrors the existing FV_PRECISION convention already used in ConfigureBaselibs.cmake for the Baselibs case
  • In ConfigureBaselibs.cmake, enforce a minimum ESMF version (matching ConfigureExternalLibraries.cmake) by checking ESMF_VERSION explicitly, since Baselibs' esmf.mk has no CMake-style version string for find_package() to check

Removed

  • Removed dependency-target creation (NetCDF, HDF5, ESMF, FMS, etc.) from external_libraries/FindBaselibs.cmake; it now only locates BASEDIR and sets Baselibs_FOUND

Added

  • Added ESMA_ESMF_MIN_VERSION variable, settable by a downstream project before include(esma), to control the minimum ESMF version required by ConfigureBaselibs.cmake/ConfigureExternalLibraries.cmake (defaults to 8.6.1 if unset). This lets projects with newer ESMF requirements (e.g. MAPL3 requiring 9.0.0) avoid needing their own version-guard boilerplate
  • Added external_libraries/ConfigureBaselibs.cmake to create the NetCDF/HDF5/ESMF/FMS dependency targets when building against a Baselibs installation (Baselibs_FOUND)
  • Added external_libraries/ConfigureExternalLibraries.cmake to create the same dependency targets via find_package when dependencies are supplied by Spack or another non-Baselibs package manager
  • Added copy_restarts() function to esma_regression_run_helpers.cmake to copy per-checkpoint restart subdirectories (excluding last) from a run's checkpoints directory into the experiment directory, for use in regression test comparisons.

Changed

  • Update GitHub Actions workflow dependencies to use the current major versions of actions/checkout and actions/upload-artifact
  • Split external library configuration out of FindBaselibs.cmake into ConfigureBaselibs.cmake and ConfigureExternalLibraries.cmake. esma.cmake now include()s the appropriate one automatically based on Baselibs_FOUND right after including FindBaselibs, so top-level projects no longer need to duplicate the non-Baselibs find_package calls in their own CMakeLists.txt

What's Changed

  • v4: Add copy_restarts helper for regression tests by @pchakraborty in #562
  • v4: Split external library configuration out of FindBaselibs.cmake by @mathomp4 in #559

Full Changelog: v4.42.0...v4.43.0