-
Notifications
You must be signed in to change notification settings - Fork 3
CMake installation method #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
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 6763c83
Using add_subdirectory in CMakeLists.txt
fmalatino 7f70964
Allow libyaml libraries to be linked to libcFMS
fmalatino 04dd8eb
Adding CMakeLists for test_data_override
fmalatino 744298b
CMakeLists for tests
fmalatino 98a6b0d
All test executables created
fmalatino 467c137
Minimal workflow for cmake
fmalatino 7ef03a3
Attempting to find NetCDF in cmake workflow
fmalatino 8bd9df7
Attempting to find NetCDF in cmake workflow - part 2
fmalatino 0193771
Attempting to find NetCDF in cmake workflow - part 3
fmalatino b17150b
Attempting to find NetCDF in cmake workflow - part 4
fmalatino 0c1f889
Attempting to find NetCDF in cmake workflow - adding in Fortran dev f…
fmalatino 8070f00
Attempting to find NetCDF in cmake workflow - adding in Fortran dev f…
fmalatino 09481d6
Adding actual build
fmalatino 8c8512f
Adding in CFLAGS and FCFLAGS
fmalatino 83895e4
Moving equal sign
fmalatino b47c8ec
Matching package installs of pyFMS build
fmalatino 7e737c0
Adding in mpich install to cmake workflow
fmalatino 9ec58d1
Testing out no unit test build of FMS
fmalatino d84fa02
Adding in functioning testing CI
fmalatino 6d958c8
Excluding some FMS tests
fmalatino ab8d066
Ignoring test_diag_manager2 until FMS updated to not automatically ru…
fmalatino 14efbf8
Testing with new FMS
fmalatino 435271d
Updating to use FMS with optional test builds
fmalatino cf7c0bb
Amending interface for get_current_pelist and declare_pelist to match…
fmalatino 5d49f84
Opting for FetchContent over addsubdirectory
fmalatino File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| 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 | ||
|
|
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
| 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() | ||
|
|
||
|
|
||
|
|
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.