#
# $Id$
# $HeadURL$
# $Author$
# Created by Mike Wille, SLSE, 2016-05-05
#

# Build this target as separate translation units (NOT a unity build). It links the
# ddsftc INTERFACE target, which propagates generic_ftc.cpp /
# generic_ftc_threading.cpp as INTERFACE sources (legacy design: consumers compile
# the generic FTC implementation themselves, one TU per file, hidden visibility).
# A unity build concatenates those .cpp's into this target's single TU, and LTO
# (USE_IPO) then reports "multiple definition of Threading::..." from the same
# object. Separate TUs restore the legacy per-file structure (behavior-neutral).
set(CMAKE_UNITY_BUILD FALSE)

# Make ${Qt6_Widgets} optional
if(QT6_GUI_AVAILABLE AND TARGET Qt6::Widgets)
  set(Qt6_Widgets ${Qt6_Widgets})
else()
  set(Qt6_Widgets "")
endif()


IF(BUILD_RTI)
SET(charge_table_gui_SRCS
  pdm_charge_table_foreign_gui_interface_impl.cpp
  pdm_charge_table_foreign_gui_interface_impl.h
  charge_table.cpp
  charge_table.h
  charge_table.ui
  charge_table_model.cpp
  charge_table_model.h
  charge_edit_dialog.cpp
  charge_edit_dialog.h
)

NGL_WRAP_UI(charge_table_gui_SRCS 
  charge_table.ui
  charge_edit_dialog.ui
)

NGL_ADD_LIBRARY(WS PdmChargeTableGui STATIC ${charge_table_gui_SRCS})
NGL_TARGET_INCLUDE_DIRECTORIES(PdmChargeTableGui
  PUBLIC
    ${CMAKE_CURRENT_SOURCE_DIR}/../../..
    ${CMAKE_SOURCE_DIR}/Lts/Widgets/
)
if(QT6_GUI_AVAILABLE)
  NGL_TARGET_LINK_LIBRARIES(PdmChargeTableGui
    PRIVATE
      ${Qt6_Widgets}
      nglwidgets
      PdmDataPluginInterface
      FlmDataPluginInterface
      LtsUtilsSettings
      LtsUtilsGuiDds
      LtsPrinting
      LtsDataView
      LtsSession
      LtsSessionData
      LtsWidgets
      NGLLogger
    PUBLIC
      PdmGuiPluginInterface
      Qt6::Core
      svcPdmClient
  )
endif()

SET(pdm_charge_table_gui_plugin_SRCS
  pdm_charge_table_gui_plugin.cpp
  pdm_charge_table_gui_plugin.h
)
NGL_ADD_LIBRARY(WS PdmChargeTableGuiPlugin MODULE ${pdm_charge_table_gui_plugin_SRCS})

NGL_TARGET_LINK_LIBRARIES(PdmChargeTableGuiPlugin
  LtsSession
  NGLLogger
  PdmChargeTableGui
  PdmDataPluginInterface
)

NGL_INSTALL_TARGET(PdmChargeTableGuiPlugin)
ENDIF()
