Skip to content

Commit

Permalink
Merge PR #79 (Fix error in CMake logic for KPP standalone)
Browse files Browse the repository at this point in the history
This merge brings PR #79 (Fixed error in CMake logic that
attempted to build the KPP standalone for mechanisms other
than fullchem and custom, by @yantosca) into the GEOS-Chem
"no-diff-to-benchmark" development stream.

This PR fixes a build issue that can occur when the CMake
commands are given separately instead of as a single command.
See issue #78 for details.

Signed-off-by: Bob Yantosca <yantosca@seas.harvard.edu>
  • Loading branch information
yantosca committed Dec 16, 2024
2 parents f866ce2 + 7f7b6ff commit f9c3ea7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
### Changed
- Changed `submodules: true` to `submodules: recursive` in `.ci-pipelines/*.yml` files, which will fetch all levels of submodules in Azure CI tests.

### Fixed
- Fixed logic error in `src/CMakeLists.txt` that attempted to build the KPP standalone for the carbon simulation (see geoschem/GCClassic #78)

## [14.5.0] - 2024-11-08
### Changed
- Updated GEOS-Chem to 14.5.0
Expand Down
29 changes: 21 additions & 8 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,20 @@ set_target_properties(${EXE_FILE_NAME}
# 2. Specify the location of the main program
# 3. Specify libraries that the main program depends on
# 4. Store the binary exectuable file in the bin folder (pre-install)
# 5. If not fullchem or custom mechanism, prevent executable from being built
#
# At present build KPP standalone only for fullchem or custom mechanisms.
#
# 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)
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
)
target_link_libraries(${KPPSA_FILE_NAME}
PUBLIC
KPPStandalone
Expand All @@ -63,6 +66,11 @@ if("${MECH}" STREQUAL fullchem OR "${MECH}" STREQUAL custom)
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
else()
set_target_properties(${KPPSA_FILE_NAME}
PROPERTIES
EXCLUDE_FROM_ALL TRUE
)
endif()

#-----------------------------------------------------------------------------
Expand Down Expand Up @@ -98,7 +106,12 @@ foreach(INSTALL_PATH ${COMBINED_INSTALL_DIRS})
# Installation path is a GEOS-Chem run directory,
# Therefore we will install the executable there.
install(TARGETS ${EXE_FILE_NAME} RUNTIME DESTINATION ${INSTALL_PATH})
install(TARGETS ${KPPSA_FILE_NAME} RUNTIME DESTINATION ${INSTALL_PATH})

# Only install KPP standalone for fullchem/custom mechanisms.
# See: htps://github.com/geoschem/GCClassic/issues/78
if("${MECH}" STREQUAL fullchem OR "${MECH}" STREQUAL custom)
install(TARGETS ${KPPSA_FILE_NAME} RUNTIME DESTINATION ${INSTALL_PATH})
endif()
endif()

endforeach()

0 comments on commit f9c3ea7

Please sign in to comment.