add initial cmake build#180
Open
rem1776 wants to merge 6 commits into
Open
Conversation
added 6 commits
June 1, 2026 10:35
There was a problem hiding this comment.
Pull request overview
This PR introduces an initial CMake-based build for FMScoupler (and its component libraries) and wires up a basic end-to-end null-model run via CTest, with accompanying README documentation to describe the new build/test flow.
Changes:
- Added a top-level
CMakeLists.txtto build the coupler drivers (“full” and “simple”) and component libraries, with optional dependency fetching viaFetchContent. - Added a new
ctest-invoked null-model run script (t/test_run.sh) to exercise the built executables. - Updated
README.mdwith a new section describing repository structure and CMake build/test usage.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 16 comments.
| File | Description |
|---|---|
CMakeLists.txt |
Adds initial CMake build system, dependency fetching/symlinking, library/executable targets, and a CTest entry. |
t/test_run.sh |
Adds an end-to-end runtime test script intended to be executed from CTest. |
README.md |
Documents the new build system and provides example build/test commands. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+27
to
+28
| set(EXTERNAL_SOURCE_DIR ${CMAKE_SOURCE_DIR}/external) | ||
| file(MAKE_DIRECTORY ${EXTERNAL_SOURCE_DIR}) |
Comment on lines
+81
to
+83
| else() | ||
| add_subdirectory(${fms_path} ${CMAKE_CURRENT_BINARY_DIR}/fms_build) | ||
| endif() |
| file(GLOB_RECURSE component_srcs ${EXTERNAL_SOURCE_DIR}/${component_name}/*.F90) | ||
| # TODO if/when cmake is added to component libraries, this should use add_subdirectory instead | ||
| add_library(${component_name} STATIC ${component_srcs}) | ||
| target_include_directories(${component_name} PUBLIC ${EXTERNAL_SOURCE_DIR}/FMS) |
Comment on lines
+103
to
+105
| SOURCE_DIR ${EXTERNAL_SOURCE_DIR}/${component_name} | ||
| GIT_TAG main | ||
| ) |
|
|
||
| # Build libraries for each external component | ||
| foreach(component_name IN LISTS COMPONENTS) | ||
| file(GLOB_RECURSE component_srcs ${EXTERNAL_SOURCE_DIR}/${component_name}/*.F90) |
Comment on lines
+14
to
+16
| tarFile=coupler_null_test_data_full_simple.tar.gz | ||
| curl -O ftp://ftp.gfdl.noaa.gov/perm/GFDL_pubrelease/test_data/${tarFile} | ||
| tar zxf ${tarFile} |
| curl -O ftp://ftp.gfdl.noaa.gov/perm/GFDL_pubrelease/test_data/${tarFile} | ||
| tar zxf ${tarFile} | ||
| # add an io layout to the full nml | ||
| sed -i '22i io_layout = 1, 1' input-full.nml |
Comment on lines
+38
to
+42
| The "full" coupler has 5 direct dependencies: FMS[github.com/noaa-gfdl/fms], "ice_model_mod", "land_model_mod", | ||
| "atmos_model_mod", "ocean_model_mod". The "simple" coupler differs in that in does not require a ocean model, and | ||
| includes its own ice_model module, rather than using an external repository. "ice_param" is a dependency of the simple | ||
| ice_model, so is also included in the build. It is commonly used by GFDL ice models as well, so will be linked with | ||
| the ice component by default. |
Comment on lines
+47
to
+48
| A cmake build is available to build the coupler and component libraries. It is currently only tested with the null model | ||
| and supports either locally cloned repositories or automagically cloning components during configuration. |
|
|
||
| To build using local components, all source code must be cloned in a single directory: | ||
|
|
||
| ```{shell} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
adds a cmakelists to build the coupler code and any components. I only used it for the null model, but tried to make things generic enough so that it can be easily used for other models.
This also includes a run test using ctest from the null model build script.