project(qplayer)

add_subdirectory(engines)

SET(qdvdauthor_SOURCES
   ${CMAKE_SOURCE_DIR}/qdvdauthor/filepreviewdialog.cpp
   ${CMAKE_SOURCE_DIR}/qdvdauthor/global.cpp
   ${CMAKE_SOURCE_DIR}/qdvdauthor/importsub.cpp
   ${CMAKE_SOURCE_DIR}/qdvdauthor/log.cpp
   ${CMAKE_SOURCE_DIR}/qdvdauthor/messagebox.cpp
   ${CMAKE_SOURCE_DIR}/qdvdauthor/utils.cpp   
   ${CMAKE_SOURCE_DIR}/qdvdauthor/rgba.cpp
   ${CMAKE_SOURCE_DIR}/qdvdauthor/subtitles.cpp
)

SET(qdvdauthor_HAEDERS
   ${CMAKE_SOURCE_DIR}/qdvdauthor/filepreviewdialog.h
   ${CMAKE_SOURCE_DIR}/qdvdauthor/global.h
   ${CMAKE_SOURCE_DIR}/qdvdauthor/importsub.h   
   ${CMAKE_SOURCE_DIR}/qdvdauthor/log.h
   ${CMAKE_SOURCE_DIR}/qdvdauthor/messagebox.h
   ${CMAKE_SOURCE_DIR}/qdvdauthor/utils.h   
   ${CMAKE_SOURCE_DIR}/qdvdauthor/rgba.h
   ${CMAKE_SOURCE_DIR}/qdvdauthor/subtitles.h
)

SET(engines_SOURCES
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/dialogmplayersetup.cpp
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/dialogqxinesetup.cpp
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/dummywidget.cpp
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/kaffeineswidget.cpp
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/kplayerengine.cpp
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/kxinewidget.cpp
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/mediainterface.cpp
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/mplayerinfo.cpp
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/mplayerwidget.cpp
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/mrl.cpp
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/qmplayerwidget.cpp
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/qvlcwidget.cpp
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/qxinewidget.cpp
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/vlcinfo.cpp
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/vlcwidget.cpp
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/xineinfo.cpp
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/xinewidget.cpp
)

SET(engines_HEADERS
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/dialogmplayersetup.h
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/dialogqxinesetup.h
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/dummywidget.h
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/kaffeineswidget.h
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/kplayerengine.h
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/kxinewidget.h
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/mediainterface.h
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/mplayerinfo.h
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/mplayerwidget.h
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/mrl.h
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/qmplayerwidget.h
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/qvlcwidget.h
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/qxinewidget.h
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/vlcinfo.h
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/vlcwidget.h
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/xineinfo.h
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/xinewidget.h
   #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/xml_mplayer.h
)

SET(engines_FORMS
    #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/dialogqxinesetup3.ui
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/dialogqxinesetup.ui
    #${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/uidialogmplayersetup3.ui
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/uidialogmplayersetup.ui
)

SET(engines_xine_SOURCES
    ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/dialogqxinesetup.cpp
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/kaffeineswidget.cpp
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/kxinewidget.cpp
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/qxinewidget.cpp
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/xineinfo.cpp
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/xinewidget.cpp
)

SET(engines_xine_HEADERS
    ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/dialogqxinesetup.h
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/kaffeineswidget.h
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/kxinewidget.h
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/qxinewidget.h
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/xineinfo.h
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/xinewidget.h
)

SET(engines_vlc_SOURCES
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/qvlcwidget.cpp
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/vlcinfo.cpp
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/vlcwidget.cpp
)

SET(engines_vlc_HEADERS
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/qvlcwidget.h
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/vlcinfo.h
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/vlcwidget.h
)

SET(engines_mplayer_SOURCES
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/dialogmplayersetup.cpp
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/mplayerinfo.cpp
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/mplayerwidget.cpp
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/qmplayerwidget.cpp
)

SET(engines_mplayer_HEADERS
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/dialogmplayersetup.h
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/mplayerinfo.h
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/mplayerwidget.h
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/qmplayerwidget.h
   ${CMAKE_SOURCE_DIR}/qdvdauthor/qplayer/engines/xml_mplayer.h
)

SET(qplayer_SOURCES ${engines_SOURCES} ${qdvdauthor_SOURCES} ${engines_xine_SOURCES} ${engines_vlc_SOURCES} ${engines_mplayer_SOURCES}
         dialogaboutqplayer.cpp   #inserted
         dialogconfigure.cpp   #inserted
   listviewfileitem.cpp
   mediacreator.cpp
   mediainfo.cpp
   mediascanner.cpp
    qplayer.cpp
   qplayer_main.cpp
   #run.cpp
   startstopcontrol.cpp
)

SET(qplayer_HEADERS ${engines_HEADERS} ${qdvdauthor_HAEDERS} ${engines_xine_HEADERS} ${engines_vlc_HEADERS} ${engines_mplayer_HEADERS}
         dialogaboutqplayer.h   #inserted
         dialogconfigure.h   #inserted
   listviewfileitem.h
   #MEDIA_CONFIG.h
   mediacreator.h
   mediainfo.h
   mediascanner.h
   qplayer.h
   qplayer_global.h
   #run.h
   startstopcontrol.h
   xml_qplayer.h
)

SET(qplayer_FORMS ${engines_FORMS}
   dialogaboutqplayer.ui
    #dialogaboutqplayer3.ui
   dialogconfigure.ui
    #dialogconfigure3.ui
      dialogqxinesetup.ui
   uiqplayer.ui
    #uiqplayer3.ui
   uistartstopcontrol.ui
    #uistartstopcontrol3.ui
)

SET(qplayer_RESOURCES images.qrc)

QT5_WRAP_CPP(qplayer_HEADERS_MOC ${qplayer_HEADERS})
QT5_WRAP_UI(qplayer_FORMS_HEADERS ${qplayer_FORMS})
QT5_ADD_RESOURCES(qplayer_RESOURCES_RCC ${qplayer_RESOURCES})

ADD_EXECUTABLE(qplayer ${qplayer_SOURCES} 
    ${qplayer_HEADERS_MOC} 
    ${qplayer_FORMS_HEADERS}
    ${qplayer_RESOURCES_RCC}
    )
    
target_compile_options(qplayer PRIVATE -fPIC)    
#TARGET_LINK_LIBRARIES(qplayer ${QT_LIBRARIES})
#TARGET_LINK_LIBRARIES(qplayer ${QT_LIBRARIES} ${FFMPEG_LIBRARIES} ${VLC_LIBRARIES} ${CMAKE_DL_LIBS} ${QT_QT3SUPPORT_LIBRARY} ${QT_QTXML_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTNETWORK_LIBRARY} ${xine_libs} X11)
TARGET_LINK_LIBRARIES(qplayer Qt5::Widgets Qt5::Xml xine X11 Qt5::Network Qt5::PrintSupport dl)
#link_directories(${FFMPEG_LIBRARIES})
link_directories(${X11_LIBRARY_DIRS})
message(STATUS "Found qplayer:")

INSTALL( TARGETS qplayer DESTINATION bin)


