Skip to content

Commit

Permalink
Add option to build ESMX application with pf
Browse files Browse the repository at this point in the history
  • Loading branch information
danrosen25 committed May 24, 2024
1 parent 7c4039b commit 7df977b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,10 @@ if ( ${PARFLOW_ENABLE_TOOLS} )
add_subdirectory (pftools)
endif ()

# Optionally build the NUOPC cap
# Optionally build the NUOPC cap and ESMX
option(PARFLOW_ENABLE_NUOPC "Enable building of the Parflow nuopc" "False")
if ( ${PARFLOW_ENABLE_NUOPC} )
option(PARFLOW_ENABLE_ESMX "Enable building of ESMX" "False")
if ( ${PARFLOW_ENABLE_NUOPC} OR ${PARFLOW_ENABLE_ESMX} )
add_subdirectory (pfnuopc)
endif ()

Expand Down
18 changes: 18 additions & 0 deletions pfnuopc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,24 @@ include_directories(parflow_nuopc include)
target_link_libraries(parflow_nuopc PUBLIC ESMF)
target_link_libraries(parflow_nuopc PUBLIC pfsimulator)

# configure fire behavior esmx executable
if (PARFLOW_ENABLE_ESMX)
if(ESMF_VERSION VERSION_LESS "8.5.0")
message(FATAL_ERROR "ESMX requires ESMF version 8.5.0 or greater")
endif (ESMF_VERSION VERSION_LESS "8.5.0")
include(ExternalProject)
ExternalProject_Add(esmx
BINARY_DIR ${CMAKE_BINARY_DIR}/esmx
SOURCE_DIR ${ESMF_ESMXDIR}
CMAKE_ARGS -DESMX_BUILD_FILE=${CMAKE_CURRENT_SOURCE_DIR}/esmxBuild.yaml
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
BUILD_ALWAYS TRUE
DEPENDS parflow_nuopc
EXCLUDE_FROM_ALL TRUE
)
endif (PARFLOW_ENABLE_ESMX)

### Install Library
install(TARGETS parflow_nuopc
EXPORT ParFlow
Expand Down
9 changes: 9 additions & 0 deletions pfnuopc/esmxBuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
application:
exe_name: esmx_parflow

components:
parflow:
build_type: none
cmake_config: ParFlow.cmake
libraries: parflow_nuopc
fort_module: parflow_nuopc.mod

0 comments on commit 7df977b

Please sign in to comment.