#################################################
#
#  (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( examples )
add_subdirectory( maps )
add_subdirectory( pics )
tde_install_icons( tdemid )

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

link_directories(
  ${TQT_LIBRARY_DIRS}
)


##### tdemidlib (library) #######################

tde_add_library( tdemidlib SHARED AUTOMOC
  SOURCES
    tdemidframe.cpp tdemidclient.cpp kdisptext.cpp
    qslidertime.cpp klcdnumber.cpp ktrianglebutton.cpp
    midicfgdlg.cpp collectdlg.cpp randomlist.cpp
    channelview.cpp channel.cpp channel3d.cpp channel4d.cpp
    channelcfgdlg.cpp instrname.cpp rhythmview.cpp
    songlist.cpp slman.cpp tdemid_part.cpp tdemidIface.skel
  VERSION 0.0.0
  LINK
    DCOP-shared tdecore-shared tdeparts-shared tdeio-shared tdeui-shared tdemid-shared
  DESTINATION ${LIB_INSTALL_DIR}
)


##### libtdemidpart (module) ####################

tde_add_kpart( libtdemidpart AUTOMOC
  SOURCES
    ${CMAKE_CURRENT_BINARY_DIR}/part_dummy.cpp
  EMBED
    tdemidlib-shared
  DESTINATION ${PLUGIN_INSTALL_DIR}
)

file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/part_dummy.cpp "" )


##### tdemid (executable) #######################

tde_add_executable( tdemid AUTOMOC
  SOURCES
    main.cpp
  LINK
    DCOP-shared tdecore-shared tdeui-shared tdefx-shared tdeio-shared tdetexteditor-shared
    tdemidlib-shared
  DESTINATION ${BIN_INSTALL_DIR}
)


##### instrname.i18n (localization template) ####

add_custom_target( instrname.i18n
  COMMAND echo "/* This is an automatically generated file" > instrname.i18n
  COMMAND echo " * DO NOT EDIT !!!" >> instrname.i18n
  COMMAND echo " * To create this file run : make instrname.i18n " >> instrname.i18n
  COMMAND echo " */" >> instrname.i18n
  COMMAND echo "" >> instrname.i18n
  COMMAND awk -f instrfilter.awk instrname.cpp >> instrname.i18n
  DEPENDS instrname.cpp
  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)


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

install( FILES tdemid.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
install( FILES x-karaoke.desktop DESTINATION ${MIME_INSTALL_DIR}/audio )
install( FILES tdemidui.rc DESTINATION ${DATA_INSTALL_DIR}/tdemid )
install( FILES tdemid_partui.rc DESTINATION ${DATA_INSTALL_DIR}/tdemid )
install( FILES audiomidi.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} )
install( FILES std.sb drums.sb std.o3 drums.o3 DESTINATION ${DATA_INSTALL_DIR}/tdemid/fm )
install( FILES keyboard.xpm button1.xpm button2.xpm DESTINATION ${DATA_INSTALL_DIR}/tdemid/icons )
