From b326f5a7fed3bc354ef6dde7163c9a7f61d41468 Mon Sep 17 00:00:00 2001 From: Ahmad Nawab Date: Tue, 9 Jan 2024 09:35:47 +0000 Subject: [PATCH] IFS-SOURCE-ECWAM-SYNC: building with ecflow_light now a configurable option --- CMakeLists.txt | 12 ++++-------- src/ecwam/CMakeLists.txt | 10 ++++++++-- src/ecwam/wavemdl.F90 | 6 +++--- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c86b1d5b..85c390a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,6 +55,10 @@ ecbuild_add_option( FEATURE ECWAM_LAUNCH DEFAULT ON DESCRIPTION "Use share/ecwam/scripts/ecwam-launch script to run ecwam tests" ) +ecbuild_add_option( FEATURE ECFLOW + DESCRIPTION "ecflow meter updates" + REQUIRED_PACKAGES "ecflow_light") + if( HAVE_ECWAM_LAUNCH ) # Overwrite meaning of mpiexec set( ECWAM_LAUNCH ${CMAKE_CURRENT_SOURCE_DIR}/share/ecwam/scripts/ecwam-launch ) @@ -90,14 +94,6 @@ if( HAVE_OMP ) set( OpenMP_Fortran_LIBRARIES OpenMP::OpenMP_Fortran ) endif() -### Check if this is a standalone ecWAM build -if(PROJECT_IS_TOP_LEVEL OR (PARENT_PROJECT_NAME STREQUAL "ecwam-bundle")) - set(ECWAM_STANDALONE 1) -else() - set(ECWAM_STANDALONE 0) - ecbuild_find_package( ecflow_light REQUIRED ) -endif() - ### Sources include(ecwam_compile_flags) diff --git a/src/ecwam/CMakeLists.txt b/src/ecwam/CMakeLists.txt index 5c179bf0..598ead59 100644 --- a/src/ecwam/CMakeLists.txt +++ b/src/ecwam/CMakeLists.txt @@ -420,19 +420,25 @@ else() unset( ${PNAME}_OCEANMODEL_INCLUDE_DIRS ) endif() +if( HAVE_ECFLOW ) + list(APPEND ECWAM_PRIVATE_DEFINITIONS WAM_HAVE_ECFLOW) +endif() + ecbuild_add_library( TARGET ${ecwam} SOURCES ${ecwam_srcs} - PUBLIC_LIBS fiat parkind_${prec} $<$:ecflow_lightf> ${ecwam}_intfb + PUBLIC_LIBS fiat parkind_${prec} ${ecwam}_intfb ${MPI_Fortran_LIBRARIES} ${${PNAME}_OCEANMODEL_LIBRARIES} PRIVATE_LIBS eccodes_f90 ${MULTIO_LIBRARIES} ${OpenMP_Fortran_LIBRARIES} field_api_${prec} + $<${HAVE_ECFLOW}:ecflow_lightf> PUBLIC_INCLUDES $ PRIVATE_INCLUDES ${${PNAME}_OCEANMODEL_INCLUDE_DIRS} - PUBLIC_DEFINITIONS ${ECWAM_DEFINITIONS} $<${ECWAM_STANDALONE}:_ECWAM_STANDALONE> + PRIVATE_DEFINITIONS ${ECWAM_PRIVATE_DEFINITIONS} + PUBLIC_DEFINITIONS ${ECWAM_DEFINITIONS} ) ecwam_target_fortran_module_directory( diff --git a/src/ecwam/wavemdl.F90 b/src/ecwam/wavemdl.F90 index a4ac99da..7a4874fe 100644 --- a/src/ecwam/wavemdl.F90 +++ b/src/ecwam/wavemdl.F90 @@ -147,7 +147,7 @@ SUBROUTINE WAVEMDL (CBEGDAT, PSTEP, KSTOP, KSTPW, & USE YOWASSI , ONLY : WAMASSI USE YOWGRIB , ONLY : IGRIB_GET_VALUE USE MPL_MODULE, ONLY : MPL_BARRIER, MPL_GATHERV -#ifndef _ECWAM_STANDALONE +#ifdef WAM_HAVE_ECFLOW USE ECFLOW_LIGHT, ONLY : ECFLOW_LIGHT_UPDATE_METER #endif ! --------------------------------------------------------------------- @@ -288,7 +288,7 @@ SUBROUTINE WAVEMDL (CBEGDAT, PSTEP, KSTOP, KSTPW, & LOGICAL :: LLINIT LOGICAL :: LLINIT_FIELDG -#ifndef _ECWAM_STANDALONE +#ifdef WAM_HAVE_ECFLOW CHARACTER(LEN = 64) :: METER_NAME INTEGER(KIND=JWIM) :: METER_VALUE INTEGER(KIND=JWIM) :: ERROR @@ -670,7 +670,7 @@ SUBROUTINE WAVEMDL (CBEGDAT, PSTEP, KSTOP, KSTPW, & CALL DIFDATE (CDATEF, CDTPRO, IFCST) IFCSTEP_HOUR=IFCST/3600 IF (IRANK == 1) THEN -#ifdef _ECWAM_STANDALONE +#ifndef WAM_HAVE_ECFLOW WRITE(CLSETEV,' (A25,'' step '',I8,''&'') ') CMETER,IFCSTEP_HOUR CLSMSNAME=" " CLECFNAME=" "