Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2391358
Minimal working cmake build
fmalatino Feb 26, 2026
6763c83
Using add_subdirectory in CMakeLists.txt
fmalatino Mar 3, 2026
7f70964
Allow libyaml libraries to be linked to libcFMS
fmalatino Mar 9, 2026
04dd8eb
Adding CMakeLists for test_data_override
fmalatino Mar 9, 2026
744298b
CMakeLists for tests
fmalatino Mar 9, 2026
98a6b0d
All test executables created
fmalatino Mar 10, 2026
467c137
Minimal workflow for cmake
fmalatino Mar 10, 2026
7ef03a3
Attempting to find NetCDF in cmake workflow
fmalatino Mar 10, 2026
8bd9df7
Attempting to find NetCDF in cmake workflow - part 2
fmalatino Mar 10, 2026
0193771
Attempting to find NetCDF in cmake workflow - part 3
fmalatino Mar 10, 2026
b17150b
Attempting to find NetCDF in cmake workflow - part 4
fmalatino Mar 10, 2026
0c1f889
Attempting to find NetCDF in cmake workflow - adding in Fortran dev f…
fmalatino Mar 10, 2026
8070f00
Attempting to find NetCDF in cmake workflow - adding in Fortran dev f…
fmalatino Mar 10, 2026
09481d6
Adding actual build
fmalatino Mar 10, 2026
8c8512f
Adding in CFLAGS and FCFLAGS
fmalatino Mar 10, 2026
83895e4
Moving equal sign
fmalatino Mar 10, 2026
b47c8ec
Matching package installs of pyFMS build
fmalatino Mar 10, 2026
7e737c0
Adding in mpich install to cmake workflow
fmalatino Mar 10, 2026
9ec58d1
Testing out no unit test build of FMS
fmalatino Mar 12, 2026
d84fa02
Adding in functioning testing CI
fmalatino Mar 13, 2026
6d958c8
Excluding some FMS tests
fmalatino Mar 13, 2026
ab8d066
Ignoring test_diag_manager2 until FMS updated to not automatically ru…
fmalatino Mar 16, 2026
14efbf8
Testing with new FMS
fmalatino Mar 17, 2026
435271d
Updating to use FMS with optional test builds
fmalatino Mar 20, 2026
cf7c0bb
Amending interface for get_current_pelist and declare_pelist to match…
fmalatino Mar 20, 2026
5d49f84
Opting for FetchContent over addsubdirectory
fmalatino Mar 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/github_cmake_gnu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build libcFMS test with CMake

on: [push, pull_request]

# cancel running jobs if theres a newer push
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true


jobs:
cmake_install:
runs-on: ubuntu-latest
container:
image: ghcr.io/noaa-gfdl/fms/fms-ci-rocky-gnu:13.2.0
env:
PKG_CONFIG_PATH: "/opt/views/view/lib64/pkgconfig:/opt/views/view/lib/pkgconfig:/opt/views/view/share/pkgconfig"
steps:
- name: checkout code
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Generate makefiles with CMake
run: |
cmake -B build -DCFMS_TESTS=on -DNetCDF_ROOT=/opt/view -DLIBYAML_ROOT=/opt/view
- name: Build library and tests
run: make -C build
- name: Run tests
run: cd build && ctest --output-on-failure

107 changes: 107 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#***********************************************************************
#* Apache License 2.0
#*
#* This file is part of the GFDL Flexible Modeling System (FMS).
#*
#* Licensed under the Apache License, Version 2.0 (the "License");
#* you may not use this file except in compliance with the License.
#* You may obtain a copy of the License at
#*
#* http://www.apache.org/licenses/LICENSE-2.0
#*
#* FMS is distributed in the hope that it will be useful, but WITHOUT
#* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied;
#* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
#* PARTICULAR PURPOSE. See the License for the specific language
#* governing permissions and limitations under the License.
#***********************************************************************

cmake_minimum_required(VERSION 3.12 FATAL_ERROR)

# Build options
option(PORTABLE_KINDS "Enable compiler defition -DPORTABLE_KINDS" ON)
option(WITH_YAML "Enable compiler definition -Duse_yaml" ON)
option(CFMS_TESTS "Enable compiling of test scripts" OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

include(FetchContent)

#Define the cmake project
project(cFMS
VERSION 2026.01.0
DESCRIPTION "C Access to GFDL FMS Library"
HOMEPAGE_URL "https://github.com/NOAA-GFDL/cFMS"
LANGUAGES C Fortran)

if(NOT CMAKE_C_COMPILER_ID MATCHES "^(Intel|GNU|Clang|IntelLLVM)$")
message(
WARNING "Compiler not officially supported: ${CMAKE_C_COMPILER_ID)}"
)
endif()

if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|GNU|IntelLLVM)$")
message(
WARNING "Compiler not officially supported: ${CMAKE_Fortran_COMPILER_ID}"
)
endif()

# Find dependencies

FetchContent_Declare(
FMS
GIT_REPOSITORY https://github.com/NOAA-GFDL/FMS.git
GIT_TAG 043ab2f6037af92997aa72a467430e95c03652ae
)
FetchContent_MakeAvailable(FMS)

list(APPEND cfms_src_files
c_constants/c_constants.F90
c_data_override/c_data_override.F90
c_diag_manager/c_diag_manager.F90
c_fms/c_fms.F90
c_fms_utils/c_fms_utils.F90
c_grid_utils/c_grid_utils.F90
c_horiz_interp/c_horiz_interp.F90
)

list(APPEND cfms_header_files
c_constants/c_constants.h
c_data_override/c_data_override.h
c_diag_manager/c_diag_manager.h
c_fms/c_fms.h
c_grid_utils/c_grid_utils.h
c_horiz_interp/c_horiz_interp.h
)

add_library(cFMS SHARED
${cfms_src_files}
)

target_link_libraries(cFMS PUBLIC
FMS::fms
${LIBYAML_LIBRARIES}
)

target_include_directories(cFMS PRIVATE
c_data_override/include
c_diag_manager/include
c_fms/include
c_fms_utils/include
c_horiz_interp/include
${CMAKE_CURRENT_SOURCE_DIR}/FMS/include
)

install(TARGETS cFMS
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}
)
install(FILES ${cfms_header_files}
DESTINATION ${CMAKE_INSTALL_PREFIX}/include)

# Tests
if(CFMS_TESTS)
enable_testing()
add_subdirectory(test_cfms)
endif()



2 changes: 1 addition & 1 deletion FMS
Submodule FMS updated 262 files
4 changes: 2 additions & 2 deletions c_fms/c_fms.F90
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ subroutine cFMS_declare_pelist(npes, pelist, name, commID) bind(C, name="cFMS_de
integer, intent(in) :: npes
integer, intent(in) :: pelist(npes)
character(c_char), intent(in), optional :: name(NAME_LENGTH)
integer, intent(out), optional :: commID
Comment thread
mlee03 marked this conversation as resolved.
integer, intent(out) :: commID

character(len=NAME_LENGTH) :: name_f=" " !mpp default

Expand Down Expand Up @@ -252,7 +252,7 @@ subroutine cFMS_get_current_pelist(npes, pelist, name, commID) bind(C, name="cFM
integer, intent(in) :: npes
integer, intent(out) :: pelist(npes)
character(c_char), intent(out), optional :: name(NAME_LENGTH)
integer, intent(out), optional :: commID
integer, intent(out) :: commID

character(len=NAME_LENGTH) :: name_f=" " !mpp default

Expand Down
Loading
Loading