From a245e609a3a2cf87e12c3fa8c2f5b3069aa81fab Mon Sep 17 00:00:00 2001 From: Bob Yantosca Date: Thu, 30 Jan 2025 16:10:19 -0500 Subject: [PATCH 1/2] Now only build KPP-Standalone when -DKPPSA=y CMakeScripts/GC-ConfigureClassic.cmake - Added boolean cache variable KPPSA and print its value src/CMakeLists.txt - Only execute the block where KPPSA_FILE_NAME is defined as a target if the KPPSA boolean variable is true. This will only build the KPP-Standalone executable when -DKPPSA=y is passed from the cmd line. CHANGELOG.md - Updated accordingly TODO: Update KPP-Standalone documentation accordingly in ReadTheDocs, which is located in the geos-chem-shared-docs submodule Signed-off-by: Bob Yantosca --- CHANGELOG.md | 1 + CMakeScripts/GC-ConfigureClassic.cmake | 10 +++++- src/CMakeLists.txt | 44 ++++++++++++++------------ 3 files changed, 34 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c7e70e..c3450c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] - TBD ### Changed - Bumped `jinja2` to version 3.1.5 in `docs/requirements.txt` to fix a security issue +- Changed the build sequence so that the KPP-Standalone is only built when configuring with `-DKPPSA=y` ## [14.5.1] - 2025-01-10 ### Added diff --git a/CMakeScripts/GC-ConfigureClassic.cmake b/CMakeScripts/GC-ConfigureClassic.cmake index eb311c0..efd3d02 100755 --- a/CMakeScripts/GC-ConfigureClassic.cmake +++ b/CMakeScripts/GC-ConfigureClassic.cmake @@ -175,6 +175,14 @@ function(configureGCClassic) ) gc_pretty_print(VARIABLE HCOSA IS_BOOLEAN) + #------------------------------------------------------------------------- + # Build the KPP-Standalone? + #------------------------------------------------------------------------- + set(KPPSA OFF CACHE BOOL + "Switch to build the KPP-Standalone Box Model" + ) + gc_pretty_print(VARIABLE KPP_STANDALONE IS_BOOLEAN) + #------------------------------------------------------------------------- # Build Luo et al wetdep scheme? # (Currently a research option... turn OFF by default) @@ -208,7 +216,7 @@ function(configureGCClassic) INTERFACE FASTJX ) endif() - + #------------------------------------------------------------------------- # Export the following variables to GEOS-Chem directory's scope #------------------------------------------------------------------------- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 90bd4bd..576eec4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -39,6 +39,8 @@ set_target_properties(${EXE_FILE_NAME} ) #----------------------------------------------------------------------------- +# If GEOS-Chem Classic has been configured with -DKPPSA=y, then: +# # Define the KPP standalone executable: # 1. Specify a cache variable with the default target name # 2. Specify the location of the main program @@ -51,26 +53,28 @@ set_target_properties(${EXE_FILE_NAME} # This should now fix the issue reported by @msulprizio in: # https://github.com/geoschem/GCClassic/issues/78 #----------------------------------------------------------------------------- -set(KPPSA_FILE_NAME kpp_standalone CACHE STRING - "Default name for the KPP standalone executable file") -mark_as_advanced(KPPSA_FILE_NAME) -add_executable(${KPPSA_FILE_NAME} - GEOS-Chem/KPP/standalone/kpp_standalone.F90 -) -if("${MECH}" STREQUAL fullchem OR "${MECH}" STREQUAL custom) - target_link_libraries(${KPPSA_FILE_NAME} - PUBLIC - KPPStandalone - ) - set_target_properties(${KPPSA_FILE_NAME} - PROPERTIES - RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin - ) -else() - set_target_properties(${KPPSA_FILE_NAME} - PROPERTIES - EXCLUDE_FROM_ALL TRUE - ) +if (${KPPSA}) + set(KPPSA_FILE_NAME kpp_standalone CACHE STRING + "Default name for the KPP standalone executable file") + mark_as_advanced(KPPSA_FILE_NAME) + add_executable(${KPPSA_FILE_NAME} + GEOS-Chem/KPP/standalone/kpp_standalone.F90 + ) + if("${MECH}" STREQUAL fullchem OR "${MECH}" STREQUAL custom) + target_link_libraries(${KPPSA_FILE_NAME} + PUBLIC + KPPStandalone + ) + set_target_properties(${KPPSA_FILE_NAME} + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin + ) + else() + set_target_properties(${KPPSA_FILE_NAME} + PROPERTIES + EXCLUDE_FROM_ALL TRUE + ) + endif() endif() #----------------------------------------------------------------------------- From 11e7d2e93f93c931088b6a7133634fba87062d75 Mon Sep 17 00:00:00 2001 From: Bob Yantosca Date: Thu, 30 Jan 2025 16:51:53 -0500 Subject: [PATCH 2/2] Fixed CMake gc_pretty_print statement for KPPSA variable CMakeScripts/GC-ConfigureClassic.cmake - Bug fix: Now print KPPSA instead of KPP_STANDALONE to the screen with function gc_pretty_print Signed-off-by: Bob Yantosca --- CMakeScripts/GC-ConfigureClassic.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeScripts/GC-ConfigureClassic.cmake b/CMakeScripts/GC-ConfigureClassic.cmake index efd3d02..f07e81d 100755 --- a/CMakeScripts/GC-ConfigureClassic.cmake +++ b/CMakeScripts/GC-ConfigureClassic.cmake @@ -181,7 +181,7 @@ function(configureGCClassic) set(KPPSA OFF CACHE BOOL "Switch to build the KPP-Standalone Box Model" ) - gc_pretty_print(VARIABLE KPP_STANDALONE IS_BOOLEAN) + gc_pretty_print(VARIABLE KPPSA IS_BOOLEAN) #------------------------------------------------------------------------- # Build Luo et al wetdep scheme?