include_directories(
  ${CMAKE_BINARY_DIR}
  ${CMAKE_CURRENT_BINARY_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}
  ${TDE_INCLUDE_DIR}
  ${TQT_INCLUDE_DIRS}
)

link_directories(
  ${TQT_LIBRARY_DIRS}
  ${TDE_LIB_DIR}
)


##### target for generating common files

add_custom_target( kmplot-generated-common
    DEPENDS
        ${CMAKE_CURRENT_BINARY_DIR}/settings.cpp
        ${CMAKE_CURRENT_BINARY_DIR}/FktDlgData.cpp
        ${CMAKE_CURRENT_BINARY_DIR}/qminmax.cpp
)


##### kmplot (executable)

tde_add_executable( kmplot AUTOMOC

  SOURCES
        main.cpp
        kmplot.cpp
        kmplotprogress.cpp
        kmplotIface.skel
  LINK
     tdecore-shared
     tdeui-shared
     tdeio-shared
     tdeparts-shared

  DEPENDENCIES
    kmplot-generated-common

  DESTINATION ${BIN_INSTALL_DIR}
)

##### libkmplotpart (kpart)

tde_add_kpart( libkmplotpart AUTOMOC

  SOURCES
        settings.kcfgc
        FktDlgData.ui
        qminmax.ui
        settingspagecolor.ui
        settingspagecoords.ui
        settingspagefonts.ui
        settingspagescaling.ui
        settingspageprecision.ui
        qparametereditor.ui
        qeditparametric.ui
        qeditpolar.ui
        editfunctionpage.ui
        editderivativespage.ui
        editintegralpage.ui
        qeditconstant.ui
        qconstanteditor.ui
        sliderwindow.ui
        parser.cpp
        xparser.cpp
        diagr.cpp
        View.cpp
        MainDlg.cpp
        FktDlg.cpp
        kprinterdlg.cpp
        kconstanteditor.cpp
        kparametereditor.cpp
        keditparametric.cpp
        keditpolar.cpp
        editfunction.cpp
        kminmax.cpp
        keditconstant.cpp
        kmplotio.cpp
        ksliderwindow.cpp
        coordsconfigdialog.cpp
        MainDlgIface.skel
        parseriface.skel
        Viewiface.skel
  LINK
     tdecore-shared
     tdeui-shared
     tdeio-shared
     tdeprint-shared
     tdeparts-shared

  DEPENDENCIES
    kmplot-generated-common

  DESTINATION ${PLUGIN_INSTALL_DIR}
)

##### other data

install(
    FILES kmplot_shell.rc
    DESTINATION ${DATA_INSTALL_DIR}/kmplot
)

tde_create_translated_desktop(
    SOURCE x-kmplot.desktop
    DESTINATION ${MIME_INSTALL_DIR}/application
    PO_DIR kmplot-desktops
)

tde_create_translated_desktop(
    SOURCE kmplot.desktop
    PO_DIR kmplot-desktops
)

tde_create_translated_desktop(
    SOURCE kmplot_part.desktop
    DESTINATION ${SERVICES_INSTALL_DIR}
    PO_DIR kmplot-desktops
)

install(
    FILES kmplot_part.rc kmplot_part_readonly.rc
    DESTINATION ${DATA_INSTALL_DIR}/kmplot
)

install(
    FILES kmplot.kcfg
    DESTINATION ${KCFG_INSTALL_DIR}
)
