diff --git a/CHANGELOG.md b/CHANGELOG.md index fc9bdd1a8b83..a68810e478e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Deprecated +## [2.40.3] - 2023-08-03 + +### Changed + +- Update `components.yaml` + - ESMA_cmake v3.31.1 (Fixes for NAG) + +### Fixed + +- Undoing previous workaround for NAG + `MAPL_Config.F90` in v2.40.1 which was a workaround was not portable to Linux. Instead, this uses changes in ESMA_cmake v3.31.1 for flags with NAG. +- Updated `FindESMF.cmake` file to match that of ESMF v8.5.0 + ## [2.40.2] - 2023-08-01 ### Fixed diff --git a/CMakeLists.txt b/CMakeLists.txt index 825bba06abca..b37803868b14 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ endif () project ( MAPL - VERSION 2.40.2 + VERSION 2.40.3 LANGUAGES Fortran CXX C) # Note - CXX is required for ESMF # Set the possible values of build type for cmake-gui diff --git a/base/CMakeLists.txt b/base/CMakeLists.txt index abfccdcf963f..f07b14195333 100644 --- a/base/CMakeLists.txt +++ b/base/CMakeLists.txt @@ -76,6 +76,11 @@ if (NOT CMAKE_Fortran_COMPILER_ID MATCHES "NAG") target_link_libraries(${this} PRIVATE OpenMP::OpenMP_Fortran) endif () +# Workaround for bizarre switch in ESMF +if (ESMF_HAS_ACHAR_BUG) + set_source_files_properties(MAPL_Config.F90 PROPERTIES COMPILE_DEFINITIONS ESMF_HAS_ACHAR_BUG) +endif() + if(DISABLE_GLOBAL_NAME_WARNING) target_compile_options (${this} PRIVATE $<$:${DISABLE_GLOBAL_NAME_WARNING}>) endif() diff --git a/base/MAPL_Config.F90 b/base/MAPL_Config.F90 index 48840ca33343..9cae1e8cdb2c 100644 --- a/base/MAPL_Config.F90 +++ b/base/MAPL_Config.F90 @@ -33,6 +33,29 @@ module MAPL_ConfigMod module procedure :: MAPL_ConfigSetAttribute_string end interface + integer, parameter :: LSZ = max (1024,ESMF_MAXPATHLEN) ! Maximum line size + integer, parameter :: MSZ = 256 ! Used to size buffer; this is + ! usually *less* than the number + ! of non-blank/comment lines + ! (because most lines are shorter + ! then LSZ) + + integer, parameter :: NBUF_MAX = MSZ*LSZ ! max size of buffer + integer, parameter :: NATT_MAX = NBUF_MAX/64 ! max # attributes; + ! assumes an average line + ! size of 16, the code + ! will do a bound check + + character, parameter :: BLK = achar(32) ! blank (space) + character, parameter :: TAB = achar(09) ! TAB +#if defined(ESMF_HAS_ACHAR_BUG) + character, parameter :: EOL = achar(12) ! end of line mark (cr) +#else + character, parameter :: EOL = achar(10) ! end of line mark (newline) +#endif + character, parameter :: EOB = achar(00) ! end of buffer mark (null) + character, parameter :: NUL = achar(00) ! what it says + contains function MAPL_ConfigCreate(unusable, rc) result(config) @@ -42,7 +65,7 @@ function MAPL_ConfigCreate(unusable, rc) result(config) integer, optional, intent(out) :: rc character, parameter :: EOB = achar(00) !! end of buffer mark (null) -#if defined(ESMF_HAS_ACHAR_BUG) | defined(__NAG_COMPILER_BUILD) +#if defined(__NAG_COMPILER_BUILD) && defined(__DARWIN) character, parameter :: EOL = achar(12) !! end of line mark (cr) #else character, parameter :: EOL = achar(10) !! end of line mark (newline) @@ -79,29 +102,6 @@ subroutine MAPL_ConfigSetAttribute_real64( config, value, label, rc ) character(len=*), intent(in), optional :: label integer, intent(out), optional :: rc ! - !integer, parameter :: LSZ = 256 ! Maximum line size - integer, parameter :: LSZ = max (1024,ESMF_MAXPATHLEN) ! Maximum line size - integer, parameter :: MSZ = 256 ! Used to size buffer; this is - ! usually *less* than the number - ! of non-blank/comment lines - ! (because most lines are shorter - ! then LSZ) - - integer, parameter :: NBUF_MAX = MSZ*LSZ ! max size of buffer - integer, parameter :: NATT_MAX = NBUF_MAX/64 ! max # attributes; - ! assumes an average line - ! size of 16, the code - ! will do a bound check - - character, parameter :: BLK = achar(32) ! blank (space) - character, parameter :: TAB = achar(09) ! TAB -#if defined(ESMF_HAS_ACHAR_BUG) | defined(__NAG_COMPILER_BUILD) - character, parameter :: EOL = achar(12) ! end of line mark (cr) -#else - character, parameter :: EOL = achar(10) ! end of line mark (newline) -#endif - character, parameter :: EOB = achar(00) ! end of buffer mark (null) - character, parameter :: NUL = achar(00) ! what it says !$$ character(len=ESMF_MAXSTR) :: Iam = 'MAPL_ConfigSetAttribute_int32' @@ -248,29 +248,6 @@ subroutine MAPL_ConfigSetAttribute_real32( config, value, label, rc ) character(len=*), intent(in), optional :: label integer, intent(out), optional :: rc ! - !integer, parameter :: LSZ = 256 ! Maximum line size - integer, parameter :: LSZ = max (1024,ESMF_MAXPATHLEN) ! Maximum line size - integer, parameter :: MSZ = 256 ! Used to size buffer; this is - ! usually *less* than the number - ! of non-blank/comment lines - ! (because most lines are shorter - ! then LSZ) - - integer, parameter :: NBUF_MAX = MSZ*LSZ ! max size of buffer - integer, parameter :: NATT_MAX = NBUF_MAX/64 ! max # attributes; - ! assumes an average line - ! size of 16, the code - ! will do a bound check - - character, parameter :: BLK = achar(32) ! blank (space) - character, parameter :: TAB = achar(09) ! TAB -#if defined(ESMF_HAS_ACHAR_BUG) | defined(__NAG_COMPILER_BUILD) - character, parameter :: EOL = achar(12) ! end of line mark (cr) -#else - character, parameter :: EOL = achar(10) ! end of line mark (newline) -#endif - character, parameter :: EOB = achar(00) ! end of buffer mark (null) - character, parameter :: NUL = achar(00) ! what it says !$$ character(len=ESMF_MAXSTR) :: Iam = 'MAPL_ConfigSetAttribute_int32' @@ -417,29 +394,6 @@ subroutine MAPL_ConfigSetAttribute_int32( config, value, label, rc ) character(len=*), intent(in), optional :: label integer, intent(out), optional :: rc ! - !integer, parameter :: LSZ = 256 ! Maximum line size - integer, parameter :: LSZ = max (1024,ESMF_MAXPATHLEN) ! Maximum line size - integer, parameter :: MSZ = 256 ! Used to size buffer; this is - ! usually *less* than the number - ! of non-blank/comment lines - ! (because most lines are shorter - ! then LSZ) - - integer, parameter :: NBUF_MAX = MSZ*LSZ ! max size of buffer - integer, parameter :: NATT_MAX = NBUF_MAX/64 ! max # attributes; - ! assumes an average line - ! size of 16, the code - ! will do a bound check - - character, parameter :: BLK = achar(32) ! blank (space) - character, parameter :: TAB = achar(09) ! TAB -#if defined(ESMF_HAS_ACHAR_BUG) | defined(__NAG_COMPILER_BUILD) - character, parameter :: EOL = achar(12) ! end of line mark (cr) -#else - character, parameter :: EOL = achar(10) ! end of line mark (newline) -#endif - character, parameter :: EOB = achar(00) ! end of buffer mark (null) - character, parameter :: NUL = achar(00) ! what it says !$$ character(len=ESMF_MAXSTR) :: Iam = 'MAPL_ConfigSetAttribute_int32' @@ -581,7 +535,6 @@ subroutine MAPL_ConfigSetAttribute_ints32( config, value, label, rc ) ! !INTERFACE: ! Private name; call using MAPL_ConfigSetAttribute() - integer, parameter :: LSZ = max (1024,ESMF_MAXPATHLEN) ! Maximum line size character(len=LSZ) :: buffer character(len=12) :: tmpStr, newVal integer :: count, i, j @@ -626,7 +579,6 @@ subroutine MAPL_ConfigSetAttribute_reals32( config, value, label, rc ) ! 18 is needed for gfortran ! Hopefully 32 is large enough to fit-all. #define IWSZ 32 - integer, parameter :: LSZ = max (1024,ESMF_MAXPATHLEN) ! Maximum line size character(len=LSZ) :: buffer character(len=IWSZ) :: tmpStr, newVal integer :: count, i, j @@ -662,29 +614,6 @@ subroutine MAPL_ConfigSetAttribute_string(config, value, label, rc) character(len=*), intent(in), optional :: label integer, intent(out), optional :: rc ! - !integer, parameter :: LSZ = 256 ! Maximum line size - integer, parameter :: LSZ = max (1024,ESMF_MAXPATHLEN) ! Maximum line size - integer, parameter :: MSZ = 256 ! Used to size buffer; this is - ! usually *less* than the number - ! of non-blank/comment lines - ! (because most lines are shorter - ! then LSZ) - - integer, parameter :: NBUF_MAX = MSZ*LSZ ! max size of buffer - integer, parameter :: NATT_MAX = NBUF_MAX/64 ! max # attributes; - ! assumes an average line - ! size of 16, the code - ! will do a bound check - - character, parameter :: BLK = achar(32) ! blank (space) - character, parameter :: TAB = achar(09) ! TAB -#if defined(ESMF_HAS_ACHAR_BUG) | defined(__NAG_COMPILER_BUILD) - character, parameter :: EOL = achar(12) ! end of line mark (cr) -#else - character, parameter :: EOL = achar(10) ! end of line mark (newline) -#endif - character, parameter :: EOB = achar(00) ! end of buffer mark (null) - character, parameter :: NUL = achar(00) ! what it says !$$ character(len=ESMF_MAXSTR) :: Iam = 'MAPL_ConfigSetAttribute_string' diff --git a/cmake/FindESMF.cmake b/cmake/FindESMF.cmake index 161654428d88..23efbb31d078 100644 --- a/cmake/FindESMF.cmake +++ b/cmake/FindESMF.cmake @@ -96,13 +96,17 @@ if(EXISTS ${ESMFMKFILE}) message(WARNING "Static ESMF library (libesmf.a) not found in \ ${ESMF_LIBSDIR}. Try setting USE_ESMF_STATIC_LIBS=OFF") endif() - add_library(ESMF STATIC IMPORTED) + if(NOT TARGET ESMF) + add_library(ESMF STATIC IMPORTED) + endif() else() find_library(ESMF_LIBRARY_LOCATION NAMES esmf PATHS ${ESMF_LIBSDIR} NO_DEFAULT_PATH) if(ESMF_LIBRARY_LOCATION MATCHES "ESMF_LIBRARY_LOCATION-NOTFOUND") message(WARNING "ESMF library not found in ${ESMF_LIBSDIR}.") endif() - add_library(ESMF UNKNOWN IMPORTED) + if(NOT TARGET ESMF) + add_library(ESMF UNKNOWN IMPORTED) + endif() endif() # Add ESMF include directories diff --git a/components.yaml b/components.yaml index 6192688644d7..4ba3b008c8de 100644 --- a/components.yaml +++ b/components.yaml @@ -11,7 +11,7 @@ ESMA_env: ESMA_cmake: local: ./ESMA_cmake remote: ../ESMA_cmake.git - tag: v3.31.0 + tag: v3.31.1 develop: develop ecbuild: