Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 12 additions & 6 deletions .github/actions/buildcdeps/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ inputs:
default: $HOME/pio
required: False
type: string
esmfmkfile:
description: 'Path to the installed ESMF library mkfile'
default: $HOME/ESMF/lib/libg/Linux.gfortran.64.openmpi.default/esmf.mk
esmf_root:
description: 'Path to the installed ESMF library'
default: $HOME/ESMF
required: False
type: string
src_root:
Expand All @@ -39,8 +39,14 @@ runs:
run: |
mkdir build-cdeps
pushd build-cdeps
export ESMFMKFILE=${{ inputs.esmfmkfile }}
export PIO=${{ inputs.pio_path }}
cmake ${{ inputs.cmake_flags }} ${{ inputs.src_root }}

# Use the ESMF_DIR environment variable that is set by the
# esmf-org/install-esmf-action. This is more reliable than guessing the path
# from esmf_root. The PIO action similarly sets PIO_DIR.
cmake \
-D ESMF_DIR="${ESMF_DIR}" \
-D PIO_DIR="${PIO_DIR}" \
${{ inputs.cmake_flags }} ${{ inputs.src_root }}

make VERBOSE=1
popd
35 changes: 23 additions & 12 deletions .github/workflows/extbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ jobs:
id: cache-PARALLELIO
uses: actions/cache@v4
with:
path: ${GITHUB_WORKSPACE}/pio
path: ${{ github.workspace }}/pio
key: ${{ runner.os }}-${{ env.ParallelIO_VERSION }}-parallelio2
- name: Build ParallelIO
if: steps.cache-PARALLELIO.outputs.cache-hit != 'true'
uses: NCAR/ParallelIO/.github/actions/parallelio_cmake@9390e30e29d4ebbfbef0fc72162cacd9e8f25e4e
with:
parallelio_version: ${{ env.ParallelIO_VERSION }}
enable_fortran: True
install_prefix: ${GITHUB_WORKSPACE}/pio
install_prefix: ${{ github.workspace }}/pio
- name: Install ESMF
uses: esmf-org/install-esmf-action@v1
env:
Expand All @@ -56,23 +56,34 @@ jobs:
ESMF_COMM: openmpi
ESMF_NETCDF: nc-config
ESMF_PNETCDF: pnetcdf-config
ESMF_INSTALL_PREFIX: ${GITHUB_WORKSPACE}/ESMF
ESMF_INSTALL_PREFIX: ${{ github.workspace }}/ESMF
ESMF_PIO: external
ESMF_PIO_INCLUDE: ${GITHUB_WORKSPACE}/pio/include
ESMF_PIO_LIBPATH: ${GITHUB_WORKSPACE}/pio/lib
ESMF_PIO_INCLUDE: ${{ github.workspace }}/pio/include
ESMF_PIO_LIBPATH: ${{ github.workspace }}/pio/lib
with:
version: ${{ env.ESMF_VERSION }}
esmpy: false
cache: true

- name: Build CDEPS
uses: ./.github/actions/buildcdeps
with:
esmfmkfile: $ESMFMKFILE
pio_path: ${GITHUB_WORKSPACE}/pio
src_root: ${GITHUB_WORKSPACE}
cmake_flags: " -Wno-dev -DCMAKE_BUILD_TYPE=DEBUG -DWERROR=ON -DCMAKE_Fortran_FLAGS=\"-DCPRGNU -g -Wall \
-ffree-form -ffree-line-length-none -fallow-argument-mismatch \""
run: |
mkdir build-cdeps
pushd build-cdeps

# The FindESMF.cmake files were located in specific subdirectories.
# We need to explicitly add those paths to CMAKE_MODULE_PATH.
# We also set CMAKE_PREFIX_PATH for PIO as that is the standard method.
cmake \
-D CMAKE_MODULE_PATH=${{ github.workspace }}/ESMF/include/ESMX/Comps/ESMX_Data/cmake:${{ github.workspace }}/ESMF/include/ESMX/Driver/cmake \
-D CMAKE_PREFIX_PATH=${{ github.workspace }}/pio \
-Wno-dev \
-DCMAKE_BUILD_TYPE=DEBUG \
-DWERROR=ON \
-DCMAKE_Fortran_FLAGS="-DCPRGNU -g -Wall -ffree-form -ffree-line-length-none -fallow-argument-mismatch" \
${{ github.workspace }}

make VERBOSE=1
popd
- name: Test CDEPS
run: |
cd build-cdeps
Expand Down
16 changes: 13 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,20 @@ endif()
message("CMAKE_MODULE_PATH is ${CMAKE_MODULE_PATH}, CMAKE_Fortran_COMPILER is ${CMAKE_Fortran_COMPILER}")
enable_language(Fortran)

if (TARGET esmf)
message("Target esmf is already found. Skip find_package ...")
if (TARGET ESMF::ESMF)
message("Target ESMF::ESMF is already found. Skip find_package ...")
else()
find_package(ESMF REQUIRED)
if (DEFINED ENV{ESMF_ROOT})
message("ESMF_ROOT is $ENV{ESMF_ROOT}")
else()
if (DEFINED ESMF)
set(ESMF_PATH ${ESMF})
else()
set(ESMF_PATH $ENV{ESMF})
endif()
endif()
list(APPEND CMAKE_MODULE_PATH $ENV{ESMF_ROOT}/cmake)
find_package(ESMF REQUIRED PATH ${ESMF_PATH})
endif()

option(WERROR "add the -Werror flag to compiler (works with gcc and intel)" OFF)
Expand Down
47 changes: 0 additions & 47 deletions cmake/FindESMF.cmake

This file was deleted.

Loading