################################################################################
# Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0.
#
# SPDX-License-Identifier: EPL-2.0
################################################################################

if (WIN32)
  set(FMI_PLATFORM win)
else ()
  set(FMI_PLATFORM linux)
endif ()

if ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
  set(FMI_PLATFORM ${FMI_PLATFORM}64)
else ()
  set(FMI_PLATFORM ${FMI_PLATFORM}32)
endif ()

add_custom_target(prepare_example_configs ALL
#FMUs
 COMMAND ${CMAKE_COMMAND} -E copy "../fmus/${FMI_PLATFORM}/Fmi1/DummyFmuStaticActuator.fmu" "${CMAKE_CURRENT_SOURCE_DIR}/Configurations/FMU_Actuator/resources/${FMI_PLATFORM}/dummyFMU1_StaticFMUActuator.fmu"
 COMMAND ${CMAKE_COMMAND} -E copy "../fmus/${FMI_PLATFORM}/Fmi2/DummyFmuStaticActuator.fmu" "${CMAKE_CURRENT_SOURCE_DIR}/Configurations/FMU_Actuator/resources/${FMI_PLATFORM}/dummyFMU2_StaticFMUActuator.fmu"
 COMMAND ${CMAKE_COMMAND} -E copy "../fmus/${FMI_PLATFORM}/OSMPDummyTCTU.fmu" "${CMAKE_CURRENT_SOURCE_DIR}/Configurations/FMU_OSCAction_CustomCommandAction/resources/OSMPDummyTCTU.fmu"
 COMMAND ${CMAKE_COMMAND} -E copy "../fmus/${FMI_PLATFORM}/OSMPDummyTCTU.fmu" "${CMAKE_CURRENT_SOURCE_DIR}/Configurations/FMU_OSCAction_FollowPathAction/resources/OSMPDummyTCTU.fmu"
 COMMAND ${CMAKE_COMMAND} -E copy "../fmus/${FMI_PLATFORM}/OSMPDummyTCTU.fmu" "${CMAKE_CURRENT_SOURCE_DIR}/Configurations/FMU_OSCAction_FollowTrajectoryAction/resources/OSMPDummyTCTU.fmu"
 COMMAND ${CMAKE_COMMAND} -E copy "../fmus/${FMI_PLATFORM}/OSMPDummyTCTU.fmu" "${CMAKE_CURRENT_SOURCE_DIR}/Configurations/FMU_OSCAction_SpeedAction/resources/OSMPDummyTCTU.fmu"
 COMMAND ${CMAKE_COMMAND} -E copy "../fmus/${FMI_PLATFORM}/OSMPSensorDataToTrafficUpdateStepper.fmu" "${CMAKE_CURRENT_SOURCE_DIR}/Configurations/DynamicOSMPSensorDataToTUStepper/OSMPSDToTUS.fmu"
 COMMAND ${CMAKE_COMMAND} -E copy "../fmus/${FMI_PLATFORM}/OSMPSensorDataToTrafficUpdateStepper.fmu" "${CMAKE_CURRENT_SOURCE_DIR}/Configurations/StaticOSMPSensorDataToTUStepper/OSMPSDToTUS.fmu"
#SSP
 COMMAND ${CMAKE_COMMAND} -E copy "../ssp/ConnectionTest.ssp" "${CMAKE_CURRENT_SOURCE_DIR}/Configurations/DynamicSSPStepper/ConnectionTest.ssp"
 COMMAND ${CMAKE_COMMAND} -E copy "../ssp/ConnectionTest.ssp" "${CMAKE_CURRENT_SOURCE_DIR}/Configurations/StaticSSPStepper/ConnectionTest.ssp"
 DEPENDS
   DummyFmuStaticActuatorFmi1
   DummyFmuStaticActuatorFmi2
   OSMPDummyTCTU
   OSMPSensorDataToTrafficUpdateStepper
   build_ssp
)

