#
# THP-Viewer
#
ADD_SUBDIRECTORY(THP-Starter)
FIND_PACKAGE(VLC REQUIRED)

SET(thp_viewer_SRCS
  main.cpp
  thp_plugin_provider.cpp
  thp_plugin_provider.h
  thp_situation_filter_interface_impl.cpp
  thp_situation_filter_interface_impl.h
  thp_viewer.cpp
  thp_viewer.h

  thpwidgets/thp_audio_video_widget.cpp
  thpwidgets/thp_audio_video_widget.h
  thpwidgets/thp_audio_video_widget_p.h
  thpwidgets/thp_building_settings.cpp
  thpwidgets/thp_building_settings.h
  thpwidgets/thp_building_widget.cpp
  thpwidgets/thp_building_widget.h
  thpwidgets/thp_html_widget.cpp
  thpwidgets/thp_html_widget.h
  thpwidgets/thp_pdf_widget.cpp
  thpwidgets/thp_pdf_widget.h
  thpwidgets/thp_situation_building_base.h
  thpwidgets/thp_situation_building_base.cpp
  thpwidgets/thp_situation_filter_aes.cpp
  thpwidgets/thp_situation_filter_aes.h
  thpwidgets/thp_situation_filter_building_components.cpp
  thpwidgets/thp_situation_filter_building_components.h
  thpwidgets/thp_situation_filter_collapse_expand.cpp
  thpwidgets/thp_situation_filter_collapse_expand.h
  thpwidgets/thp_situation_filter_symbol_appearance.cpp
  thpwidgets/thp_situation_filter_symbol_appearance.h
  thpwidgets/thp_situation_filter_types.cpp
  thpwidgets/thp_situation_filter_types.h
  thpwidgets/thp_situation_widget.cpp
  thpwidgets/thp_situation_widget.h
  thpwidgets/thp_zoom_slider.cpp
  thpwidgets/thp_zoom_slider.h
)

NGL_WRAP_UI(thp_viewer_SRCS
  thp_viewer.ui
  thpwidgets/thp_audio_video_widget.ui
  thpwidgets/thp_building_settings.ui
  thpwidgets/thp_html_widget.ui
  thpwidgets/thp_pdf_widget.ui
  thpwidgets/thp_situation_building_base.ui
)
IF(WIN32)
  SET(JBN ${JENKINS_BUILD_NUMBER})
  IF (NOT JENKINS_BUILD_NUMBER)
    SET(JBN "0")
  ENDIF()
  SET(THP_VERSION_INFO "${LTS_VERSION_MAJOR}, ${LTS_VERSION_MINOR}, ${JBN}, ${LTS_VERSION_PATCH}")
  CONFIGURE_FILE(thp_viewer.rc.cmake ${CMAKE_CURRENT_BINARY_DIR}/thp_viewer.rc)
  LIST(APPEND thp_viewer_SRCS ${CMAKE_CURRENT_BINARY_DIR}/thp_viewer.rc)
ENDIF(WIN32)
NGL_ADD_APP_ICON(thp_viewer_SRCS)

NGL_ADD_EXECUTABLE(WS thp_viewer WIN32 ${thp_viewer_SRCS})
NGL_INSTALL_TARGET(thp_viewer)
NGL_TARGET_INCLUDE_DIRECTORIES(thp_viewer
  PRIVATE
    ${VLC_INCLUDE_DIR}
)
NGL_TARGET_COMPILE_DEFINITIONS(thp_viewer
  PRIVATE
    ${VLC_DEFINES}
)
NGL_TARGET_LINK_LIBRARIES(thp_viewer
  $<IF:$<TARGET_EXISTS:ArcGISQt5Hack>,ArcGISQt5Hack,>   # make sure it's loaded *before* libEsriCommonQt.so (guard: only linked when the SituationMap viewer is built, matching CentralEffectSimulation)

  ${VLC_LIBRARIES}
  Qt6::Core
  Qt6::Gui
  Qt6::PrintSupport
  Qt6::Svg
  Qt6::WebEngineCore
  Qt6::WebEngineWidgets
  Qt6::Widgets
  Qt6::Xml

  RmeLightStyleQrc

  AsbData
  AsbForeignDataPluginThp
  BuildingViewerCommon
  FltAesGuiCommon
  FltAesWidget
  FltBldgCmpntWidget
  FltParticipantWidget
  IsmDataPluginThp
  LtsCoordTrans
  LtsCommandLineParser
  NGLLogger
  nglsingleapplication
  ngltools
  ngltranslator
  nglwidgets
  PdmComboBoxGui
  PpmComboBoxGui
  SitmapDds
  SituationReplaySqlite

  svcFlmCommon

  svcAesClient
  svcBldClient
  svcCesClient
  svcGimClient
  svcIsmClient
  svcPpmClient
  svcPdmClient
  svcAlmClient
)
IF(WIN32)
#  NGL_INSTALL(WS FILES autorun.inf DESTINATION bin)
#  NGL_INSTALL(WS FILES readme.win32.en_US.txt DESTINATION bin)
#  NGL_INSTALL(WS FILES readme.win32.de_DE.txt DESTINATION bin)
ENDIF()
NGL_INSTALL(WS FILES log4cxx_thp_viewer.props DESTINATION bin)

ADD_SUBDIRECTORY(SitMapReplayTest)
