include_directories(
  ${CMAKE_BINARY_DIR}
  ${CMAKE_CURRENT_BINARY_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}
  ${TDE_INCLUDE_DIR}
  ${TDE_INCLUDE_DIR}/tde
  ${TQT_INCLUDE_DIRS}
  ${CAIRO_INCLUDE_DIRS}
  ${EXPAT_INCLUDE_DIRS}
  ${XINE_INCLUDE_DIRS}
  ${NSPR_INCLUDE_DIRS}
  ${DBUS_INCLUDE_DIRS}
  ${DBUS-TQT_INCLUDE_DIRS}
  ${GSTREAMER_INCLUDE_DIRS}
  ${GSTREAMER_VIDEO_INCLUDE_DIRS}
  ${GSTREAMER_PLUGIN_INCLUDE_DIRS}
  ${X11_INCLUDE_DIR}
  ${X11_XTest_INCLUDE_PATH}
  ${GDK2_INCLUDE_DIRS}
  ${GTK2_INCLUDE_DIRS}
  ${GLIB2_INCLUDE_DIRS}
  ${DBUS-GLIB_INCLUDE_DIRS}
)

link_directories(
  ${TQT_LIBRARY_DIRS}
  ${TDE_LIB_DIR}
)


##### kmplayercommon (shared)

tde_add_library( kmplayercommon SHARED AUTOMOC

  SOURCES
        viewarea.cpp kmplayerview.cpp
        playlistview.cpp kmplayercontrolpanel.cpp
        kmplayerconfig.cpp pref.cpp
        kmplayerprocess.cpp kmplayer_callback.skel
        kmplayer_backend.stub kmplayerpartbase.cpp
        kmplayerplaylist.cpp kmplayer_asx.cpp
        kmplayer_smil.cpp kmplayer_rp.cpp
        kmplayer_rss.cpp kmplayer_atom.cpp
        kmplayer_xspf.cpp triestring.cpp
        kmplayerpartbase.skel
  LINK
     tdecore-shared
     tdeui-shared
     tdeio-shared
     tdeparts-shared
     tdeutils-shared
     tdemediaplayer
     ${CAIRO_LIBRARIES}
     ${EXPAT_LIBRARIES}
     ${XINE_LIBRARIES}
     ${X11_LIBRARIES}
     ${X11_XTest_LIB}
     ${NSPR_LIBRARIES}
     ${DBUS_LIBRARIES}
     ${GSTREAMER_LIBRARIES}
     ${DBUS-TQT_LIBRARIES}

  DESTINATION ${LIB_INSTALL_DIR}
)


##### kmplayer (tdeinit)

tde_add_tdeinit_executable( ${PROJECT_NAME} AUTOMOC

  SOURCES
        main.cpp kmplayerapp.cpp
        kmplayertvsource.cpp
        kmplayerbroadcast.cpp
        kmplayervdr.cpp
  LINK
     tdecore-shared
     kmplayercommon-shared
     ${X11_XTest_LIB}
)


##### kmplayerbackend (static)

tde_add_library( kmplayerbackend STATIC_PIC AUTOMOC

  SOURCES
        kmplayer_backend.skel
        kmplayer_callback.stub
)


##### libkmplayerpart (kpart)

tde_add_kpart( libkmplayerpart AUTOMOC

  SOURCES
        kmplayer_part.cpp
  LINK
     kmplayercommon-shared

  DESTINATION ${PLUGIN_INSTALL_DIR}
)


##### kxineplayer (executable)

if( BUILD_KXINEPLAYER )

tde_add_executable( kxineplayer AUTOMOC

  SOURCES
        xineplayer.cpp
  LINK
     tdecore-shared
     tdeui-shared
     tdeio-shared
     kmplayerbackend-static
     ${XINE_LIBRARIES}

  DESTINATION ${BIN_INSTALL_DIR}
)
endif()


##### kxvplayer (executable)

if( BUILD_KXVPLAYER )

tde_add_executable( kxvplayer AUTOMOC

  SOURCES
        xvplayer.cpp
  LINK
     tdecore-shared
     tdeui-shared
     tdeio-shared
     kmplayerbackend-static
     ${X11_Xv_LIB}

  DESTINATION ${BIN_INSTALL_DIR}
)
endif()


##### kgstplayer (executable)

if( BUILD_KGSTPLAYER )

tde_add_executable( kgstplayer AUTOMOC

  SOURCES
        gstplayer.cpp
  LINK
     tdecore-shared
     tdeui-shared
     tdeio-shared
     kmplayerbackend-static
     ${GSTREAMER_LIBRARIES}
     ${GSTREAMER_VIDEO_LIBRARIES}
     ${GSTREAMER_PLUGIN_LIBRARIES}

  DESTINATION ${BIN_INSTALL_DIR}
)
endif()


##### knpplayer (executable)

if( BUILD_KNPPLAYER )

tde_add_executable( knpplayer AUTOMOC

  SOURCES
        npplayer.c
  LINK
     ${NSPR_LIBRARIES}
     ${X11_LIBRARIES}
     ${GMODULE2_LIBRARIES}
     ${GDK2_LIBRARIES}
     ${GLIB2_LIBRARIES}
     ${DBUS-GLIB_LIBRARIES}
     ${GTHREAD_LIBRARIES}
     ${GTK2_LIBRARIES}

  DESTINATION ${BIN_INSTALL_DIR}
)
endif()


##### kmplayerkofficepart (kpart)

if( BUILD_KOFFICE_PLUGIN )

tde_add_kpart( libkmplayerkofficepart AUTOMOC

  SOURCES
        kmplayer_koffice_part.cpp
  LINK
     kmplayercommon-shared
     ${KOFFICE_LIBRARIES}

  DESTINATION ${PLUGIN_INSTALL_DIR}
)
endif()


##### other data

install(
    FILES
        bookmarks.xml
        pluginsinfo
        noise.gif
        kmplayerui.rc
        kmplayerpartui.rc

  DESTINATION ${DATA_INSTALL_DIR}/kmplayer
)

install(
    FILES ${PROJECT_NAME}.desktop
    DESTINATION ${XDG_APPS_INSTALL_DIR}
)

install(
    FILES kmplayerrc
    DESTINATION ${CONFIG_INSTALL_DIR}
)

install(
    FILES kmplayer_part.desktop
    DESTINATION ${SERVICES_INSTALL_DIR}
)

if( BUILD_KOFFICE_PLUGIN )
install(
    FILES kmplayer_koffice.desktop
    DESTINATION ${SERVICES_INSTALL_DIR}
)
endif()
