From 0ca2883efaeab629d6074ca8c83fabbceb1d7aa4 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Wed, 17 Apr 2024 15:33:38 -0600 Subject: [PATCH 1/7] Fix CMake circular dependencies for external use --- CHANGELOG.md | 1 + CMakeLists.txt | 62 ++++++++++++++++++++++++++++++++++---------------- 2 files changed, 43 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f024e945..b6c462f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Silenced unwarranted error messages from wavelength/channel retrieval functions occurring when 470nm and/or 870nm channels are not included in GOCART resource file. - Add explicit `find_package()` calls for missing dependencies for MAPL for builds with spack-stack. Will eventually be fixed in MAPL in later versions - Corrected the units of the gravimetric soil moisture to percent instead of fractional in the FENGSHA dust scheme. +- Fix issue of GOCART/GEOSgcm circular CMake dependencies when used as external project ### Added diff --git a/CMakeLists.txt b/CMakeLists.txt index d59c2b4c..dfec7c5d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,24 +2,42 @@ cmake_minimum_required (VERSION 3.17) cmake_policy (SET CMP0053 NEW) cmake_policy (SET CMP0054 NEW) -project ( - GOCART - VERSION 2.2.1 - LANGUAGES Fortran CXX C) # Note - CXX is required for ESMF - -if ("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}") - message(SEND_ERROR "In-source builds are disabled. Please - issue cmake command in separate build directory.") -endif ("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}") - -# Set the default build type to release -if (NOT CMAKE_BUILD_TYPE) - message (STATUS "Setting build type to 'Release' as none was specified.") - set (CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) - # Set the possible values of build type for cmake-gui - set_property (CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS - "Debug" "Release" "MinSizeRel" "RelWithDebInfo") -endif () +# mepo can now clone subrepos in three styles +set (ESMA_CMAKE_DIRS + cmake + @cmake + cmake@ + ) + +foreach (dir IN LISTS ESMA_CMAKE_DIRS) + if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/${dir}) + list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/${dir}") + set (ESMA_CMAKE_PATH "${CMAKE_CURRENT_LIST_DIR}/${dir}" CACHE PATH "Path to ESMA_cmake code") + include (esma) + set(GOCART_STANDALONE TRUE) + endif () +endforeach () + +if (GOCART_STANDALONE) + project ( + GOCART + VERSION 2.2.1 + LANGUAGES Fortran CXX C) # Note - CXX is required for ESMF + + if ("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}") + message(SEND_ERROR "In-source builds are disabled. Please + issue cmake command in separate build directory.") + endif ("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}") + + # Set the default build type to release + if (NOT CMAKE_BUILD_TYPE) + message (STATUS "Setting build type to 'Release' as none was specified.") + set (CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) + # Set the possible values of build type for cmake-gui + set_property (CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Release" "MinSizeRel" "RelWithDebInfo") + endif () +endif() # Set build options option (UFS_GOCART "Build GOCART component for UFS" OFF) @@ -45,7 +63,9 @@ if (NOT COMMAND esma) include (esma) endif() -ecbuild_declare_project() +if(GOCART_STANDALONE) + ecbuild_declare_project() +endif() if (NOT Baselibs_FOUND) # Find dependencies @@ -87,7 +107,9 @@ include_directories(${MPI_Fortran_INCLUDE_PATH}) add_subdirectory (ESMF) add_subdirectory (Process_Library) -ecbuild_install_project (NAME GOCART) +if(GOCART_STANDALONE) + ecbuild_install_project (NAME GOCART) +endif() # https://www.scivision.dev/cmake-auto-gitignore-build-dir/ # --- auto-ignore build directory From 29724454cf0ce86b9ec58bdd2a6e8b04d232e6be Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Wed, 17 Apr 2024 17:57:25 -0400 Subject: [PATCH 2/7] Fix standalone --- CMakeLists.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dfec7c5d..b3cb6d8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,8 @@ cmake_minimum_required (VERSION 3.17) cmake_policy (SET CMP0053 NEW) cmake_policy (SET CMP0054 NEW) -# mepo can now clone subrepos in three styles +# Let's look for the ESMA cmake directory in a few places +# to see if we are building standalone set (ESMA_CMAKE_DIRS cmake @cmake @@ -13,7 +14,6 @@ foreach (dir IN LISTS ESMA_CMAKE_DIRS) if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/${dir}) list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/${dir}") set (ESMA_CMAKE_PATH "${CMAKE_CURRENT_LIST_DIR}/${dir}" CACHE PATH "Path to ESMA_cmake code") - include (esma) set(GOCART_STANDALONE TRUE) endif () endforeach () @@ -59,7 +59,6 @@ if (UFS_GOCART) endif() if (NOT COMMAND esma) - list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake@") include (esma) endif() From 8f216e9ad4852de5ed22a2e17e5b5b4eb64c4aea Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Mon, 29 Jul 2024 12:00:02 -0400 Subject: [PATCH 3/7] Update components.yaml to match GEOSgcm main as of 2024-Jul-29 --- components.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components.yaml b/components.yaml index faf25a7d..a26ecd8d 100644 --- a/components.yaml +++ b/components.yaml @@ -5,13 +5,13 @@ GOCART: env: local: ./env@ remote: ../ESMA_env.git - tag: v4.24.0 + tag: v4.29.0 develop: main cmake: local: ./cmake@ remote: ../ESMA_cmake.git - tag: v3.36.0 + tag: v3.46.0 develop: develop ecbuild: @@ -28,12 +28,12 @@ HEMCO: GMAO_Shared: local: ./ESMF/Shared/GMAO_Shared@ remote: ../GMAO_Shared.git - tag: v1.9.6 + tag: v1.9.7 sparse: ./config/GMAO_Shared.sparse develop: main MAPL: local: ./ESMF/Shared/MAPL@ remote: ../MAPL.git - tag: v2.43.0 + tag: v2.47.0 develop: develop From bfa278c9632161632f8c3f1020f3b9c12be05c6c Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Mon, 29 Jul 2024 12:12:55 -0400 Subject: [PATCH 4/7] Update to ESMA_cmake v3.48.0 (for spack builds) --- components.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components.yaml b/components.yaml index a26ecd8d..f131655b 100644 --- a/components.yaml +++ b/components.yaml @@ -11,7 +11,7 @@ env: cmake: local: ./cmake@ remote: ../ESMA_cmake.git - tag: v3.46.0 + tag: v3.48.0 develop: develop ecbuild: From a9e739dcde2624d4fcd77aebc3a490b72a5f8508 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Mon, 29 Jul 2024 12:13:20 -0400 Subject: [PATCH 5/7] Do not add MAPL twice --- ESMF/Shared/CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ESMF/Shared/CMakeLists.txt b/ESMF/Shared/CMakeLists.txt index e9a3f721..4763e354 100644 --- a/ESMF/Shared/CMakeLists.txt +++ b/ESMF/Shared/CMakeLists.txt @@ -12,10 +12,12 @@ if( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/@GSW ) set (gsw_ECBUILD_SYSTEM_INCLUDED TRUE) endif() -if ( IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/MAPL@ ) - esma_add_subdirectories ( - MAPL - ) +if (NOT TARGET MAPL) + if ( IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/MAPL@ ) + esma_add_subdirectories ( + MAPL + ) + endif () endif () if ( IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/GMAO_Shared@ ) From 7f35ce4f6f7d395bbd6ed846b5e7cd57fdaf1d7e Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Mon, 12 Aug 2024 13:28:54 -0400 Subject: [PATCH 6/7] Update components.yaml to match GEOSgcm main as of 2024-Aug-12 --- components.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components.yaml b/components.yaml index f131655b..5330f040 100644 --- a/components.yaml +++ b/components.yaml @@ -28,12 +28,12 @@ HEMCO: GMAO_Shared: local: ./ESMF/Shared/GMAO_Shared@ remote: ../GMAO_Shared.git - tag: v1.9.7 + tag: v1.9.8 sparse: ./config/GMAO_Shared.sparse develop: main MAPL: local: ./ESMF/Shared/MAPL@ remote: ../MAPL.git - tag: v2.47.0 + tag: v2.47.1 develop: develop From 0dae7a8ee4f28f2df0d9e815d4da198154a8b7a5 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Mon, 12 Aug 2024 13:35:53 -0400 Subject: [PATCH 7/7] Update changelog --- CHANGELOG.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6c462f4..366372ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,11 +21,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -Modified ExtData.yaml files to persist as climatological anthropogenic emissions after the end of the CEDS dataset in 2019. Analogous rc files removed as this capability is only available with ExtData2G -- Update `components.yaml` to match that of GEOSgcm v11.3.3 - - ESMA_env v4.20.6 (Baselibs 7.14.0, Updates for SLES15 at NCCS) - - ESMA_cmake v3.36.0 (Fixes for NAS, debug flags, Updates for SLES15 at NCCS) - - GMAO_Shared v1.9.6 (Bug fix for MITgcm, CI fixes, SLES15 Updates) - - MAPL 2.42.0 (Various fixes and features) +- Update `components.yaml` to match that of GEOSgcm v11.6.1 + - ESMA_env v4.29.0 (Baselibs 7.24.0, Updates for SLES15 at NCCS, various fixes) + - ESMA_cmake v3.48.0 (Fixes for NAS, debug flags, Updates for SLES15 at NCCS, MPI detection, ESMF and MPI CMake fixes for Spack) + - GMAO_Shared v1.9.8 (Bug fix for MITgcm, CI fixes, SLES15 Updates) + - MAPL 2.47.1 (Various fixes and features, support for Spack) - Update CI to use Baselibs by default from CircleCI Orb - Correct soil moisture parameterization in FENGSHA - Add `soil_moisture_factor` to the DU2G_instance_DU.rc (same name used in the K14 scheme) and DU2G_GridCompMod.F90 files for FENGSHA