#################################################
#
#  (C) 2017 Slávek Banko
#  slavek (DOT) banko (AT) axis.cz
#
#  Improvements and feedback are welcome
#
#  This file is released under GPL >= 2
#
#################################################

add_subdirectory( noatun )
add_subdirectory( noatunarts )
add_subdirectory( noatuntags )

include_directories(
  ${CMAKE_CURRENT_SOURCE_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}/noatun
  ${CMAKE_CURRENT_SOURCE_DIR}/noatunarts
  ${CMAKE_SOURCE_DIR}/arts/gui/kde
  ${CMAKE_SOURCE_DIR}/arts/gui/common
  ${CMAKE_BINARY_DIR}
  ${CMAKE_CURRENT_BINARY_DIR}
  ${CMAKE_CURRENT_BINARY_DIR}/noatunarts
  ${CMAKE_BINARY_DIR}/arts/gui/kde
  ${CMAKE_BINARY_DIR}/arts/gui/common
  ${ARTS_INCLUDE_DIRS}
  ${TQT_INCLUDE_DIRS}
  ${TDE_INCLUDE_DIR}
)

link_directories(
  ${TQT_LIBRARY_DIRS}
  ${ARTS_LIBRARY_DIRS}
)

if( BUILD_ARTS )
  set( NOATUN_ARTS_LIBRARIES "artsgui-shared;artsgui_kde-shared;artsmodules-shared" )
else( )
  set( NOATUN_WITHOUT_ARTS_EFFECTS 1 CACHE INTERNAL "" FORCE )
endif( )


##### noatun (library) ##########################

tde_add_library( noatun SHARED AUTOMOC
  SOURCES
    pluginmodule.cpp cmodule.cpp downloader.cpp engine.cpp
    playlist.cpp pref.cpp
    player.cpp playlistsaver.cpp app.cpp
    pluginloader.cpp plugin.cpp
    noatunstdaction.cpp conversion.cpp
    noatunui.cpp effectview.cpp
    equalizerwidget.ui equalizerview.cpp equalizer.cpp
    effects.cpp mimetypetree.cpp stereobuttonaction.cpp ksaver.cpp
    video.cpp vequalizer.cpp spline.cpp titleproxy.cpp
  META_INCLUDES
    ${CMAKE_CURRENT_SOURCE_DIR}/noatun
  VERSION 1.2.0
  LINK
    DCOP-shared tdeio-shared artskde-shared ${DL_LIBRARIES}
    ${NOATUN_ARTS_LIBRARIES}
    mcop qtmcop kmedia2_idl soundserver_idl artsflow
    noatunarts-shared
  DESTINATION ${LIB_INSTALL_DIR}
)


##### noatuncontrols (library) ##################

tde_add_library( noatuncontrols SHARED AUTOMOC
  SOURCES
    controls.cpp scrollinglabel.cpp
  META_INCLUDES
    ${CMAKE_CURRENT_SOURCE_DIR}/noatun
  VERSION 1.2.0
  LINK
    tdecore-shared tdeui-shared ${DL_LIBRARIES}
  DESTINATION ${LIB_INSTALL_DIR}
)


##### gentable (executable) #####################

tde_add_executable( gentable AUTOMOC
  SOURCES
    gentable.cpp
  LINK
    ${TQT_LIBRARIES}
)

add_custom_target( noatun-magictable ALL
  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/magictable
)

add_custom_command(
  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/magictable
  COMMAND gentable > magictable
  DEPENDS gentable
)


##### other data ################################

install(
  FILES
    cmodule.h plugin_deps.h
    equalizerview.h effectview.h
    mimetypetree.h
    ksaver.h
  DESTINATION ${INCLUDE_INSTALL_DIR}
)

install(
  FILES ${CMAKE_CURRENT_BINARY_DIR}/magictable
  DESTINATION ${DATA_INSTALL_DIR}/noatun
)
