#-----------------------------------------------------------------------------
#
# Copyright (C) 2012 - 2017  Florian Pose <fp@igh-essen.com>
#               2022         Bjarne von Horn <vh at igh dot de>
#
# This file is part of the data logging service (DLS).
#
# DLS is free software: you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# DLS is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
# more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with the DLS. If not, see <http://www.gnu.org/licenses/>.
#
#-----------------------------------------------------------------------------

add_executable(dls_ctl
    CtlDialogChannel.cpp
    CtlDialogChannels.cpp
    CtlDialogJob.cpp
    CtlDialogJobEdit.cpp
    CtlDialogMain.cpp
    CtlDialogMsg.cpp
    CtlJobPreset.cpp
    CtlMain.cpp
    fl_grid.cpp
)

target_link_libraries(dls_ctl
    EtherLab::pdcom5
    dls
    ${FLTK_LIBRARIES}
    uriparser::uriparser
    Threads::Threads
)

target_compile_options(dls_ctl PRIVATE -Wall)

target_include_directories(dls_ctl PRIVATE
    "${CMAKE_CURRENT_BINARY_DIR}/.."
    "${CMAKE_CURRENT_SOURCE_DIR}/.."
    ${FLTK_INCLUDE_DIR}
)

install(TARGETS dls_ctl
    RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
)
install(FILES dls_ctl.desktop DESTINATION "${CMAKE_INSTALL_DATADIR}/applications")



add_executable(dls_view
    ViewChannel.cpp
    ViewDialogExport.cpp
    ViewDialogMain.cpp
    ViewMain.cpp
    ViewViewData.cpp
    ViewViewMsg.cpp
    fl_grid.cpp
    fl_track_bar.cpp
)

target_link_libraries(dls_view
    dls
    ${FLTK_LIBRARIES}
    uriparser::uriparser
    Threads::Threads
)

target_compile_options(dls_view PRIVATE -Wall)

target_include_directories(dls_view PRIVATE
    "${CMAKE_CURRENT_BINARY_DIR}/.."
    "${CMAKE_CURRENT_SOURCE_DIR}/.."
    ${FLTK_INCLUDE_DIR}
)

install(TARGETS dls_view
    RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
)
install(FILES dls_view.desktop DESTINATION "${CMAKE_INSTALL_DATADIR}/applications")

install(FILES
    images/dls_view.png
    images/dls_ctl.png
    DESTINATION "${CMAKE_INSTALL_DATADIR}/icons/hicolor/32x32/apps"
)

install(FILES
    images/dls_ctl.svg
    images/dls_view.svg
    DESTINATION "${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps"
)
