# Copyright (c) 2024 The YAC Authors
#
# SPDX-License-Identifier: BSD-3-Clause

if(YAC_ENABLE_MCI AND YAC_ENABLE_FORTRAN)
  add_executable(simulation_component.x
    icon_grid_mod.F90
    coupler_mod.F90
    simulation_component.F90)
  target_link_libraries(simulation_component.x yac_mci yac_utils MPI::MPI_Fortran)
endif()

set(srcdir ${CMAKE_CURRENT_SOURCE_DIR})

configure_file(
  toy_ml_coupling.sh.in
  toy_ml_coupling.sh
  @ONLY
  FILE_PERMISSIONS
  OWNER_READ
  OWNER_WRITE
  OWNER_EXECUTE
  GROUP_READ
  GROUP_EXECUTE
  WORLD_READ
  WORLD_EXECUTE
)

add_test(NAME toy_ml_coupling COMMAND toy_ml_coupling.sh)
set_tests_properties(
  toy_ml_coupling
  PROPERTIES LABELS
             examples
             PROCESSORS
             2
             SKIP_RETURN_CODE
             77
             DISABLED
             $<NOT:$<BOOL:${YAC_ENABLE_EXAMPLES_TESTS}>>
)
