function(gldoze_add_presentation_plugin target_name app_id display_name description icon_source)
  set(app_dir "${CMAKE_BINARY_DIR}/apps/${app_id}")
  set(APP_ID "${app_id}")
  set(APP_NAME "${display_name}")
  set(APP_DESCRIPTION "${description}")
  set(APP_LIBRARY "lib${target_name}${CMAKE_SHARED_LIBRARY_SUFFIX}")

  add_library(${target_name} MODULE presentation_plugin.cpp)
  target_link_libraries(${target_name} PRIVATE gldoze_sdk)
  target_compile_definitions(${target_name} PRIVATE
    GLDOZE_PRESENTATION_ID="${app_id}"
    GLDOZE_PRESENTATION_NAME="${display_name}"
  )
  set_target_properties(${target_name} PROPERTIES
    LIBRARY_OUTPUT_DIRECTORY "${app_dir}"
    PREFIX "lib"
    OUTPUT_NAME "${target_name}"
    CXX_VISIBILITY_PRESET hidden
    VISIBILITY_INLINES_HIDDEN YES
  )

  file(MAKE_DIRECTORY "${app_dir}")
  configure_file(app.json.in "${app_dir}/app.json" @ONLY)
  configure_file("${icon_source}" "${app_dir}/icon.svg" COPYONLY)
  install(TARGETS ${target_name}
    LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/gldoze/apps/${app_id}"
    COMPONENT GLDozeDesktop)
  install(FILES "${app_dir}/app.json" "${app_dir}/icon.svg"
    DESTINATION "${CMAKE_INSTALL_LIBDIR}/gldoze/apps/${app_id}"
    COMPONENT GLDozeDesktop)
endfunction()

set(_gldoze_verdant_icon "${GLDOZE_REPO_ROOT}/assets/desktop/icons/verdant.svg")
gldoze_add_presentation_plugin(gldoze_talon_fighters talon-fighters "Talon Fighters"
	"Ten-second Talon Fighters patrol" "${_gldoze_verdant_icon}")
gldoze_add_presentation_plugin(gldoze_thunderstorm thunderstorm "Thunderstorm"
  "Ten-second clouds, rain, and lightning cinematic" "${_gldoze_verdant_icon}")
gldoze_add_presentation_plugin(gldoze_battle_tanks battle-tanks "Battle Tanks"
	"Ten-second Battle Tanks plasma raid" "${_gldoze_verdant_icon}")

add_custom_target(gldoze_presentation_plugins DEPENDS
	gldoze_talon_fighters gldoze_thunderstorm gldoze_battle_tanks)
